Problem/Motivation

Per #3231364-31: Add CKEditor 5 module to Drupal core, we started investigating what it would take to update the Linkit module to work with CKEditor 5's native link dialog.

https://github.com/ckeditor/ckeditor5/issues/7834 is the closest related issue, but is not following the recommended approach.

We discussed this with the CKEditor 5 team earlier today. They told us that an MVP with the autocomplete inserting the URL in the <input> is feasible. But the better UX with the <input> showing the label of the selected content/entity would be trickier (since the value displayed is not the value stored in the model).

Fortunately, this is something they've been asked a number of times. They're considering to implement this natively. We'll get more news in ~2 weeks (September 23, 2021).

Will keep you posted!

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#135 3232190-133.patch56.15 KBmark_fullmer
#135 3232190-113_133.interdiff.txt1.56 KBmark_fullmer
#133 Screen Shot 2023-01-31 at 7.42.35 AM.png50.39 KBmark_fullmer
#133 3232190-132.patch56.1 KBmark_fullmer
#133 3232190-113_132.interdiff.txt488 bytesmark_fullmer
#125 voiceover.mp4438.01 KBrkoller
#125 focus_contrast.jpg122.27 KBrkoller
#113 3232190-113.patch55.62 KBWim Leers
#113 interdiff.txt705 bytesWim Leers
#111 3232190-111-6.x.patch55.68 KBStryKaizer
#111 interdiff.txt13.65 KBStryKaizer
#106 3232190-101-rebased-on-6.0.x.patch56.71 KBWim Leers
#101 linkit-cke5-3232190-101.patch89.51 KBWim Leers
#101 interdiff.txt1.07 KBWim Leers
#99 linkit-cke5-3232190-99.patch89.21 KBWim Leers
#99 interdiff.txt34.57 KBWim Leers
#97 linkit-cke5-3232190-97.patch58.77 KBWim Leers
#97 interdiff.txt1.75 KBWim Leers
#96 linkit-cke5-3232190-94.patch57.26 KBWim Leers
#96 interdiff.txt15.23 KBWim Leers
#94 linkit-cke5-3232190-93.patch56.03 KBWim Leers
#94 interdiff.txt905 bytesWim Leers
#92 linkit-cke5-3232190-92.patch55.95 KBWim Leers
#92 interdiff.txt7.2 KBWim Leers
#91 linkit-cke5-3232190-91.patch55.03 KBWim Leers
#91 interdiff.txt4.55 KBWim Leers
#90 media_embed-linkit.post_update.php_.txt4.44 KBGraber
#89 linkit-cke5-3232190-89.patch55.8 KBWim Leers
#89 interdiff.txt4.26 KBWim Leers
#88 linkit-cke5-3232190-88.patch56.92 KBWim Leers
#88 interdiff.txt15.42 KBWim Leers
#87 linkit-cke5-3232190-87.patch57.29 KBWim Leers
#87 interdiff.txt1.08 KBWim Leers
#85 linkit-cke5-3232190-85.patch57.95 KBWim Leers
#85 interdiff.txt1.21 KBWim Leers
#82 linkit-cke5-3232190-82.patch58.2 KBWim Leers
#82 interdiff.txt1.68 KBWim Leers
#79 linkit-cke5-3232190-79.patch58.82 KBWim Leers
#79 interdiff.txt6.35 KBWim Leers
#78 linkit-cke5-3232190-78.patch52.95 KBWim Leers
#78 interdiff.txt2.09 KBWim Leers
#77 linkit-cke5-3232190-77.patch51.97 KBWim Leers
#77 interdiff.txt1.01 KBWim Leers
#63 interdiff-58-63.txt806 bytesnod_
#63 linkit-cke5-3232190-63.patch51.89 KBnod_
#62 linkit-cke5-3232190-62.patch51.87 KBnod_
#60 Screen Shot 2022-09-22 at 11.34.15 AM.png105.02 KBWim Leers
#58 interdiff-55-58.txt14.09 KBnod_
#58 linkit-cke5-3232190-58.patch51.25 KBnod_
#56 3232190-55.patch50.18 KBlarowlan
#56 3232190-56-interdiff.txt349 byteslarowlan
#54 linkit-link-inception.png12.75 KBmathilde_dumond
#54 linkit-this-link-has-no-link.png9.5 KBmathilde_dumond
#52 3232190-52.patch50.17 KBlarowlan
#52 3232190-interdiff-52.txt25.37 KBlarowlan
#48 Add_text_format___Check_My_Practice.png114.32 KBjastraat
#46 interdiff-45-46.txt801 bytesnod_
#46 linkit-cke5-3232190-46.patch62.02 KBnod_
#45 interdiff-43-45.txt27.72 KBnod_
#45 linkit-cke5-3232190-45.patch61.92 KBnod_
#43 interdiff.txt2.14 KBlauriii
#43 3232190-43.patch49.05 KBlauriii
#42 interdiff-40-42.txt3.58 KBnod_
#42 linkit-cke5-3232190-42.patch48.97 KBnod_
#40 linkit-cke5-3232190-40.patch48.97 KBnod_
#39 linkit-cke5-3232190-39.patch48.97 KBnod_
#27 linkit-without-info-change-n3232190-27.patch114.81 KBDanielVeza
#26 linkit-without-info-change-n3232190-26.patch231.48 KBDanielVeza
#25 linkit-n3232190-25.patch115.08 KBDamienMcKenna
#14 Screen Shot 2021-10-26 at 12.27.31 PM.png211.28 KBbnjmnm
#12 linkit upgrade path.gif3.96 MBWim Leers
#11 linkit config UI improved.gif130.57 KBWim Leers
#10 linkit config UI.gif235.11 KBWim Leers
#4 Screen Shot 2021-10-07 at 11.37.23.png95.21 KBlauriii

Issue fork linkit-3232190

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:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Wim Leers created an issue. See original summary.

anon’s picture

Thanks Wim. Please keep us updated on this topic

Wim Leers’s picture

lauriii’s picture

Assigned: Unassigned » lauriii
FileSize
95.21 KB

I've been doing some experimentation on this with Oleq from CKSource. The first step was to try to integrate the current, CKEditor rendered <input> element with a11y_autocomplete. It seems like this is feasible meaning that we should be able to implement at least the MVP version of this. Here's a screenshot of how this looks like currently:

I'm assigning this to myself to turn what we currently have into a MR on this issue.

Wim Leers’s picture

🥳

Wim Leers’s picture

Status: Active » Needs work

Do I need something extra installed besides this MR checked out locally to get this to work? I can see the XHR responses returning suggestions, but I can't see anything in the UI. 😅

Wim Leers’s picture

For some reason, the Gitlab integration seems to be broken here? I don't see any pushed commits getting mentioned… so giving a manual status update.

Pushed 5 commits, starting with 1de5ba67319bef1965ef4eb73ff30c4be965e448, ending with 8b79415a7dc3ae769f4238fad72efd02654fbb27. They clean up the WIP PoC that @lauriii pushed, to provide a working starting point for the CKEditor 4 → 5 upgrade path I need to add.

Wim Leers’s picture

Pushed another 5 commits, starting with 68184f60e45a8720284b3a861cc4750238ee9d37 and ending with bbeaeae5952c4d02ed8924426089558ce14749c9. They gradually add config-level validation constraints, clean up the existing CKEditor 5 plugin's configuration form to follow plugin-with-config-and-form best practices (per the plugin system maintainer, per Drupal core) and most crucially: they add tight tests.

Testing /Users/wim.leers/Work/d8/modules/linkit/tests/src/Kernel/ValidatorsTest
........S                                                           9 / 9 (100%)

Time: 23.3 seconds, Memory: 10.00 MB

🥳

This allows us to be highly confident that the auto-generated configuration will actually be valid. IOW: everything up to this point has been just to pave the path for me to be able to work on the upgrade path, and to be extremely confident about it.

Wim Leers’s picture

In doing #8, I found two bugs and one task in the CKEditor 5 module:

  1. #3245723: Follow-up for #3201637: omitting PrimitiveTypeConstraint violations for filter settings is implemented too broadly → this prevented the validation constraints in linkit.schema.yml from having any effect in the UI!
  2. #3245735: Follow-up for #3222852: validation errors are not associated with the correct form element → this prevented the validation errors from having a good UX
  3. #3245807: DX: allow contrib modules to subclass \Drupal\Tests\ckeditor5\Kernel\ValidatorsTest → prevents the unit test from being sane
Wim Leers’s picture

FileSize
235.11 KB

#9 was at my EOD.

This is what it looks like as of #8, with the 3 issues linked from #9 fixed, as well as #3231289: Follow-up for #3230447: since optimizing admin UI, messages can accumulate fixed:

Exactly the same as the CKEditor 4 configuration UI, but now with real-time validation errors.

Wim Leers’s picture

FileSize
130.57 KB

#10 shows how the current UI is a bit awkward: the Linkit profile <select> is basically conditionally required.

Why not merge this into a single form item, remove the 1:1 mapping of form items to config key-value pairs, and create a simpler, better UX? (Without modifying the config structure.) So … that's what I did:

Pushed in 6289937.

Wim Leers’s picture

FileSize
3.96 MB

Just pushed the upgrade path: 628993752386e02819f86225224d024305a5b6d0.

That looks like this:

I show 3 different upgrade paths:

  1. CKE4 has Linkit disabled
  2. CKE4 has Linkit enabled, with the profile Custom selected
  3. CKE4 has Linkit enabled, with the profile Default selected

You can see all of them upgrading nicely 😊

bnjmnm made their first commit to this issue’s fork.

bnjmnm’s picture

This is now rendering the list in a manner that resembles the CK4 version

Note that -at the moment- this will stop working if yarn build is run. This was built with a version of A11y_Autocomplete that includes the not-yet-commited changes in #3245923: Provide API to override suggestion template. Adding the commit hash for that issue-in-progress did not work as yarn looked for that hash on the main branch. (perhaps this is addressable, but could not find it in any docs...). Once that A11y_Autocompelte issue lands, build will be fine.

Wim Leers’s picture

#14: 🤩🤩🤩🤩

bnjmnm’s picture

Video of Linkit working in CKEditor 5 https://youtu.be/5GoorQdqQ40

I also created a CKEditor 5 equivalent of LinkitDialogTest which passes.

There is a peculiarity with the current MR that will require some attention. Sometimes, when changing a link from a linkit-provided one to a manually typed one, the data attributes are not removed as expected. This seems to occur more often when a link is change is submitted by clicking the submit button vs submitting with the enter key. This is not a problem with the FuntionalJavascript tests. Similarly, if a manually typed link is added and the attributes are removed, changing it to a linkit-provided link often results in the attributes not being re-added. This is a frequent enough occurrence it should not be difficult to reproduce, but I can't figure out the exact steps. Just try changing linkit-links to manually typed ones a few times and keep an eye on how the attributes are impacted.

nod_ made their first commit to this issue’s fork.

nod_’s picture

Wim Leers’s picture

PHP Fatal error:  Uncaught Error: Class 'Drupal\Tests\ckeditor5\Kernel\ValidatorsTest' not found in /var/www/html/modules/contrib/linkit/tests/src/Kernel/ValidatorsTest.php:16

Just added a test dependency on https://www.drupal.org/project/ckeditor5.

DamienMcKenna’s picture

Tim Plunkett mentioned that there's a new documentation page that might be useful for others looking to help: https://www.drupal.org/docs/core-modules-and-themes/core-modules/ckedito...

DamienMcKenna’s picture

Should the merge request be updated to work against the 6.0.x branch?

DamienMcKenna’s picture

Never mind, I just realized that the 6.0.x releases are actually just tags on the 8.x-5.x branch.

DamienMcKenna’s picture

FileSize
115.08 KB

This is the merge request in patch format, for anyone who wants it.

DanielVeza’s picture

The patch was failing for me because it was conflicting with the drupal.org packaging. Attached a quick patch for use in composer. It'e exactly the same as #25 just without the test_dependency change in .info.yml

Oops bad patch - ignore this one

DanielVeza’s picture

FileSize
114.81 KB

The patch was failing for me because it was conflicting with the drupal.org packaging. Attached a quick patch for use in composer. It'e exactly the same as #25 just without the test_dependency change in .info.yml

DamienMcKenna’s picture

Could one of the maintainers please create a 6.0.x (or 6.x) branch rather than just adding these tags to the 8.x-5.x branch? I think that's the separation we need to distinguish between ckeditor 4 & 5. Thanks.

DamienMcKenna’s picture

Issue tags: +ckeditor5
Rajab Natshah’s picture

Patch in #27 is working
Thank you :)

Rajab Natshah’s picture

I suggest to have that in a 9.0.x branch and release a 9.0.0

The module has 6.x, 7.x, 8.x branches before.

  • 6.x

    Under development.

  • 8.x-5.x Under development
  • 8.x-4.x Current version - Maintenance only (in favor of 8.x-5.x and 6.0).
  • 7.x-3.x Current version - Maintenance only.
  • 7.x-2.x No further development.
  • 7.x-1.x Not maintained.
  • 6.x-1.x

    No further development.


Or maybe like what the maintainer of the Webform module is doing
Development version: 6.0.x
johnwebdev’s picture

I've added a 6.0.x development branch.

DamienMcKenna’s picture

Thank you John. Could you please also create a dev release on the 6.0.x branch to make it easier to test against it? Thanks.

DieterHolvoet’s picture

I found an issue: when switching between two text formats with CKEditor 5, an error is logged in the console and CKEditor disappears (fails to render). Both text formats have the Linkit plugin enabled.

TypeError: Cannot read properties of undefined (reading 'on')
    at LinkitEditing._removeExtraAttributesOnUnlinkCommandExecute (linkitediting.js:129:19)
    at LinkitEditing.init (linkitediting.js:14:10)

The error happens on this line:

unlinkCommand.on('execute', evt => {

The error also happens during the initial CKEditor render if the field is restricted to only the second text format using the Allowed Formats module, so not only when switching text formats.

I also noticed that on the second text format, Allowed HTML tags is missing the a href attribute. When I manually fix this in the config yml (the text area is greyed out on the text format page), the error still happens, so this is probably unrelated.

DamienMcKenna’s picture

DieterHolvoet: Please open core issues for those bugs, I'm sure Wim Leers and others would like to know about them.

johnwebdev’s picture

Version: 6.0.0-beta2 » 6.0.x-dev
Wim Leers’s picture

#35: That's not a core bug. The JS call stack trace even says so: LinkitEditing.[…] → that is part of this issue's MR, it's not in core.

The code here is >6 months old and was just meant to A) prove viability, B) help get the Linkit maintainers going. This MR needs to be updated. After CKEditor 5 is stable in core, I think @lauriii, @bnjmnm and I might be able to help 🤞😊 But please don't let that stop you!

nod_’s picture

Assigned: lauriii » nod_
nod_’s picture

Assigned: nod_ » Unassigned
Status: Needs work » Needs review
FileSize
48.97 KB

Back to jQuery UI, can't test the 6.0 branch though :/

nod_’s picture

FileSize
48.97 KB

Status: Needs review » Needs work

The last submitted patch, 40: linkit-cke5-3232190-40.patch, failed testing. View results

nod_’s picture

Status: Needs work » Needs review
FileSize
48.97 KB
3.58 KB
lauriii’s picture

FileSize
49.05 KB
2.14 KB

Changed the code to open the edit link dialog. This was failing locally but I think it was unrelated to the dialog opening.

Status: Needs review » Needs work

The last submitted patch, 43: 3232190-43.patch, failed testing. View results

nod_’s picture

Status: Needs work » Needs review
FileSize
61.92 KB
27.72 KB

still failing but this fixes a case when the extra attributes should be removed if we input a value that doesn't come from the autocomplete dropdown.

nod_’s picture

so one line change that took a while to find. Tests should be passing.

jastraat’s picture

This may be an edge case, but I'm not seeing a way to have a rich text format that does not support links with ckeditor 5 (Drupal 9.4.3) + linkit 5.x with this patch. This error is likely caused by a combination of both core and linkit.

Example use case: text format used for teaser text where we want to allow bold and italics but no links because the entire teaser will be linked.

In testing, we've only included bold and italic WYSIWYG styles, Linkit is disabled for this text format, Linkit URL converter is off, and limit HTML is on.

The allowed HTML tags box is no longer editable, and even after removing heading, link, and list options, those still appear as allowed tags.

When trying to save the text format, linkit throws the following error:

The Linkit plugin needs another plugin to create <a>, for it to be able to create the following attributes: <a data-entity-type data-entity-uuid data-entity-substitution>. Enable a plugin that supports creating this tag. If none exists, you can configure the Source Editing plugin to support it.

Edit: if the linkit module is not enabled, it is possible to create a ckeditor enabled text format that does not allow links. So linkit is breaking core ckeditor 5 functionality even in text formats where it is disabled.

jastraat’s picture

Status: Needs review » Needs work
FileSize
114.32 KB
larowlan’s picture

The Linkit plugin needs another plugin to create <a>, for it to be able to create the following attributes: <a data-entity-type data-entity-uuid data-entity-substitution>. Enable a plugin that supports creating this tag. If none exists, you can configure the Source Editing plugin to support it.

Edit: if the linkit module is not enabled, it is possible to create a ckeditor enabled text format that does not allow links. So linkit is breaking core ckeditor 5 functionality even in text formats where it is disabled.

I'm seeing this too with the latest core patch for styles combo

nod_’s picture

larowlan’s picture

+++ b/webpack.config.js
@@ -0,0 +1,57 @@
+  const bc = {
+    mode: 'production',
+    optimization: {
+      minimize: true,
+      minimizer: [
+        new TerserPlugin({
+          terserOptions: {
+            format: {
+              comments: false,
+            },
+          },
+          test: /\.js(\?.*)?$/i,
+          extractComments: false,
+        }),
+      ],
+      moduleIds: 'named',

We need to add devtool: false here to prevent this emitting `eval` in the source code and therefore requiring people to include `unsafe-eval` in their CSP headers.

larowlan’s picture

Status: Needs work » Needs review
FileSize
25.37 KB
50.17 KB

Fixes #51

Status: Needs review » Needs work

The last submitted patch, 52: 3232190-52.patch, failed testing. View results

mathilde_dumond’s picture

Hi all, I have been testing this patch and I found another bug that I think has not been addressed yet:

When adding a link on the last word I wrote, and putting the cursor after the last link character, I have a "this is a link but there is not link" kind of situation (see screenshot). When checking the source, I have:
```

this is a test no link

```
which is a duplicated link of the first one, as far as I can tell (and when rendered on the frontend, behaves as such: 2 links to the same target)

(note I edited the uuids for readibility)

Which I guess is not that bad, but then, if I edit the link in the second link, it adds the path inside of my string (see the "link inception" screenshot), and here is the source then:
```

this is a test no li/node/8nk

```

A second problem that we got, that could be related to #47, is that if I have 2 editors, one allowing links and one not allowing links, that can be used on the same text element, then if I switch between them, I get the javascript error:
```
TypeError: i is undefined
_removeExtraAttributesOnUnlinkCommandExecute http://mysite.local/modules/contrib/linkit/js/build/linkit.js?v=9.4.5:1
init http://mysite.local/modules/contrib/linkit/js/build/linkit.js?v=9.4.5:1
promise callback*./src/core.js/init/h/< http://mysite.local/modules/contrib/ckeditor5/js/build/ckeditor5-dll.js?v=31.0.0:5
h http://mysite.local/modules/contrib/ckeditor5/js/build/ckeditor5-dll.js?...
init http://mysite.local/modules/contrib/ckeditor5/js/build/ckeditor5-dll.js?...
initPlugins http://mysite.local/modules/contrib/ckeditor5/js/build/ckeditor5-dll.js?...
create http://mysite.local/modules/contrib/ckeditor5/js/build/editor-classic.js...
create http://mysite.local/modules/contrib/ckeditor5/js/build/editor-classic.js...
attach http://mysite.local/modules/contrib/ckeditor5/js/ckeditor5.js?riajk9:313
editorAttach http://mysite.local/core/modules/editor/js/editor.js?v=9.4.5:172
attach http://mysite.local/core/modules/editor/js/editor.js?v=9.4.5:124
attach http://mysite.local/core/modules/editor/js/editor.js?v=9.4.5:112
attachBehaviors http://mysite.local/core/misc/drupal.js?v=9.4.5:27
attachBehaviors http://mysite.local/core/misc/drupal.js?v=9.4.5:24
http://mysite.local/core/misc/drupal.init.js?v=9.4.5:29
listener http://mysite.local/core/misc/drupal.init.js?v=9.4.5:17
domReady http://mysite.local/core/misc/drupal.init.js?v=9.4.5:24
http://mysite.local/core/misc/drupal.init.js?v=9.4.5:28
http://mysite.local/core/misc/drupal.init.js?v=9.4.5:31
ckeditor5.js:355:19
```

mathilde_dumond’s picture

ay sorry I messed up the formatting, here are the sources that I have:

link has no link:

<p>
    this is a <a href="/node/26" data-entity-type="node" data-entity-uuid="uuid1" data-entity-substitution="canonical" rel="nofollow">test</a><a data-entity-type="node" data-entity-uuid="uuid1" data-entity-substitution="canonical" rel="nofollow"> no link</a>
</p>

and here is the inception link example source:

<p>
    this is a <a href="/node/26" data-entity-type="node" data-entity-uuid="uuid1" data-entity-substitution="canonical" rel="nofollow">test</a><a data-entity-type="node" data-entity-uuid="uuid1" data-entity-substitution="canonical" rel="nofollow"> no li</a><a data-entity-type="node" data-entity-uuid="uuid2" data-entity-substitution="canonical" href="/node/8" rel="nofollow">/node/8</a><a data-entity-type="node" data-entity-uuid="uuid1" data-entity-substitution="canonical" rel="nofollow">nk</a>
</p>
larowlan’s picture

Status: Needs work » Needs review
FileSize
349 bytes
50.18 KB

Found it wasn't working in layout builder forms, traced it down to a misnamed libraries entry

Status: Needs review » Needs work

The last submitted patch, 56: 3232190-55.patch, failed testing. View results

nod_’s picture

Category: Plan » Task
FileSize
51.25 KB
14.09 KB

making it work for D10

nod_’s picture

Status: Needs work » Needs review

To be more specific, I tried to implement the autocomplete with CKE5 widgets and tools.

Tried using createDropdown, which sort of work beside the UI being quite different than what's currently available. The tried using DropdownViewPanel, came with a bit too many things, switched to using ListView directly and that was a closer match although a few key keyboard interaction would need to be wired.

All that would sort of work if we didn't have groups to support. As of today I'm not sure we can implement grouping easily with what's provided by CKE5. I'll be off for a few weeks so probably not the best time for me to get into that right now.

Building a whole new UI element and making it adopted upstream would probably be the best solution, for now sticking with the current implementation looks like the quickest way to make this work, especially given that there is a working patch for it.

Wim Leers’s picture

Priority: Normal » Critical
Status: Needs review » Needs work
Issue tags: +Needs followup
Related issues: +#2786049: Make entity URL substitutions pluggable to support a wider variety of use cases.
FileSize
105.02 KB

Queued tests against 9.5.x for #58 because the linkit module does not yet declare D10 compatibility. It's equally valuable to develop CKEditor 5 support for linkit against 9.5.x because CKEditor 5 is stable there too 😊

What's still missing:

  1. support for groups (see @nod_'s comment in #59 in the autocomplete, to easily distinguish between different entity types/bundles) — perhaps this could be a follow-up?
  2. the JS should set data-entity-type and data-entity-uuid attributes
  3. the @CKEditor5Plugin Drupal plugin should ensure those attributes are automatically enabled when a LinkIt profile is selected
  4. A @CKEditor4To5Upgrade plugin!
  5. test coverage to verify that data-entity-substitution is not removed when editing a link through the UI (AFAICT the data-entity-substitution attribute + functionality does not have a UI today, it's just something for power users to set in the source — see #2786049: Make entity URL substitutions pluggable to support a wider variety of use cases.)

Only the first is something that can be deferred to a follow-up I think, everything else is essential for data integrity.

Wim Leers’s picture

Also, to fix the test failures (which BTW are happening in HEAD too), all you need is

 tests/src/Kernel/LinkitEditorLinkDialogTest.php | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/src/Kernel/LinkitEditorLinkDialogTest.php b/tests/src/Kernel/LinkitEditorLinkDialogTest.php
index 0a1963b..16d0645 100644
--- a/tests/src/Kernel/LinkitEditorLinkDialogTest.php
+++ b/tests/src/Kernel/LinkitEditorLinkDialogTest.php
@@ -71,6 +71,7 @@ class LinkitEditorLinkDialogTest extends LinkitKernelTestBase {
     $format->save();
 
     // Set up editor.
+    $ckeditor = $this->container->get('plugin.manager.editor')->createInstance('ckeditor');
     $this->editor = Editor::create([
       'format' => 'filtered_html',
       'editor' => 'ckeditor',
@@ -82,7 +83,7 @@ class LinkitEditorLinkDialogTest extends LinkitKernelTestBase {
           'linkit_profile' => $this->linkitProfile->id(),
         ],
       ],
-    ]);
+    ] + $ckeditor->getDefaultSettings());
     $this->editor->save();
   }
 

(This is a consequence of #3291744: Ensure Editor config entities using CKEditor 4 only store plugins settings for actually enabled plugins.)

nod_’s picture

Status: Needs work » Needs review
Issue tags: -Needs followup
FileSize
51.87 KB

Thanks for the fix for the test failure :)

  1. Grouping already works with the jquery UI version of the patch, it's a setting to enable in the matcher.
  2. Already the case? For this to work a click on a suggestion is needed. Simply putting the node URL in the textfield without clicking a suggestion will only add the URL, not the other data attributes, for that a click on the suggestion is needed. Makes sense to me, maybe you don't want to "link" the link with the entity? Not sure how it is currently without the patch.
  3. The new data attributes are declared in linkit.ckeditor5.yml, you think we should have an extra layer of validation? In which cases could it break down?
  4. There is a CKEditor4To5Upgrade plugin, couple of methods are not implemented, you mean address those ?
  5. Debatable. The substitution value comes from the autocomplete response and that is taken from ->setSubstitutionId($this->configuration['substitution_type']). Is the substitution value associated with the entity it points to, or with the specific <a> link in the specific place is it used? If it's associated with the entity, then nothing to do. If it's associated with the specific link then yes we would need to make sure the substitition is kept when changing the link. But I don't think we should do that, if you link to a file first, then change that link to an entity, you'll have kept the substitution value that is not correct for the new link.
nod_’s picture

little issue with the complied linkit plugin disregard patch #62

Wim Leers’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests
  1. D'oh — I thought that because of what you wrote in #59 that groups didn't quite work yet, so I didn't even look at them 🙈

    So … I'm not sure how to interpret #59 then? Is it just saying that we need jQuery UI Autocomplete to support the groups, we can't do it with CKEditor 5's built-in UI components?

  2. I missed that because … see next point 😅
  3. I should've been more clear — right now linkit_extension is always enabled. It should only be enabled when A) the ckeditor5_link plugin is enabled, B) and really, only when a Linkit profile has been selected. Right now, the plugin is ALWAYS enabled, which means <a data-entity-type data-entity-uuid data-entity-substitution> is ALWAYS allowed 🧟‍♀️ The fix is simple though:
    diff --git a/linkit.ckeditor5.yml b/linkit.ckeditor5.yml
    index 39d8dbd..5e00227 100644
    --- a/linkit.ckeditor5.yml
    +++ b/linkit.ckeditor5.yml
    @@ -8,3 +8,8 @@ linkit_extension:
         class: Drupal\linkit\Plugin\CKEditor5Plugin\Linkit
         elements:
           - <a data-entity-type data-entity-uuid data-entity-substitution>
    +    conditions:
    +      requiresConfiguration:
    +        linkit_enabled: true
    +      plugins:
    +        - ckeditor5_link
    
  4. D'oh, I missed that too (can you tell I was multitasking? 🙈🙈🙈). Worse: I implemented it almost a year ago — see #7. The upstream API changed a bit, and this needs test coverage. I can take care of that 👍
  5. Hm … I'll need to really dig into the code to understand this better before I can confirm that with confidence, but what would definitely help, is test coverage 🤓

So … looks like this is actually pretty much ready, except for some missing test coverage?! 🥳 If you were to put on your Drupal core JavaScript maintainer hat, what would you like to see changed? What tests would you like to see added?

Wim Leers’s picture

(IOW: I'd love for @nod_ to finish the JS pieces as far as possible before he goes on vacation next week, so that next week I can write the remaining test coverage 🤓 @nod_, feel free to jot down tests for edge cases you'd like to see have test coverage!)

nod_’s picture

1. yes

If you're working on 4. I'll let you roll the fix for 3. as well too then :)

