Support for ckeditor 5

Created on 3 December 2021, over 2 years ago
Updated 4 August 2023, 11 months ago

Now that ckeditor 5 has been added to core ( โœจ Add CKEditor 5 module to Drupal core Fixed ), it would be good to rewrite the plugin to be compatible with it.

Documentation is available for updating the plugin: https://www.drupal.org/docs/core-modules-and-themes/core-modules/ckedito... โ†’

โœจ Feature request
Status

Fixed

Version

3.0

Component

Footnotes

Created by

๐Ÿ‡บ๐Ÿ‡ธUnited States DamienMcKenna NH, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • First commit to issue fork.
  • @praveenpb opened merge request.
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia praveenpb Bangalore

    Created a patch and MR for the ckeditor5 compatibility.

  • Status changed to Needs review over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia praveenpb Bangalore
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia praveenpb Bangalore

    Created a patch and MR for the ckeditor5 compatibility.

  • ๐Ÿ‡ซ๐Ÿ‡ทFrance prudloff Lille

    The upcast in #22 is not working correctly. It creates empty FootnotesValue elements in the data model and those are not displayed.
    I updated the patch to create FootnotesValue element with a text content and now they are correctly displayed in the editor.

    However, I am not entirely sure why there is both the FootnotesValue and Footnotes elements, because only FootnotesValue elements seem to be actually used in the data model.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia praveenpb Bangalore

    @prudloff, Thanks for updating the patch.
    I thought to add support for footnotes which doesn't have value attribute(added in ckeditor4) so added Footnotes and FootnotesValue. But you might be right we can get rid of one of them.

    Updated the MR and the patch accordingly.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States scottop

    I have a new project in Drupal 10 that needs footnotes. The "Drupal 10 compatibility" patch ( 3343180 ๐Ÿ“Œ Drupal 10 compatibility Fixed ) was for version 3.0.1 (and worked). This patch does not work on that version, I assume because it was made to patch version 3.0 (Composer just gave up). Is there a chance to get this patch rolled into the Drupal 10 compatibility?

  • ๐Ÿ‡ช๐Ÿ‡ธSpain idiaz.roncero Madrid

    @scottop I just tried to apply both this patch and the D10 Compatibility, and for me are working with the latest 3.0.x version of footnotes.

    They apply, but the order is important: Cke5 first, then D10. Maybe is this what is failing on your install?

                "drupal/footnotes" : {
                    "3252524 - Updated with ckeditor5 compatibility." : "https://git.drupalcode.org/project/footnotes/-/merge_requests/4.patch",
                    "3343180 - Drupal 10 compatibility" : "https://www.drupal.org/files/issues/2023-03-08/footnotes-d10-compatibility-3343180-5.patch"
                },
    
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States scottop

    @idaz.roncero I had tried the ordering, but I was using the patch from #24. I noticed that you used the patch from the Git repository #5. It works with that patch, but not with the one from #24 here.

    The problem is, when I use your patch and try to enable it, it still requires CKEditor 4 and asks me to Download the FakeObjects module and put it in the /libraries folder. I don't think Drupal 10 has a /libraries folder anymore, or at least I don't since I let it set up the new structure with just /vendor and /web folders at the top level, and will I be able to disable CKEditor 4 later?

  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia sonnykt Melbourne, Australia

    Patch #24 cannot apply to Footnotes 3.0.1.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States scottop

    So, can I use Footnotes in Drupal 10? It seems that patch 5 didn't quite work, and thus the need for patch 24, but only Footnotes 3.0.1 is compatible with Drupal 10.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States hyperlogos

    See #26, put that snip into patches under extras in composer.json.

    then composer require cweagans/composer-patches

    then composer require 'drupal/footnotes:^3.0'

    The UI is a bit messed up for me but the functionality seems to be working, kind of. Also, HTML footnotes are not rendered in HTML, the tags are just stripped, and I'm not sure the right things are happening with styles either. But it is possible to create footnotes, and have the list render at the bottom of the display. I cannot edit them except by going to source view.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States scottop

    hyperlogos,

    Thanks for the response. I do that, and I still have the error message when I go to enable the module:

    Error message
    Before you can use the FakeObjects module, you need to download the plugin from ckeditor.com and place it in /libraries/fakeobjects. Check the README.txt for more information. Get the plugin here. (Currently using FakeObjects version Plugin not detected)
    

    So, as I said above, I have a fresh Drupal 10 install, and we no longer seem to have a /libraries folder. At the top level, I only have two folders, "vendor" and "web". Or, perhaps I just ignore the error?

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States hyperlogos

    the fakeobjects library goes into libraries/fakeobjects in your web directory. you will unpack the zip in web/libraries and then rename it from fakeobjects-version to fakeobjects

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom catch

    Does the ckeditor5 version actually require fakeobjects though? If not then that message should be conditional on the ckeditor4 module being installed.

  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany Franz-m

    ckeditor5 has fakeobjects as dependency.
    But then, fakeobjects has ckeditor4 as dependency, so it automatically gets required on D10 on enabling footnotes :(.
    As far as I remember, ckeditor5 possibly needs ckeditor4 to import earlier texts on migration.
    Nevertheless, I edited fakeobjects dependency to drop ckeditor4. I'll see how my migrations (D6 .. D10) will do.

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada Dylan Donkersgoed London, Ontario

    Dylan Donkersgoed โ†’ made their first commit to this issueโ€™s fork.

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada Dylan Donkersgoed London, Ontario

    The CKE4 version of this plugin used to display footnotes as [fn] rather than showing them inline. I've updated the CKE5 plugin to behave in a similar way and pushed it to the MR. I've attached a patch as well.

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada Dylan Donkersgoed London, Ontario

    The old version also allowed editing footnotes by clicking them, I've added that to the new version as well. Updated patch attached and it's in the MR.

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada Dylan Donkersgoed London, Ontario

    The old footnotes widget supported entering the footnote text in a text area, but it was a single line input in the new one. This made editing long footnotes much harder. I've pushed up another change to switch the footnote text input back to a text area and enlarge it. Patch is attached.

  • ๐Ÿ‡ซ๐Ÿ‡ทFrance everhee

    Last patch is very good. Is there any way that footnotes created with ckeditor 4 might be compatible to ckeditor 5 when switching the text format ?

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada Dylan Donkersgoed London, Ontario

    @everhee That should be working already. The new CKE5 plugin does store them in a different format, but it's supposed to load the child content of old tags into the value attribute of new ones. Is that not working for you and if so could you provide some sample markup with the issue?

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada Dylan Donkersgoed London, Ontario

    @everhee Nevermind, I see the issue and have pushed up a fix to the MR. New patch attached as well.

  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 5.7
    last update 11 months ago
    run-tests.sh fatal error
  • @Franz-m how did that โœจ Support for ckeditor 5 Fixed end up for you ?
    Do you have ckeditor4 installed despite the core ck5 being there :-?
    This whole chaos/dilemma about D10/Ckeditor5 .. fakeobjects/ck4 seems to not be addressed by anyone yet so we get a working D10 compatible version without the need for the ckedtior4 anymore.

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom catch

    There's a separate issue with a patch for the fakeobjects dependency here: ๐Ÿ“Œ Remove Fakeobjects as hard dependency Fixed .

    PHP Fatal error:  Declaration of Drupal\Tests\footnotes\FunctionalJavascript\FootnotesCkeditorPluginTest::setUp() must be compatible with Drupal\Tests\BrowserTestBase::setUp(): void
    

    Test error above looks like an easy fix.

  • @catch thanks, I tried this and it didn't work and I guess it's because I have core CKE5 enabled and I don't want to uninstall it. This also doesn't address what should be the main issue worked on for footnotes i.e. a D10 compatible footnotes module that takes into account that fakeobjetcs is dependent on cke4 when core D10 already has cke5 with fakeojects plugin already there.
    Different issues each working on one aspect but no one is taking ALL these considerations together especially now that D9 is near its EOL!

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom catch

    @cestmoi it's not clear if you mean this patch didn't work, or the patch on ๐Ÿ“Œ Remove Fakeobjects as hard dependency Fixed didn't work, if you mean the fakeobjects issue, it would be better to report anything over there.

  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 5.7
    last update 11 months ago
    run-tests.sh fatal error
  • @catch thank you. For some reason installing the footnotes module after applying all 3 patches (D10, CKE5, and Fakeobjects) threw a php error when I did the install via drush but all went fine when I installed the module via drupal admin UI. I have the core CKeditor5 enabled, CKE4 and Fakeobjects modules removed, and footnotes filter enabled and it seems to be working as expected per my testing so far, and no errors.

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada smulvih2 Canada ๐Ÿ

    I tested patch #41 and it works great! I have a D10 sandbox and with this patch I can insert and manage footnotes in both CKE4 and CKE5. This has been merged with the 3.1.x branch for testing. We can handle any issues in a separate ticket.

    The 3.1.x branch also includes some updates for the CKE4 plugin that would be good to roll into the CKE5 plugin, but we can do that as part of a separate ticket:

  • Status changed to Fixed 11 months ago
  • ๐Ÿ‡จ๐Ÿ‡ฆCanada smulvih2 Canada ๐Ÿ
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.69.0 2024