Problem/Motivation
CKEditor 5 will not use the editor.module
-andmedia.module
provided link, image and media dialog forms:
\Drupal\editor\Form\EditorLinkDialog
\Drupal\editor\Form\EditorImageDialog
\Drupal\media\Form\EditorMediaDialog
There are no longer Drupal-owned dialog forms to add/edit links or images. We did that for the CKEditor 4 integration because it was going to be a dialog in CKEditor anyway. In CKEditor 5, the UX is simpler (not a dialog).
This does mean that certain contributed modules will need to be rearchitected, since all they do with CKEditor 4 is alter one of these forms:
- https://www.drupal.org/project/editor_advanced_link
- https://www.drupal.org/project/editor_advanced_image
- https://www.drupal.org/project/linkit
Proposed resolution
Since Drupal 10 will ship without CKEditor 4, and we do not know of any contributed modules that provide alternative text editor plugins that use these, it is probably worth deprecating these in Drupal 9 for removal in Drupal 10.
Remaining tasks
TBD
User interface changes
None.
API changes
Deprecate:
\Drupal\editor\Form\EditorLinkDialog
\Drupal\editor\Form\EditorImageDialog
\Drupal\media\Form\EditorMediaDialog
Data model changes
None.
Release notes snippet
TBD
Issue fork drupal-3231341
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:
- 10.1.x compare
- 9.5.x compare
- 9.3.x compare
- 3231341-deprecate-editorlinkdialog-and changes, plain diff MR !1193 / changes, plain diff MR !1192
- 3231341-d10.1-deprecate-editorlinkdialog-editorimagedialog-and-editormediadialog changes, plain diff MR !2969
- 3231341-d10-deprecate-editorlinkdialog-editorimagedialog-and-editormediadialog changes, plain diff MR !2700
- 3231341-d95-deprecate-editorlinkdialog-editorimagedialog-and-editormediadialog changes, plain diff MR !2414
Comments
Comment #2
xjmComment #4
gaurav.kapoor CreditAttribution: gaurav.kapoor at Axelerant for Drupal India Association commentedComment #8
gaurav.kapoor CreditAttribution: gaurav.kapoor at Axelerant for Drupal India Association commentedHello!!. I am still new and trying to understand the new MR workflow introduced for the issues and also to the D10 readiness initiative. Based on my understanding I have added an MR which has code for mentioned deprecations. Looking forward to feedback regarding the same. Thanks.
Comment #9
Wim LeersComment #10
SpokjeComment #11
SpokjeComment #12
SpokjeComment #13
SpokjeComment #15
SpokjeHmmm, 198 deprecation notices.
Are we sure that CKEditor5 is not using those dialogs?
I see quite a lot of deprecation notices in the
Drupal\Tests\ckeditor5\Functional
namespaceComment #16
Wim LeersI think #3270734: Update Editor + CKEditor 5 module to not use CKEditor 4 in tests having landed will make a huge difference. Let's see. Rebasing…
Comment #17
Wim LeersAll (or at least the vast majority) of the remaining test failures are due to
pointing to the deprecated class. Why is that triggering so many failures?
Because
\Drupal\Core\EventSubscriber\EntityRouteAlterSubscriber::onRoutingRouteAlterSetType()
calls\Drupal\Core\Entity\EntityResolverManager::setRouteOptions()
which does… which loads the class and hence triggers the deprecation 😬
It's been a while since I dealt with this kind of thing so … hoping here that @Spokje knows how to solve this 🤓
Comment #18
SpokjeI can't think of another way, but to skip/suppress those deprecations altogether. Route deprecation never landed and (at least) I have never dealt with these
EntityRouteAlterSubscriber/EntityResolverManager
shenanigans.Not very nice, since we _might_ be missing actual use of the deprecated classes, but without hacking into
EntityRouteAlterSubscriber/EntityResolverManager
, (which IMHO is even worse) I'm out of brilliant ideas.Very happy for Big Brains to come up with a much better approach.
Comment #19
Wim LeersI don't have a better idea either, nor does it seem worth our time if the very simple solution in the (brilliantly named!) commit from @Spokje solves it 😊
Comment #20
SpokjeIt's green (which, according to a certain amphibian, is not an easy thing to be...)
Putting this on NR to get committers eyes on the chosen "Oh-shut-up-with-your-silly-deprecation-notices" approach.
Comment #22
SpokjeRetitling, correct version and added #3306584: [11.x] Remove EditorLinkDialog, EditorImageDialog and EditorMediaDialog in Drupal 11 for the actual removal in
10.0.x
.Comment #23
Wim LeersComment #24
catchWon't this break the ckeditor contrib module if it's committed?
Comment #25
xjmBased on #24 I suggest we deprecate this in 10.1 for removal in 11.0.
Comment #26
Wim Leers#24 is totally right 🙈
+1.
Whew, one less thing to do before
10.0.0-beta1
! 😄Comment #27
catchComment #28
Wim LeersTangentially related: #2710427-81: Broken "Allowed Tags" updating: after all values for an attribute are allowed, it should not be overridden to allow only certain attribute values.
Comment #29
nod_MR needs updating to 10.1.x
Comment #33
SpokjeMR!2969 is against 10.1.x
Comment #34
Wim LeersThat looks perfect — thank you @Spokje!
Comment #35
xjmComment #36
xjmBased on #2935897: [policy, then docs] Change how we deprecate classes, I think we should be triggering the deprecations in these classes' constructors rather than at the top of the file. Tagging for RM review to confirm with others.
Comment #37
SpokjeI think the changes proposed in #2935897: [policy, then docs] Change how we deprecate classes make sense, but (at least) I also think that we can't expect people to make patches/MRs that are based on the official policy, which then are being put back to NW because of something that isn't an official policy (yet).
Then again, n=1.
Comment #38
xjm@Spokje This might be the first issue where we adopt it. I did leave the issue RTBC for a reason though.
Comment #39
xjm#2935897: [policy, then docs] Change how we deprecate classes was indeed adopted today, so let's move the instantiated classes' deprecations to their constructors. (Don't worry, there's another issue that was NW on this too.)
Comment #40
SpokjeThanks @xjm
Not sure if I should check my feet for bullet wounds, but at the very least we got an improvement on the deprecation policy. :)
I gave up worrying about d.o. issues quite a while ago, so we're all good here.
Comment #41
SpokjeDo we still need a Release Manager review?
Comment #42
SpokjeUpdated CR for 10.1.x/11.0.x
Comment #43
Wim LeersComment #44
SpokjeThanks @Wim Leers!
Comment #45
catchThe route and deprecation message skipping is a bit tricky.
Ideally we'd want to deprecate the route, but this depends on #3159210: Support route aliasing (Symfony 5.4) and allow deprecating the route name.
Also even if we deprecate the route, it wouldn't would help us remove the deprecation skipping. The one thing it might mean is that we've got an un-suppressed deprecation for the route, which would be another way to alert contrib/custom code. Either way that should be a follow-up.
The only other thing I can think of would be moving the deprecation out of the constructor and into EditorImageDialog::buildForm() and EditorImageDialog::skipForm(), this would (probably?) mean it could be non-skipped, but that'd be an even further change to policy and not necessarily more useful.
Then after all that I realised controllers/forms are @internal anyway meaning anything we do here is 'best effort', so if the skipping does mean some custom or contrib code doesn't catch this, well we did our best.
So I think we should open a PP-1 follow-up to deprecate the routes once #3159210: Support route aliasing (Symfony 5.4) and allow deprecating the route name is in, but otherwise agreed this is the best we can do here and untagging for RM review.
Comment #46
SpokjeThanks @catch, opened #3337813: Properly deprecate routes editor.image_dialog, editor.link_dialog and editor.media_dialog to address #45.
Comment #47
alexpottCommitted 15cebd32 and pushed to 10.1.x. Thanks!