On Fri, Oct 25, 2013 at 11:35 AM, Paul Libbrecht <paul(a)hoplahup.net> 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
<mariusdumitru.florea(a)xwiki.com> 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 <paul(a)hoplahup.net> 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
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs
--
Thomas Mortagne
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs