twingle/twingle/content/workspace midasbindings.xml,1.2,1.3
[email protected] Sun, 9 Mar 2003 13:48:34 -0700 (MST)
| Newsgroups | gmane.comp.cms.oscom.twingle.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvs/root/twingle/twingle/content/workspace
In directory alpha.oscom.org:/tmp/cvs-serv20700
Modified Files:
midasbindings.xml
Log Message:
you can now edit in both tabs "midas" and "source" and switch between them
Index: midasbindings.xml
===================================================================
RCS file: /cvs/root/twingle/twingle/content/workspace/midasbindings.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** midasbindings.xml 9 Mar 2003 19:20:44 -0000 1.2
--- midasbindings.xml 9 Mar 2003 20:48:32 -0000 1.3
***************
*** 11,17 ****
<xul:tabbox flex="1">
<xul:tabs>
! <xul:tab label="Midas"
/>
! <xul:tab label="Source" oncommand="document.getAnonymousNodes(this)[0].parentNode.parentNode.parentNode.getElementsByAttribute('name','sourceedit')[0].setAttribute('value',document.getBindingParent(this).dataSource)"/>
</xul:tabs>
<xul:tabpanels>
--- 11,17 ----
<xul:tabbox flex="1">
<xul:tabs>
! <xul:tab label="Midas" oncommand="document.getBindingParent(this).onCommandStart('midasValue');"
/>
! <xul:tab label="Source" oncommand="document.getBindingParent(this).onCommandStart('sourceValue');"/>
</xul:tabs>
<xul:tabpanels>
***************
*** 34,54 ****
<constructor>
this.loadHTML();
</constructor>
<fields name="editFrame"/>
! <property readonly="true" name="dataSource">
<getter>
! var ser = new XMLSerializer();
! return ser.serializeToString(this.editFrame.contentDocument);
</getter>
!
</property>
<method name="setEditFrame">
<body>
<![CDATA[
this.editFrame = document.getAnonymousNodes(this)[0].getElementsByTagNameNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul","iframe")[0];
]]>
</body>
--- 34,85 ----
<constructor>
this.loadHTML();
+ this.oldTab = 'midasValue';
</constructor>
<fields name="editFrame"/>
+ <fields name="sourceFrame"/>
! <fields name="oldTab"/>
!
! <property name="sourceValue">
<getter>
! return(this.sourceFrame.value);
</getter>
! <setter>
! this.sourceFrame.value = val;
! </setter>
</property>
+ <property name="midasValue">
+ <getter>
+ var ser = new XMLSerializer();
+ var children = this.editFrame.contentDocument.body.childNodes;
+ var out = "";
+ for (i = 0; i < children.length; i++ ) {
+ out += ser.serializeToString(children[i]);
+ }
+ return out;
+ /*
+ This would be another solution, but it isn't well-formed then...
+ return this.editFrame.contentDocument.body.innerHTML;
+ */
+ </getter>
+ <setter>
+ this.editFrame.contentDocument.body.innerHTML = val;
+ </setter>
+ </property>
+ <method name="onCommandStart">
+ <parameter name="prop"/>
+ <body>
+ eval("this."+ prop + " = this." + this.oldTab);
+ this.oldTab = prop;
+ </body>
+ </method>
<method name="setEditFrame">
<body>
<![CDATA[
this.editFrame = document.getAnonymousNodes(this)[0].getElementsByTagNameNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul","iframe")[0];
+ this.sourceFrame = document.getAnonymousNodes(this)[0].getElementsByAttribute('name','sourceedit')[0];
]]>
</body>
***************
*** 60,63 ****
--- 91,95 ----
// this = iframe here, since it's called from the onload event of the iframe
this.contentDocument.designMode = "on";
+ this.contentDocument.execCommand("useCSS", false, true);
]]>
</body>
***************
*** 72,75 ****
--- 104,108 ----
this.editFrame.setAttribute("src", document.getBindingParent(this).sourceurl );
}
+
]]></body>
</method>