- Issue created by @DamienMcKenna
- ๐บ๐ธUnited States DamienMcKenna NH, USA
This is an unstable feature that is not available by default, with some known issues:
By default, all HTML comments are filtered out during the editor initialization. The HTML Comments feature allows developers to keep them in the document content and retrieve them back, e.g. while saving the editor data. The comments are transparent from the users point of view and they are not displayed in the editable content.
The HTML comment feature is experimental and not yet production-ready.
The support for HTML comments is at the basic level so far - see the known issues section below.
This feature is enabled by default in the superbuild only. See the installation section to learn how to enable it in your editor.
https://ckeditor.com/docs/ckeditor5/latest/features/general-html-support...
- ๐บ๐ธUnited States DamienMcKenna NH, USA
There is a premium plugin that supports a custom comment style:
https://ckeditor.com/docs/ckeditor5/latest/installation/plugins/features... - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
That makes sense. ๐
I'll work with @lauriii to prioritize this in ๐ฑ [meta] [upstream] Prioritized CKEditor 5 upstream blockers Active . I'll bring it up at today's meeting I have with the CKEditor 5 developers.
- Status changed to Postponed
over 1 year ago 11:14am 24 February 2023 - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Discussed with @lauriii and now prioritized โ see #3340578-7: [meta] [upstream] Prioritized CKEditor 5 upstream blockers โ .
- Status changed to Needs review
over 1 year ago 11:26am 24 February 2023 - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Clarifying the issue summary: the necessary plugin already exists upstream but has significant issues.
But โฆ I think that in this case, it's probably better to have some support rather than none? Although perhaps that would be more infuriating?
Either way, I think that this is all that's needed โ untested, please give it a try ๐
- Status changed to Needs work
over 1 year ago 2:52pm 24 February 2023 - ๐บ๐ธUnited States smustgrave
Applied the patch on Drupal 10.1 standard install
<!-- Hello world. -->
Addedto the source of the ckeditor
Clicked source again and it's gone. - Status changed to Postponed
over 1 year ago 3:03pm 24 February 2023 - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
You probably ran into https://github.com/ckeditor/ckeditor5/issues/10118 then ๐ฌ
- ๐บ๐ธUnited States DamienMcKenna NH, USA
I can't get the patch to work, it removes all comments no matter where they're placed, not just within certain HTML tags.
Are there suppose to be any changes necessary on the text format to make it work?
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Are there suppose to be any changes necessary on the text format to make it work?
Not that I know of, but for the sake of testing, could you test it on a format that has no filters at all? ๐
- ๐ช๐ธSpain navneet0693 Madrid
I am having the same issue as suggested in https://www.drupal.org/project/drupal/issues/3342874#comment-14943480 โจ [upstream] Allow inline HTML comments in ckeditor5 Postponed
Also, I did checked on latest Drupal 10 installation with Basic HTML text editor, it behaved the same.
The following
<!-- comment -->
was stripped when we go out of source ediiting mode.
- Status changed to Active
about 1 year ago 11:00am 12 October 2023 - First commit to issue fork.
- Merge request !5269Issue #3342874: Allow inline comments in CKEditor 5 โ (Closed) created by Unnamed author
- Status changed to Needs review
about 1 year ago 9:44pm 6 November 2023 - ๐จ๐ฆCanada star-szr
I found that our core
drupalHtmlEngine
plugin is stripping out the comments. Tracing it back this was originally added in #3247246: Attribute value encoding not compatible with Xss::filter() โ . I've added HTML comment support to thedrupalHtmlEngine
plugin. I'm not 100% sure about the approach, feedback please!I opened an MR to make code review easier and I'm attaching a patch with the same changes.
Testing note: If you test by adding only an HTML comment to the editor with no other content, it will still be removed. You need to add something else: an HTML element or text for example. This seems to be the case for the upstream plugin as well so I don't think that bug is on our side: https://ckeditor.com/docs/ckeditor5/latest/features/html/html-comments.html
Issue management note: I'm removing 'upstream' from the title because I think we have what we need to implement this but I do realize there are known issues with the upstream plugin and it's experimental. Maybe we can get something into core and then open another issue to track the known upstream issues?
- ๐บ๐ธUnited States luke.leber Pennsylvania
Aren't data loss issues supposed to be triaged as critical?
This seems more severe than a normal data loss issue because it may be months or years until someone actually notices that data has gone missing! Maybe even so long that revision pruning has made the data unrecoverable!
- last update
about 1 year ago 30,487 pass, 1 fail - Status changed to Needs work
about 1 year ago 10:35am 7 November 2023 - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
@star-szr in #17: Oh, hi again! ๐ After running into a colleague of yours at DrupalCon Lille and then seeing you on the GitLab CI Nightwatch issue, I'm now seeing you everywhere somehow ๐
Thanks for the research! And in fact โฆ the MR looks pretty much ready! What I'm missing is a bit more test coverage: the Nightwatch JS unit test is great, but I think we want at least one end-to-end test. A new test method in
\Drupal\Tests\ckeditor5\FunctionalJavascript\CKEditor5Test
seems appropriate?@Luke.Leber in #18: Yes. But HTML comments have historically never contained actual content. Exceedingly rarely sites are putting critical content in HTML comments โฆ a statement that seems to be confirmed by the fact this issue has only 11 followers. See #5 and #6 for the considerations @lauriii and I put into this.
- ๐จ๐ฆCanada star-szr
Hi @Wim Leers! This year I have been leading the project on our team to integrate CKEditor 5 which has involved porting and updating a contrib module โ , adding table footer support to CKEditor 5 upstream, a few custom CKEditor plugins, and now this issue! So I suppose it was inevitable we would run into each other and itโs always nice to see a friendly face in the queues (and on GitHub)!
I will work on the test coverage, and agree that itโs missing.
Oh and thanks for adding the related issue. I did that at one point but had to fight with this form a bit (hence why it says there are so many patches from me in Credit & committing, I believe).
- Status changed to Needs review
about 1 year ago 1:55pm 7 November 2023 - ๐จ๐ฆCanada star-szr
I was seeing a failure in TimestampFormatterWithTimeDiffTest and one other similar one, seems like a random fail, re-ran and it passed. I re-ran Nightwatch and the failure switched from one to another so also seems random.
- ๐บ๐ธUnited States smustgrave
Could be a coincidence for sure but I've never seen randoms back to back to back like that. Wonder if a change is causing the random errors to appear more frequent. What if we took out the change to nightwatch? Change is covered by the FunctionalJavascript test right?
- ๐จ๐ฆCanada star-szr
If we remove the Nightwatch change it should be failing every time, in other words we need that change. I'm going to try running Nightwatch again.
- ๐จ๐ฆCanada star-szr
Same failure as last time, in Tests/Olivero/oliveroSearchFormTest. https://git.drupalcode.org/issue/drupal-3342874/-/jobs/288500#L174
- Status changed to RTBC
about 1 year ago 4:21pm 7 November 2023 - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
- last update
about 1 year ago 29,678 pass - ๐จ๐ฆCanada star-szr
Thanks @Wim Leers!
Re: Nightwatch, I can sometimes trigger the failure locally, both with these changes and on 11.x. So it does seem unreliable/random.
This test specifically:
core/tests/Drupal/Nightwatch/Tests/Olivero/oliveroSearchFormTest.js
- last update
about 1 year ago 29,678 pass - ๐ฌ๐งUnited Kingdom longwave UK
Let's get this critical feature request in to 10.2.0.
Committed and pushed 66716dc920 to 11.x and a9ee5c1044 to 10.2.x. Thanks!
-
longwave โ
committed a9ee5c10 on 10.2.x
Issue #3342874 by star-szr, Wim Leers, DamienMcKenna: Allow inline HTML...
-
longwave โ
committed a9ee5c10 on 10.2.x
- Status changed to Fixed
about 1 year ago 12:13pm 11 November 2023 -
longwave โ
committed 66716dc9 on 11.x
Issue #3342874 by star-szr, Wim Leers, DamienMcKenna: Allow inline HTML...
-
longwave โ
committed 66716dc9 on 11.x
Automatically closed - issue fixed for 2 weeks with no activity.
- Status changed to Fixed
11 months ago 8:21pm 18 December 2023 - ๐บ๐ธUnited States nkraft
hi! we've been watching this for client sites. We just tested 10.2.0 -- and we are not seeing the presevation of commetns, they are still being stripped.
Does 10.2.0 have this fix natively, or does it rely on some additional plugin to be installed still? was testing done? I don't see any "RTBC" comments above for the work done by star-szr
Thanks for your efforts! We're really eager to see this patched into CK5. These sorts of issues have been causing us all sorts of headaces on our enterprise sites.
- ๐จ๐ฆCanada star-szr
@nkraft just to be sure, are you testing HTML comments along with other content? If the editor contains only an HTML comment it will still be stripped because CKEditor 5 doesnโt see any content to render.
- ๐บ๐ฆUkraine _tarik_ Lutsk
Ported the patch for those who are still on Drupal 9
Works fine with 9.5.11