|
|
@@ -16,15 +16,21 @@ import ElementReplacer from '@ckeditor/ckeditor5-utils/src/elementreplacer';
|
|
|
import '../theme/theme.scss';
|
|
|
|
|
|
/**
|
|
|
- * Classic editor. Uses an inline editable and a sticky toolbar, all
|
|
|
+ * {@glink builds/guides/overview#Classic-editor Classic editor} - uses an inline editable and a sticky toolbar, all
|
|
|
* enclosed in a boxed UI.
|
|
|
*
|
|
|
+ * In order to create a Classic editor, use the
|
|
|
+ * {@link module:editor-classic/classiceditor~ClassicEditor#create ClassicEditor.create()} method.
|
|
|
+ *
|
|
|
* @extends module:core/editor/standardeditor~StandardEditor
|
|
|
*/
|
|
|
export default class ClassicEditor extends StandardEditor {
|
|
|
/**
|
|
|
* Creates an instance of the classic editor.
|
|
|
*
|
|
|
+ * <strong>Note:</strong> do not use the constructor to create editor instances. Use static
|
|
|
+ * {@link module:editor-classic/classiceditor~ClassicEditor#create `ClassicEditor.create()`} method instead.
|
|
|
+ *
|
|
|
* @param {HTMLElement} element The DOM element that will be the source for the created editor.
|
|
|
* The data will be loaded from it and loaded back to it once the editor is destroyed.
|
|
|
* @param {Object} config The editor configuration.
|
|
|
@@ -63,16 +69,36 @@ export default class ClassicEditor extends StandardEditor {
|
|
|
/**
|
|
|
* Creates a classic editor instance.
|
|
|
*
|
|
|
- * ClassicEditor.create( document.querySelector( '#editor' ), {
|
|
|
- * plugins: [ Delete, Enter, Typing, Paragraph, Undo, Bold, Italic ],
|
|
|
- * toolbar: [ 'bold', 'italic', 'undo', 'redo' ]
|
|
|
- * } )
|
|
|
- * .then( editor => {
|
|
|
- * console.log( 'Editor was initialized', editor );
|
|
|
- * } )
|
|
|
- * .catch( err => {
|
|
|
- * console.error( err.stack );
|
|
|
- * } );
|
|
|
+ * Creating instance when using {@glink builds/index CKEditor build}:
|
|
|
+ *
|
|
|
+ * ClassicEditor
|
|
|
+ * .create( document.querySelector( '#editor' ) )
|
|
|
+ * .then( editor => {
|
|
|
+ * console.log( 'Editor was initialized', editor );
|
|
|
+ * } )
|
|
|
+ * .catch( err => {
|
|
|
+ * console.error( err.stack );
|
|
|
+ * } );
|
|
|
+ *
|
|
|
+ * Creating instance when using CKEditor from source (make sure to specify the list of plugins to load and the toolbar):
|
|
|
+ *
|
|
|
+ * 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 ...
|
|
|
+ *
|
|
|
+ * ClassicEditor
|
|
|
+ * .create( document.querySelector( '#editor' ), {
|
|
|
+ * plugins: [ Essentials, Bold, Italic, ... ],
|
|
|
+ * toolbar: [ 'bold', 'italic', ... ]
|
|
|
+ * } )
|
|
|
+ * .then( editor => {
|
|
|
+ * console.log( 'Editor was initialized', editor );
|
|
|
+ * } )
|
|
|
+ * .catch( err => {
|
|
|
+ * console.error( err.stack );
|
|
|
+ * } );
|
|
|
*
|
|
|
* @param {HTMLElement} element See {@link module:editor-classic/classiceditor~ClassicEditor#constructor}'s parameters.
|
|
|
* @param {Object} config See {@link module:editor-classic/classiceditor~ClassicEditor#constructor}'s parameters.
|