Problem/Motivation
With D10 releasing soon with ckeditor5 this module will need to be updated
Steps to reproduce
NA
Proposed resolution
Update for ckeditor 5 maybe utilizing https://github.com/abedi-ir/ckeditor5-direction
Remaining tasks
Implement
Review
Commit
User interface changes
NA
API changes
NA
Data model changes
NA
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | text_format_toolbar_config.png | 10.82 KB | anairamzap |
| #4 | bidi_button_ckeditor_node.png | 106.68 KB | anairamzap |
Issue fork ckeditor_bidi-3312442
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:
- 3312442-one-button-option
changes, plain diff MR !2
- 3312442-make-ready-for
changes, plain diff MR !1
Comments
Comment #2
wim leersAsked the CKEditor team for guidance.
Comment #4
anairamzapWe are using this module on a project that is in arabic, hence the ckeditor needs to support "rtl" direction, we also are defaulting to "rtl" while showing both directions in the ckeditor toolbar.
I've tested the MR!1 by:
Only one really minor issue in here: the styling for the button seems to be a bit broken (showing like a dropdown arrow above the icon). It should be a really quick fix to maybe remove it on.ckeditor5-toolbar-button-direction::afteron bidi_direction.admin.css line 22Please disregard this, I was not using Claro theme to test this :S. On Claro there are no issues with the button in the config page:
The only thing missing to behave exactly as is CK4 is not related with this plugin/module, but with the
contentsLangDirectionhttps://docs-old.ckeditor.com/ckeditor_api/symbols/CKEDITOR.config.html#... that we were using to setrtlas the default direction. Just commenting this here in case it helps someone else for the upgrade: https://ckeditor.com/docs/ckeditor5/latest/installation/getting-started/...UPDATE: to set the default language/direction in CK5 you can use the following hook:
That uses the
languageconfig for CK5 API and sets a different lang for the UI and the editor content for all editor formats.Comment #5
wim leersWoah! WHAT A FIND! Extracted into a Drupal core issue, thank you! 🙏 See #3312816: CKEditor 5 should explicitly set negotiated content language, not just UI language — credited you!
Comment #6
wim leersActually … isn't this already covered by the toolbar item in core, which uses the
language.TextPartLanguageCKEditor 5 plugin?Tested it and … looks like the difference is that that plugin can only produce
whereas the BiDi plugin can produce
So close, so unfortunate! 😬 We could've hugely simplified all this otherwise! 😞
Comment #7
smustgrave commentedSo are you staying we may not need this module? Should the language button be updated to allow for a default language? and apply to p tags.
Comment #8
wim leersSadly, no, because of the "so close, so unfortunate" bit 😞
Comment #10
smustgrave commentedPersonally I prefer the approach of using one button but lets see.
Comment #11
wim leersAdvertised this: https://twitter.com/wimleers/status/1578360118336688129 🤓
Comment #13
wim leersIn working on the upgrade path test coverage, I ran into two core bugs: #3314478: Follow-up for #3231334: global attributes should result in HTMLRestrictions becoming simplified and #3314511: CKEditor 4 → 5 upgrade path may trigger warnings in some edge cases, making upgrade path tests impossible! This is blocked on the first only (it'll make the second disappear).
Until that core bug is fixed, this will fail with:
But already without that core patch applied, you'll see one test failure:
(I've already left a comment on the MR where I point out the root cause.)
Comment #14
smustgrave commentedAdded the ckeditor4 plugin back.
Addressed most of the open threads though a few questions.
Other one is how do we setup translations?
Comment #15
wim leersYay, the upgrade path test now passes! (With #3314478: Follow-up for #3231334: global attributes should result in HTMLRestrictions becoming simplified applied to Drupal core.)
Created #3314680: Incorporate translations support into the starter template for that. Not sure either, I have barely worked on the JS side of CKEditor 5!
I think that for now, you can choose to not handle translations. Or, if you modify the plugin further, you could choose to use
Drupal.t()…Comment #16
wim leersGood news: per https://softwareengineering.stackexchange.com/a/105926 (and per @lauriii!), you can in fact relicense MIT under the GPL. You just have to include the original license file.
This also means that you can easily handle translations in this case by adding
Drupal.t()calls 👍Comment #17
smustgrave commentedResolved most of the points. but left a few questions on others
RTBC = #3314478: Follow-up for #3231334: global attributes should result in HTMLRestrictions becoming simplified
Comment #18
wim leers#3314511: CKEditor 4 → 5 upgrade path may trigger warnings in some edge cases, making upgrade path tests impossible landed!
Comment #19
wim leersPosted another review round! 👍
This is getting very close to the finish line! 🤩
Comment #20
smustgrave commentedAddressed what I could. Left comments on the threads I had questions on.
Thanks!
Comment #21
wim leersJust addressed all of the feedback on #3314478: Follow-up for #3231334: global attributes should result in HTMLRestrictions becoming simplified, which is still blocking this actually 🙈 See #3314478-27: Follow-up for #3231334: global attributes should result in HTMLRestrictions becoming simplified.
Comment #22
wim leersActually, two issues are blocking this, thanks to @smustgrave confirming that on the merge request. #3312816: CKEditor 5 should explicitly set negotiated content language, not just UI language is the second.
Comment #23
wim leers#3314478: Follow-up for #3231334: global attributes should result in HTMLRestrictions becoming simplified just landed, so one fewer blocker! 👍
That leaves only #3312816: CKEditor 5 should explicitly set negotiated content language, not just UI language.
Comment #24
smustgrave commented@Wim Leers what's left for this issue?
Comment #25
wim leersPer #23, AFAICT the only blocker to this working is #3312816: CKEditor 5 should explicitly set negotiated content language, not just UI language. If you could push that forward, I would be eligible to RTBC 😇🙏
Comment #26
smustgrave commentedUnfortunately don't know what the fix is for https://www.drupal.org/project/drupal/issues/3312816. Not entirely sure I even understand the issue.
Comment #27
smustgrave commentedSo still confused how https://www.drupal.org/project/drupal/issues/3312816 blocks this.
This module sets rtl but NO lang so sounds like that’s missing.
But adding to core not sure if it fixes here
They seem independent of each other
Comment #29
smustgrave commentedComment #30
smustgrave commentedOpened https://www.drupal.org/project/ckeditor_bidi/issues/3333568 for final testing