-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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 for double escaping content in nested editables #4227
Conversation
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.
- The testing button works incorrectly. It always gives green feedback for editing mode and red for source editing with and without widget changes.
- Switching between editing and source mode a second time gives a bit different HTML:
For the first switch:
<div class="testwidget"><div class="content">CKEditor rulez<br /><script src="data:text/javascript,''"></script></div></div>
For the second switch:
<div class="testwidget"><div class="content">CKEditor rulez<script src="data:text/javascript,''"></script></div></div>
Not sure if it's caused by widget definition itself, but it changes widget editable content:
- I have been really worried about the performance impact of this change. However, it seems not that huge, a couple of ms for complex editable. Nevertheless, it would be nice to prepare some complex widget with a couple of editable elements to make sure everything works ok, WDYT?
@@ -0,0 +1,24 @@ | |||
@bender-tags: 4.15.0, bug, 4060 | |||
@bender-ui: collapsed | |||
@bender-ckeditor-plugins: widget, wysiwygarea, toolbar, sourcearea |
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.
What do you think about adding htmlwriter
plugin here to make source HTML more readable?
Actually it was intended to work only in WYSIWYG mode… But thanks to your feedback, I greatly simplified manual test – now it's basically just clicking a button 😅.
Yup, it was connected with invalid widget definition. Fixed.
Added 👍 |
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.
Good job!
What is the purpose of this pull request?
Bug fix
Does your PR contain necessary tests?
All patches that change the editor code must include tests. You can always read more
on PR testing,
how to set the testing environment and
how to create tests
in the official CKEditor documentation.
This PR contains
Did you follow the CKEditor 4 code style guide?
Your code should follow the guidelines from the CKEditor 4 code style guide which helps keep the entire codebase consistent.
What is the proposed changelog entry for this pull request?
What changes did you make?
It seems that the content inside nested editables was changed due to the fact that it was escaped twice – once during widget initialization and second time during processing the whole editor content. The fix forces unescaping the content before the widget initialization, which eliminated the second, unnecessary escape.
Which issues does your PR resolve?
Closes #4060.