-
Notifications
You must be signed in to change notification settings - Fork 17
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
EZP-31321: Replaced zero-width space with oe-upcast-placeholder #88
EZP-31321: Replaced zero-width space with oe-upcast-placeholder #88
Conversation
@@ -585,7 +585,7 @@ | |||
<xsl:call-template name="ezattribute"/> | |||
<xsl:apply-templates/> | |||
<xsl:if test="./docbook:ezattribute or not(node())"> | |||
<xsl:text> </xsl:text> | |||
<xsl:text>ao-upcast-placeholder</xsl:text> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't make much sense to me. What is ao-upcast-placeholder
and why I would want to expose this in OE? Is this shown as attribute value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I just choose this placeholder and made a type there. It should be ae-upcast-placeholder
. Basically its value does not matter at all. It just needs to be some non-space characters. It is passed only to OE, and so AlloyEditor upcasts the widget for it.
Without this placeholder, there will be following HTML in the editor:
...
<p><span some-custom-tag-attributes /></p>
...
And AlloyEditor will ignore that custom tag span for widget upcasting. The point is to get some paceholder within the span:
...
<p><span some-custom-tag-attributes>ao-upcast-placeholder</span></p>
...
And in this case, the custom tag span will be upcasted and transformed to the widget. It's widget will not contain the placeholder text at all.
@alongosz should we change the placeholder text? Do you have any better suggestions for that?
Zero width space seems to also cause some issues with Solr indexing:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that oe-upcast-placeholder
would be better, "ao" doesn't mean anything to me.
I'll commit it and rebase.
src/lib/eZ/RichText/Resources/stylesheets/docbook/xhtml5/edit/core.xsl
Outdated
Show resolved
Hide resolved
tests/lib/eZ/RichText/Converter/Xslt/_fixtures/xhtml5/edit/023-embedInline.xml
Outdated
Show resolved
Hide resolved
.../lib/eZ/RichText/Converter/Xslt/_fixtures/xhtml5/edit/035-itemizedListWithNestedElements.xml
Outdated
Show resolved
Hide resolved
tests/lib/eZ/RichText/Converter/Xslt/_fixtures/xhtml5/edit/023-embedInline.xml
Outdated
Show resolved
Hide resolved
d1c4a64
to
980505c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested with ezsystems/ezplatform-admin-ui#1151.
@alongosz could you merge it up? |
Merged up to master via 280f8d7. Thank you @SerheyDolgushev 🎉 |
The original fix for this issue was ezsystems/ezplatform-admin-ui#746. Which fixed the symptoms, but introduced zero-width spaces. Which are causing serious issues in
ezsystems/ezplatform-admin-ui#1034, and seems to be a nice reason for some very strange bugs in the future.
Before posting this PR, we checked the original issue to understand the reasons why it was happening. So the case is:
It happens because, in this case, the HTML which is passed to OE contains just a paragraph and child's
span
element, without any child content. And OE skips such kind elements during widgets upcasting. Adding a zero-width space makes that paragraph a non-empty element so its child'sspan
is checked for widgets upcasting. But zero-width space adds additional complexity and might cause more serious issues/bugs. That's why our solution seems to be more simple and predicted. It just adds "ao-upcast-placeholder" placeholder in the described scenario. Sospan
element for inline embed is not ignored if its parent has no and text nodes, and it is upcasted.Related PR: ezsystems/ezplatform-admin-ui#1151
TODO:
$ composer fix-cs
).