Problem/Motivation
When using CKEditor 5, there is a default set of markup languages provided (see screenshot below). But to fully make use of the plugin we would like to change that list to match the list provided by the field_highlightjs module. That would allow all code blocks to be added easily and then highlighted accordingly. Right now many of the languages can not be enabled in CKEditor 5.
Steps to reproduce
- Enable the field_highlightjs (optional) and drupal:ckeditor5 modules
- Change text editor setting to ckeditor5 for full_html (/admin/config/content/formats/manage/full_html)
- Create a new page with the full_html filter selected for the body field (/node/add/page)
- Paste the text below into the body field while in source code mode.
- Save the page.
<pre><code class="language-html">
<marquee>Hello, world!</marquee>
< /code></pre>
<pre><code class="language-bash">
#!/bin/bash
###### CONFIG
ACCEPTED_HOSTS="/root/.hag_accepted.conf"
BE_VERBOSE=false
if [ "$UID" -ne 0 ]
then
echo "Superuser rights required"
exit 2
fi
genApacheConf(){
echo -e "# Host ${HOME_DIR}$1/$2 :"
}
echo '"quoted"' | tr -d \" > text.txt
< /code></pre>
As a result of the hardcoded configuration in CKEditor 5 for the codeBlock
plugin the bash code will receive an extra language-plaintext class before the one that we set with language-bash. This results in the markup being highlighted as plain text.
Proposed resolution
Allow for configuration of the codeblock plugin of CKEditor 5 in Drupal core. I tried the following without effect:
- Before
- no ability to configure the Code Block plugin, which means a hardcoded set of languages is available to choose in CKEditor 5
- After
- the list of languages is now configurable, and the same hardcoded set of languages is the default configuration, which means there's no functional change
Furthermore, based on the feedback at #3269387-8: Drupal 10 & CKEditor 5 support and #3269387-9: Drupal 10 & CKEditor 5 support, this simple feature is sufficient for https://www.drupal.org/project/codesnippet to become obsolete when upgrading from CKEditor 4 to CKEditor 5, much like we previously did with #3274278: Migrate "codetag" contrib CKEditor 4 plugin to built-in equivalent in core's CKEditor 5.
Release notes snippet
The CKEditor code block is now configurable, allowing the list of languages that can be input to be changed in the editor configuration. Modules or install profiles that provide default editor configurations may need to update their shipped config.
Comment | File | Size | Author |
---|---|---|---|
#69 | 3282233-69.patch | 23.64 KB | Wim Leers |
| |||
#69 | interdiff.txt | 3.04 KB | Wim Leers |
#69 | Screenshot 2023-04-26 at 6.10.47 PM.png | 111.39 KB | Wim Leers |
#66 | interdiff.txt | 771 bytes | lauriii |
#66 | 3282233-66.patch | 23.88 KB | lauriii |
|
Issue fork drupal-3282233
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
alexverb CreditAttribution: alexverb as a volunteer and commentedComment #3
alexverb CreditAttribution: alexverb as a volunteer and commentedMoving this issue over to Drupal core (ckeditor5.module) to get support.
Comment #4
alexverb CreditAttribution: alexverb as a volunteer and commentedComment #5
Wim LeersYou're right — #3263384: Add ckeditor5-code-block package and CodeBlock plugin added the Code Block plugin, but did not yet allow any configuration:
We can (and should) totally add that. It just was not necessary for feature parity with CKEditor 4. Hence it's not a stable blocker. We're first tackling stable blockers.
We'll get to this after CKEditor 5 is stable!
Comment #6
Wim LeersActually … would you be interested in contributing this feature? 🤓
You'd need to do this:
… and then copy/paste
\Drupal\ckeditor5\Plugin\CKEditor5Plugin\Heading
, rename it toCodeBlock
, and modify it to be about languages to support 😊Comment #7
alexverb CreditAttribution: alexverb as a volunteer and commentedThanks Wim! For sure I will have a look at contributing this. I didn't know where to start. Now I have an idea.
Comment #8
Wim LeersAwesome! 😄
Comment #10
alexverb CreditAttribution: alexverb as a volunteer and commentedHey Wim, I've created a merge request. I would like to get a review.
Remaining issue:
One thing I still can not seem to figure out is how to update the dropdown list in Ckeditor code block button. It keeps displaying the list from config provided by the vendor javascript file: https://github.com/drupal/core/blob/9.4.x/assets/vendor/ckeditor5/code-b...
Everything else looks like it is working properly:
Questions:
Comment #11
Wim LeersWow! 🤩 You went all the way! 😄👏 Validation constraints included! Thank you so much!
Ah, yes!
For that, we need to generate the correct CKEditor 5 JS plugin configuration based on the Drupal-managed/stored configuration. But … I see you already have a
::getDynamicPluginConfig()
that looks good. 👏 So what's going on? 🤔Do you see the JS configuration you would expect if you go to a page where your CKEditor 5 instance is active and you type this in the console?
?
Great question! For this kind of thing, where all we're doing is non-risky configuration for a CKEditor 5 plugin, what we tend to do is write a unit test for them. (Yes, that is possible thanks to the use of
\Drupal\Component\Plugin\ConfigurableInterface
! 👍) The unit test basically tests the default configuration plus relevant edge cases you can think of, and verifies thatgetDynamicPluginConfig()
actually generates the expected CKEditor 5 JS plugin configuration.Examples:
\Drupal\Tests\ckeditor5\Unit\HeadingPluginTest
,\Drupal\Tests\ckeditor5\Unit\ListPluginTest
,\Drupal\Tests\ckeditor5\Unit\AlignmentPluginTest
.Usually they actually go against the "next" branch, which right now is
9.5.x
. But … the CKEditor 5 module is "special": it is experimental. Which means that every change gets committed to every branch (so currently that is9.3.x
,9.4.x
,9.5.x
and10.0.x
— this is a pretty special time in the Drupal core release cycle — usually it's only two branches!), to make sure that sites/people testing experimental modules are actually testing the latest and greatest.So: what you did is perfect — once this gets to RTBC we'll just need to create a patch (or multiple) to ensure it passes tests against all those branches. (I'm happy to do that for you if you'd rather not.)
Question
What was this experience like for you? Any and all feedback on the DX would be deeply appreciated 😊 Now is the time when we can still make tweaks. Please be brutally honest 😄 🙏
Comment #12
Wim LeersI think I found the answer to the one problem we were having here: https://git.drupalcode.org/project/drupal/-/merge_requests/2319/diffs#no...
Comment #13
Wim LeersBTW, if you want the tests to run a lot faster on this merge request: this patch will run only the CKE5 tests. We'll have to remove it eventually, but while working to get this to pass tests, this can save you a lot of time :) Test results in <10 minutes 👍
Comment #14
alexverb CreditAttribution: alexverb as a volunteer and commentedFixed the config key issue and provided a unit test for checking expected config.
Adding patch to start testing. Left out the quick testing patch because I think I did sufficient local testing.
Comment #15
alexverb CreditAttribution: alexverb as a volunteer and commentedProvided fix for cSpell and split up HTML and XML. Re-applied and force pushed changes because I had issues with rebasing.
The new configuration for codeBlock config makes other ckeditor5 tests fail. I could try to fix these tests, but I'm expecting it will take me a lot of time to figure out. Especially with my current setup (which is inside of a contrib module codebase). If I have a better local setup for working on core I would probably have less trouble. Which takes me to the question Wim posed:
Answer:
I love the feedback and help I'm getting to be able to contribute something back.
What I'm currently missing a bit is a quick environment/codebase setup that allows me to easily run and debug the tests locally. Because I was looking for a solution for my contributed module field_highlightjs I tried including a Drupal core codebase setup in there. But this proves to be somewhat annoying.
I would love to know what setup core developers are using to work on the Drupal development codebase. I prefer Docker based setups. But the ones listed here require manual setup steps: https://www.drupal.org/community/contributor-guide/reference-information...
I like 'docker-compose up -d' start working kinda deals. Let me know if there is/are any possibilities I can check out. For now I'm pausing my work on this issue until I switch my setup.
Comment #17
Wim LeersRE: contribution experience
"Bare metal": natively installed PHP + Apache + MySQL using this guide: https://getgrav.org/blog/macos-monterey-apache-multiple-php-versions. Everything else interferes too much. Core's code base is large. Docker performance on macOS is poor (but I hear this is maybe changing?). Performance matters when running core tests. (Though unit tests are probably fine in Docker too.)
cp core/phpunit.xml.dist core/phpunit.xml
and tweakcore/phpunit.xml
to specify your local DB + URL. As of that point, you can run all tests locally. Also through PHPStorm.Test failures
The tests that are failing make a ton of sense:
CKEditor4to5UpgradeCompletenessTest
fails because now that this plugin has been made configurable, our test coverage that verifies that configurable plugins generate the sensible configuration when upgrading from CKE4 is failing. This is good — we need to add that 🤓Drupal\Tests\ckeditor5\Kernel\ConfigurablePluginTest::testDefaults()
: same thing — this tests the expected default configuration for each configurable CKEditor 5 plugin. And this one was just made configurable, whereas previously it was not. A simple addition to the expectations will suffice! 🤓SmartDefaultSettingsTest
has 2 failing test cases: those that place theCodeBlock
toolbar item. Why? Because the default configuration that you just added is now present after upgrading from CKEditor 4. This is also good — we need to update the expectations 🤓ValidatorsTest
: fails due to this change:Why that change? I think we can revert that 😄
Review
See the last bullet above, and:
Nit: if you move this and everything under it a few lines higher, to before the
htmlSupport:
line, the diff will become simpler to review 🤓Why two classes here? 🤔
This does not match what's documented upstream as the default:
https://ckeditor.com/docs/ckeditor5/latest/api/module_code-block_codeblo..., where it says:
Why is that?
I think this could be a lot simpler. Something like this:
That is a lot of repetition/duplication 😅 I agree with the sentiment, but in this case it might be a bit much?
Would you be opposed to applying the pattern from
\Drupal\Tests\ckeditor5\Unit\LanguagePluginTest::buildExpectedDynamicConfig()
, to avoid having this list hardcoded in two places?Can't this be simplified to
$default_language_ids = CodeBlock::DEFAULT_CONFIGURATION
? 🤓Comment #18
alexverb CreditAttribution: alexverb as a volunteer and commentedHi Wim, thanks for your extensive review. I'll reply to your points. I did some research on them before making the changes. I think I may have valid reasons for some of them.
RE: Review
The htmlSupport key is part of the main ckeditor properties because it its not listed under the codeBlock properties:
So according to the functionality of ckeditor5 this is the correct way to set them.
I did think about keeping language-html and language-xml seperated with a single class as Ckeditor5 sets it like that. But since I'm working on the contrib field_highlightjs there the highlighting is the same for html and xml under the key language-xml (https://highlightjs.org/download/#download-form).
I applied this change for two reasons:
You are right. I decided to change the list of enabled_languages. I went back and forth on that because I also thought about not deviating from Ckeditors defaults. But I decided against keeping the default for three reasons:
I'm open to any suggestions. I would even revert back to the default settings that Ckeditor5 provides. But I thought it would be nice to have 34 common languages available instead of only 14 languages and have them be active. The contrib field_highlightjs module I'm working on will eventually make all 197 languages available.
In this case I think you are right. I do not fully understand how one plugin can have an effect on the other. So I wanted to keep using the subset diff, merge and/or intersect functionality. It is pretty complicated to me. I will try your suggestion.
Yes I thought the same thing. Also went a bit back and forth on that. The benefit of duplicating it really supports "a very" edge case where Drupal core would change the list with a removal. I'm ok with removing the duplication and relying on config and code.
Recap
So for 1 and 2 I would like to keep this as is. Maybe provide documentation somewhere on point 2 so people know they have the option to add or alter classes. The functionality on dual classes does work as expected.
For point 3 I think maybe we should open a discussion on what the list of available languages should be. And what the list of enabled languages should be. I simply applied a personal preference because I thought it would be sad to have core be limited to only 14 languages.
Point 4 and 5 I will change according to your review.
RE:RE: contribution experience
I still love Docker too much to go back to a local development setup. I'm currently setting up a .gitlab-ci.yml pipeline for my field_highlightjs project. With things like DrupalPod, Gitpod, Github Codespaces, Vscode.dev, Cloud9 etc. I think many opensource projects will move there entirely. And with Drupal being in Gitlab alpha phase there will be a need do provide that environment anyway to run the tests. But I love the overall direction Drupal is going. I hope I can still make some suggestions for the gitlab pipelines for contributed projects.
PS: Question: Do you happen to know people that can get me onto Drupal Gitlab Alpha at https://git.drupalcode.org/ ? I'm now working on https://gitlab.com/ to be able to run tests and find out a good way to mix/match contrib and core code setups. I think it is essential to be able to easily contribute to Drupal core through a contributed module. And that running Drupal tests and codechecks should be performed the same way. Even though I would love to see Drupal move onto Grumphp.
RE: Test failures
I've almost finished my test setup for my field_highlightjs project. When that's done I will tackle the remaining failing tests at ckeditor5. Glad these are expected failures. Anyway, it may now take a couple of days before you see changes. I hope to get some other things done in the meantime.
Comment #19
alexverb CreditAttribution: alexverb as a volunteer and commentedRe-running tests with suggestions applied.
Comment #20
alexverb CreditAttribution: alexverb as a volunteer and commentedMore test fixes to test.
Comment #21
Wim LeersThis change is causing the last test failure.
And … this should not actually work! You should get the validation error
Ah, no, that is for the attribute name, not the attribute value.
Congrats, you've found an edge case for which we did not yet have an explicit validation check! 🤓😄 Created #3284254: HTMLRestrictions should not allow <tag attr="*"> because that is equivalent to <tag attr> for addressing that.
Comment #22
alexverb CreditAttribution: alexverb as a volunteer and commentedFixed last test. Requesting review, if it is green at least.
I still stayed with <code class> without the wildcard. Since that means the same. Reason I went away from <code class="language-*"> is because when there is a language that has a class that does not start with "language-" I could not get the subset to resolve properly.
Class names are open to CKE5: https://ckeditor.com/docs/ckeditor5/latest/features/code-blocks.html
We just happen to provide the language- prefix.
Comment #23
Wim Leers#22:
language-
prefix is A) totally reasonable, B) more predictable. I think we should enforce that restriction. We could even add anassert()
to::getDynamicPluginConfig()
to prevent people from altering the metadata in this way.Patch review
Excellent work here! 👍👏
👎 This is effectively saying that this plugin can generate any value for the
class
attribute. That is not true.👏 NICE! 😄
But this means we should have explicit upgrade path test coverage. You can achieve that by adding a new text format + editor (just like
$basic_html_format_with_pre
does) and adding a new test case to\Drupal\Tests\ckeditor5\Kernel\SmartDefaultSettingsTest::provider()
😊🤓 Interesting indentation here, and also very interesting that
phpcs
does not complain about this. Core does not allow this kind of formatting.🤓 Nit: Drupal core always uses strict
in_array()
checks, so could you specify the third parameter? 🙏👍 Like here!
🤔
This should beThis is only called from the unit test — then this should be a private helper on the unit test instead.private
: we don't want this to become a public API that we must continue to support forever!Comment #25
alexverb CreditAttribution: alexverb as a volunteer and commentedOk Wim,
I went back to only allowing <code class="language-*"> classes. But for this I had to remove subset functionality to limit the allowed tags to only the enabled language classes. This is documented in a code comment why it is currently not possible. Because attribute values do not have the functionality to diff wildcards such as attributes themselves can. So it is not really a bug, but rather a non-existing feature.
For the rest I fixed the location for the static config function. I hope my tests are still green.
Comment #26
Wim Leers#25 is now in fact possible — #3284254: HTMLRestrictions should not allow <tag attr="*"> because that is equivalent to <tag attr> has been fixed!
Furthermore, based on the feedback at #3269387-8: Drupal 10 & CKEditor 5 support and #3269387-9: Drupal 10 & CKEditor 5 support, I'm now convinced that implementing this simple feature is sufficient for https://www.drupal.org/project/codesnippet to become obsolete when upgrading from CKEditor 4 to CKEditor 5, much like we previously did with #3274278: Migrate "codetag" contrib CKEditor 4 plugin to built-in equivalent in core's CKEditor 5.
Comment #27
Wim LeersThe last commit (
0f8c5c47
) does not apply cleanly to D10: a small conflict needs to be resolved. Let's see how this would do on D10.This one's for you, @Steffen Schlaer!
Note that because of limitations in the current patch, you'll for now have to manually modify
core/modules/ckeditor5/ckeditor5.ckeditor5.yml
, and add something like this:Comment #29
Wim LeersClosed #3349740: CK5 code block languages are not configurable as a duplicate.
Comment #30
mherchel💯💯💯
The current patch UI is this:
My use case is that I want to add support for YML, bash, etc.
I would love (and expect) to be able to do something like this:
Comment #31
mherchelNote the @lauriii's patch in #3349740: CK5 code block languages are not configurable implements this. Thoughts on continuing with that patch?
Screenshot:
Comment #32
Wim LeersDoes the CKEditor 5 plugin actually support arbitrary languages? According to https://ckeditor.com/docs/ckeditor5/latest/features/code-blocks.html#con..., it does.
I'd like to avoid adding more of this
thing|label\n
-style syntax. That's why I think checkboxes are nice. Can you think of a scalable UI pattern that is more userfriendly than a<textarea>
with a bunch of custom syntax?Comment #33
mherchelI can't think of any that's in use within Drupal core.
Would you be in favor of adding
thing|label\n
syntax (which is used throughout core) and then creating a followup issue to change the UI?Comment #34
Wim LeersDiscussed this with @mherchel in Drupal Slack: https://drupal.slack.com/archives/C01GWN3QYJD/p1680107668028699.
He convinced me that we shouldn't hold this issue up on improving the UI. That is an independent problem that affects many UIs in Drupal core. This single one isn't going to make the difference. Plus, this introduces the opportunity to in the future fix two config UIs at the same time: that for the
Style
CKEditor 5 plugin and that of theCodeBlock
plugin!The crucial requirement for that is already present: store the settings in a structured way, so that the UI is decoupled from the exact syntax in that
<textarea>
. Or rather, it's partially present in theDrupal\ckeditor5\Plugin\CKEditor5Plugin\CodeBlock
class in the current MR, it's 100% present in\Drupal\ckeditor5\Plugin\CKEditor5Plugin\Style
. This MR can copy/paste the pattern already established in Drupal core 👍So: +1 for @mherchel's proposal in #31, and let's create a follow-up for that improved UI 😊
Comment #35
lauriii+1 that it would be nice to something like what #32 is describing. However, it's not super straight forward to build a UI like this like I discovered with @timplunkett on #2521800: List key|label entry field is textarea, which doesn't give guidance towards the expected input. Because of that, I think it would be perfectly fine to leave that for a follow-up as suggested by #34. 👍
Comment #36
Wim LeersOh wow, that'd be another place where that same pattern is used, and that same follow-up should target that too! 👍 In fact … that issue SHOULD be the follow-up! 😄
Done: #2521800-27: List key|label entry field is textarea, which doesn't give guidance towards the expected input.
GREAT 😄
Comment #38
mherchelAttaching the patch from #3349740: CK5 code block languages are not configurable
This was originally created by @lauriii, and then had some code formatting changes done by @TanujJain-TJ (adding credit now).
The patch still isn't passing code checks, so I'm attaching one more interdiff from the patch here, and hopefully it will pass.
Still needs tests.
Comment #39
mherchelComment #40
mherchelAttaching the same patch, but running against 10.1.x
Comment #41
mherchelPrevious patch had an
xdebug_break();
in it. Yanking that out.Comment #42
mherchelNew patch adds a Nightwatch test to verify the functionality of the new editable code block languages.
There's still some legitimate CK5 kernel tests failing, so this will still fail.
Comment #43
mherchelUpdating dictionary.txt
Comment #45
Wim Leers🤩 This keeps the door open for a better UI in the future! 👏 (see #34 & #36) — and it matches the pattern used by the
Style
plugin.👍 I first thought this should be
orderby: key
, but actually this is better: it allows the administrator to control in which order the languages are presented to the end user 👍👍 This also matches the pattern established by the
Style
plugin.🐛 This should be
protected
, notpublic
.The reference
\Drupal\ckeditor5\Plugin\CKEditor5Plugin\Style::parseStylesFormValue()
was public to allow\Drupal\ckeditor5\Plugin\CKEditor4To5Upgrade\Core::mapCKEditor4SettingsToCKEditor5Configuration()
to reuse it. That's not needed here.🐛 This is incorrect. This returns
But it really intended to generate:
<code class="language-plaintext language-c language-cs language-cpp language-css language-diff …">
.We could absolutely implement it that way.
But … that actually comes with a pretty significant downside: it would mean that if the site administrator later changed the available languages that existing content (text stored in the DB) would not longer be considered valid. The set of languages that are configured here could easily evolve over time.
So I think that in this case, not implementing
CKEditor5PluginElementsSubsetInterface
and ALWAYS returning<code class="language-*">
would actually be reasonable.Comment #46
Wim LeersStandardTest
fails becauseeditor.editor.full_html
has not been updated to include the configuration for thecodeBlock
plugin.ConfigurablePluginTest
andSmartDefaultSettingsTest
fail for a similar reason but instead of changing code we need to change test expectations: there now is default configuration, and we're not yet expecting that in these tests.These all just require me to copy over
\Drupal\ckeditor5\Plugin\CKEditor5Plugin\CodeBlock::defaultConfiguration()
, so doing that to hopefully enable this patch to still land in10.1
😊Comment #47
Wim LeersValidatorsTest
fails due to the bug I pointed out in #45.5. I can fix that by just deleting a few LoC!Now tests should pass.
Comment #49
Wim Leers🐛 This does not actually update the configuration.
… and that would've been caught by an update test 😅
I know these tests can be a PITA to write, but I've done it so many times at this point that I figure I'd do that for you, @mherchel.
(It's 99% copy/paste of
\Drupal\Tests\ckeditor5\Functional\Update\CKEditor5UpdatePluginSettingsSortTest
, so I don't think this should prevent me from RTBC'ing it after the update path logic is added and the test is passing.)Comment #51
Wim LeersFor #49 and #45.4.
Comment #52
Wim Leers@mherchel told me he's traveling to a Drupal conference and asked me to write the update path (#49) and fix the nit (#45.4).
Unfortunately, this means I can in principle no longer RTBC this … even though I really only made trivial additions to help get this across the finish line. 😞
Comment #53
Wim LeersI made a small mistake in #46: I appended the
ckeditor5_codeBlock
config at the end, but thanks to config schema'sorderby
, it should've have been sorted by key — thankfullyConfigImportAllTest
caught that 😊Comment #55
mglamanGreat! This helps unblock my blog migration to D10. @mherchel demoed this to me at MidCamp.
Comment #56
Wim LeersImproved the issue summary.
Comment #57
Wim LeersFix markup.
Comment #58
Wim LeersDrupal.org's code filter is horribly broken 🥲
Comment #59
Wim LeersUntagging
rc target
and moving the relevant information out of #26 into the issue summary instead.Comment #60
Wim LeersDear reviewer:
Note that all of this closely resembles the logic in
\Drupal\ckeditor5\Plugin\CKEditor5Plugin\Style
.Run
diff core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/Style.php core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/CodeBlock.php
to convince yourself.Comment #61
catchThis needs to happen in a hook_entity_presave() so that it also applies to config entities that are exported in install profiles or modules. Then the post update itself just needs to save the config entity and the changes will be applied here too.
Agreed with improving the UI in the follow-up identified. I did not review the entire patch.
Comment #62
lauriiiThis should address #61.
Comment #63
lauriiiAddressing the PHPCS violation.
Comment #64
mherchelJust tested patch #63, and it works as expected! Looked through code, and seems logical (as far as I can tell).
RTBC (pending tests passing)
Comment #66
lauriiiLooks like I forgot to apply this only for editors with CKEditor 5 🤦♂️
Comment #67
Wim LeersThere was only a random functional JS test failure in a test unrelated to CKEditor 5.
Re-testing and back to RTBC.
Comment #68
catchCan this use hook_editor_presave()?
This looks good.
Should this be 'A list of languages'. 'code block languages' looks like a type of language, but we just mean languages available for the code block plugin. Or should it even say 'Programming languages' to avoid confusion with the other sort of language?
Same question with 'Languages' vs. 'Code block languages' - depends on context in the UI I guess.
I'm assuming we don't have code block enabled in any existing configuration so no shipped config to update?
Comment #69
Wim LeersIt could, but it shouldn't? 🤔 This is a concern of the CKEditor 5 text editor plugin, not of the generic Text Editor module? For [#3293540], we also added the update logic (ckeditor_post_update_omit_settings_for_disabled_plugins()
) to theckeditor
module, not theeditor
module?D'oh, now I understand. You were worried that this is now running for every entity save instead of just
Editor
entities! 😅✅ Done! Matched the pattern established by
comment_entity_view_display_presave()
,layout_builder_entity_view_display_presave()
etc.✅ Done. Updated UI:
Correct. 👍 In more detail: Full HTML has the
codeBlock
plugin enabled, but there was indeed no configuration for it, hence no config was ever shipped. (That's why the update path test makes grateful use of that existing config entity to prove that the necessary default configuration is now added.)Comment #70
lauriiiI also tried to address the feedback. Our interdiffs were identical with one exception:
We may want to have a lowercase l on languges but other than that looks good. This could be fixed on commit.
Comment #71
catchWhat about core/profiles/standard/config/install/editor.editor.full_html.yml - if that's re-exported, won't it have the code block config added?
Comment #72
lauriiiIsn't that use case covered by this?
Comment #74
catchI was going to quietly ignore that (and CSS). Agreed it's clearer if not 100% precise.
Agreed and done.
Sorry, yes, that's exactly what I meant.
I looked through the rest of the patch and can't find any more to complain about, I am not really qualified to review the nightwatch test but other people have done (and it's well commented and easy enough to follow along).
Added a change record: https://www.drupal.org/node/3356871
Committed/pushed to 10.1.x, thanks!
Comment #75
Wim LeersNext step: #3356929: Provide an upgrade path from "codesnippet" contrib CKEditor 4 plugin to "CodeBlock" core CKEditor 5 plugin 😊
Comment #76
quietone CreditAttribution: quietone at PreviousNext commentedI published the change record.