Started to use CKEditor 5 as richt text editor.

This commit is contained in:
Jan Böhmer 2022-07-25 01:09:31 +02:00
parent 156301b8a4
commit dbdfe5ea95
9 changed files with 1575 additions and 49 deletions

View file

@ -25,6 +25,8 @@ const CopyPlugin = require('copy-webpack-plugin');
const zlib = require('zlib');
const CompressionPlugin = require("compression-webpack-plugin");
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const CKEditorWebpackPlugin = require( '@ckeditor/ckeditor5-dev-webpack-plugin' );
const { styles } = require( '@ckeditor/ckeditor5-dev-utils' );
// Manually configure the runtime environment if not already configured yet by the "encore" command.
// It's useful when you use tools that rely on webpack.config.js file.
@ -124,8 +126,43 @@ Encore
// uncomment if you're having problems with a jQuery plugin
.autoProvidejQuery()
.addPlugin( new CKEditorWebpackPlugin( {
// See https://ckeditor.com/docs/ckeditor5/latest/features/ui-language.html
language: 'en',
addMainLanguageTranslationsToAllAssets: true,
additionalLanguages: 'all'
} ) )
// 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
} )
}
} )
;
//Copy bootstrap map if in debug mode
if (Encore.isDev()) {
Encore.addPlugin(new CopyPlugin({