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

CommentFileSizeAuthor
#10 when-unsupported-tags-occur.png143.64 KBbnjmnm

Issue fork ckeditor5-3222852

Command icon 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

Wim Leers created an issue. See original summary.

Wim Leers credited Reinmar.

wim leers’s picture

Status: Postponed (maintainer needs more info) » Active

Currently awaiting information from the CKEditor 5 team.

Got a response from @Reinmar:

Similar to - can be enabled with GHS, but definition lists are not on our roadmap as a real feature.

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?

bnjmnm’s picture

And 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.

wim leers’s picture

You 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 sourceEditing toolbar item … what if we associated those tags with sourceEditing? 🤓

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 remove sourceEditing, you'll also make all those pesky weird/obscure/exotic tags disappear!

This … well … weirdly excites me 🙈🤣 REALLY curious about your thoughts, @bnjmnm!

wim leers’s picture

Assigned: Unassigned » bnjmnm

🤩 Exciting!

wim leers’s picture

Issue tags: +blocker

Marked #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! 👍)

wim leers’s picture

Category: Task » Feature request
Priority: Normal » Major

Also bumping to Major and marking as feature, to match the increased scope.

bnjmnm’s picture

Assigned: bnjmnm » Unassigned
Category: Feature request » Task
Priority: Major » Normal
StatusFileSize
new143.64 KB

Here is what it looks like when switching to a text format that includes tags/attributes that existing plugins don't support

wim leers’s picture

Awesome! 🤩

This is nothing short of magic 👏

wim leers’s picture

Merged 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 😊

wim leers’s picture

Assigned: Unassigned » bnjmnm

Pushed 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:

  1. https://git.drupalcode.org/project/ckeditor5/-/merge_requests/84#note_38249
  2. https://git.drupalcode.org/project/ckeditor5/-/merge_requests/84#note_38253

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.

wim leers’s picture

marked this merge request as draft

I … did? 🙃

wim leers’s picture

Apparently DrupalCI only runs when a merge request is marked "ready" 🤷‍♂️

wim leers’s picture

Assigned: bnjmnm » wim leers

Self-assigning because I'll push this forward tomorrow! :)

wim leers’s picture

Assigned: wim leers » bnjmnm
Status: Active » Needs work

I 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! 🥳

wim leers’s picture

wim leers’s picture

Replying here since finding the thread on the GitLab UI is impossible :/

I think it would be best to add unit tests for everything in HTMLRestrictionsUtilities, but they can probably be done in a followup. Having this at least establish a standard for how it would happen make the followup easier to get started with.

+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.

wim leers’s picture

IMHO 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:

This comment is super helpful, thank you!

Unfortunately, I've noticed that the `allowed_tags` setting for `FilterHtml` becomes editable again due to the check in `ckeditor5_form_filter_format_form_alter()` to _not_ modify the form if there's a fundamental compatibility error.

We can fix that by either:

1. Changing the logic in `\Drupal\ckeditor5\Plugin\Editor\CKEditor5::buildConfigurationForm()` to only set `ckeditor5_fundamentally_compatible=true` if the truly fundamental compatibility constraint is violated
2. Changing the logic elsewhere.

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?

wim leers’s picture

Title: <dl> <dt> <dd> » <dl> <dt> <dd> and really
Related issues: +#3228580: Follow-up for #3222852: additional test coverage for real-time validation race conditions

So 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.

wim leers’s picture

Well well … turns out that 45e7159 causes the "new text format" scenario to fail. Remarks in #24 still stand.

Fixed in f0773d9.

wim leers’s picture

Status: Needs work » Reviewed & tested by the community

Discussed 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!

🚢

wim leers’s picture

Title: <dl> <dt> <dd> and really » <dl> <dt> <dd> by introducing "Manually editable HTML tags" configuration on Source Editing
Priority: Normal » Critical
wim leers’s picture

Status: Reviewed & tested by the community » Fixed

  • Wim Leers committed 28fc2f0 on 1.0.x authored by bnjmnm
    Issue #3222852 by Wim Leers, bnjmnm, Reinmar: <dl> <dt> <dd> by...

  • bnjmnm committed a3a953a on 1.0.x authored by Wim Leers
    Issue #3228346 by Wim Leers, bnjmnm: Follow-up for #3222852: revert...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

andypost’s picture

There's core's follow-up as implementation throws deprecation error on PHP 8.1.0 #3249240: HTMLRestrictionsUtilities:: providedElementsAttributes() causes deprecations on PHP 8.1