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
Comment | File | Size | Author |
---|---|---|---|
#135 | 3232190-133.patch | 56.15 KB | mark_fullmer |
#135 | 3232190-113_133.interdiff.txt | 1.56 KB | mark_fullmer |
#133 | 3232190-132.patch | 56.1 KB | mark_fullmer |
#133 | 3232190-113_132.interdiff.txt | 488 bytes | mark_fullmer |
#111 | 3232190-111-6.x.patch | 55.68 KB | StryKaizer |
Issue fork linkit-3232190
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 #2
anonThanks Wim. Please keep us updated on this topic
Comment #3
Wim LeersLatest news: #3231364-57: Add CKEditor 5 module to Drupal core.
Comment #4
lauriiiI'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.
Comment #5
Wim Leers🥳
Comment #6
Wim LeersDo 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. 😅
Comment #7
Wim LeersFor 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 with8b79415a7dc3ae769f4238fad72efd02654fbb27
. 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.Comment #8
Wim LeersPushed another 5 commits, starting with
68184f60e45a8720284b3a861cc4750238ee9d37
and ending withbbeaeae5952c4d02ed8924426089558ce14749c9
. 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.🥳
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.
Comment #9
Wim LeersIn doing #8, I found two bugs and one task in the CKEditor 5 module:
linkit.schema.yml
from having any effect in the UI!Comment #10
Wim Leers#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.
Comment #11
Wim Leers#10 shows how the current UI is a bit awkward: the
<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
.Comment #12
Wim LeersJust pushed the upgrade path:
628993752386e02819f86225224d024305a5b6d0
.That looks like this:
I show 3 different upgrade paths:
You can see all of them upgrading nicely 😊
Comment #14
bnjmnmThis 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.Comment #15
Wim LeersI mentioned these issues in #9 and #10:
They all landed at yesterday.
Comment #16
Wim Leers#14: 🤩🤩🤩🤩
Comment #17
bnjmnmVideo 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.
Comment #19
nod_updated branch with latest changes from #3246362: Keep autocomplete lib passing jquery ui tests and #3247369: Add back option to customize classes
Comment #21
Wim LeersJust added a test dependency on https://www.drupal.org/project/ckeditor5.
Comment #22
DamienMcKennaTim 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...
Comment #23
DamienMcKennaShould the merge request be updated to work against the 6.0.x branch?
Comment #24
DamienMcKennaNever mind, I just realized that the 6.0.x releases are actually just tags on the 8.x-5.x branch.
Comment #25
DamienMcKennaThis is the merge request in patch format, for anyone who wants it.
Comment #26
DanielVezaThe 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.ymlOops bad patch - ignore this one
Comment #27
DanielVezaThe 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
Comment #28
DamienMcKennaCould 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.
Comment #29
DamienMcKennaComment #30
Rajab Natshah CreditAttribution: Rajab Natshah at Vardot for Vardot commentedPatch in #27 is working
Thank you :)
Comment #31
Rajab Natshah CreditAttribution: Rajab Natshah at Vardot for Vardot commentedI 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.
6.x-1.x
No further development.
Or maybe like what the maintainer of the Webform module is doing
Development version: 6.0.x
Comment #32
johnwebdev CreditAttribution: johnwebdev commentedI've added a 6.0.x development branch.
Comment #33
DamienMcKennaThank 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.
Comment #34
DieterHolvoet CreditAttribution: DieterHolvoet at Minsky commentedI 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.
The error happens on this line:
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.Comment #35
DamienMcKennaDieterHolvoet: Please open core issues for those bugs, I'm sure Wim Leers and others would like to know about them.
Comment #36
johnwebdev CreditAttribution: johnwebdev commentedComment #37
Wim Leers#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!
Comment #38
nod_Comment #39
nod_Back to jQuery UI, can't test the 6.0 branch though :/
Comment #40
nod_Comment #42
nod_Comment #43
lauriiiChanged the code to open the edit link dialog. This was failing locally but I think it was unrelated to the dialog opening.
Comment #45
nod_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.
Comment #46
nod_so one line change that took a while to find. Tests should be passing.
Comment #47
jastraat CreditAttribution: jastraat at Technivant commentedThis 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.
Comment #48
jastraat CreditAttribution: jastraat at Technivant commentedComment #49
larowlanI'm seeing this too with the latest core patch for styles combo
Comment #50
nod_another instance of #3294908: Configuration overlaps between Styles and other CKE5 plugins?
Comment #51
larowlanWe 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.
Comment #52
larowlanFixes #51
Comment #54
mathilde_dumond CreditAttribution: mathilde_dumond at MD Systems GmbH commentedHi 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
```
Comment #55
mathilde_dumond CreditAttribution: mathilde_dumond at MD Systems GmbH commenteday sorry I messed up the formatting, here are the sources that I have:
link has no link:
and here is the inception link example source:
Comment #56
larowlanFound it wasn't working in layout builder forms, traced it down to a misnamed libraries entry
Comment #58
nod_making it work for D10
Comment #59
nod_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 usingDropdownViewPanel
, came with a bit too many things, switched to usingListView
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.
Comment #60
Wim LeersQueued tests against
9.5.x
for #58 because thelinkit
module does not yet declare D10 compatibility. It's equally valuable to develop CKEditor 5 support forlinkit
against9.5.x
because CKEditor 5 is stable there too 😊What's still missing:
data-entity-type
anddata-entity-uuid
attributes@CKEditor5Plugin
Drupal plugin should ensure those attributes are automatically enabled when a LinkIt profile is selected@CKEditor4To5Upgrade
plugin!data-entity-substitution
is not removed when editing a link through the UI (AFAICT thedata-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.
Comment #61
Wim LeersAlso, to fix the test failures (which BTW are happening in HEAD too), all you need is
(This is a consequence of #3291744: Ensure Editor config entities using CKEditor 4 only store plugins settings for actually enabled plugins.)
Comment #62
nod_Thanks for the fix for the test failure :)
->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.Comment #63
nod_little issue with the complied linkit plugin disregard patch #62
Comment #64
Wim LeersSo … 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?
linkit_extension
is always enabled. It should only be enabled when A) theckeditor5_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: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?
Comment #65
Wim Leers(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!)
Comment #66
nod_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:
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.
Comment #67
Wim Leers👍
Wait, are you saying that there's a difference based on using the mouse vs keyboard?
Comment #68
nod_not mouse vs. keyboard, more like: writing the url and "validating" the link vs. writing the url, clicking the suggestion, and "validating" the link.
Comment #69
FeuerwagenFor 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)
Comment #70
Wim Leers@Feuerwagen: which Drupal core version are you testing this with?
Comment #71
Feuerwagen@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).
Comment #72
jcnventura CreditAttribution: jcnventura at 1xINTERNET commentedOne question to the ones working on this. Should #3288339: Drupal 10 compatibility be marked as a duplicate?
Comment #73
Wim Leers@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:)Comment #74
Martijn de Witchanged tittle :)
Comment #75
Wim LeersHah, great call! 😅
Comment #76
Wim LeersJust pushed the Drupal 10 compatibility issue forward: #3288339-9: Drupal 10 compatibility.
Comment #77
Wim LeersUpdate to comply with upstream interface update in #3268174: Bug in CKE 4 → 5 upgrade path "format" does not always map to "heading", it could map to "codeBlock" too, or both, or neither.
Comment #78
Wim LeersUpgrade path completeness test, and harden
::mapCKEditor4SettingsToCKEditor5Configuration()
for missing/incomplete CKE4 plugin settings.Comment #79
Wim LeersUpgrade path test, this unveiled there were some missing
conditions
in the plugin definition.Comment #80
Wim Leers@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 with9.5.x
and10.0.x
!Comment #81
Wim Leersis caused by the core bug in #3314511: CKEditor 4 → 5 upgrade path may trigger warnings in some edge cases, making upgrade path tests impossible.
Comment #82
Wim LeersRefine
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.
Comment #83
Wim LeersThis obviously is wrong and needs to change. It was just to build a PoC. Now we need to make this mergeable.
… and this will need to change accordingly.
Comment #84
Wim Leers#3314511: CKEditor 4 → 5 upgrade path may trigger warnings in some edge cases, making upgrade path tests impossible landed! Re-testing #79.
Comment #85
Wim LeersLet's ensure the test does not introduce new deprecation errors on PHP 8.2.
Comment #86
Wim LeersNote: tests are
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.
Comment #87
Wim LeersDue to this in HEAD's
linkit.routing.yml
:… 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.
Comment #88
Wim LeersThe CKE5 plugin has only been loading
linkit
if it's been enabled since #78.Comment #89
Wim LeersMassively simplify the test setup.
Comment #90
Graber CreditAttribution: Graber as a volunteer commentedRelated 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!
Comment #91
Wim LeersNow adopt the helpers provided by
\Drupal\Tests\ckeditor5\Traits\CKEditor5TestTrait
to make this test understandable and maintainable.Comment #92
Wim LeersExpand the test coverage to be more thorough — and clean it up too.
Comment #94
Wim LeersDrupalCI is faster than my local machine apparently.
Comment #96
Wim LeersStop using
_.groupBy
inrenderMenu
in the CKEditor 5 implementation, to allow it to work on Drupal 10.Comment #97
Wim LeersMore cross-D9-and-D10 test compatibility tweaks.
Comment #98
Wim LeersI'm just repeating the work from #3288339 at this point, so let's get that green first: #3288339-31: Drupal 10 compatibility. 🤞
Comment #99
Wim Leers#3288339-35: Drupal 10 compatibility is green.
Merging in that patch, so that we can get a green test result here too.
Comment #101
Wim LeersComment #103
Wim LeersFYI: proposing this as a Drupal core feature too now: #3317769: Drastically improve the linking experience in CKEditor 5 — but this should absolutely still land!
Comment #104
danthorneWould be awesome if this lands in core.
Comment #105
Wim LeersYay, #3288339: Drupal 10 compatibility is in! Will reroll…
Comment #106
Wim LeersWaiting 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 the6.0.x
branch will get D10 support.)Comment #107
freelockHi,
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
Comment #108
Wim LeersGreat feedback! I'll get that fixed … or you could! 🤓🤞
Comment #110
quotientix CreditAttribution: quotientix commentedPatch from #106 working fine with 6-Dev version. Thanks for the work!
Comment #111
StryKaizerPatch from 106 + autocomplete throbbler class added.
Comment #113
Wim LeersDrupal
9.5.0
and10.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?
Comment #115
theRuslanPatch #113 works fine for me with Drupal 9.5.0 + Linkit 6.0.x-dev. Thanks!
Comment #116
Nchase CreditAttribution: Nchase as a volunteer commentedpatch #113 works fine for me with Drupal 9.5 + Linkit 6.0. Thank you!
Comment #117
Johan den Hollander CreditAttribution: Johan den Hollander at Finalist commentedPatch in #113 works fine with Drupal 9.5.0 and Linkit 6.0.x-dev.
Comment #118
jds1Patch 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!!
Comment #119
jds1Scratch that RTBC – tests need to pass first. Sorry about that!
Comment #120
Wim LeersLinkit maintainers, what's your plan here? 😊
Comment #121
joelpittetThis 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
Comment #122
joelpittetComment #124
dasginganinjaI would hope that after tests pass this could get added into the next beta release. 🤞
Comment #125
rkollerI 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.
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 intolinkit.autocomplete.css
in line 43 and 44and 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-0075ba2) 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)
Comment #126
ras-ben CreditAttribution: ras-ben commentedThe 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:
Comment #127
ras-ben CreditAttribution: ras-ben commentedHmm.. 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
Comment #128
ras-ben CreditAttribution: ras-ben commented...and then this core patch is also necessary. sigh.
https://www.drupal.org/project/drupal/issues/3222107
Comment #129
J. CreditAttribution: J. commentedI'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')
Comment #130
J. CreditAttribution: J. commentedIn 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.
Comment #131
mark_fullmerTesting 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.
Comment #132
J. CreditAttribution: J. commentedApologies 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
Comment #133
mark_fullmerFrom #125:
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
: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.
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).
Comment #135
mark_fullmerHere 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...
Comment #136
hudriI 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.
Comment #137
Nchase CreditAttribution: Nchase as a volunteer commentedI wonder why Linkit is not part of core. It is such an essential feature for content creators.
Comment #138
DamienMcKenna@Nchase: see: #3317769: Drastically improve the linking experience in CKEditor 5
Comment #139
ressa CreditAttribution: ressa at Ardea commentedYes @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.
Comment #140
rafaticarte CreditAttribution: rafaticarte commentedHi, when will be published this fix in the next beta release? Thanks for your work!
Comment #141
jason.ullstam CreditAttribution: jason.ullstam commentedVerified 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.
Comment #142
mark_fullmerThe status of a new release for LinkIt will be related to progress on #3338953: Offering to co-maintain LinkIt.
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.
Comment #143
agoradesign CreditAttribution: agoradesign commentedThank you very much Mark in advance for your efforts!
Comment #144
jason.ullstam CreditAttribution: jason.ullstam commentedSounds great Mark! Much appreciated...
Comment #145
Rar9 CreditAttribution: Rar9 commentedpatch 133 will not apply to D9.53
Comment #146
mark_fullmerJust 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?
Comment #147
Rar9 CreditAttribution: Rar9 commentedthis 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"
},
Comment #148
jvogt CreditAttribution: jvogt as a volunteer commentedFWIW, 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.
Comment #149
mark_fullmerThanks 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.
Comment #150
gordon CreditAttribution: gordon at Heydon Consulting for Department of Customer Service, NSW commentedI 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.
Comment #151
Rar9 CreditAttribution: Rar9 commented@mark_fullmer thanks both patched updated and are working. Now they are working as under ckeditor 4
Comment #152
mark_fullmerGreat! 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?
Comment #153
mark_fullmerStatus 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!
Comment #155
mark_fullmerThanks, 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.
Comment #156
dadderley CreditAttribution: dadderley as a volunteer commentedJust tried it out.
Great work!!!
Comment #157
maxilein CreditAttribution: maxilein commentedThank you!
Comment #159
AnybodyFollow-Up issue for the overwritten styles in the autocomplete results: #3362180: CKEditor5 resets the autocomplete result styles
Comment #160
joseph.olstadWe'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:
So does this mean we need to upgrade to D10 before using ckeditor 5?
Chicken and the egg?
Comment #161
mark_fullmerLinkit 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?