Skip to content

Commit

Permalink
[BUGFIX] Add font plugin to CKEditor5
Browse files Browse the repository at this point in the history
Add the configuration to the "Full" RTE preset, and also
include some modules that missed in Full preset since #102099.

npm install --save @ckeditor/ckeditor5-font@41.1.0
npm run build

Resolves: #100847
Releases: main, 12.4
Change-Id: Iaa56d48e043397aefb902b6c9a5afbfcc453ae74
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/79006
Tested-by: core-ci <typo3@b13.com>
Reviewed-by: Torben Hansen <derhansen@gmail.com>
Tested-by: David Bruchmann <david.bruchmann@gmail.com>
Reviewed-by: Benjamin Franzke <ben@bnf.dev>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Guido Schmechel <guido.schmechel@brandung.de>
Reviewed-by: David Bruchmann <david.bruchmann@gmail.com>
Tested-by: Benni Mack <benni@typo3.org>
Tested-by: Benjamin Franzke <ben@bnf.dev>
Tested-by: Torben Hansen <derhansen@gmail.com>
Reviewed-by: Guido Schmechel <guido.schmechel@brandung.de>
  • Loading branch information
FlyKasual authored and bnf committed Feb 19, 2024
1 parent 038d7ac commit f2c2786
Show file tree
Hide file tree
Showing 67 changed files with 272 additions and 62 deletions.
9 changes: 9 additions & 0 deletions Build/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Build/package.json
Expand Up @@ -96,6 +96,7 @@
"@ckeditor/ckeditor5-engine": "^41.1.0",
"@ckeditor/ckeditor5-essentials": "^41.1.0",
"@ckeditor/ckeditor5-find-and-replace": "^41.1.0",
"@ckeditor/ckeditor5-font": "^41.1.0",
"@ckeditor/ckeditor5-heading": "^41.1.0",
"@ckeditor/ckeditor5-horizontal-line": "^41.1.0",
"@ckeditor/ckeditor5-html-support": "^41.1.0",
Expand Down
1 change: 1 addition & 0 deletions Build/web-test-runner.config.mjs
Expand Up @@ -151,6 +151,7 @@ export default {
'@ckeditor/ckeditor5-enter': './typo3/rte_ckeditor/Resources/Public/Contrib/@ckeditor/ckeditor5-enter.js',
'@ckeditor/ckeditor5-essentials': './typo3/rte_ckeditor/Resources/Public/Contrib/@ckeditor/ckeditor5-essentials.js',
'@ckeditor/ckeditor5-find-and-replace': './typo3/rte_ckeditor/Resources/Public/Contrib/@ckeditor/ckeditor5-find-and-replace.js',
'@ckeditor/ckeditor5-font': './typo3/rte_ckeditor/Resources/Public/Contrib/@ckeditor/ckeditor5-font.js',
'@ckeditor/ckeditor5-heading': './typo3/rte_ckeditor/Resources/Public/Contrib/@ckeditor/ckeditor5-heading.js',
'@ckeditor/ckeditor5-horizontal-line': './typo3/rte_ckeditor/Resources/Public/Contrib/@ckeditor/ckeditor5-horizontal-line.js',
'@ckeditor/ckeditor5-html-support': './typo3/rte_ckeditor/Resources/Public/Contrib/@ckeditor/ckeditor5-html-support.js',
Expand Down
16 changes: 12 additions & 4 deletions typo3/sysext/core/Classes/Configuration/CKEditor5Migrator.php
Expand Up @@ -160,11 +160,11 @@ class CKEditor5Migrator
// styles
'Styles' => 'style',
'Format' => 'heading',
'Font' => null,
'FontSize' => null,
'Font' => 'fontFamily',
'FontSize' => 'fontSize',
// colors
'TextColor' => null,
'BGColor' => null,
'TextColor' => 'fontColor',
'BGColor' => 'fontBackgroundColor',
// tools
'Maximize' => null,
'ShowBlocks' => null,
Expand Down Expand Up @@ -202,6 +202,14 @@ class CKEditor5Migrator
'module' => '@ckeditor/ckeditor5-link',
'exports' => [ 'AutoLink' ],
],
'font' => [
'module' => '@ckeditor/ckeditor5-font',
'exports' => [ 'Font' ],
],
'Font' => [
'module' => '@ckeditor/ckeditor5-font',
'exports' => [ 'Font' ],
],
'justify' => [
'module' => '@ckeditor/ckeditor5-alignment',
'exports' => [ 'Alignment' ],
Expand Down
@@ -0,0 +1,62 @@
.. include:: /Includes.rst.txt

.. _important-100847-1686218342:

===================================================
Important: #100847 - Added font plugin to CKEditor5
===================================================

See :issue:`100847`

Description
===========

The font plugin has been added to the CKEditor5.
In order to use the font plugin, the RTE configuration needs to be adapted:

.. code-block:: yaml
editor:
config:
toolbar:
items:
# add button to select font family
- fontFamily
# add button to select font size
- fontSize
# add button to select font color
- fontColor
# add button to select font background color
- fontBackgroundColor
fontColor:
colors:
- { label: 'Orange', color: '#ff8700' }
- { label: 'Blue', color: '#0080c9' }
- { label: 'Green', color: '#209d44' }
fontBackgroundColor:
colors:
- { label: 'Stage orange light', color: '#fab85c' }
fontFamily:
options:
- 'default'
- 'Arial, sans-serif'
fontSize:
options:
- 'default'
- 18
- 21
importModules:
- { 'module': '@ckeditor/ckeditor5-font', 'exports': ['Font'] }
More information can be found in the official documentation_.


.. _documentation: https://ckeditor.com/docs/ckeditor5/latest/features/font.html

.. index:: RTE, ext:rte_ckeditor
Expand Up @@ -757,6 +757,8 @@ public static function migrationDataProvider(): array
'items' => [
'style',
'heading',
'fontFamily',
'fontSize',
'|',
'bold',
'italic',
Expand Down Expand Up @@ -890,6 +892,8 @@ public static function migrationDataProvider(): array
'-',
'style',
'heading',
'fontFamily',
'fontSize',
],
'removeItems' => [],
'shouldNotGroupWhenFull' => true,
Expand Down
Expand Up @@ -27,6 +27,7 @@
'@ckeditor/ckeditor5-enter' => 'EXT:rte_ckeditor/Resources/Public/Contrib/@ckeditor/ckeditor5-enter.js',
'@ckeditor/ckeditor5-essentials' => 'EXT:rte_ckeditor/Resources/Public/Contrib/@ckeditor/ckeditor5-essentials.js',
'@ckeditor/ckeditor5-find-and-replace' => 'EXT:rte_ckeditor/Resources/Public/Contrib/@ckeditor/ckeditor5-find-and-replace.js',
'@ckeditor/ckeditor5-font' => 'EXT:rte_ckeditor/Resources/Public/Contrib/@ckeditor/ckeditor5-font.js',
'@ckeditor/ckeditor5-heading' => 'EXT:rte_ckeditor/Resources/Public/Contrib/@ckeditor/ckeditor5-heading.js',
'@ckeditor/ckeditor5-horizontal-line' => 'EXT:rte_ckeditor/Resources/Public/Contrib/@ckeditor/ckeditor5-horizontal-line.js',
'@ckeditor/ckeditor5-html-support' => 'EXT:rte_ckeditor/Resources/Public/Contrib/@ckeditor/ckeditor5-html-support.js',
Expand Down
30 changes: 30 additions & 0 deletions typo3/sysext/rte_ckeditor/Configuration/RTE/Full.yaml
Expand Up @@ -70,6 +70,10 @@ editor:
- '-'
- style
- heading
- fontFamily
- fontBackgroundColor
- fontColor
- fontSize

alignment:
options:
Expand All @@ -87,3 +91,29 @@ editor:
- tableProperties
- tableCellProperties
- toggleTableCaption

fontColor:
colors:
- { label: 'Orange', color: '#ff8700' }
- { label: 'Blue', color: '#0080c9' }
- { label: 'Green', color: '#209d44' }

fontBackgroundColor:
colors:
- { label: 'Stage orange light', color: '#fab85c' }

fontFamily:
options:
- 'default'
- 'Arial, sans-serif'

fontSize:
options:
- 'default'
- 18
- 21

importModules:
- { 'module': '@ckeditor/ckeditor5-font', 'exports': ['Font'] }
- { 'module': '@ckeditor/ckeditor5-show-blocks', 'exports': ['ShowBlocks'] }
- { 'module': '@ckeditor/ckeditor5-word-count', 'exports': ['WordCount'] }

0 comments on commit f2c2786

Please sign in to comment.