RetroZilla/xpfe/global/resources/content/bindings/editor.xml
2015-10-20 23:03:22 -04:00

86 lines
3.5 KiB
XML

<?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">
<implementation type="application/x-javascript" implements="nsIAccessibleProvider">
<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="accessible">
<getter>
<![CDATA[
var accService = Components.classes["@mozilla.org/accessibilityService;1"].getService(Components.interfaces.nsIAccessibilityService);
return accService.createOuterDocAccessible(this);
]]>
</getter>
</property>
<method name="makeEditable">
<parameter name="editortype"/>
<parameter name="waitForUrlLoad"/>
<body>
<![CDATA[
this.editingSession.makeWindowEditable(this.contentWindow, editortype, waitForUrlLoad);
this.setAttribute("editortype", editortype);
]]>
</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.nsIEditorBoxObject).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>