[jbosstools-dev] Embedded javascript in the VPE visual document?
Max Rydahl Andersen
max.andersen at redhat.com
Mon Aug 18 17:29:01 EDT 2008
Thanks for the update Maxim.
Marshall, his commments enhances my opinion about this.
If you want to use javascript to render some html do it in a seperate
controlled environment (e.g. rhino) and inject the actual html out to VPE
when it is done.
-max
> Marshall Culpepper wrote:
>> Rhino is a possibility, but it seems silly to load 2 seperate
>> javascript interpreters (Seamonkey for XULRunner and Rhino for Java..)
>> at the same time when Seamonkey is already available (or at least
>> could be).
>>
>> Maxim/Sergey, any pointers?
> 1)For know we are not support execution of java script in visual editor.
> To allow javascript we should switch off design mode, but know it's
> hard to do, because all selections events
> processing throw nsISelectionController which can be obtained only
> if we switch mozilla in design mode.
> 2) possibly JavaScript that inserted into head node doesn't be executed
> automatically, because browser executes this scripts
> when documents are loaded. When we insert it into DOM, document already
> loaded.
>
> PS. Using of JavaScript in Visual Editor can strongly change the process
> handling, because we can modify dom using js, and using
> xpcom, there then many questins how to map elements from source and
> visual part and others.
>>
>> On Sun, Aug 17, 2008 at 8:49 AM, Max Rydahl Andersen
>> <max.andersen at redhat.com <mailto:max.andersen at redhat.com>> wrote:
>>
>> On Sun, 17 Aug 2008 04:44:20 +0200, Marshall Culpepper
>> <mculpepper at appcelerator.org <mailto:mculpepper at appcelerator.org>>
>> wrote:
>>
>> Right, but I'm trying to avoid reinventing the wheel ;) I
>> guess I have no
>> other recourse?
>>
>>
>> I guess using rhino or some other javascript interpreter you
>> should be able to do whatever you want in javascript -
>> assuming your javascript spits out something that can be inserted
>> into a DOM tree...
>>
>> To find out where in VPE javascript is disabled/enabled we should
>> hear from Maxim or Sergey which know it better than I.
>>
>> -max
>>
>>
>> On Sat, Aug 16, 2008 at 11:27 AM, Max Andersen
>> <manderse at redhat.com <mailto:manderse at redhat.com>> wrote:
>>
>> This is why you write templates - to simulate the rendering
>> :)
>>
>> /max (sent from my phone)
>>
>> On 16/08/2008, at 16.39, "Marshall Culpepper"
>> <mculpepper at appcelerator.org
>> <mailto:mculpepper at appcelerator.org>>
>> wrote:
>>
>> I guess the next logical question is, where can I look to
>> find the
>> Javascript disabling code? I've been doing lots of poking
>> around looking for
>> it, but haven't had any luck... any pointers?
>>
>> On Fri, Aug 15, 2008 at 9:33 PM, Marshall Culpepper
>> <<mculpepper at appcelerator.org
>> <mailto:mculpepper at appcelerator.org>>
>> mculpepper at appcelerator.org
>> <mailto:mculpepper at appcelerator.org>> wrote:
>>
>> At runtime, our widgets are rendered using Javascript.
>> It would help
>> tremendously if we could execute the same script in
>> VPE so I don't have to
>> reinvent the wheel in Java.... (though calling into JS
>> using Rhino is
>> another option, but I'm guessing nowhere near as
>> effecient)
>>
>>
>> On Fri, Aug 15, 2008 at 6:33 PM, Max Andersen <
>> <manderse at redhat.com <mailto:manderse at redhat.com>>
>> manderse at redhat.com <mailto:manderse at redhat.com>> wrote:
>>
>> We do what we can to prevent javascript to execute
>> in the editor to avoid
>> bad sidesffects -. Why do you need it ?
>>
>> /max (sent from my phone)
>>
>>
>>
>> On 15/08/2008, at 21.25, "Marshall Culpepper"
>> <<mculpepper at appcelerator.org
>> <mailto:mculpepper at appcelerator.org>>
>> mculpepper at appcelerator.org
>> <mailto:mculpepper at appcelerator.org>> wrote:
>>
>> Hey guys..
>>
>>
>> I was curious if it's possible to execute
>> javascript by adding <script>
>> nodes into the head node the same way that
>> <link> nodes are added for CSS
>> styles. I've created a method that does it for
>> me locally, but the script in
>> question doesn't seem to be executing... is
>> there something special needed
>> to make javascript work in this document?
>> Here's my snippet:
>>
>> public static void addScriptNodeToHead
>> (VpePageContext pageContext,
>> nsIDOMDocument visualDocument, String
>> scriptSrc) {
>> nsIDOMNode headNode =
>> pageContext.getVisualBuilder().getHeadNode();
>>
>> nsIDOMElement scriptNode =
>> visualDocument.createElement("script");
>> scriptNode.setAttribute("src", scriptSrc);
>> scriptNode.setAttribute("type",
>> "text/javascript");
>>
>> headNode.appendChild(scriptNode);
>> }
>> _______________________________________________
>> jbosstools-dev mailing list
>> <jbosstools-dev at lists.jboss.org
>> <mailto:jbosstools-dev at lists.jboss.org>>jbosstools-dev at lists.jboss.org
>> <mailto:jbosstools-dev at lists.jboss.org>
>>
>> <https://lists.jboss.org/mailman/listinfo/jbosstools-dev>
>> https://lists.jboss.org/mailman/listinfo/jbosstools-dev
>>
>>
>>
>> _______________________________________________
>> jbosstools-dev mailing list
>> jbosstools-dev at lists.jboss.org
>> <mailto:jbosstools-dev at lists.jboss.org>
>> https://lists.jboss.org/mailman/listinfo/jbosstools-dev
>>
>>
>>
>>
>>
>> --
>> -max
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> jbosstools-dev mailing list
>> jbosstools-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/jbosstools-dev
>
--
-max
More information about the jbosstools-dev
mailing list