[xwiki-devs] HTMLCleaner to remove some iframes?
Hello fellow xwiki developers, trying to understand why an iframe element disappears after we re-edit source after we insert the iframe in source html, I seem to understand that the service called "HTMLCleaner" is the guilty one (the service is called as a POST to URL /xwiki/resources/js/xwiki/wysiwyg/xwe/HTMLConverter.gwtrpc Is there any way to configure the policy of the html-cleaner? I did not see this among the configs. thanks in advance. paul
Hi Paul, What syntax are you using? I just tried with XWiki 2.1 syntax: ----------8<---------- before {{html}} <iframe src="http://www.xwiki.org"></iframe> {{/html}} after ---------->8---------- and the iframe element is not lost when I use the WYSIWYG editor. Moreover, even if I inject the following HTML in the BODY element of the WYSIWYG editor's rich text area: ----------8<---------- <p>before</p> <iframe src="http://www.xwiki.org"></iframe> <p>after</p> ---------->8---------- the HTML cleaner produces: ----------8<---------- <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html><head></head><body><p>before</p> <iframe src="http://www.xwiki.org"></iframe> <p>after</p></body></html> ---------->8---------- which has the iframe element as you can see. Of course, the iframe element is lost when the cleaned HTML is converted to XWiki 2.1 syntax because there's no equivalent for the iframe element in the wiki syntax. That's why we use the HTML macro. So I think your problem is elsewhere. Hope this helps, Marius On Fri, Oct 25, 2013 at 1:27 AM, Paul Libbrecht <[email protected]> wrote:
Hello fellow xwiki developers,
trying to understand why an iframe element disappears after we re-edit source after we insert the iframe in source html, I seem to understand that the service called "HTMLCleaner" is the guilty one (the service is called as a POST to URL /xwiki/resources/js/xwiki/wysiwyg/xwe/HTMLConverter.gwtrpc
Is there any way to configure the policy of the html-cleaner? I did not see this among the configs.
thanks in advance.
paul _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
What version of HTMLCleaner/XWiki do you have ? Could be a bug in an older version. On Fri, Oct 25, 2013 at 8:44 AM, Marius Dumitru Florea <[email protected]> wrote:
Hi Paul,
What syntax are you using? I just tried with XWiki 2.1 syntax:
----------8<---------- before
{{html}} <iframe src="http://www.xwiki.org"></iframe> {{/html}}
after ---------->8----------
and the iframe element is not lost when I use the WYSIWYG editor. Moreover, even if I inject the following HTML in the BODY element of the WYSIWYG editor's rich text area:
----------8<---------- <p>before</p> <iframe src="http://www.xwiki.org"></iframe> <p>after</p> ---------->8----------
the HTML cleaner produces:
----------8<---------- <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html><head></head><body><p>before</p> <iframe src="http://www.xwiki.org"></iframe> <p>after</p></body></html> ---------->8----------
which has the iframe element as you can see. Of course, the iframe element is lost when the cleaned HTML is converted to XWiki 2.1 syntax because there's no equivalent for the iframe element in the wiki syntax. That's why we use the HTML macro. So I think your problem is elsewhere.
Hope this helps, Marius
On Fri, Oct 25, 2013 at 1:27 AM, Paul Libbrecht <[email protected]> wrote:
Hello fellow xwiki developers,
trying to understand why an iframe element disappears after we re-edit source after we insert the iframe in source html, I seem to understand that the service called "HTMLCleaner" is the guilty one (the service is called as a POST to URL /xwiki/resources/js/xwiki/wysiwyg/xwe/HTMLConverter.gwtrpc
Is there any way to configure the policy of the html-cleaner? I did not see this among the configs.
thanks in advance.
paul _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Thomas Mortagne
Hello fellow debs,
What version of HTMLCleaner/XWiki do you have ? Could be a bug in an older version.
- htmlcleaner-2.2.jar - xwiki 3.5.1
On Fri, Oct 25, 2013 at 8:44 AM, Marius Dumitru Florea <[email protected]> wrote:
What syntax are you using? I just tried with XWiki 2.1 syntax:
2.1 However, the problem is not that html macro is lost. The problem is that we use the wysiwyg editor for html editing, the underlying xwiki content is purely html and not xwiki syntax, and the editor seems to call the htmlCleaner service at start. In this setting, the workflow: - start to edit (shows wysiwyg) - click source - add the iframe - save … shows the iframe well - click edit again (shows wysiwyg) - go to source, the iframe element is gone (but not, for example, the child text) Sergiu, your statement:
Of course, the iframe element is lost when the cleaned HTML is converted to XWiki 2.1 syntax because there's no equivalent for the iframe element in the wiki syntax.
is contradicting the rest of the mail: the converter could replace it with an html macro but I do not know how to patch it for this. paul
----------8<---------- before
{{html}} <iframe src="http://www.xwiki.org"></iframe> {{/html}}
after ---------->8----------
and the iframe element is not lost when I use the WYSIWYG editor. Moreover, even if I inject the following HTML in the BODY element of the WYSIWYG editor's rich text area:
----------8<---------- <p>before</p> <iframe src="http://www.xwiki.org"></iframe> <p>after</p> ---------->8----------
the HTML cleaner produces:
----------8<---------- <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html><head></head><body><p>before</p> <iframe src="http://www.xwiki.org"></iframe> <p>after</p></body></html> ---------->8----------
which has the iframe element as you can see. Of course, the iframe element is lost when the cleaned HTML is converted to XWiki 2.1 syntax because there's no equivalent for the iframe element in the wiki syntax. That's why we use the HTML macro. So I think your problem is elsewhere.
Hope this helps, Marius
On Fri, Oct 25, 2013 at 1:27 AM, Paul Libbrecht <[email protected]> wrote:
Hello fellow xwiki developers,
trying to understand why an iframe element disappears after we re-edit source after we insert the iframe in source html, I seem to understand that the service called "HTMLCleaner" is the guilty one (the service is called as a POST to URL /xwiki/resources/js/xwiki/wysiwyg/xwe/HTMLConverter.gwtrpc
Is there any way to configure the policy of the html-cleaner? I did not see this among the configs.
thanks in advance.
paul _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Thomas Mortagne _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
On Fri, Oct 25, 2013 at 11:35 AM, Paul Libbrecht <[email protected]> wrote:
Hello fellow debs,
What version of HTMLCleaner/XWiki do you have ? Could be a bug in an older version.
- htmlcleaner-2.2.jar - xwiki 3.5.1
On Fri, Oct 25, 2013 at 8:44 AM, Marius Dumitru Florea <[email protected]> wrote:
What syntax are you using? I just tried with XWiki 2.1 syntax:
2.1
However, the problem is not that html macro is lost.
The problem is that we use the wysiwyg editor for html editing, the underlying xwiki content is purely html and not xwiki syntax, and the editor seems to call the htmlCleaner service at start.
In this setting, the workflow: - start to edit (shows wysiwyg) - click source
- add the iframe
Using the {{html}} macro?
- save … shows the iframe well - click edit again (shows wysiwyg)
- go to source, the iframe element is gone (but not, for example, the child text)
This doesn't happen if you use the {{html}} macro but it seems you don't use it.
Sergiu, your statement:
Marius ;)
Of course, the iframe element is lost when the cleaned HTML is converted to XWiki 2.1 syntax because there's no equivalent for the iframe element in the wiki syntax.
is contradicting the rest of the mail: the converter could replace it with an html macro but I do not know how to patch it for this.
There's no contradiction at all. The title of this thread is "HTMLCleaner to remove some iframes?" and the answer is definitely No, the HTML cleaner doesn't remove the iframe element. As I already said, the iframe element is lost when the cleaned HTML is converted to wiki syntax because the iframe element doesn't have a corresponding wiki syntax element. The conversion is done using the rendering module http://rendering.xwiki.org with very precise rules. You need a parser to obtain an XDOM from the input syntax (HTML) and a renderer to serialize the XDOM into the output syntax (XWiki 2.1). The converter cannot magically add a macro/transformation marker around the iframe element. You have to do this. I see two options in your case: 1) Try to use XHTML as source syntax, not XWiki 2.1 2) Check the Annotated XHTML syntax that is used as input for the WYSIWYG editor. Edit a page that has macros and check the HTML that is given as input to the editor. You'll notice some markers. Or, you could check the HTML that is produced when you insert a macro from the WYSIWYG editor. Hope this helps, Marius
paul
----------8<---------- before
{{html}} <iframe src="http://www.xwiki.org"></iframe> {{/html}}
after ---------->8----------
and the iframe element is not lost when I use the WYSIWYG editor. Moreover, even if I inject the following HTML in the BODY element of the WYSIWYG editor's rich text area:
----------8<---------- <p>before</p> <iframe src="http://www.xwiki.org"></iframe> <p>after</p> ---------->8----------
the HTML cleaner produces:
----------8<---------- <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html><head></head><body><p>before</p> <iframe src="http://www.xwiki.org"></iframe> <p>after</p></body></html> ---------->8----------
which has the iframe element as you can see. Of course, the iframe element is lost when the cleaned HTML is converted to XWiki 2.1 syntax because there's no equivalent for the iframe element in the wiki syntax. That's why we use the HTML macro. So I think your problem is elsewhere.
Hope this helps, Marius
On Fri, Oct 25, 2013 at 1:27 AM, Paul Libbrecht <[email protected]> wrote:
Hello fellow xwiki developers,
trying to understand why an iframe element disappears after we re-edit source after we insert the iframe in source html, I seem to understand that the service called "HTMLCleaner" is the guilty one (the service is called as a POST to URL /xwiki/resources/js/xwiki/wysiwyg/xwe/HTMLConverter.gwtrpc
Is there any way to configure the policy of the html-cleaner? I did not see this among the configs.
thanks in advance.
paul _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Thomas Mortagne _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
In this setting, the workflow: - start to edit (shows wysiwyg) - click source
- add the iframe
Using the {{html}} macro?
No we had not tried this but now I did and it also got killed. (we have opened bug http://jira.xwiki.org/browse/CURRIKI-6382 for this, a video is coming there showing how non-functional the html macro is in this case). My guess is that were are hitting an unsupported feature of the "html editor" facet.
Sergiu, your statement:
Marius ;)
Sorry for that! I like your reactivity!
There's no contradiction at all. The title of this thread is "HTMLCleaner to remove some iframes?" and the answer is definitely No, the HTML cleaner doesn't remove the iframe element.
Well. It does if it's not wrapped within an html macro.
As I already said, the iframe element is lost when the cleaned HTML is converted to wiki syntax because the iframe element doesn't have a corresponding wiki syntax element. The conversion is done using the rendering module http://rendering.xwiki.org with very precise rules.
This is what would interest me. Where are the rules?
You need a parser to obtain an XDOM from the input syntax (HTML) and a renderer to serialize the XDOM into the output syntax (XWiki 2.1). The converter cannot magically add a macro/transformation marker around the iframe element. You have to do this.
I see two options in your case:
1) Try to use XHTML as source syntax, not XWiki 2.1
This is done in the video and fails.
2) Check the Annotated XHTML syntax that is used as input for the WYSIWYG editor. Edit a page that has macros and check the HTML that is given as input to the editor. You'll notice some markers. Or, you could check the HTML that is produced when you insert a macro from the WYSIWYG editor.
(I have never seen markers of xwiki macros output inside html, this must be the reason). thanks Paul
Marius, I have finally been able to see the extra "processing-instructions-like" html comments that the html macro (and probably all macros?) generate in one of my stock XWiki installations (an XWiki 4.3): HTMLCleaner was called with code: <!--startmacro:html\!-\!clean="false"\!-\!<iframe src="http://node1.hoplahup.net/xwiki/bin/view/Coll_adminPolx/bigvideo?viewer=vide..." width="450" height="350">no frames?</iframe>--><!--stopmacro--> And this properly edits into the editor. So, what can be the reason that our editor (based on xwiki 3.5) does not include these comments but includes the raw html which then gets cleaned out by the html-cleaner? thanks in advance. Paul Le 25 oct. 2013 à 21:19, Paul Libbrecht <[email protected]> a écrit :
In this setting, the workflow: - start to edit (shows wysiwyg) - click source
- add the iframe
Using the {{html}} macro?
No we had not tried this but now I did and it also got killed. (we have opened bug http://jira.xwiki.org/browse/CURRIKI-6382 for this, a video is coming there showing how non-functional the html macro is in this case). My guess is that were are hitting an unsupported feature of the "html editor" facet.
Sergiu, your statement:
Marius ;)
Sorry for that! I like your reactivity!
There's no contradiction at all. The title of this thread is "HTMLCleaner to remove some iframes?" and the answer is definitely No, the HTML cleaner doesn't remove the iframe element.
Well. It does if it's not wrapped within an html macro.
As I already said, the iframe element is lost when the cleaned HTML is converted to wiki syntax because the iframe element doesn't have a corresponding wiki syntax element. The conversion is done using the rendering module http://rendering.xwiki.org with very precise rules.
This is what would interest me. Where are the rules?
You need a parser to obtain an XDOM from the input syntax (HTML) and a renderer to serialize the XDOM into the output syntax (XWiki 2.1). The converter cannot magically add a macro/transformation marker around the iframe element. You have to do this.
I see two options in your case:
1) Try to use XHTML as source syntax, not XWiki 2.1
This is done in the video and fails.
2) Check the Annotated XHTML syntax that is used as input for the WYSIWYG editor. Edit a page that has macros and check the HTML that is given as input to the editor. You'll notice some markers. Or, you could check the HTML that is produced when you insert a macro from the WYSIWYG editor.
(I have never seen markers of xwiki macros output inside html, this must be the reason).
thanks
Paul
On Fri, Nov 1, 2013 at 2:34 PM, Paul Libbrecht <[email protected]> wrote:
Marius,
I have finally been able to see the extra "processing-instructions-like" html comments that the html macro (and probably all macros?) generate in one of my stock XWiki installations (an XWiki 4.3): HTMLCleaner was called with code:
Yes, these type of comments are generated for all macros, precisely for all rendering transformations, as macros are just one type of rendering transformation.
<!--startmacro:html\!-\!clean="false"\!-\!<iframe src="http://node1.hoplahup.net/xwiki/bin/view/Coll_adminPolx/bigvideo?viewer=vide..." width="450" height="350">no frames?</iframe>--><!--stopmacro-->
And this properly edits into the editor.
So, what can be the reason that our editor (based on xwiki 3.5) does not include these comments but includes the raw html which then gets cleaned out by the html-cleaner?
You should check how the editor gets its input. If the input is wiki syntax and the editor makes itself an AJAX request to convert it to (Annotated)XHTML then you should have the macro markers. Otherwise, if the input is HTML and you instruct the editor to not convert it then it's your responsibility to give Annotated XHTML to the editor. In this case check how you get the HTML. Hope this helps, Marius
thanks in advance.
Paul
Le 25 oct. 2013 à 21:19, Paul Libbrecht <[email protected]> a écrit :
In this setting, the workflow: - start to edit (shows wysiwyg) - click source
- add the iframe
Using the {{html}} macro?
No we had not tried this but now I did and it also got killed. (we have opened bug http://jira.xwiki.org/browse/CURRIKI-6382 for this, a video is coming there showing how non-functional the html macro is in this case). My guess is that were are hitting an unsupported feature of the "html editor" facet.
Sergiu, your statement:
Marius ;)
Sorry for that! I like your reactivity!
There's no contradiction at all. The title of this thread is "HTMLCleaner to remove some iframes?" and the answer is definitely No, the HTML cleaner doesn't remove the iframe element.
Well. It does if it's not wrapped within an html macro.
As I already said, the iframe element is lost when the cleaned HTML is converted to wiki syntax because the iframe element doesn't have a corresponding wiki syntax element. The conversion is done using the rendering module http://rendering.xwiki.org with very precise rules.
This is what would interest me. Where are the rules?
You need a parser to obtain an XDOM from the input syntax (HTML) and a renderer to serialize the XDOM into the output syntax (XWiki 2.1). The converter cannot magically add a macro/transformation marker around the iframe element. You have to do this.
I see two options in your case:
1) Try to use XHTML as source syntax, not XWiki 2.1
This is done in the video and fails.
2) Check the Annotated XHTML syntax that is used as input for the WYSIWYG editor. Edit a page that has macros and check the HTML that is given as input to the editor. You'll notice some markers. Or, you could check the HTML that is produced when you insert a macro from the WYSIWYG editor.
(I have never seen markers of xwiki macros output inside html, this must be the reason).
thanks
Paul
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
participants (3)
-
Marius Dumitru Florea -
Paul Libbrecht -
Thomas Mortagne