diff --git a/package.json b/package.json index bcfe31cae..c7506351b 100644 --- a/package.json +++ b/package.json @@ -6,12 +6,6 @@ "@apidevtools/swagger-cli": "^4.0.4", "@babel/core": "^7.20.5", "@babel/preset-env": "^7.20.2", - "@ckeditor/ckeditor5-build-classic": "^44.1.0", - "@ckeditor/ckeditor5-dev-translations": "^43.0.1", - "@ckeditor/ckeditor5-dev-utils": "^43.0.1", - "@ckeditor/ckeditor5-dev-webpack-plugin": "^31.1.13", - "@ckeditor/ckeditor5-markdown-gfm": "^44.1.0", - "@ckeditor/ckeditor5-theme-lark": "^44.1.0", "@ckeditor/ckeditor5-vue": "^7.3.0", "@eslint/js": "^9.14.0", "@luminateone/eslint-baseline": "^1.0.9", @@ -23,6 +17,7 @@ "bindings": "^1.5.0", "bootstrap": "5.2.3", "chokidar": "^3.5.1", + "ckeditor5": "^44.1.0", "dompurify": "^3.1.0", "eslint": "^9.14.0", "eslint-config-prettier": "^9.1.0", diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/ckeditor5/editor_config.ts b/src/Bundle/ChillMainBundle/Resources/public/module/ckeditor5/editor_config.ts index 2ab3e0f22..2905153a0 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/module/ckeditor5/editor_config.ts +++ b/src/Bundle/ChillMainBundle/Resources/public/module/ckeditor5/editor_config.ts @@ -1,30 +1,24 @@ -import ClassicEditorBase from "@ckeditor/ckeditor5-editor-classic/src/classiceditor"; -import EssentialsPlugin from "@ckeditor/ckeditor5-essentials/src/essentials"; -import MarkdownPlugin from "@ckeditor/ckeditor5-markdown-gfm/src/markdown"; -import BoldPlugin from "@ckeditor/ckeditor5-basic-styles/src/bold"; -import ItalicPlugin from "@ckeditor/ckeditor5-basic-styles/src/italic"; -import BlockQuotePlugin from "@ckeditor/ckeditor5-block-quote/src/blockquote"; -import HeadingPlugin from "@ckeditor/ckeditor5-heading/src/heading"; -import LinkPlugin from "@ckeditor/ckeditor5-link/src/link"; -import ListPlugin from "@ckeditor/ckeditor5-list/src/list"; -import ParagraphPlugin from "@ckeditor/ckeditor5-paragraph/src/paragraph"; +import { + Essentials, + Bold, + Italic, + Paragraph, + Mention, + Markdown, + BlockQuote, + Heading, + Link, + List, +} from 'ckeditor5'; +import coreTranslations from 'ckeditor5/translations/fr.js'; + +import 'ckeditor5/ckeditor5.css'; + import "./index.scss"; -export default class ClassicEditor extends ClassicEditorBase {} -ClassicEditor.builtinPlugins = [ - EssentialsPlugin, - MarkdownPlugin, - BoldPlugin, - ItalicPlugin, - BlockQuotePlugin, - HeadingPlugin, - LinkPlugin, - ListPlugin, - ParagraphPlugin, -]; - -ClassicEditor.defaultConfig = { +export default { + plugins: [Essentials, Markdown, Bold, Italic, BlockQuote, Heading, Link, List, Paragraph], toolbar: { items: [ "heading", @@ -39,6 +33,8 @@ ClassicEditor.defaultConfig = { "redo", ], }, - language: "fr", + translations: [ + coreTranslations + ], licenseKey: "GPL", -}; +} ; diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/ckeditor5/index.ts b/src/Bundle/ChillMainBundle/Resources/public/module/ckeditor5/index.ts index 7671557ae..9b849c8f7 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/module/ckeditor5/index.ts +++ b/src/Bundle/ChillMainBundle/Resources/public/module/ckeditor5/index.ts @@ -1,14 +1,13 @@ -import ClassicEditor from "./editor_config"; +import config from "./editor_config"; +import {ClassicEditor} from "ckeditor5"; const ckeditorFields: NodeListOf = document.querySelectorAll("textarea[ckeditor]"); ckeditorFields.forEach((field: HTMLTextAreaElement): void => { - ClassicEditor.create(field) - .then((editor) => { - //console.log( 'CkEditor was initialized', editor ); - }) + ClassicEditor.create(field, config) .catch((error) => { console.error(error.stack); + throw error; }); }); //Fields.push.apply(Fields, document.querySelectorAll('.cf-fields textarea')); diff --git a/src/Bundle/ChillMainBundle/chill.webpack.config.js b/src/Bundle/ChillMainBundle/chill.webpack.config.js index ee640e677..88b537932 100644 --- a/src/Bundle/ChillMainBundle/chill.webpack.config.js +++ b/src/Bundle/ChillMainBundle/chill.webpack.config.js @@ -1,45 +1,3 @@ -const { styles } = require("@ckeditor/ckeditor5-dev-utils"); -const { - CKEditorTranslationsPlugin, -} = require("@ckeditor/ckeditor5-dev-translations"); - -buildCKEditor = function (encore) { - encore - .addPlugin( - new CKEditorTranslationsPlugin({ - language: "fr", - addMainLanguageTranslationsToAllAssets: true, - verbose: !encore.isProduction(), - strict: true, - }), - ) - - // Use raw-loader for CKEditor 5 SVG files. - .addRule({ - test: /ckeditor5-[^/\\]+[/\\]theme[/\\]icons[/\\][^/\\]+\.svg$/, - loader: "raw-loader", - }) - - // Configure other image loaders to exclude CKEditor 5 SVG files. - .configureLoaderRule("images", (loader) => { - loader.exclude = - /ckeditor5-[^/\\]+[/\\]theme[/\\]icons[/\\][^/\\]+\.svg$/; - }) - - // Configure PostCSS loader. - .addLoader({ - test: /ckeditor5-[^/\\]+[/\\]theme[/\\].+\.css$/, - loader: "postcss-loader", - options: { - postcssOptions: styles.getPostCssConfig({ - themeImporter: { - themePath: require.resolve("@ckeditor/ckeditor5-theme-lark"), - }, - minify: true, - }), - }, - }); -}; // Compile and loads all assets from the Chill Main Bundle module.exports = function (encore, entries) { @@ -79,8 +37,6 @@ module.exports = function (encore, entries) { __dirname + "/Resources/public/page/export/download-export.js", ); - buildCKEditor(encore); - // Modules entrypoints encore.addEntry( "mod_collection", diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Comment.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Comment.vue index b63061888..f8914faae 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Comment.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Comment.vue @@ -16,7 +16,8 @@ @@ -60,8 +61,9 @@