Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix EZP-25161: Impossible to publish a content with a Richtext field with Firefox #446

Merged
merged 1 commit into from Dec 2, 2015

Conversation

5 participants
@dpobel
Copy link
Contributor

dpobel commented Dec 1, 2015

JIRA: https://jira.ez.no/browse/EZP-25161

Description

It's impossible to save a content item with a RichText field in Firefox (nor in IE11). This is happening because of the way we build the XHTML5Edit version of the RichText field and especially because of our usage of a namespace in this format...

To avoid that, we are kind of forced to build the XML by concatenating strings... While at it, I also refactored this part by delegating the editor's content clean up to a set of dedicated components (EditorContentProcessors).

Test

unit tests and manual tests in Chrome, Firefox and IE11.

@dpobel

This comment has been minimized.

Copy link
Contributor Author

dpobel commented Dec 1, 2015

ping @yannickroger @mhyndle @StephaneDiot @andrerom

Also, this makes me realize that EZP-24732 is not fixed when we try to set the value of a RichText field through REST. @bdunogier can you have a look ?

@dpobel dpobel force-pushed the ezp-25161_publish_richtext branch from 4d03bf9 to 03796ba Dec 1, 2015

@bdunogier

This comment has been minimized.

Copy link
Member

bdunogier commented Dec 1, 2015

Also, this makes me realize that EZP-24732 is not fixed when we try to set the value of a RichText field through REST. @bdunogier can you have a look ?

Yep, I'll dig.

@mhyndle

This comment has been minimized.

Copy link
Contributor

mhyndle commented Dec 1, 2015

+1

@andrerom

This comment has been minimized.

Copy link
Member

andrerom commented Dec 1, 2015

+1 kind of, care to exapand on the namespace issues? And why we use xml parser in the browser? (As opposed to Dom, ..)

@dpobel

This comment has been minimized.

Copy link
Contributor Author

dpobel commented Dec 2, 2015

@andrerom: sure. Let's take a simple example. If the editor puts something like

<p>I'm a paragraph</p>

in the RichText editor, I should generate something like:

<section xmlns="http://ez.no/namespaces/ezpublish5/xhtml5/edit">
  <p>I'm a paragraph</p>
</section>

to the save RichText field content. This is a equivalent to:

<ez:section xmlns:ez="http://ez.no/namespaces/ezpublish5/xhtml5/edit">
  <ez:p>I'm a paragraph</ez:p>
</ez:section>

But to generate that properly (without concatenating strings and pray that results in a valid XML document) I should first parse what the user put in the rich text editor and then recursively import everything in the xhtml5edit namespace.

But actually, having ez:p is semantically wrong to me. The format is called xhtml5edit so basically that means we want to use some part of xhtml5 so instead of defining the namespace http://ez.no/namespaces/ezpublish5/xhtml5/edit for everything we should reuse the xhtml namespace when we are using XHTML elements. That could give something like:

<ez:section xmlns:ez="http://ez.no/namespaces/ezpublish5/xhtml5/edit" xmlns:xhtml="http://www.w3.org/1999/xhtml">
  <xhtml:p>I'm a paragraph</xhtml:p>
</ez:section>

which is equivalent to:

<ez:section xmlns:ez="http://ez.no/namespaces/ezpublish5/xhtml5/edit" xmlns="http://www.w3.org/1999/xhtml">
  <p>I'm a paragraph</p>
</ez:section>

or

<ez:section xmlns="http://ez.no/namespaces/ezpublish5/xhtml5/edit" xmlns:xhtml="http://www.w3.org/1999/xhtml">
  <xhtml:p>I'm a paragraph</xhtml:p>
</ez:section>

Semantically, that's much better IMHO (at least the structure reflects the goal of this format) and it would be much easier for me to generate.

One can also argue that section is a HTML5 element so this one too should not be in our custom namespace and the xhtml5edit version of the document could then be:

<section><!-- maybe with  xmlns="http://www.w3.org/1999/xhtml" -->
  <p>I'm a paragraph</p>
</section>

For me, it would be the easiest of course but the RichText field was build with the idea of having a mapping between the namespace and the parser.

And why we use xml parser in the browser? (As opposed to Dom, ..)

not sure to understand the question, we use DOM when parsing some XML

@yannickroger

This comment has been minimized.

Copy link
Contributor

yannickroger commented Dec 2, 2015

+1

dpobel added a commit that referenced this pull request Dec 2, 2015

Merge pull request #446 from ezsystems/ezp-25161_publish_richtext
Fix EZP-25161: Impossible to publish a content with a Richtext field with Firefox

@dpobel dpobel merged commit b345904 into master Dec 2, 2015

2 of 3 checks passed

ez/ci/behat Behat test execution by ezrobot
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
ezrobot Code review by ezrobot
Details

@dpobel dpobel deleted the ezp-25161_publish_richtext branch Dec 1, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.