-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Simplified the structure of a build's source files #46
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,67 +5,77 @@ | |
|
||
import ClassicEditorBase from '@ckeditor/ckeditor5-editor-classic/src/classiceditor'; | ||
import EssentialsPlugin from '@ckeditor/ckeditor5-essentials/src/essentials'; | ||
import UploadadapterPlugin from '@ckeditor/ckeditor5-adapter-ckfinder/src/uploadadapter'; | ||
import UploadAdapterPlugin from '@ckeditor/ckeditor5-adapter-ckfinder/src/uploadadapter'; | ||
import AutoformatPlugin from '@ckeditor/ckeditor5-autoformat/src/autoformat'; | ||
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 EasyimagePlugin from '@ckeditor/ckeditor5-easy-image/src/easyimage'; | ||
import BlockQuotePlugin from '@ckeditor/ckeditor5-block-quote/src/blockquote'; | ||
import EasyImagePlugin from '@ckeditor/ckeditor5-easy-image/src/easyimage'; | ||
import HeadingPlugin from '@ckeditor/ckeditor5-heading/src/heading'; | ||
import ImagePlugin from '@ckeditor/ckeditor5-image/src/image'; | ||
import ImagecaptionPlugin from '@ckeditor/ckeditor5-image/src/imagecaption'; | ||
import ImagestylePlugin from '@ckeditor/ckeditor5-image/src/imagestyle'; | ||
import ImagetoolbarPlugin from '@ckeditor/ckeditor5-image/src/imagetoolbar'; | ||
import ImageuploadPlugin from '@ckeditor/ckeditor5-image/src/imageupload'; | ||
import ImageCaptionPlugin from '@ckeditor/ckeditor5-image/src/imagecaption'; | ||
import ImageStylePlugin from '@ckeditor/ckeditor5-image/src/imagestyle'; | ||
import ImageToolbarPlugin from '@ckeditor/ckeditor5-image/src/imagetoolbar'; | ||
import ImageUploadPlugin from '@ckeditor/ckeditor5-image/src/imageupload'; | ||
import LinkPlugin from '@ckeditor/ckeditor5-link/src/link'; | ||
import ListPlugin from '@ckeditor/ckeditor5-list/src/list'; | ||
import ParagraphPlugin from '@ckeditor/ckeditor5-paragraph/src/paragraph'; | ||
|
||
export default class ClassicEditor extends ClassicEditorBase {} | ||
|
||
ClassicEditor.build = { | ||
plugins: [ | ||
EssentialsPlugin, | ||
UploadadapterPlugin, | ||
AutoformatPlugin, | ||
BoldPlugin, | ||
ItalicPlugin, | ||
BlockquotePlugin, | ||
EasyimagePlugin, | ||
HeadingPlugin, | ||
ImagePlugin, | ||
ImagecaptionPlugin, | ||
ImagestylePlugin, | ||
ImagetoolbarPlugin, | ||
ImageuploadPlugin, | ||
LinkPlugin, | ||
ListPlugin, | ||
ParagraphPlugin | ||
], | ||
config: { | ||
toolbar: { | ||
items: [ | ||
'heading', | ||
'|', | ||
'bold', | ||
'italic', | ||
'link', | ||
'bulletedList', | ||
'numberedList', | ||
'imageUpload', | ||
'blockQuote', | ||
'undo', | ||
'redo' | ||
] | ||
}, | ||
image: { | ||
toolbar: [ | ||
'imageStyle:full', | ||
'imageStyle:side', | ||
'|', | ||
'imageTextAlternative' | ||
] | ||
}, | ||
language: 'en' | ||
} | ||
// Plugins which will be automatically loaded when creating an instance of this editor build. | ||
// Note: New plugins should not be added to an existing editor build. They should be added at this stage. | ||
ClassicEditor.defaultPlugins = [ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like the idea of calling it "buildInPlugins" because this is exactly what it is, and emphasize the fact that you can not change it in the runtime. |
||
EssentialsPlugin, | ||
UploadAdapterPlugin, | ||
AutoformatPlugin, | ||
BoldPlugin, | ||
ItalicPlugin, | ||
BlockQuotePlugin, | ||
EasyImagePlugin, | ||
HeadingPlugin, | ||
ImagePlugin, | ||
ImageCaptionPlugin, | ||
ImageStylePlugin, | ||
ImageToolbarPlugin, | ||
ImageUploadPlugin, | ||
LinkPlugin, | ||
ListPlugin, | ||
ParagraphPlugin | ||
]; | ||
|
||
// The default configuration of this editor build. | ||
// It can be overridden by passing your own options to the `create()` method. | ||
// | ||
// See all the configuration options: | ||
// https://docs.ckeditor.com/ckeditor5/latest/api/module_core_editor_editorconfig-EditorConfig.html | ||
ClassicEditor.defaultConfig = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. However, I would not use |
||
toolbar: { | ||
items: [ | ||
'heading', | ||
'|', | ||
'bold', | ||
'italic', | ||
'link', | ||
'bulletedList', | ||
'numberedList', | ||
'imageUpload', | ||
'blockQuote', | ||
'undo', | ||
'redo' | ||
] | ||
}, | ||
image: { | ||
toolbar: [ | ||
'imageStyle:full', | ||
'imageStyle:side', | ||
'|', | ||
'imageTextAlternative' | ||
] | ||
}, | ||
|
||
// UI language. Language codes follow the https://en.wikipedia.org/wiki/ISO_639-1 format. | ||
// | ||
// See: https://docs.ckeditor.com/ckeditor5/latest/features/ui-language.html | ||
language: 'en' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we want to deduplicate it, this variable could be also overwritten by |
||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,24 +12,29 @@ const webpack = require( 'webpack' ); | |
const { bundler, styles } = require( '@ckeditor/ckeditor5-dev-utils' ); | ||
const CKEditorWebpackPlugin = require( '@ckeditor/ckeditor5-dev-webpack-plugin' ); | ||
const BabiliPlugin = require( 'babel-minify-webpack-plugin' ); | ||
const buildConfig = require( './build-config' ); | ||
|
||
module.exports = { | ||
devtool: 'source-map', | ||
|
||
entry: path.resolve( __dirname, 'src', 'ckeditor.js' ), | ||
|
||
output: { | ||
// The name under which the editor will be exported. | ||
library: 'ClassicEditor', | ||
|
||
path: path.resolve( __dirname, 'build' ), | ||
filename: 'ckeditor.js', | ||
libraryTarget: 'umd', | ||
libraryExport: 'default', | ||
library: buildConfig.moduleName | ||
libraryExport: 'default' | ||
}, | ||
|
||
plugins: [ | ||
new CKEditorWebpackPlugin( { | ||
language: buildConfig.config.language, | ||
// UI language. Language codes follow the https://en.wikipedia.org/wiki/ISO_639-1 format. | ||
// When changing the builtin language, remember to also change it in the ditor's config (src/ckeditor.js). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. // When changing the built-in language, remember to also change it in the editor's configuration (src/ckeditor.js). |
||
// | ||
// See: https://docs.ckeditor.com/ckeditor5/latest/features/ui-language.html | ||
language: 'en', | ||
additionalLanguages: 'all' | ||
} ), | ||
new BabiliPlugin( null, { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New plugins -> Additional plugins