toolkit/content/widgets/editor.xml

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:0b0f7875f012
1 <?xml version="1.0"?>
2 <!-- This Source Code Form is subject to the terms of the Mozilla Public
3 - License, v. 2.0. If a copy of the MPL was not distributed with this
4 - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
5
6
7 <bindings id="editorBindings"
8 xmlns="http://www.mozilla.org/xbl"
9 xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
10 xmlns:xbl="http://www.mozilla.org/xbl">
11
12 <binding id="editor" role="outerdoc">
13 <implementation type="application/javascript">
14 <constructor>
15 <![CDATA[
16 // Make window editable immediately only
17 // if the "editortype" attribute is supplied
18 // This allows using same contentWindow for different editortypes,
19 // where the type is determined during the apps's window.onload handler.
20 if (this.editortype)
21 this.makeEditable(this.editortype, true);
22 ]]>
23 </constructor>
24 <destructor/>
25
26 <field name="_editorContentListener">
27 <![CDATA[
28 ({
29 QueryInterface: function(iid)
30 {
31 if (iid.equals(Components.interfaces.nsIURIContentListener) ||
32 iid.equals(Components.interfaces.nsISupportsWeakReference) ||
33 iid.equals(Components.interfaces.nsISupports))
34 return this;
35
36 throw Components.results.NS_ERROR_NO_INTERFACE;
37 },
38 onStartURIOpen: function(uri)
39 {
40 return false;
41 },
42 doContent: function(contentType, isContentPreferred, request, contentHandler)
43 {
44 return false;
45 },
46 isPreferred: function(contentType, desiredContentType)
47 {
48 return false;
49 },
50 canHandleContent: function(contentType, isContentPreferred, desiredContentType)
51 {
52 return false;
53 },
54 loadCookie: null,
55 parentContentListener: null
56 })
57 ]]>
58 </field>
59 <method name="makeEditable">
60 <parameter name="editortype"/>
61 <parameter name="waitForUrlLoad"/>
62 <body>
63 <![CDATA[
64 this.editingSession.makeWindowEditable(this.contentWindow, editortype, waitForUrlLoad, true, false);
65 this.setAttribute("editortype", editortype);
66
67 this.docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
68 .getInterface(Components.interfaces.nsIURIContentListener)
69 .parentContentListener = this._editorContentListener;
70 ]]>
71 </body>
72 </method>
73 <method name="getEditor">
74 <parameter name="containingWindow"/>
75 <body>
76 <![CDATA[
77 return this.editingSession.getEditorForWindow(containingWindow);
78 ]]>
79 </body>
80 </method>
81 <method name="getHTMLEditor">
82 <parameter name="containingWindow"/>
83 <body>
84 <![CDATA[
85 var editor = this.editingSession.getEditorForWindow(containingWindow);
86 return editor.QueryInterface(Components.interfaces.nsIHTMLEditor);
87 ]]>
88 </body>
89 </method>
90
91 <field name="_finder">null</field>
92 <property name="finder" readonly="true">
93 <getter><![CDATA[
94 if (!this._finder) {
95 if (!this.docShell)
96 return null;
97
98 let Finder = Components.utils.import("resource://gre/modules/Finder.jsm", {}).Finder;
99 this._finder = new Finder(this.docShell);
100 }
101 return this._finder;
102 ]]></getter>
103 </property>
104
105 <field name="_fastFind">null</field>
106 <property name="fastFind"
107 readonly="true">
108 <getter>
109 <![CDATA[
110 if (!this._fastFind) {
111 if (!("@mozilla.org/typeaheadfind;1" in Components.classes))
112 return null;
113
114 if (!this.docShell)
115 return null;
116
117 this._fastFind = Components.classes["@mozilla.org/typeaheadfind;1"]
118 .createInstance(Components.interfaces.nsITypeAheadFind);
119 this._fastFind.init(this.docShell);
120 }
121 return this._fastFind;
122 ]]>
123 </getter>
124 </property>
125
126 <field name="_lastSearchString">null</field>
127 <field name="_lastSearchHighlight">false</field>
128
129 <property name="editortype"
130 onget="return this.getAttribute('editortype');"
131 onset="this.setAttribute('editortype', val); return val;"/>
132 <property name="webNavigation"
133 onget="return this.docShell.QueryInterface(Components.interfaces.nsIWebNavigation);"
134 readonly="true"/>
135 <property name="contentDocument" readonly="true"
136 onget="return this.webNavigation.document;"/>
137 <property name="docShell"
138 onget="return this.boxObject.QueryInterface(Components.interfaces.nsIContainerBoxObject).docShell;"
139 readonly="true"/>
140 <property name="currentURI"
141 readonly="true"
142 onget="return this.webNavigation.currentURI;"/>
143 <property name="contentWindow"
144 readonly="true"
145 onget="return this.docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindow);"/>
146 <property name="webBrowserFind"
147 readonly="true"
148 onget="return this.docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIWebBrowserFind);"/>
149 <property name="markupDocumentViewer"
150 readonly="true"
151 onget="return this.docShell.contentViewer.QueryInterface(Components.interfaces.nsIMarkupDocumentViewer);"/>
152 <property name="editingSession"
153 readonly="true"
154 onget="return this.webNavigation.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIEditingSession);"/>
155 <property name="commandManager"
156 readonly="true"
157 onget="return this.webNavigation.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsICommandManager);"/>
158 <property name="fullZoom"
159 onget="return this.markupDocumentViewer.fullZoom;"
160 onset="this.markupDocumentViewer.fullZoom = val;"/>
161 <property name="textZoom"
162 onget="return this.markupDocumentViewer.textZoom;"
163 onset="this.markupDocumentViewer.textZoom = val;"/>
164 <property name="isSyntheticDocument"
165 onget="return this.contentDocument.isSyntheticDocument;"
166 readonly="true"/>
167 </implementation>
168 </binding>
169
170 </bindings>
171

mercurial