From dc1f8e95331a3b33ae2e27ecafc4a333f03a5abf Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Sat, 20 Mar 2021 22:07:20 +0100 Subject: [PATCH] webpack installation of ckeditor5 --- .../modules/ckeditor5/ckeditor5/index.js | 29 +++++++++++++++++++ .../ChillMainBundle/chill.webpack.config.js | 5 ++-- 2 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 src/Bundle/ChillMainBundle/Resources/public/modules/ckeditor5/ckeditor5/index.js diff --git a/src/Bundle/ChillMainBundle/Resources/public/modules/ckeditor5/ckeditor5/index.js b/src/Bundle/ChillMainBundle/Resources/public/modules/ckeditor5/ckeditor5/index.js new file mode 100644 index 000000000..fb4fbc110 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Resources/public/modules/ckeditor5/ckeditor5/index.js @@ -0,0 +1,29 @@ +//require('@ckeditor/ckeditor5-editor-classic/theme/classiceditor.css'); + +import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor'; +import Essentials from '@ckeditor/ckeditor5-essentials/src/essentials'; +import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold'; +import Italic from '@ckeditor/ckeditor5-basic-styles/src/italic'; +import Markdown from '@ckeditor/ckeditor5-markdown-gfm/src/markdown'; +//require('./ckeditor5.css'); + +let Fields = document.querySelectorAll('textarea'); + +Fields.forEach(function(field) { + ClassicEditor + .create( field, { + plugins: [ + Markdown, + Essentials, + Bold, + Italic, + ], + } ) + .then( editor => { + console.log( editor ); + }) + .catch( error => { + console.error( error ); + }) + ; +}) diff --git a/src/Bundle/ChillMainBundle/chill.webpack.config.js b/src/Bundle/ChillMainBundle/chill.webpack.config.js index f65ef3b24..ec268b99d 100644 --- a/src/Bundle/ChillMainBundle/chill.webpack.config.js +++ b/src/Bundle/ChillMainBundle/chill.webpack.config.js @@ -5,11 +5,12 @@ module.exports = function(encore, entries) entries.push(__dirname + '/Resources/public/main.js'); encore - // Add new separate entries + // Add new separate entrypoints .addEntry('login', __dirname + '/Resources/public/modules/login_page/index.js') .addEntry('tabs', __dirname + '/Resources/public/modules/tabs/index.js') - // chill2 assets + // chill2 new assets + .addEntry('ckeditor5', __dirname + '/Resources/public/modules/ckeditor5/index.js') .addEntry('bootstrap', __dirname + '/Resources/public/modules/bootstrap/index.js') .addEntry('forkawesome', __dirname + '/Resources/public/modules/forkawesome/index.js')