Closed (fixed)
Project:
Drupal core
Version:
9.3.x-dev
Component:
ckeditor5.module
Priority:
Major
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
26 Jan 2022 at 09:19 UTC
Updated:
22 Feb 2022 at 20:34 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #5
wim leersWow! 3 people on the same merge request — loving the collaboration here! :D
@lauriii opened a blocking issue: #3261061 — and I think I just unblocked you there: #3261061-3: Allow filter condition to depend on multiple filters.
Comment #6
nod_needs a rebase,
If I understood correctly the code was a copy/paste from ckeditor imagestyle plugin. Code looks very similar so I don't think there are problems with it (it seems to works as intended). Got at couple of small questions
Comment #7
lauriiiThe code is mostly copied from CKEditor 5
imagestyleplugin but it isn't exactly the same. The CKEditor 5 API provides more flexibility compared to the API that we are providing indrupalmediastyle. We have also addeddrupalMediaAlignoption which maps todata-align.Comment #8
lauriiiComment #9
nod_Looks good to me now, thanks :)
Comment #10
wim leersLeft a bunch of questions, and found one significant bug.
Comment #11
lauriiiComment #12
wim leersThe bug I found wasn't an actual bug, but I did uncover a weakness in investigating that: we have no upgrade path test coverage proving that
<drupal-media … data-align>actually works. And we should do that as part of this issue, to ensure that we do not have to touch upon this again.So created #3261712: Expand SmartDefaultSettingsTest to also test a format + editor with media embedding to establish test coverage of the state in HEAD, this MR will be able to remove the
data-alignfrom the expected generated configuration forckeditor5_sourceEditing.Comment #13
lauriii#3261712: Expand SmartDefaultSettingsTest to also test a format + editor with media embedding was committed.
Comment #14
wim leersYep, and as expected and intended, this failure occurred thanks to #3261712: Expand SmartDefaultSettingsTest to also test a format + editor with media embedding:
Comment #15
lauriiiComment #16
wim leersThe test coverage now proves that this solves a need! 🥳
Wanted to RTBC this, but then realized the JS hadn't gotten a thorough review yet. So did that just now, and ended up with a range of questions 🤓
Comment #17
lauriiiComment #18
wim leersNo more remarks. Huge leap forward, and preparing us well for the future 👍
Epic work here :D
Comment #19
lauriiiHere's the MR in patch too
Comment #20
bnjmnmNot sure if the patch itself needs any changes yet, but the issue summary does not seem indicative of the solution provided. Setting to NW for visibility on that, but I'll still go ahead and look at the patch.
Comment #21
bnjmnmSomething I ran into while testing that does not need to be addressed in this issue, but should be mentioned in case other people run into it.
If GHS has
<drupal-media data-align>configured, but Align Images isn't enabled - if it is later enabled, the allowed HTML tags will add unwanted allowed values of 0 and 1 instead of simply allowing the attributeThis will be fixed when we land #3228334: Refactor HTMLRestrictionsUtilities to a HtmlRestrictions value object
Comment #22
bnjmnmThis gets pretty confusing, could it get another pass? Some of the context might not be necessary - perhaps some of it could be summarized as "This is marked @internal because although it is currently part of drupalMedia, the intent is to make it available to other elements to provide the following benefits:
- benefit 1
- benefit 2
etc."
Could this be rephrased as something like "This provides a toolbar making it possible to add element styles via the UI"?
This is where it clicks for me that a model's drupalElementStyle is a single string value. The following may not be a concern since elementStyle is @internal, but just in case: Assuming I'm even understanding this correctly, are we limiting ourselves by introducing this as a single value property. It seems likely there could be needs to map many arbitrary attribute values to classes added on downcast. It seems like this could even be the foundation of reproducing StylesCombo functionality. I'm still reading through all this so this may become apparent later.
Still reviewing - adding what I have so far since I'll be AFK for a bit.
Comment #23
bnjmnmHave to pause again. Leaving what I have so far (pretty much surface level stuff) and will continue looking at it soon.
Needs @return description
Needs the full doc or an @inheritDoc
Needs param description
These two functions that begin with 'get', which create new strings, are used very close to uses of CK5
get(), which returns an existing property within the editor object. It's not a huge concern, but if there's alternate phrasing that makes sense and overlaps less with nearby methods we don't have naming rights for, lets do it.Is there syntax for adding a @see to the element style definition within media_mediaAlign in ckeditor5.ckeditor5.yml?
Needs description for @param and @return
Comment #24
lauriii#22.1: I tried to simplify that. Is it better now?
#22.2: The comment is trying to say exactly the opposite. The Drupal Element Style plugin doesn't provide a generic toolbar for the element, the element needs to provide its own toolbar where the buttons can be added to.
#22.3:
This plugin is intentionally limited by the fact that this can only modify single attribute to one value (or add a single CSS class). This keeps the logic much simpler. Complex use cases should use filters / editing downcast overrides to convert attributes into multiple CSS classes when rendering on frontend or editing view. The StylesCombo will probably implement something similar but with different UI, and potentially mapping to view elements instead of model elements. We can see how these overlap once CKSource has made more progress with the StylesCombo.
#23.1 ✅
#23.2 ✅
#23.3 ✅
#23.4: Sorry, I'm afraid I don't follow what's being proposed here.
#23.5: Not sure we can add it exactly there but I added see and clarified the docs.
#23.6 ✅
Comment #25
lauriiiComment #26
wim leers#21: I've noticed that occasionally but was never able to figure out what exactly caused that to happen — I'm glad to see you did! :D
Leaving this for @bnjmnm.
Comment #27
bnjmnmI added a few additional feedback items. They're largely docs related as the code itself seems sound. Once those items are addressed I think another reviewer could RTBC back to a candidate for me committing.
Comment #28
lauriiiComment #29
wim leersI see that @lauriii has thoroughly addressed all of @bnjmnm's feedback. So, moving back to RTBC.
Comment #30
bnjmnmPatches to facilitate committing.
Comment #33
bnjmnmAdded to 10.0.x and 9.4.x, will see how amenable 9.3.x is next.
Comment #35
bnjmnmCherry-picked to 9.3.x as CKEditor 5 is experimental, this is non disruptive, and it's a feature we want to get people using ASAP.