As a maintainer I'm not fan of that piece of code:

+++ b/js/ckeditor5_plugins/linkit/src/index.js
@@ -0,0 +1,148 @@
+    editor.plugins.get( 'ContextualBalloon' )._rotatorView.content.on('add', ( evt, view ) => {
+      if ( view !== linkFormView || wasAutocompleteAdded ) {
+        return;
+      }

But when I looked into it I didn't find a better solution.

As for tests it's probably good enough?

What's more of a concern is the fact that the extra attributes are only added when clicking a suggestion. Ideally if there is something matching it would automatically wire it, click or no click. to avoid the different behavior based on the user interaction.

Wim Leers’s picture

If you're working on 4. I'll let you roll the fix for 3. as well too then :)

👍

What's more of a concern is the fact that the extra attributes are only added when clicking a suggestion. Ideally if there is something matching it would automatically wire it, click or no click. to avoid the different behavior based on the user interaction.

Wait, are you saying that there's a difference based on using the mouse vs keyboard?

nod_’s picture

not mouse vs. keyboard, more like: writing the url and "validating" the link vs. writing the url, clicking the suggestion, and "validating" the link.

Feuerwagen’s picture

For a project we were using the patch from #27 before (which worked well enough). After replacing that with #63 we got a lot of errors in seemingly unrelated JS code:

controlgroup.js:39 Uncaught TypeError: t.widget is not a function
at controlgroup.js:39:10
form-reset-mixin.js:34 Uncaught TypeError: Cannot set properties of undefined (setting 'formResetMixin')
at form-reset-mixin.js:34:13
mouse.js:40 Uncaught TypeError: e.widget is not a function
at mouse.js:40:10
(anonymous) @ mouse.js:15
checkboxradio.js:40 Uncaught TypeError: Cannot read properties of undefined (reading 'formResetMixin')
at checkboxradio.js:40:38
draggable.js:42 Uncaught TypeError: Cannot read properties of undefined (reading 'mouse')
at draggable.js:42:32
resizable.js:41 Uncaught TypeError: Cannot read properties of undefined (reading 'mouse')
at resizable.js:41:32
button.js:44 Uncaught TypeError: t.widget is not a function
at button.js:44:3
dialog.js:49 Uncaught TypeError: i.widget is not a function
at dialog.js:49:3
widget.js:104 Uncaught TypeError: i is not a constructor
at t.widget (widget.js:104:18)
dialog.js?v=9.4.6:31 Uncaught TypeError: $element.dialog is not a function
at openDialog (dialog.js?v=9.4.6:31:16)

Wim Leers’s picture

@Feuerwagen: which Drupal core version are you testing this with?

Feuerwagen’s picture

@Wim Leers – Sorry, I forgot: We're on 9.4.6. I'd assume that it should be working as the patch is testing with Drupal 9 (although 9.5).

jcnventura’s picture

One question to the ones working on this. Should #3288339: Drupal 10 compatibility be marked as a duplicate?

Wim Leers’s picture

@jcnventura: No! That should still happen. And should probably happen first.

The patch here will work just fine in Drupal >9.4.6 too; it does not require Drupal 10 at all. It's actually independent of Drupal 10 compatibility — that's a separate concern:)

Martijn de Wit’s picture

Title: Drupal 10 & CKEditor 5 readiness » CKEditor 5 readiness

changed tittle :)

Wim Leers’s picture

Hah, great call! 😅

Wim Leers’s picture

Just pushed the Drupal 10 compatibility issue forward: #3288339-9: Drupal 10 compatibility.

Wim Leers’s picture

Status: Needs work » Needs review
FileSize
2.09 KB
52.95 KB

Upgrade path completeness test, and harden ::mapCKEditor4SettingsToCKEditor5Configuration() for missing/incomplete CKE4 plugin settings.

Wim Leers’s picture

Issue tags: -Needs tests
FileSize
6.35 KB
58.82 KB

Upgrade path test, this unveiled there were some missing conditions in the plugin definition.

Wim Leers’s picture

@Feuerwagen in #69 and #71: please update to https://www.drupal.org/project/drupal/releases/9.4.8 — as of that release, 9.4.x is in sync again with 9.5.x and 10.0.x!

Wim Leers’s picture

Wim Leers’s picture

Refine ValidatorsTest. One of the test cases is not a concern of this plugin, but of #3259795: Generalize textPartLanguage's validation: no configuration allowed unless the plugin's toolbar item is active, so has been removed.

The tweaked test case is no longer possible thanks to the YAML changes in #79.

Wim Leers’s picture

Status: Needs review » Needs work
  1. +++ b/src/Plugin/Linkit/Matcher/EntityMatcher.php
    @@ -322,6 +322,7 @@ class EntityMatcher extends ConfigurableMatcherBase {
    +    $query->accessCheck(FALSE);
    

    This obviously is wrong and needs to change. It was just to build a PoC. Now we need to make this mergeable.

  2. +++ b/src/Plugin/CKEditor5Plugin/Linkit.php
    @@ -0,0 +1,166 @@
    +    // @todo access check, cacheable metadata
    ...
    +        'autocompleteUrl' => Url::fromRoute('linkit.autocomplete', ['linkit_profile_id' => $this->configuration['linkit_profile']])->toString(),
    

    … and this will need to change accordingly.

Wim Leers’s picture

Title: [PP-1] CKEditor 5 readiness » CKEditor 5 readiness
Wim Leers’s picture

Let's ensure the test does not introduce new deprecation errors on PHP 8.2.

Wim Leers’s picture

Note: tests are

+++ b/js/ckeditor5_plugins/linkit/src/autocomplete.js
@@ -0,0 +1,133 @@
+  var grouped_items = _.groupBy(items, function (item) {
+    return item.hasOwnProperty('group') ? item.group : '';
+  });

This uses Underscore.js. This A) is not a declared dependency of the asset library, B) is not available in Drupal 10. This also came up at #3288339-19: Drupal 10 compatibility.

Wim Leers’s picture

Status: Needs work » Needs review
FileSize
1.08 KB
57.29 KB

