On 01/29/2010 03: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 .
WDYT? Should we limit the WYSIWYG in order to make the editing safer?
I'm +0.
+1
If some script should be executed in edit mode, I think a possible
solution would be to add a new field to the JSX class to tell if the
extension should be used in edit mode, too. By default it should be
false. The problem is that this doesn't fix file extensions, and those
are the ones that cause problems now. So, at least for file extensions,
they should always be disabled in edit mode.
Actually we can use a parameter for file extensions too, in the extra
params parameter.
--
Sergiu Dumitriu