- Issue created by @mahtab_alam
- Merge request !38Issue #3375880: maxlength does not work on layout builder + paragraph ckeditor fields โ (Open) created by mahtab_alam
- last update
over 1 year ago 4 pass, 1 fail - Status changed to Needs review
over 1 year ago 11:40am 24 July 2023 - Status changed to Postponed: needs info
over 1 year ago 10:07pm 24 July 2023 - ๐บ๐ธUnited States cedewey Denver, CO
Hi Mahtab,
Thank you for reporting this issue and for working on a fix for it.
I tried to recreate the issue with a vanilla Drupal 10.1.1 site, using the latest 2.1.x branch of MaxLength, Paragraphs 8.x-1.15 and CKEditor 5.
It is all working as expected for me. I tested it with the hard limit option enabled and disabled. Both scenarios worked as expected.
Please share more information on how to recreate this issue. Thanks!
- ๐ฎ๐ณIndia mahtab_alam
Can you try with paragraphs inside a paragraph scenario.
You can also try using layout builder + paragraph approach. - Status changed to Closed: cannot reproduce
over 1 year ago 2:45pm 25 July 2023 - ๐บ๐ธUnited States cedewey Denver, CO
I've tried nested paragraphs and having the content types use Layout Builder for the default view mode. Both scenarios work with MaxLength as expected. I'm going to mark this closed, cannot reproduce. If you still have an issue and can include specific steps to reproduce it, re-open it and we'll take another look.
- ๐บ๐ธUnited States art4003 New York
I am having the same issue here and the proposed solution by @mahtab_alam fixes the issue.
My setup:
- Content Type with Entity reference revisions field for Reference type: Paragraph.
- Paragraph with long text field and MaxLength enabled. - Assigned to cedewey
- Status changed to Needs review
over 1 year ago 11:05pm 18 November 2023 - ๐บ๐ธUnited States cedewey Denver, CO
Re-opening this to see if I can reproduce the issue and to review the proposed fix.
- ๐ง๐ทBrazil julio_retkwa Balneรกrio Camboriรบ
Hi all
I've faced the same issue and solution from @mahtab_alam worked fine, Thank you!
had to do nothing else on maxlength.libraries.yml
then just add:
- ckeditor5/internal.drupal.ckeditor5
In my scenario I was using paragraph
- First commit to issue fork.
- last update
about 1 year ago 4 pass, 1 fail - ๐ฉ๐ชGermany stefan.korn Jossgrund
I can also confirm this issue in some setup. I believe it is not especially tied to CKeditor5 in paragraphs, because in my setup though we are using paragraphs the CKEditor5 field with max length setting is not used in a paragraph.
I suppose it can happen that the maxlength.js is called before the ckeditor5.js and this is causing the issue, because the ckeditor5Id is not availabe for maxlength then: https://git.drupalcode.org/project/maxlength/-/blob/79379c927380d1796f38...
Adding the dependency on ckeditor5/internal.drupal.ckeditor5 solves the issue by assuring that ckeditor5.js is always called before maxlength.js.
This seems to be an easy solution for this problem, though it probaby is not nice for supporting CKEditor4 and would also request that library for non CKEditor fields with maxlength. A clean solution would need to distinguish whether we are on CKEditor5 field before attaching the library and then maybe have a library for ckeditor5 especially that has the dependency on ckeditor5/internal.drupal.ckeditor5. But this does not seem easy (the distinguishing part). - ๐ฉ๐ชGermany stefan.korn Jossgrund
One thing I can think of, would be to introduce a new setting for maxlength like "require CKEditor5" and include the dependency only based on this setting.
- last update
about 1 year ago 6 pass - ๐ฉ๐ชGermany stefan.korn Jossgrund
How about this patch, which introduces a new setting for CKEditor5 library dependency.
Maybe could use allowed settings for this too and only allow on formatted text fields.
- ๐ง๐ชBelgium joevagyok
I don't like the idea to add a setting for the user to fix a problem which the user should not even be aware about and maintain that configuration setting, rather confusing.
We need to find a solution which doesn't disrupt the user experience and doesn't require any action from the users. - ๐ฉ๐ชGermany stefan.korn Jossgrund
We need to find a solution which doesn't disrupt the user experience and doesn't require any action from the users.
true surely, but not so easy as far as I can see.
For me now it is better to decide when to load the ckeditor5 library myself, rather than loading it just on any occasion which the previous patch does.
- Issue was unassigned.
- Status changed to Needs work
about 1 year ago 5:16pm 13 December 2023 - ๐บ๐ธUnited States cedewey Denver, CO
I agree with joevagyok that we shouldn't introduce a setting for behavior the site builder expects by default.
For version 3.0 we will ๐ฑ Remove CKEditor 4 support Active so that is worth taking into account with as we decide on the best solution.
Also, can someone update the steps to reproduce? I'm still unclear on what specific scenario causes this problem, since some are reporting that it is not happening with Paragraphs.
- ๐ฉ๐ชGermany stefan.korn Jossgrund
I think it is a dependency issue which is rather hard to pin down. ckeditor5.js needs to be called before maxlength.js. This is not assured because maxlength does not set a dependency on this. Maybe if some other module is requiring maxlength, this may result in a change of the dependency order and maxlength.js comes before ckeditor5.js.
- ๐ฉ๐ชGermany broon Potsdam
I can confirm that adding the dependency by using a patch works and solves the problem.
However as Stefan points out, it's not directly related to paragraphs but I believe rather depends on the size of the form which in turn may lead to different order of loading required JS files. I also agree that the user should not be required to switch on some extra option to make it work for each RTF field. But adding the dependency for all is also not correct as there might be sites not using CKEditor at all.
Maybe, instead of having just a single library "maxlength", there ought to be additional ones like "maxlength_ckeditor" which should automatically be selected if the corresponding textfield is using CKEditor.
- Assigned to joevagyok
- ๐ง๐ชBelgium joevagyok
Since we have reached Drupal 9 end of life there for CKEditor4 end of life as well which means there will be no further support or security releases for these versions, I think we will follow suit and focus on CKEditor5 and future release where we drop the support for CKEditor4.
- ๐ง๐ชBelgium joevagyok
This needs to be checked over 3.x-dev if it can be reproduced.
Environment: D10.2.3; PHP 8.2.15; MaxLength 3.0.0-beta1. This was a new installation of D10 last August. Added a new page (node) and reached a character limit and upon Save the Edit tab reloads without additional text. I tried increasing PHP memory from 128M to 256M and in Settings - not the problem I'm having but found and added the two lines with 2 changed to 6:
/**
* If you encounter a situation where users post a large amount of text, and
* the result is stripped out upon viewing but can still be edited, Drupal's
* output filter may not have sufficient memory to process it. If you
* experience this issue, you may wish to uncomment the following two lines
* and increase the limits of these variables. For more information, see
* http://php.net/manual/pcre.configuration.php.
*/
# ini_set('pcre.backtrack_limit', 200000);
# ini_set('pcre.recursion_limit', 200000);ini_set('pcre.backtrack_limit', 600000);
ini_set('pcre.recursion_limit', 600000);Neither of the above changes worked. I copied the text from edit window into Office doc. Character count is 3,031 and adding another sentence the change is not saved. So I installed MaxLength 3.0.0-beta1 and in /structure/types/manage/page/form-display I added and saved 10000 as the Body character limit. Adding an additional sentence with 6914 characters remaining, same result, Edit tab reloads with the additional sentence missing.
This module is working as intended. I added lorem ipsum text of almost 12,000 characters and the page saves.
I found a new problem - the page has one external and one internal link. Adding an additional link causes the edit tab to reload and not save the change. Hmm?
Sorry for the confusion.
- Status changed to Postponed: needs info
12 months ago 10:40am 27 February 2024 Confirming that I was having this issue:
- Version 2.1.2 of MaxLength module.
- After upgrading to CKE5, the remaining character count was not updating on Paragraph content fields with the max length set (it was working in CKE4 on for those fields).
- I updated to MaxLength 3.0.0-beta1 and the issue appears to be resolved.- ๐ฉ๐ชGermany stefan.korn Jossgrund
3.x is now requiring ckeditor5/internal.drupal.ckeditor5 as a library dependency.
Though this works as expected and fixes the issue mentioned here, it has a minor issue if ckeditor5 module is not installed.
You will get warning message "The following theme is missing from the file system: ckeditor5" during installation of maxlength.
This could be fixed by requiring ckeditor5 module in info.yml. But in a scenario where you do not want to use CKEditor5 at all, it seems not correct to force the installation of ckeditor5 module, because maxlength will in principle also work without it.
So maybe one wants to tolerate the warning message during installation. Or one could maybe use hook_library_info_alter to add the dependency just in case ckeditor5 module is active.
- Status changed to Needs work
12 months ago 4:42pm 6 March 2024 - ๐บ๐ธUnited States cedewey Denver, CO
Hi Stefan,
Thank you for your ongoing testing and investigation of this issue!
I support your proposal of using hook_library_info_alter to add the dependency in case the CKEditor5 module is enabled.
Since this is now only displaying a warning message, I am reducing the priority to minor.
I'll leave it assigned to joevagyok to review this suggested proposal and if you're up for it Joe, implement the proposed resolution.
- ๐บ๐ธUnited States recrit
Hiding patch 15 to avoid confusion. The MR should be used for any fixes.
- ๐บ๐ธUnited States recrit
attached a static patch of the current MR that can be used with 2.1.x for the library dependency change adding "ckeditor5/internal.drupal.ckeditor5" similar to 3.x.
- Merge request !47Issue #3375880: Fix CKEditor5 library dependency. โ (Merged) created by joevagyok
- last update
10 months ago 6 pass - ๐ง๐ชBelgium joevagyok
joevagyok โ changed the visibility of the branch 3.x to hidden.
- ๐ง๐ชBelgium joevagyok
joevagyok โ changed the visibility of the branch 3375880-maxlength-does-not to hidden.
- Status changed to Needs review
10 months ago 9:35am 6 May 2024 - ๐ง๐ชBelgium joevagyok
Issue is fixed in a new PR, the merge commit will be pushed to 2.1.x as well.
- Status changed to RTBC
9 months ago 11:04am 29 May 2024 -
joevagyok โ
committed ddb69acd on 3.x
Issue #3375880: Fix CKEditor5 library dependency.
-
joevagyok โ
committed ddb69acd on 3.x
- Status changed to Fixed
9 months ago 1:35pm 29 May 2024 -
joevagyok โ
committed 72bf50c0 on 2.1.x
Issue #3375880: Fix CKEditor5 library dependency.
-
joevagyok โ
committed 72bf50c0 on 2.1.x
-
joevagyok โ
committed a41834a9 on 2.1.x
Revert "Issue #3375880: Fix CKEditor5 library dependency." This reverts...
-
joevagyok โ
committed a41834a9 on 2.1.x
-
joevagyok โ
committed f9853249 on 2.1.x
Issue #3375880: Fix CKEditor5 library dependency.
-
joevagyok โ
committed f9853249 on 2.1.x
Automatically closed - issue fixed for 2 weeks with no activity.