Due to this in HEAD's linkit.routing.yml:

linkit.autocomplete:
  path: '/linkit/autocomplete/{linkit_profile_id}'
  defaults:
    _controller: '\Drupal\linkit\Controller\AutocompleteController::autocomplete'
  requirements:
    # Access is handled by the matchers.
    _access: 'TRUE'
  options:
    _theme: ajax_base_page

… there is nothing left to be done for #82 other than to remove those lines.

I'm pretty sure that was only there to simplify the work on the initial MVP that @lauriii built.

Wim Leers’s picture

FileSize
15.42 KB
56.92 KB

The CKE5 plugin has only been loading linkit if it's been enabled since #78.

Wim Leers’s picture

Massively simplify the test setup.

Graber’s picture

Related and may help someone, not sure if it's the right place to put this. When switching from CKEditor 4 to 5 we also switched from entity_embed to linkit.

Here's a post update that does the migration.

And thank you for all the work here!

Wim Leers’s picture

Now adopt the helpers provided by \Drupal\Tests\ckeditor5\Traits\CKEditor5TestTrait to make this test understandable and maintainable.

Wim Leers’s picture

Expand the test coverage to be more thorough — and clean it up too.

The last submitted patch, 91: linkit-cke5-3232190-91.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Wim Leers’s picture

FileSize
905 bytes
56.03 KB

DrupalCI is faster than my local machine apparently.

Status: Needs review » Needs work

The last submitted patch, 94: linkit-cke5-3232190-93.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Wim Leers’s picture

Status: Needs work » Needs review
FileSize
15.23 KB
57.26 KB

Stop using _.groupBy in renderMenu in the CKEditor 5 implementation, to allow it to work on Drupal 10.

Wim Leers’s picture

More cross-D9-and-D10 test compatibility tweaks.

Wim Leers’s picture

I'm just repeating the work from #3288339 at this point, so let's get that green first: #3288339-31: Drupal 10 compatibility. 🤞

Wim Leers’s picture

FileSize
34.57 KB
89.21 KB

#3288339-35: Drupal 10 compatibility is green.

Merging in that patch, so that we can get a green test result here too.

Status: Needs review » Needs work

The last submitted patch, 99: linkit-cke5-3232190-99.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Wim Leers’s picture

Status: Needs work » Needs review
FileSize
1.07 KB
89.51 KB

Status: Needs review » Needs work

The last submitted patch, 101: linkit-cke5-3232190-101.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Wim Leers’s picture

FYI: proposing this as a Drupal core feature too now: #3317769: Drastically improve the linking experience in CKEditor 5 — but this should absolutely still land!

danthorne’s picture

Would be awesome if this lands in core.

Wim Leers’s picture

Yay, #3288339: Drupal 10 compatibility is in! Will reroll…

Wim Leers’s picture

Assigned: Wim Leers » Unassigned
Status: Needs work » Needs review
FileSize
56.71 KB

Waiting on @johnwebdev to add automated testing to the 6.0.x branch that he committed #3288339: Drupal 10 compatibility to — only then can I queue a test 😊

