<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Marshall Culpepper wrote:
<blockquote
 cite="mid:ab04aa740808200938x33980218o861de996f573e6ec@mail.gmail.com"
 type="cite">
  <div dir="ltr">Why would I want to print the dom on the console? My
goal is to edit the visual dom directly =). <br>
  <br>
  </div>
</blockquote>
You want generate dom using java script and then edit visual editor?<br>
<blockquote
 cite="mid:ab04aa740808200938x33980218o861de996f573e6ec@mail.gmail.com"
 type="cite">
  <div dir="ltr">Also wouldn't getEditor() still need to instantiate /
initialize the editor object somehow??<br>
  </div>
</blockquote>
Yes, It will broke selection functionality.<br>
<blockquote
 cite="mid:ab04aa740808200938x33980218o861de996f573e6ec@mail.gmail.com"
 type="cite">
  <div dir="ltr"><br>
  <div class="gmail_quote">On Tue, Aug 19, 2008 at 8:20 AM, Max
Areshkau <span dir="ltr">&lt;<a moz-do-not-send="true"
 href="mailto:mareshkau@exadel.com">mareshkau@exadel.com</a>&gt;</span>
wrote:<br>
  <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
    <div class="Ih2E3d">Max Rydahl Andersen wrote:<br>
    <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Maxim, Marshall is not really asking for enabling javascript in the
live preview...he is asking for away to evaluate javascript so he can
actually generate the corresponding html via javascript instead of
manually coding.<br>
      <br>
-max<br>
      <br>
    </blockquote>
    </div>
Then DOM tree can be modifying in &nbsp;using js and dumped to console.<br>
To do this need following:<br>
1) disable design mode (Comment body of
org.jboss.tools.vpe.editor.mozilla.MozillaEditor.getEditor())<br>
2) include js into visual document(into head node)<br>
3) run included js, simple way by some action (onclick for submit for
example)<br>
4) dump visual dom &nbsp;to console, such fuctionality already exist and use
generated html.
    <div>
    <div class="Wj3C7c"><br>
    <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
      <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Marshall
Culpepper wrote:<br>
        <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
          <br>
          <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
&nbsp; &nbsp;Maxim/Sergey, any pointers?<br>
          </blockquote>
&nbsp; &nbsp;1)For know we are not support execution of java script in visual<br>
&nbsp; &nbsp;editor.<br>
&nbsp; &nbsp; &nbsp; &nbsp;To allow javascript we should switch off design mode, but know<br>
&nbsp; &nbsp;it's hard to do, because all selections events<br>
&nbsp; &nbsp; &nbsp; &nbsp;processing throw nsISelectionController which can be obtained<br>
&nbsp; &nbsp;only if we switch mozilla in design mode.<br>
          <br>
          <br>
Where is "design mode" turned on and off? So if I understand correctly<br>
... taking the Mozilla renderer out of design mode turns off the<br>
propogation of nsISelectionController events?<br>
        </blockquote>
org.jboss.tools.vpe.editor.mozilla.MozillaEditor.getEditor(), this<br>
method calls from VpeController.init();<br>
To Disable design mode you should comment body of method<br>
org.jboss.tools.vpe.editor.mozilla.MozillaEditor.getEditor().<br>
Also for &nbsp;**Preview** &nbsp;tab we using another instance of mozilla , which<br>
in browser mode and &nbsp;you can use preview mode, then you shouldn't<br>
swicth off design mode.<br>
        <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
          <br>
          <br>
          <br>
&nbsp; &nbsp;2) possibly JavaScript that inserted into head node doesn't be<br>
&nbsp; &nbsp;executed automatically, because browser executes this scripts<br>
&nbsp; &nbsp;when documents are loaded. When we insert it into DOM, document<br>
&nbsp; &nbsp;already loaded.<br>
          <br>
          <br>
This sounds right, but if I can't execute javascript at all, I guess<br>
it doesn't matter? =)<br>
        </blockquote>
For execution js i have mode following steps(Easy way):<br>
1)create html page with following content<br>
/ &nbsp; &nbsp;&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"<br>
"<a moz-do-not-send="true"
 href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
 target="_blank">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</a>"&gt;<br>
&nbsp; &nbsp;&lt;html&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp;&lt;head&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp;&lt;/head&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp;&lt;body&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;input type="button" onclick="alert('I am an alert
box!!')"<br>
value="Display alert box" /&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;input type="button" onclick="document.write('Test');"<br>
value="Display alert box" /&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp;&lt;/body&gt;<br>
&nbsp; &lt;/html&gt;<br>
2)/ open /org.jboss.tools.vpe.html/templates/vpe-templates-html.xml/<br>
file and add for tag with name="input" to copy attributes /onclick/<br>
attribute.<br>
&nbsp; &nbsp; &nbsp; It's should looks like this: &lt;vpe:copy<br>
attrs="id,type,style,class,value,size,*onclick*" /&gt;<br>
3) open page which was created in [1] in visual editor.<br>
4) switch to preview tab, and click on submit button on page. JavaScript<br>
will be executed.<br>
//<br>
        <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
          <br>
          <br>
          <br>
&nbsp; &nbsp;PS. Using of JavaScript in Visual Editor can strongly change the<br>
&nbsp; &nbsp;process handling, &nbsp;because &nbsp;we can modify dom using js, and using<br>
&nbsp; &nbsp;xpcom, there then &nbsp;many questins how to map elements from source<br>
&nbsp; &nbsp;and visual part &nbsp;and others.<br>
          <br>
          <br>
Very true.. Our problem is that the appcelerator platform uses<br>
javascript code to render widgets.. it's sounding more and more like<br>
it would be better to try and approach this using Rhino. I'd still<br>
like to fiddle with the design mode to see what I can accomplish<br>
though, any pointers to source code?<br>
        </blockquote>
I think it's better to use in test purposes preview tab for testing js,<br>
in such way it's takes minimal changes.<br>
      </blockquote>
      <br>
      <br>
      <br>
    </blockquote>
    <br>
    </div>
    </div>
  </blockquote>
  </div>
  <br>
  </div>
</blockquote>
<br>
</body>
</html>