Problem/Motivation
Will need either upstream feature (https://github.com/ckeditor/ckeditor5/issues/775) or GHS. Currently awaiting information from the CKEditor 5 team.
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | when-unsupported-tags-occur.png | 143.64 KB | bnjmnm |
Issue fork ckeditor5-3222852
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
wim leersGot a response from @Reinmar:
Alright, so let's do what we did for #3222842: <a hreflang> + <blockquote cite> and use #3216021: Automatically use CKE5's General HTML Support feature on text formats without any TYPE_HTML_RESTRICTOR filter + add `sourceEditing` button to bring this to Drupal.
Except that unlike for
<cite>(where we can hinge this off of blockquote support), there isn't a clear way to enable these tags conditionally… 🤔 Ideas?Comment #4
bnjmnmAnd porting https://www.drupal.org/project/ckeditor_descriptionlist seems like it would be a bit much, and it's kind of difficult to use.
The approach that comes to mind is a bizarre one, but maybe it can be used to inspire something sane. Have a single definition list toolbar button that adds the tags to allowed HTML that requires the edit source plugin. The extra hacky part: the button within CKEditor will do nothing when clicked except provide a notification saying"
Use source editing to include <dl> <dt> <dd>". It seems preferable to using type of plugin provided for CKEditor 4.Comment #5
wim leersYou just inspired me to think of an alternative proposal, @bnjmnm! 😄
Since you will only be able to modify this kind of content properly when using the
sourceEditingtoolbar item … what if we associated those tags withsourceEditing? 🤓Or … what if we take this further … and we provide a configuration UI for
sourceEditing?! So you can choose which additional tags to list, but hey, you'll have to be comfortable writing HTML source code to be able to use them! And so if/when you removesourceEditing, you'll also make all those pesky weird/obscure/exotic tags disappear!This … well … weirdly excites me 🙈🤣 REALLY curious about your thoughts, @bnjmnm!
Comment #7
wim leers🤩 Exciting!
Comment #8
wim leersMarked #3222840: <ol start>, #3224256: <h* id> (or more generically: <$block id>) and #3220534: [PP-1] [needs upstream feature] Type attribute not configurable for <ul> and <ol> as blocked on this per @bnjmnm 😄 (Not yet closing them, but likely/hopefully we will be able to close them! 👍)
Comment #9
wim leersAlso bumping to and marking as feature, to match the increased scope.
Comment #10
bnjmnmHere is what it looks like when switching to a text format that includes tags/attributes that existing plugins don't support

Comment #11
wim leersAwesome! 🤩
This is nothing short of magic 👏
Comment #12
wim leersMerged in #3215600: Unclear relationship between "plugin_config" in *.ckeditor5.yml and Drupal plugin settings to generate that configuration, resolved conflict. Hopefully that makes it slightly easier for you to continue here, @bnjmnm 😊
Comment #13
wim leersPushed forward the one area deep down I was concerned about, I'm quite happy with the result — curious what you think, @bnjmnm 😊
The comment stream from GitLab here on d.o is an impossible-to-parse
clusterf…mess, but the following two comments walk you through it step-by-step:Finally: I'm happy to pull out the validation piece (which I added there) out of this issue and into a separate one. That'd make this MR/issue more focused.
Comment #14
wim leersI … did? 🙃
Comment #15
wim leersApparently DrupalCI only runs when a merge request is marked "ready" 🤷♂️
Comment #16
wim leersSelf-assigning because I'll push this forward tomorrow! :)
Comment #17
wim leersI was getting concerned about repeating parsing logic for how to interpret “elements”/“allowed tags” strings. Each time slightly different. I feel much safer now that they’re all reusing the same logic. That's what I did in those last 4 commits.
I think we should go further, but that’s for a follow-up issue.
Assigning back to you for the last few (literally less than a handful) of threads that need attention! 🥳
Comment #18
wim leersCreated #3228334: Refactor HTMLRestrictionsUtilities to a HtmlRestrictions value object for this.
Comment #19
wim leersOne more follow-up created: #3228343: Follow-up for #3222852: "change" event is triggered only once for Source Editing's "Manually editable HTML tags" form item.
Comment #20
wim leersReplying here since finding the thread on the GitLab UI is impossible :/
+1 — IMHO that's part of #3228334: Refactor HTMLRestrictionsUtilities to a HtmlRestrictions value object. Clarified the issue title there: #3228334-2: Refactor HTMLRestrictionsUtilities to a HtmlRestrictions value object.
Comment #21
wim leersIMHO the only truly essential remaining thing to clarify is https://git.drupalcode.org/project/ckeditor5/-/merge_requests/84#note_38845 — where I wrote this on
src/Plugin/Validation/Constraint/ProcessLikeFundamentalConstraintInterface.php:Ideally I'd like to not add that interface — because special-casing it in
\Drupal\ckeditor5\Plugin\Editor\CKEditor5::validatePair()and then lots of code calling::validatePair()is why this problem is occurring I think.Pairing on this might be a good idea?
Comment #22
wim leersOne more follow-up, discussed ~1.5 week ago: #3228346: Follow-up for #3222852: revert ineditable attributes (<blockquote cite> and <a hreflang>) now that Source Editing plugin can handle arbitrary elements & attributes.
Comment #23
wim leersWhew, new multi-hour deep-dive onto those 2 last commits WRT config forms. Created #3228465: Final pass over the public API prior to creating core merge request and #3228477: CKEditor5PluginConfigurableInterface should extend PluginFormInterface and ConfigurableInterface instead of adding ::settingsForm(). Those are not caused by this issue, they were just made more apparent by this issue. Especially the latter.
Comment #24
wim leersSo the fact that f6722cc4 was green is … unexpected. Created #3228580: Follow-up for #3222852: additional test coverage for real-time validation race conditions for fixing that. I already have an idea for how to test this.
Comment #25
wim leersWell well … turns out that 45e7159 causes the "new text format" scenario to fail. Remarks in #24 still stand.
Fixed in f0773d9.
Comment #26
wim leersDiscussed with @bnjmnm earlier today — he was happy with this being the final set of changes. I needed two more fix-up commits for edge cases, but it's still fundamentally the same as what we looked at together.
So … finally this monster has been slain!
🚢
Comment #27
wim leersComment #28
wim leersComment #32
andypostThere's core's follow-up as implementation throws deprecation error on PHP 8.1.0 #3249240: HTMLRestrictionsUtilities:: providedElementsAttributes() causes deprecations on PHP 8.1