toolkit/content/widgets/editor.xml

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/content/widgets/editor.xml	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,171 @@
     1.4 +<?xml version="1.0"?>
     1.5 +<!-- This Source Code Form is subject to the terms of the Mozilla Public
     1.6 +   - License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 +   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
     1.8 +
     1.9 +
    1.10 +<bindings id="editorBindings"
    1.11 +   xmlns="http://www.mozilla.org/xbl"
    1.12 +   xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
    1.13 +   xmlns:xbl="http://www.mozilla.org/xbl">
    1.14 +  
    1.15 +  <binding id="editor" role="outerdoc">
    1.16 +    <implementation type="application/javascript">
    1.17 +      <constructor>
    1.18 +        <![CDATA[
    1.19 +          // Make window editable immediately only
    1.20 +          //   if the "editortype" attribute is supplied
    1.21 +          // This allows using same contentWindow for different editortypes,
    1.22 +          //   where the type is determined during the apps's window.onload handler.
    1.23 +          if (this.editortype)
    1.24 +            this.makeEditable(this.editortype, true);
    1.25 +        ]]>
    1.26 +      </constructor>
    1.27 +      <destructor/>
    1.28 +
    1.29 +      <field name="_editorContentListener">
    1.30 +        <![CDATA[
    1.31 +          ({
    1.32 +            QueryInterface: function(iid)
    1.33 +            {
    1.34 +              if (iid.equals(Components.interfaces.nsIURIContentListener) ||
    1.35 +                  iid.equals(Components.interfaces.nsISupportsWeakReference) ||
    1.36 +                  iid.equals(Components.interfaces.nsISupports))
    1.37 +              return this;
    1.38 +
    1.39 +              throw Components.results.NS_ERROR_NO_INTERFACE;
    1.40 +            },
    1.41 +            onStartURIOpen: function(uri)
    1.42 +            {
    1.43 +              return false;
    1.44 +            },
    1.45 +            doContent: function(contentType, isContentPreferred, request, contentHandler)
    1.46 +            {
    1.47 +              return false;
    1.48 +            },
    1.49 +            isPreferred: function(contentType, desiredContentType)
    1.50 +            {
    1.51 +              return false;
    1.52 +            },
    1.53 +            canHandleContent: function(contentType, isContentPreferred, desiredContentType)
    1.54 +            {
    1.55 +              return false;
    1.56 +            },
    1.57 +            loadCookie: null,
    1.58 +            parentContentListener: null
    1.59 +          })
    1.60 +        ]]>
    1.61 +      </field>
    1.62 +      <method name="makeEditable">
    1.63 +        <parameter name="editortype"/>
    1.64 +        <parameter name="waitForUrlLoad"/>
    1.65 +        <body>
    1.66 +        <![CDATA[
    1.67 +          this.editingSession.makeWindowEditable(this.contentWindow, editortype, waitForUrlLoad, true, false);
    1.68 +          this.setAttribute("editortype", editortype);
    1.69 +
    1.70 +          this.docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
    1.71 +              .getInterface(Components.interfaces.nsIURIContentListener)
    1.72 +              .parentContentListener = this._editorContentListener;
    1.73 +        ]]>
    1.74 +        </body>
    1.75 +      </method>
    1.76 +      <method name="getEditor">
    1.77 +        <parameter name="containingWindow"/>
    1.78 +        <body>
    1.79 +        <![CDATA[
    1.80 +          return this.editingSession.getEditorForWindow(containingWindow);
    1.81 +        ]]>
    1.82 +        </body>
    1.83 +      </method>
    1.84 +      <method name="getHTMLEditor">
    1.85 +        <parameter name="containingWindow"/>
    1.86 +        <body>
    1.87 +        <![CDATA[
    1.88 +          var editor = this.editingSession.getEditorForWindow(containingWindow);
    1.89 +          return editor.QueryInterface(Components.interfaces.nsIHTMLEditor);
    1.90 +        ]]>
    1.91 +        </body>
    1.92 +      </method>
    1.93 +
    1.94 +      <field name="_finder">null</field>
    1.95 +      <property name="finder" readonly="true">
    1.96 +        <getter><![CDATA[
    1.97 +          if (!this._finder) {
    1.98 +            if (!this.docShell)
    1.99 +              return null;
   1.100 +
   1.101 +            let Finder = Components.utils.import("resource://gre/modules/Finder.jsm", {}).Finder;
   1.102 +            this._finder = new Finder(this.docShell);
   1.103 +          }
   1.104 +          return this._finder;
   1.105 +        ]]></getter>
   1.106 +      </property>
   1.107 +
   1.108 +      <field name="_fastFind">null</field>
   1.109 +      <property name="fastFind"
   1.110 +                readonly="true">
   1.111 +        <getter>
   1.112 +        <![CDATA[
   1.113 +          if (!this._fastFind) {
   1.114 +            if (!("@mozilla.org/typeaheadfind;1" in Components.classes))
   1.115 +              return null;
   1.116 +
   1.117 +            if (!this.docShell)
   1.118 +              return null;
   1.119 +
   1.120 +            this._fastFind = Components.classes["@mozilla.org/typeaheadfind;1"]
   1.121 +                                       .createInstance(Components.interfaces.nsITypeAheadFind);
   1.122 +            this._fastFind.init(this.docShell);
   1.123 +          }
   1.124 +          return this._fastFind;
   1.125 +        ]]>
   1.126 +        </getter>
   1.127 +      </property>
   1.128 +
   1.129 +      <field name="_lastSearchString">null</field>
   1.130 +      <field name="_lastSearchHighlight">false</field>
   1.131 +
   1.132 +      <property name="editortype"
   1.133 +                onget="return this.getAttribute('editortype');"
   1.134 +                onset="this.setAttribute('editortype', val); return val;"/>
   1.135 +      <property name="webNavigation"
   1.136 +                onget="return this.docShell.QueryInterface(Components.interfaces.nsIWebNavigation);"
   1.137 +                readonly="true"/>
   1.138 +      <property name="contentDocument" readonly="true"
   1.139 +                onget="return this.webNavigation.document;"/>
   1.140 +      <property name="docShell"
   1.141 +                onget="return this.boxObject.QueryInterface(Components.interfaces.nsIContainerBoxObject).docShell;"
   1.142 +                readonly="true"/>
   1.143 +      <property name="currentURI"
   1.144 +                readonly="true"
   1.145 +                onget="return this.webNavigation.currentURI;"/>
   1.146 +      <property name="contentWindow"
   1.147 +                readonly="true"
   1.148 +                onget="return this.docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindow);"/>
   1.149 +      <property name="webBrowserFind"
   1.150 +                readonly="true"
   1.151 +                onget="return this.docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIWebBrowserFind);"/>
   1.152 +      <property name="markupDocumentViewer"
   1.153 +                readonly="true"
   1.154 +                onget="return this.docShell.contentViewer.QueryInterface(Components.interfaces.nsIMarkupDocumentViewer);"/>
   1.155 +      <property name="editingSession"
   1.156 +                readonly="true"
   1.157 +                onget="return this.webNavigation.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIEditingSession);"/>
   1.158 +      <property name="commandManager"
   1.159 +                readonly="true"
   1.160 +                onget="return this.webNavigation.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsICommandManager);"/>
   1.161 +      <property name="fullZoom"
   1.162 +                onget="return this.markupDocumentViewer.fullZoom;"
   1.163 +                onset="this.markupDocumentViewer.fullZoom = val;"/>
   1.164 +      <property name="textZoom"
   1.165 +                onget="return this.markupDocumentViewer.textZoom;"
   1.166 +                onset="this.markupDocumentViewer.textZoom = val;"/>
   1.167 +      <property name="isSyntheticDocument"
   1.168 +                onget="return this.contentDocument.isSyntheticDocument;"
   1.169 +                readonly="true"/>
   1.170 +    </implementation>
   1.171 +  </binding>
   1.172 +
   1.173 +</bindings>
   1.174 +

mercurial