Vincent Massol wrote:
On Jan 29, 2010, at 3:33 PM, Jerome Velociter wrote:
Vincent Massol wrote:
On Jan 29, 2010, at 3:04 PM, Marius Dumitru Florea wrote:
Hi devs,
Right now JavaScript extensions are included when a document is rendered in WYSIWYG edit mode. This has both advantages and disadvantages.
Pro: If the output of a macro depends on a JavaScript extension, then the result of rendering that macro will be the same in view mode and (WYSIWYG) edit mode.
Con: If the JavaScript extension is not aware of the edit mode then it can modify the DOM document outside of the read-only macro markers which leads to unwanted changes in the content of the edited document (i.e. the modifications done by the JavaScript extension are saved). Such an example is http://jira.xwiki.org/jira/browse/XWIKI-4665 . Before deciding isn't there a possibility to protect the DOM? Is there no way to do that? What do you mean protect the DOM ?
If you mean prevent DOM modifications by the extensions, I think it is a hard problem, and it does not really make sense (what the point of including extensions to not discriminate vs. view mode if in the end they cannot affect the DOM ?)
But maybe that's not what you mean.
No I meant protect the DOM when in wysiwyg edit mode.
I have no idea if it's possible. We have the same issue for the XDOM when a transformation makes a change in other parts of the XDOM and we need to protect it (by adding markers around the changes). The way I plan to implement this is to implement a TransformationXDOM which is an extension of the default XOM implementation and that automatically adds markers when a change is done outside of its zone.
I don't think this is possible. DOM changes can come from different places: the editor, in-line JavaScript, JavaScript extensions (including third-party JavaScript libraries). Catching DOM mutations is not possible in IE, and how can we detect the entity behind the DOM mutation (especially when it's a third-party JavaScript library)? Moreover, I'm not sure it's possible to wrap all the JavaScript DOM API to be able to detect for instance when a DOM node is added to the document. Note that a macro would still be able to generate in-line JavaScript (though the best practice is to have this code in a JavaScript extension). Thanks, Marius
Thanks -Vincent
Jerome.
We're going to do something a little similar for the rendering is there's invalid HTML entered: http://jira.xwiki.org/jira/browse/XWIKI-3782
Thanks -Vincent
WDYT? Should we limit the WYSIWYG in order to make the editing safer?
I'm +0.
Thanks, Marius
devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs