Project

General

Profile

Actions

Task #102082

open

Epic #99669: CKEditor5 Collection

CKEditor5 - Re-add ability to set maximum allowed char count

Added by Jasmina Ließmann 9 months ago. Updated 8 months ago.

Status:
Accepted
Priority:
Should have
Assignee:
Category:
RTE (rtehtmlarea + ckeditor)
Target version:
Start date:
2023-10-04
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
12
PHP Version:
8.2
Tags:
cke4
Complexity:
Sprint Focus:

Description

Scenario:
I have a content element with a text field. From a conceptual and graphical perspective, this text field should contain a maximum of 250 characters. This can be achieved using TCA:

'columns' => [
    'bodytext' => [
        'config' => [
            'max' => 250,
        ],
    ],
],

In order to create barrier-free websites, it is necessary to be able to mark language changes in the text. In order to ensure this requirement and to enable the editor to mark language changes in the text, the RTE is activated for the text field. However, it is now no longer possible to assign a maximum number of characters via TCA to the text field.

In former TYPO3 versions that used CKeditor4, there was a plugin with which, among other things, the maximum number of characters could be set (https://ckeditor.com/cke4/addon/wordcount).

editor:
     external plugins:
         wordcount:
             maxCharCount: 250

From TYPO3 v12 onwards, CKEditor5 is used, which comes with a plugin of the same name as standard. However, this only contains a fraction of the configuration options of the plugin for CKeditor4. Among other things, there is no option to define a maximum number of characters:
https://ckeditor.com/docs/ckeditor5/latest/features/word-count.html

Workaround:
My current workaround is to add a description for the field in the TCA, which tells the editor the intended maximum number of characters. However, the editor can insert any amount of text in the RTE field. In the Fluid template, the text is then shortened using Fluid ViewHelper:

{data.bodytext -> f:format.crop(maxCharacters: '250', respectWordBoundaries: '1')}

Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #102170: CKEditor5: wordCount plugin does not work after updating to TYPO3 v12.4.7ClosedBenjamin Franzke2023-10-14

Actions
Actions

Also available in: Atom PDF