- Issue created by @wim leers
- Open on Drupal.org →Environment: PHP 8.2 & MySQL 8last update
over 1 year ago Not currently mergeable. - @wim-leers opened merge request.
- Issue was unassigned.
- Status changed to Needs review
over 1 year ago 9:07am 11 August 2023 - last update
over 1 year ago 29,920 pass, 2 fail - 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
Based on the test results → at #3379104-7: [meta] Test against CKEditor 5 nightly → , I expect that
html-support: A link attached to an image should not be lost when loading content with the LinkImage plugin and full General HTML Support enabled. Closes #12831. (commit)
will cause some tests to fail — but likely this means a simplification on our end, since we won't need to work around it anymore 🤞
- Assigned to lauriii
- Status changed to Needs work
over 1 year ago 9:22am 11 August 2023 - 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
Hm, looks like this is causing a genuine regression:
// When unrestricted, additional attributes on links should be retained. $xpath = new \DOMXPath($this->getEditorDataAsDom()); $this->assertCount($unrestricted ? 1 : 0, $xpath->query('//a[@href="http://www.drupal.org/association" and @class="trusted"]'));
👆 when
$unrestricted === TRUE
, we expect that thatclass="trusted"
is retained. That is no longer true once we update to39.0.1
. 🐛When
$unrestricted === TRUE
, Drupal will have:ckeditor5_arbitraryHtmlSupport: ckeditor5: plugins: [htmlSupport.GeneralHtmlSupport] config: htmlSupport: allow: - name: regexp: pattern: /.*/ attributes: true classes: true styles: true drupal: label: Arbitrary HTML support elements: false library: core/ckeditor5.htmlSupport # @see \Drupal\ckeditor5\Plugin\CKEditor5PluginManagerInterface::getEnabledDefinitions() conditions: []
i.e. it will enable the GHS that allows EVERYTHING.
It looks like https://github.com/ckeditor/ckeditor5/commit/3d155169b2cad4b40330059382b... introduced a genuine regression against this 🤔 Or maybe we need to change our logic in
core/modules/ckeditor5/js/ckeditor5_plugins/drupalImage/src/drupalimageediting.js
Either way, this is causing a net regression. 🙈
On our side, only @lauriii can figure this out efficiently. He’ll be back from vacation next week. Assigning to him. Welcome back, Lauri 😜
- First commit to issue fork.
- last update
over 1 year ago Custom Commands Failed - last update
over 1 year ago 29,921 pass, 2 fail - last update
over 1 year ago 29,959 pass - Status changed to Needs review
over 1 year ago 10:53am 16 August 2023 - 🇬🇧United Kingdom longwave UK
Looks like this is ready for review but I don't know enough about the change to make it RTBC.
- Status changed to Needs work
over 1 year ago 11:21am 16 August 2023 - 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
@lauriii, could you add some comments explaining why this change is needed? Why is https://github.com/ckeditor/ckeditor5/commit/3d155169b2cad4b40330059382b... not handling this for us? I hoped/expected that we'd be able to delete code rather than add more.
Especially because the conditionality in that upstream commit:
if ( editor.plugins.has( 'LinkImage' ) ) { conversion.for( 'upcast' ).add( viewToModelLinkImageAttributeConverter( dataFilter, editor ) ); }
… indicates that the necessary upcasting should be added only if
LinkImage
is loaded, and\Drupal\Tests\ckeditor5\FunctionalJavascript\ImageTest::setUp()
does place thelink
toolbar item, which means that the CKEditor 5LinkImage
plugin should be loaded according to:ckeditor5_linkImage: ckeditor5: plugins: - link.LinkImage config: # Append the "Link" button to the image balloon toolbar. image: toolbar: - '|' - linkImage drupal: label: Linked Image elements: false conditions: plugins: - ckeditor5_link - ckeditor5_image
And hence I thought we'd be able to delete the "image link GHS" integration code on our end:
// Modified alternative implementation of GHS' addBlockImageLinkAttributeConversion(). // This is happening here as well to avoid a race condition with the link // element not yet existing. …
which we had introduced in #3246168: Images are not linkable through UI; already linked images are unlinked (data loss!) → (before it was added to core!).
- 🇫🇮Finland lauriii Finland
The DrupalImage plugin heavily customizes the way Image plugin works. The key difference being, that we never wrap images with a
<figure>
in the data view.It turns out that the commit mentioned in #8 adds more assumption to the CKEditor 5 linked image upcast process. In particular, it assumes that the link is inside the
imageBlock
element. This is not true in the case of Drupal, because in our case<img>
is directly converted intoimageBlock
, meaning that the link is wrapping theimageBlock
element.We could try to document this inline in the JavaScript file, but I want to point out that majority of the code in that same file exist for this same reason.
- last update
over 1 year ago 29,961 pass - Status changed to Needs review
over 1 year ago 11:57am 16 August 2023 - Issue was unassigned.
- Status changed to RTBC
over 1 year ago 12:12pm 16 August 2023 - 🇬🇧United Kingdom longwave UK
Committed and pushed 5cc339ea60 to 11.x and 4befb2b456 to 10.1.x. Thanks!
-
longwave →
committed 4befb2b4 on 10.1.x
Issue #3380637 by lauriii, Wim Leers: Update CKEditor 5 to 39.0.1 (...
-
longwave →
committed 4befb2b4 on 10.1.x
-
longwave →
committed 5cc339ea on 11.x
Issue #3380637 by lauriii, Wim Leers: Update CKEditor 5 to 39.0.1
-
longwave →
committed 5cc339ea on 11.x
- Status changed to Fixed
over 1 year ago 3:13pm 16 August 2023 - 🇪🇸Spain eduardo morales alberti Spain, 🇪🇺
Is it possible to also apply it on Drupal 9.5.x? we have some problems with inline styles and the remove format button 🐛 [upstream] Remove Format button does not remove `style` attributes Postponed
- 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
@Eduardo Morales Alberti No, not possible. Other contrib modules will break. If you are using no CKEditor 5 contrib modules, then you could.
But it'll have to be you doing it for your site, an official release Drupal 9.5 release with this would break countless sites.
- 🇪🇸Spain eduardo morales alberti Spain, 🇪🇺
Let's see then how we fix the inline styles format remove scenario because is something important on our site and we have contrib modules not compatible with Drupal 10.x (yet).
Thank you. - 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
Wish there was more I could do — but our hands are tied! Good luck 😊 Personally, I'd look into getting those contrib modules on D10!
Automatically closed - issue fixed for 2 weeks with no activity.