(Everything up to #101 was developed against 8.x-5.x because A) it's 99% identical, B) it does have automated testing. But it's clear that only the 6.0.x branch will get D10 support.)

freelock’s picture

Hi,

Great work, all, exciting to see!

I just tested out #106 and found one tiny issue: no visual indication that it's an autocomplete text field, or when it's searching for a match. This is because the input inside CKEditor5 isn't getting the form-linkit-autocomplete class, which loads the throbber gif. This breaks the first 4 styles in the linkit.autocomplete.css file.

Cheers,
John

Wim Leers’s picture

This is because the input inside CKEditor5 isn't getting the form-linkit-autocomplete class, which loads the throbber gif. This breaks the first 4 styles in the linkit.autocomplete.css file.

Great feedback! I'll get that fixed … or you could! 🤓🤞

Status: Needs review » Needs work

The last submitted patch, 106: 3232190-101-rebased-on-6.0.x.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

quotientix’s picture

Patch from #106 working fine with 6-Dev version. Thanks for the work!

StryKaizer’s picture

Status: Needs work » Needs review
FileSize
13.65 KB
55.68 KB

Patch from 106 + autocomplete throbbler class added.

Status: Needs review » Needs work

The last submitted patch, 111: 3232190-111-6.x.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Wim Leers’s picture

Status: Needs work » Needs review
Related issues: +#3326896: Update CKEditor 5 to 35.4.0
FileSize
705 bytes
55.62 KB

Drupal 9.5.0 and 10.0.0 will ship with CKEditor 5 35.4.0 as of earlier today: #3326896: Update CKEditor 5 to 35.4.0.

The package.json in this patch also long predates https://git.drupalcode.org/project/ckeditor5_dev/-/blob/1.0.x/ckeditor5_..., and could use some cleaning up and general updating … so not only updated CKEditor 5 to that 35.4.0, but also other packages listed.

Result: identical JS build 👍

The test is passing fine for me locally 😬

@StryKaizer: Does it pass for you?

Status: Needs review » Needs work

The last submitted patch, 113: 3232190-113.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

theRuslan’s picture

Patch #113 works fine for me with Drupal 9.5.0 + Linkit 6.0.x-dev. Thanks!

Nchase’s picture

patch #113 works fine for me with Drupal 9.5 + Linkit 6.0. Thank you!

Johan den Hollander’s picture

Patch in #113 works fine with Drupal 9.5.0 and Linkit 6.0.x-dev.

jds1’s picture

Status: Needs work » Reviewed & tested by the community

Patch in #113 also works for me with Drupal 9.5.0 and Linkit 6.0.x-dev. I'm marking this as RTBC. Would the maintainers consider making a release so we don't need to point to a dev version? Thank you!!

jds1’s picture

Status: Reviewed & tested by the community » Needs work

Scratch that RTBC – tests need to pass first. Sorry about that!

Wim Leers’s picture

Linkit maintainers, what's your plan here? 😊

joelpittet’s picture

This does make it work with CKeditor5! Thanks Wim Leers for your work on this, I'd RTBC and any polish can be taken into follow-ups

joelpittet’s picture

Status: Needs work » Reviewed & tested by the community

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 113: 3232190-113.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

dasginganinja’s picture

I would hope that after tests pass this could get added into the next beta release. 🤞

rkoller’s picture

FileSize
122.27 KB
438.01 KB

I wanted to lookup and test something in Linkit yesterday and got aware of this issue (otherwise i wouldn't been able to test it). I can also confirm that the patch enables Linkit in CKEditor5. Thanks for that! I've noticed only two details.

1) The list item in focus in the results list is quite hard to read due to a low color contrast with that black on blue.
linkit results in a ckeditor 5 link widget
i am somehow unable to inspect the elements in devtools the ul element gets a display:none readded and i have no idea how to manage to keep it displayed (i am not a developer). but if i take a look into linkit.autocomplete.css in line 43 and 44

  background: #0075ba;
  color: #fff;

and in case the background color blue set in the css is identical to the one in the widget (which i am unable to verify) then the current color contrast is 2.56:1 https://coolors.co/contrast-checker/333333-0075ba
It looks the variable --ck-color-text(#333) is used instead of #fff for the text color. With the latter the color contrast in focus would be 4.94:1 instead https://coolors.co/contrast-checker/ffffff-0075ba

2) the other detail is out of the scope of this issue but i've quickly tested the aural interface of the results list and currently only the list item's titles are announced. The group titles as well as the meta data like the author, date and time are not announced (see voiceover.mp4 - i've tested in voiceover on macos 12.6.1)

ras-ben’s picture

The patch makes the linkit field work, but it fills the browser console with errors.

These errors also appears to break my paragraphs module/field, with a "This value should not be null".

These are the errors in the console:

Uncaught TypeError: t.widget is not a function
    at controlgroup-min.js?v=9.5.1:9:176
    at controlgroup-min.js?v=9.5.1:9:98
    at controlgroup-min.js?v=9.5.1:9:108
form-reset-mixin-min.js?v=9.5.1:9 Uncaught TypeError: Cannot set properties of undefined (setting 'formResetMixin')
    at form-reset-mixin-min.js?v=9.5.1:9:170
    at form-reset-mixin-min.js?v=9.5.1:9:107
    at form-reset-mixin-min.js?v=9.5.1:9:117
mouse-min.js?v=9.5.1:9 Uncaught TypeError: e.widget is not a function
    at mouse-min.js?v=9.5.1:9:219
    at mouse-min.js?v=9.5.1:9:119
    at mouse-min.js?v=9.5.1:9:129
checkboxradio-min.js?v=9.5.1:9 Uncaught TypeError: Cannot read properties of undefined (reading 'formResetMixin')
    at checkboxradio-min.js?v=9.5.1:9:210
    at checkboxradio-min.js?v=9.5.1:9:132
    at checkboxradio-min.js?v=9.5.1:9:142
draggable-min.js?v=9.5.1:9 Uncaught TypeError: Cannot read properties of undefined (reading 'mouse')
    at draggable-min.js?v=9.5.1:9:275
    at draggable-min.js?v=9.5.1:9:202
    at draggable-min.js?v=9.5.1:9:212
resizable-min.js?v=9.5.1:9 Uncaught TypeError: Cannot read properties of undefined (reading 'mouse')
    at resizable-min.js?v=9.5.1:9:229
    at resizable-min.js?v=9.5.1:9:156
    at resizable-min.js?v=9.5.1:9:166
button-min.js?v=9.5.1:9 Uncaught TypeError: t.widget is not a function
    at button-min.js?v=9.5.1:9:198
    at button-min.js?v=9.5.1:9:146
    at button-min.js?v=9.5.1:9:156
dialog-min.js?v=9.5.1:9 Uncaught TypeError: i.widget is not a function
    at dialog-min.js?v=9.5.1:9:317
    at dialog-min.js?v=9.5.1:9:271
    at dialog-min.js?v=9.5.1:9:281
widget-min.js?v=9.5.1:9 Uncaught TypeError: i is not a constructor
    at t.widget (widget-min.js?v=9.5.1:9:813)
    at dialog.jquery-ui.js?v=9.5.1:10:5
    at dialog.jquery-ui.js?v=9.5.1:61:3
widget-min.js?v=9.5.1:9 Uncaught RangeError: Maximum call stack size exceeded
    at new t.<computed>.<computed> (widget-min.js?v=9.5.1:9:678)
    at new t.<computed>.<computed> (widget-min.js?v=9.5.1:9:678)
    at new t.<computed>.<computed> (widget-min.js?v=9.5.1:9:678)
    at new t.<computed>.<computed> (widget-min.js?v=9.5.1:9:678)
    at new t.<computed>.<computed> (widget-min.js?v=9.5.1:9:678)
    at new t.<computed>.<computed> (widget-min.js?v=9.5.1:9:678)
    at new t.<computed>.<computed> (widget-min.js?v=9.5.1:9:678)
    at new t.<computed>.<computed> (widget-min.js?v=9.5.1:9:678)
    at new t.<computed>.<computed> (widget-min.js?v=9.5.1:9:678)
    at new t.<computed>.<computed> (widget-min.js?v=9.5.1:9:678)
ras-ben’s picture

Hmm.. it would appear that it's cause jquery_ui is missing.

It works when i:

- Install the jquery_ui contrib module https://www.drupal.org/project/jquery_ui
- Add jquery_ui/core to the linkit.base library dependencies in linkit.libraries.yml

ras-ben’s picture

...and then this core patch is also necessary. sigh.

https://www.drupal.org/project/drupal/issues/3222107

J.’s picture

I'm have problems with paragrahs and Linkit w/ckeditor 5 and this patch. I click the link icon and "nothing happens." When i opened the console window to inspect i noticed that the popup for linkit is behind the paragraph overlay.

The error in the console is:

jquery.validate.min.js:4

Uncaught TypeError: Cannot read properties of undefined (reading 'replace')

J.’s picture

In case this helps, I also ran into problems with the table tooltip not showing up in paragraphs while using ckeditor5.

Found a similar problem described here: https://www.drupal.org/project/drupal/issues/3274937#comment-14824232. The css fix mentioned in #69 worked for me. I patched ckeditor5.dialog.fix.css and now table tooltip and linkit are working correctly.

mark_fullmer’s picture

The patch makes the linkit field work, but it fills the browser console with errors.

These errors also appears to break my paragraphs module/field, with a "This value should not be null".

Hmm.. it would appear that it's cause jquery_ui is missing.

Testing with the 10.1.x-dev branch of Drupal core with the patch from #113, I am not able to reproduce any browser console errors.

I then added the Paragraphs module (8.x-1.15) and proceeded to add a simple paragraph type with a single text-formatted field and added that to the Basic Page content type. Again, I was not able to trigger any console errors, either during the manipulation of the CKEditor interface or during render of the page.

Given all this, I think we need more specific steps to reproduce the problem.

J.’s picture

Apologies for not clarifying. I am on 9.4.10 using layout_paragraphs 2.0.2, not paragraphs. https://www.drupal.org/project/layout_paragraphs/releases/2.0.2

mark_fullmer’s picture

Status: Needs work » Needs review
FileSize
488 bytes
56.1 KB
50.39 KB

From #125:

The list item in focus in the results list is quite hard to read due to a low color contrast with that black on blue.

This is due to a combination of factors: the blue background color is coming from Claro (and it isn't present when using other admin themes), specifically web/core/themes/claro/css/components/jquery.ui/theme.css:

.ui-autocomplete .ui-menu-item.ui-state-focus,
.autocomplete .ui-menu-item.ui-state-hover {
  margin: 0;
  background: var(--color-blue-600);
}

The text color is coming from the CKEditor reset (.ck-reset_all :not(.ck-reset_all-excluded *)

The most reliable way to fix this across any admin theme is to set a more specific background color, as done in the attached patch. Screenshot attached of the result. Color contrast between #333 and #BFBFBF is 6.87:1.

screenshot of color contrast in linkit

Also, FWIW, this patch which is otherwise identical to that in #113, has all tests passing locally, including the one that is failing on d.o, (LinkitDialogCKEditor5Test).

Status: Needs review » Needs work

The last submitted patch, 133: 3232190-132.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

mark_fullmer’s picture

Status: Needs work » Needs review
FileSize
1.56 KB
56.15 KB

Here is a variation on the test steps intended to establish passing tests for the MVP. Instead of demonstrating that the user clicks the "No content suggestions found..." text, in this the user clicks the "Cancel" button to exit the autocomplete. As with #113, the tests pass locally for me. We'll see what happens on d.o...

hudri’s picture

I just wanted to mention here too that this module currently doesn't seem to have active maintainers anymore. I see a lot of experienced devs in here and hoped that someone would step up and become maintainer for this excellent module.

Nchase’s picture

I wonder why Linkit is not part of core. It is such an essential feature for content creators.

DamienMcKenna’s picture

ressa’s picture

Yes @Nchase, I agree. Linkit should be in Drupal core, just like Admin Toolbar (#2634854: Add dropdowns to horizontal toolbar menu (as with 'admin toolbar' in contrib)) and Drush (#3159647: Add drush/drush to Drupal Composer project templates).

Like, 90% of all sites install these two projects, right off the bat.

Thanks for the link @DamienMcKenna, it's great to see that there's recent activity in that issue.

rafaticarte’s picture

Hi, when will be published this fix in the next beta release? Thanks for your work!

jason.ullstam’s picture

Verified patch from #135 is working on Drupal 9.5.3 with linkit dev-6.0.x. I would also ask the same as @rafaticarte about when this can be added to the next beta release. I have upgraded all my 120+ instances to CKeditor5 already and would prefer not to use the dev version of the linkit module with a patch.

mark_fullmer’s picture

when this can be added to the next beta release

The status of a new release for LinkIt will be related to progress on #3338953: Offering to co-maintain LinkIt.

Without a comment posted on that issue in the next 14 days, Mark will be probably made co-maintainer

Based on the fact that I've functionally tested the CKEditor 5 version of this and verified that it retains feature parity, upon becoming maintainer, I plan to create a new beta release for the 6.x branch.

agoradesign’s picture

Thank you very much Mark in advance for your efforts!

jason.ullstam’s picture

Sounds great Mark! Much appreciated...

Rar9’s picture

patch 133 will not apply to D9.53

mark_fullmer’s picture

patch 133 will not apply to D9.53

Just double-checking before digging further: the patch should be applied to the 6.0.x branch of this module, Linkit, and can then be tested in the context of Drupal 9.5.x or 10.x. When you say the patch "will not apply to D9.53," do you mean you were able to apply the patch to LinkIt but the functionality is not working in 9.53, or that you were trying to apply this patch directly to Drupal core?

Rar9’s picture

this is what i currently use
"drupal/linkit": {
"2886455- Add support for multilanguage": "https://www.drupal.org/files/issues/2020-12-04/multilingual-support-link...",
"3232190 - CKEditor 5 readiness ": "https://www.drupal.org/files/issues/2023-01-31/3232190-133.patch"
},

jvogt’s picture

FWIW, I can confirm that the patch from 133 applied successfully in my environment:

Drupal core: 9.5.3
Php: 7.4.10
Linkit: 6.0.x-dev (against the latest commit: https://git.drupalcode.org/project/linkit/-/commits/6.0.x)

I believe it did fail against the 6.0.0-beta3 release, so maybe that's what Rar9 is experiencing.

mark_fullmer’s picture

Thanks for providing the patchfile declarations from your composer.json file. Based on the fact that you're using a patch for multilingual support designed for the 8.x-5.x branch of Linkit, I infer that is the version of this module you're using. I tested whether that patch would apply to the 6.0.x branch, and unfortunately (as predicted), it doesn't.

So I think we'll want to add a patch that works with 6.0.x in #2886455: Multilingual support: Allow linking to specific translations, and potentially add a patch for CKEditor 5 (here) that works with 8.x-5.x

To summarize: right now, you can't use this CKEditor 5 patch alongside the multilingual patch, which is designed for 8.x-5.x.

For others coming here seeking similar clarification:

Usage notes

This issue is initially providing CKEditor 5 support for the 6.0.x branch. In order to make use of it, you need to be using that branch in your code. Upon merge of this fix and a new release (6.0.0-beta4), sites wanting to use this module with CKEditor 5 will need to use the following: composer require drupal/linkit "^6".

Subsequent tasks will endeavor to make patches for other issues in the LinkIt issue queue for the 6.0.x branch.

gordon’s picture

I have installed and done some preliminary testing of #135 applied to 6.0-dev and it is going well so far.

Would really like to see this in the next release.

Rar9’s picture

@mark_fullmer thanks both patched updated and are working. Now they are working as under ckeditor 4

mark_fullmer’s picture

@mark_fullmer thanks both patched updated and are working. Now they are working as under ckeditor 4

Great! Assuming this is referring to using this issue's CKEditor 5 patch alongside the 6.0.x patch for multilingual support in https://www.drupal.org/project/linkit/issues/2886455#comment-14944869, could you post a comment on #2886455: Multilingual support: Allow linking to specific translations confirming that the patch for multilingual support works for you with the 6.0.x branch?

mark_fullmer’s picture

Status update for folks following this issue: pending final review of this issue, I plan to merge it and provide a new release that includes Drupal 10 compatibility and CKEditor 5 support on 5 March 2023.

For your future planning, refer to #3345480: LinkIt Release Roadmap and Issue Prioritization .

Thanks, all!

mark_fullmer’s picture

Status: Needs review » Fixed

Thanks, everyone, and especially Wim Leers who created this issue and did the majority of the work, for providing a CKEditor 5 solution for the LinkIt module!

The 6.0.0-beta4 release is forthcoming today, which will include this new feature, along with #3288339: Drupal 10 compatibility.

To follow and help shape the direction of this module going forward, visit #3345480: LinkIt Release Roadmap and Issue Prioritization.

dadderley’s picture

Just tried it out.
Great work!!!

maxilein’s picture

Thank you!

Status: Fixed » Closed (fixed)

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

Anybody’s picture

Follow-Up issue for the overwritten styles in the autocomplete results: #3362180: CKEditor5 resets the autocomplete result styles

joseph.olstad’s picture

We're on an exercise of D10 readiness, however when using D9.5.10 with ckeditor 5 along with linkit 6.0.0 we're getting this error:

Uncaught TypeError: Cannot read properties of undefined (reading 'add')
    at draggable.js:776:13

So does this mean we need to upgrade to D10 before using ckeditor 5?

Chicken and the egg?

mark_fullmer’s picture

We're on an exercise of D10 readiness, however when using D9.5.10 with ckeditor 5 along with linkit 6.0.0 we're getting this error:

Linkit 6.0.0 is designed to work with the latest version of Drupal 9.5. As of right now, all tests pass: https://www.drupal.org/pift-ci-job/2717325

Give that the error is reported in draggable.js, my guess is that the issue has to do with some other integration in CKEditor 5?

Can you reproduce the problem on a "vanilla" Drupal 9 site?