2007-03-22 10:30:00 -07:00
|
|
|
<?xml version="1.0"?>
|
|
|
|
|
|
|
|
<bindings id="editorBindings"
|
|
|
|
xmlns="http://www.mozilla.org/xbl"
|
|
|
|
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
|
|
|
xmlns:xbl="http://www.mozilla.org/xbl">
|
|
|
|
|
|
|
|
<binding id="editor">
|
2007-05-23 11:08:10 -07:00
|
|
|
<implementation type="application/javascript" implements="nsIAccessibleProvider">
|
2007-03-22 10:30:00 -07:00
|
|
|
<constructor>
|
|
|
|
<![CDATA[
|
|
|
|
// Make window editable immediately only
|
|
|
|
// if the "editortype" attribute is supplied
|
|
|
|
// This allows using same contentWindow for different editortypes,
|
|
|
|
// where the type is determined during the apps's window.onload handler.
|
|
|
|
if (this.editortype)
|
|
|
|
this.makeEditable(this.editortype, true);
|
|
|
|
]]>
|
|
|
|
</constructor>
|
|
|
|
<destructor/>
|
|
|
|
|
|
|
|
<property name="accessibleType" readonly="true">
|
|
|
|
<getter>
|
|
|
|
<![CDATA[
|
|
|
|
return Components.interfaces.nsIAccessibleProvider.OuterDoc;
|
|
|
|
]]>
|
|
|
|
</getter>
|
|
|
|
</property>
|
|
|
|
|
|
|
|
<field name="_editorContentListener">
|
|
|
|
<![CDATA[
|
|
|
|
({
|
|
|
|
QueryInterface: function(iid)
|
|
|
|
{
|
|
|
|
if (iid.equals(Components.interfaces.nsIURIContentListener) ||
|
|
|
|
iid.equals(Components.interfaces.nsISupportsWeakReference) ||
|
|
|
|
iid.equals(Components.interfaces.nsISupports))
|
|
|
|
return this;
|
|
|
|
|
2009-01-15 20:02:21 -08:00
|
|
|
throw Components.results.NS_ERROR_NO_INTERFACE;
|
2007-03-22 10:30:00 -07:00
|
|
|
},
|
|
|
|
onStartURIOpen: function(uri)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
},
|
|
|
|
doContent: function(contentType, isContentPreferred, request, contentHandler)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
},
|
|
|
|
isPreferred: function(contentType, desiredContentType)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
},
|
|
|
|
canHandleContent: function(contentType, isContentPreferred, desiredContentType)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
},
|
|
|
|
loadCookie: null,
|
|
|
|
parentContentListener: null
|
|
|
|
})
|
|
|
|
]]>
|
|
|
|
</field>
|
|
|
|
<method name="makeEditable">
|
|
|
|
<parameter name="editortype"/>
|
|
|
|
<parameter name="waitForUrlLoad"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
2007-06-27 19:48:16 -07:00
|
|
|
this.editingSession.makeWindowEditable(this.contentWindow, editortype, waitForUrlLoad, true, false);
|
2007-03-22 10:30:00 -07:00
|
|
|
this.setAttribute("editortype", editortype);
|
|
|
|
|
|
|
|
this.docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
|
|
|
.getInterface(Components.interfaces.nsIURIContentListener)
|
|
|
|
.parentContentListener = this._editorContentListener;
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
<method name="getEditor">
|
|
|
|
<parameter name="containingWindow"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
return this.editingSession.getEditorForWindow(containingWindow);
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
<method name="getHTMLEditor">
|
|
|
|
<parameter name="containingWindow"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
var editor = this.editingSession.getEditorForWindow(containingWindow);
|
|
|
|
return editor.QueryInterface(Components.interfaces.nsIHTMLEditor);
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
<property name="editortype"
|
|
|
|
onget="return this.getAttribute('editortype');"
|
|
|
|
onset="this.setAttribute('editortype', val); return val;"/>
|
|
|
|
<property name="webNavigation"
|
|
|
|
onget="return this.docShell.QueryInterface(Components.interfaces.nsIWebNavigation);"
|
|
|
|
readonly="true"/>
|
|
|
|
<property name="contentDocument" readonly="true"
|
|
|
|
onget="return this.webNavigation.document;"/>
|
|
|
|
<property name="docShell"
|
|
|
|
onget="return this.boxObject.QueryInterface(Components.interfaces.nsIContainerBoxObject).docShell;"
|
|
|
|
readonly="true"/>
|
|
|
|
<property name="contentWindow"
|
|
|
|
readonly="true"
|
|
|
|
onget="return this.docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindow);"/>
|
|
|
|
<property name="webBrowserFind"
|
|
|
|
readonly="true"
|
|
|
|
onget="return this.docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIWebBrowserFind);"/>
|
|
|
|
<property name="editingSession"
|
|
|
|
readonly="true"
|
|
|
|
onget="return this.webNavigation.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIEditingSession);"/>
|
|
|
|
<property name="commandManager"
|
|
|
|
readonly="true"
|
|
|
|
onget="return this.webNavigation.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsICommandManager);"/>
|
|
|
|
</implementation>
|
|
|
|
</binding>
|
|
|
|
|
|
|
|
</bindings>
|
|
|
|
|