|
|
@@ -14,22 +14,28 @@ import getDataFromElement from '../utils/dom/getdatafromelement.js';
|
|
|
import setDataInElement from '../utils/dom/setdatainelement.js';
|
|
|
|
|
|
/**
|
|
|
- * Represents a single editor instance.
|
|
|
+ * Class representing a typical browser-based editor. It handles a single source element and
|
|
|
+ * uses {@link engine.EditingController}.
|
|
|
*
|
|
|
- * @memberOf ckeditor5
|
|
|
- * @mixes utils.ObservaleMixin
|
|
|
+ * @memberOf ckeditor5.editor
|
|
|
*/
|
|
|
export default class StandardEditor extends Editor {
|
|
|
/**
|
|
|
- * Creates a new instance of the Editor class.
|
|
|
+ * Creates a new instance of the standard editor.
|
|
|
*
|
|
|
- * @param {HTMLElement} [element] The DOM element that will be the source
|
|
|
+ * @param {HTMLElement} element The DOM element that will be the source
|
|
|
* for the created editor.
|
|
|
* @param {Object} config The editor config.
|
|
|
*/
|
|
|
constructor( element, config ) {
|
|
|
super( config );
|
|
|
|
|
|
+ /**
|
|
|
+ * The element on which the editor has been initialized.
|
|
|
+ *
|
|
|
+ * @readonly
|
|
|
+ * @member {HTMLElement} ckeditor5.editor.StandardEditor#element
|
|
|
+ */
|
|
|
this.element = element;
|
|
|
|
|
|
/**
|
|
|
@@ -49,6 +55,15 @@ export default class StandardEditor extends Editor {
|
|
|
this.keystrokes = new KeystrokeHandler( this );
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @inheritDoc
|
|
|
+ */
|
|
|
+ destroy() {
|
|
|
+ return Promise.resolve()
|
|
|
+ .then( () => this.editing.destroy() )
|
|
|
+ .then( super.destroy() );
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Sets the data in the editor's main root.
|
|
|
*
|
|
|
@@ -57,7 +72,7 @@ export default class StandardEditor extends Editor {
|
|
|
setData( data ) {
|
|
|
if ( !this.data ) {
|
|
|
/**
|
|
|
- * Data controller has not been defined yet, so methds like {@link ckeditor5.editor.StandardEditor#setData} and
|
|
|
+ * Data controller has not been defined yet, so methods like {@link ckeditor5.editor.StandardEditor#setData} and
|
|
|
* {@link ckeditor5.editor.StandardEditor#getData} cannot be used.
|
|
|
*
|
|
|
* @error editor-no-datacontroller
|
|
|
@@ -80,16 +95,28 @@ export default class StandardEditor extends Editor {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Updates the {@link ckeditor5.Editor#element editor element}'s content with the data.
|
|
|
+ * Updates the {@link ckeditor5.editor.StandardEditor#element editor element}'s content with the data.
|
|
|
*/
|
|
|
updateEditorElement() {
|
|
|
setDataInElement( this.element, this.getData() );
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Loads the data from the {@link ckeditor5.Editor#element editor element} to the main root.
|
|
|
+ * Loads the data from the {@link ckeditor5.editor.StandardEditor#element editor element} to the main root.
|
|
|
*/
|
|
|
loadDataFromEditorElement() {
|
|
|
this.setData( getDataFromElement( this.element ) );
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Creates a standard editor instance.
|
|
|
+ *
|
|
|
+ * @abstract
|
|
|
+ * @static
|
|
|
+ * @method #create
|
|
|
+ * @param {HTMLElement} element See {@link ckeditor5.editor.StandardEditor}'s param.
|
|
|
+ * @param {Object} config See {@link ckeditor5.editor.StandardEditor}'s param.
|
|
|
+ * @returns {Promise} Promise resolved once editor is ready.
|
|
|
+ * @returns {ckeditor5.editor.StandardEditor} return.editor The editor instance.
|
|
|
+ */
|
|
|
}
|