@ckeditor/ckeditor5-editor-decoupled
Advanced tools
Comparing version 10.0.2 to 11.0.0
Changelog | ||
========= | ||
## [11.0.0](https://github.com/ckeditor/ckeditor5-editor-decoupled/compare/v10.0.2...v11.0.0) (2018-07-18) | ||
### Other changes | ||
* Aligned `DecoupledEditor` to changes in the `EditorWithUI` and `ElementApi` interfaces. ([8c7414b](https://github.com/ckeditor/ckeditor5-editor-decoupled/commit/8c7414b)) | ||
* Used the `EditorUI` as a parent class for the `DecoupledEditorUI` (see [ckeditor/ckeditor5-core#130](https://github.com/ckeditor/ckeditor5-core/issues/130)). ([d92da9f](https://github.com/ckeditor/ckeditor5-editor-decoupled/commit/d92da9f)) | ||
### BREAKING CHANGES | ||
* The `DecoupledEditor#element` property was renamed to `DecoupledEditor#sourceElement`. See [ckeditor/ckeditor5-core#64](https://github.com/ckeditor/ckeditor5-core/issues/64). | ||
## [10.0.2](https://github.com/ckeditor/ckeditor5-editor-decoupled/compare/v10.0.1...v10.0.2) (2018-06-21) | ||
@@ -5,0 +17,0 @@ |
{ | ||
"name": "@ckeditor/ckeditor5-editor-decoupled", | ||
"version": "10.0.2", | ||
"version": "11.0.0", | ||
"description": "Decoupled editor implementation for CKEditor 5.", | ||
@@ -12,15 +12,15 @@ "keywords": [ | ||
"dependencies": { | ||
"@ckeditor/ckeditor5-core": "^10.1.0", | ||
"@ckeditor/ckeditor5-engine": "^10.1.0", | ||
"@ckeditor/ckeditor5-theme-lark": "^10.1.0", | ||
"@ckeditor/ckeditor5-ui": "^10.1.0", | ||
"@ckeditor/ckeditor5-utils": "^10.1.0" | ||
"@ckeditor/ckeditor5-core": "^11.0.0", | ||
"@ckeditor/ckeditor5-engine": "^10.2.0", | ||
"@ckeditor/ckeditor5-theme-lark": "^11.0.0", | ||
"@ckeditor/ckeditor5-ui": "^11.0.0", | ||
"@ckeditor/ckeditor5-utils": "^10.2.0" | ||
}, | ||
"devDependencies": { | ||
"@ckeditor/ckeditor5-basic-styles": "^10.0.1", | ||
"@ckeditor/ckeditor5-enter": "^10.1.0", | ||
"@ckeditor/ckeditor5-heading": "^10.0.1", | ||
"@ckeditor/ckeditor5-paragraph": "^10.0.1", | ||
"@ckeditor/ckeditor5-typing": "^10.0.1", | ||
"@ckeditor/ckeditor5-undo": "^10.0.1", | ||
"@ckeditor/ckeditor5-basic-styles": "^10.0.2", | ||
"@ckeditor/ckeditor5-enter": "^10.1.1", | ||
"@ckeditor/ckeditor5-heading": "^10.0.2", | ||
"@ckeditor/ckeditor5-paragraph": "^10.0.2", | ||
"@ckeditor/ckeditor5-typing": "^11.0.0", | ||
"@ckeditor/ckeditor5-undo": "^10.0.2", | ||
"eslint": "^4.15.0", | ||
@@ -32,3 +32,3 @@ "eslint-config-ckeditor5": "^1.0.7", | ||
"engines": { | ||
"node": ">=6.0.0", | ||
"node": ">=6.9.0", | ||
"npm": ">=3.0.0" | ||
@@ -35,0 +35,0 @@ }, |
@@ -60,22 +60,12 @@ /** | ||
* @protected | ||
* @param {HTMLElement|String} elementOrData The DOM element that serves as an editable. | ||
* The data will be loaded from it and loaded back to it once the editor is destroyed. | ||
* Alternatively, a data string to be loaded into the editor. | ||
* @param {HTMLElement|String} sourceElementOrData The DOM element that will be the source for the created editor | ||
* (on which the editor will be initialized) or initial data for the editor. For more information see | ||
* {@link module:editor-balloon/ballooneditor~BalloonEditor.create `BalloonEditor.create()`}. | ||
* @param {module:core/editor/editorconfig~EditorConfig} config The editor configuration. | ||
*/ | ||
constructor( elementOrData, config ) { | ||
constructor( sourceElementOrData, config ) { | ||
super( config ); | ||
if ( isElement( elementOrData ) ) { | ||
/** | ||
* The element used as an editable. The data will be loaded from it and loaded back to | ||
* it once the editor is destroyed. | ||
* | ||
* **Note:** The property is available only when such element has been passed | ||
* to the {@link #constructor}. | ||
* | ||
* @readonly | ||
* @member {HTMLElement} | ||
*/ | ||
this.element = elementOrData; | ||
if ( isElement( sourceElementOrData ) ) { | ||
this.sourceElement = sourceElementOrData; | ||
} | ||
@@ -87,6 +77,15 @@ | ||
this.ui = new DecoupledEditorUI( this, new DecoupledEditorUIView( this.locale, this.element ) ); | ||
this.ui = new DecoupledEditorUI( this, new DecoupledEditorUIView( this.locale, this.sourceElement ) ); | ||
} | ||
/** | ||
* @inheritDoc | ||
*/ | ||
get element() { | ||
// This editor has no single "main UI element". Its editable and toolbar are exposed separately and need | ||
// to be added to the DOM manually by the consumer. | ||
return null; | ||
} | ||
/** | ||
* Destroys the editor instance, releasing all resources used by it. | ||
@@ -119,4 +118,4 @@ * | ||
.then( () => { | ||
if ( this.element ) { | ||
setDataInElement( this.element, data ); | ||
if ( this.sourceElement ) { | ||
setDataInElement( this.sourceElement, data ); | ||
} | ||
@@ -129,3 +128,3 @@ } ); | ||
* | ||
* Creating an instance when using the {@glink builds/index CKEditor 5 build}: | ||
* Creating an instance when using a {@glink builds/index CKEditor 5 build}: | ||
* | ||
@@ -185,5 +184,11 @@ * DecoupledEditor | ||
* | ||
* @param {HTMLElement|String} elementOrData The DOM element that serves as an editable. | ||
* The data will be loaded from it and loaded back to it once the editor is destroyed. | ||
* Alternatively, a data string to be loaded into the editor. | ||
* @param {HTMLElement|String} sourceElementOrData The DOM element that will be the source for the created editor | ||
* (on which the editor will be initialized) or initial data for the editor. | ||
* | ||
* If a source element is passed, then its contents will be automatically | ||
* {@link module:editor-decoupled/decouplededitor~DecoupledEditor#setData loaded} to the editor on startup and the element | ||
* itself will be used as the editor's editable element. | ||
* | ||
* If data is provided, then `editor.ui.view.editable.element` will be created automatically and needs to be added | ||
* to the DOM manually. | ||
* @param {module:core/editor/editorconfig~EditorConfig} config The editor configuration. | ||
@@ -193,5 +198,5 @@ * @returns {Promise} A promise resolved once the editor is ready. | ||
*/ | ||
static create( elementOrData, config ) { | ||
static create( sourceElementOrData, config ) { | ||
return new Promise( resolve => { | ||
const editor = new this( elementOrData, config ); | ||
const editor = new this( sourceElementOrData, config ); | ||
@@ -205,3 +210,7 @@ resolve( | ||
.then( () => { | ||
return editor.data.init( editor.element ? getDataFromElement( editor.element ) : elementOrData ); | ||
const initialData = isElement( sourceElementOrData ) ? | ||
getDataFromElement( sourceElementOrData ) : | ||
sourceElementOrData; | ||
return editor.data.init( initialData ); | ||
} ) | ||
@@ -208,0 +217,0 @@ .then( () => { |
@@ -10,4 +10,3 @@ /** | ||
import ComponentFactory from '@ckeditor/ckeditor5-ui/src/componentfactory'; | ||
import FocusTracker from '@ckeditor/ckeditor5-utils/src/focustracker'; | ||
import EditorUI from '@ckeditor/ckeditor5-core/src/editor/editorui'; | ||
import enableToolbarKeyboardFocus from '@ckeditor/ckeditor5-ui/src/toolbar/enabletoolbarkeyboardfocus'; | ||
@@ -19,33 +18,12 @@ import normalizeToolbarConfig from '@ckeditor/ckeditor5-ui/src/toolbar/normalizetoolbarconfig'; | ||
* | ||
* @implements module:core/editor/editorui~EditorUI | ||
* @extends module:core/editor/editorui~EditorUI | ||
*/ | ||
export default class DecoupledEditorUI { | ||
export default class DecoupledEditorUI extends EditorUI { | ||
/** | ||
* Creates an instance of the editor UI class. | ||
* | ||
* @param {module:core/editor/editor~Editor} editor The editor instance. | ||
* @param {module:ui/editorui/editoruiview~EditorUIView} view The view of the UI. | ||
* @inheritDoc | ||
*/ | ||
constructor( editor, view ) { | ||
/** | ||
* @inheritDoc | ||
*/ | ||
this.editor = editor; | ||
super( editor, view ); | ||
/** | ||
* @inheritDoc | ||
*/ | ||
this.view = view; | ||
/** | ||
* @inheritDoc | ||
*/ | ||
this.componentFactory = new ComponentFactory( editor ); | ||
/** | ||
* @inheritDoc | ||
*/ | ||
this.focusTracker = new FocusTracker(); | ||
/** | ||
* A normalized `config.toolbar` object. | ||
@@ -85,9 +63,2 @@ * | ||
} | ||
/** | ||
* Destroys the UI. | ||
*/ | ||
destroy() { | ||
this.view.destroy(); | ||
} | ||
} |
@@ -31,3 +31,4 @@ /** | ||
* @param {module:utils/locale~Locale} locale The {@link module:core/editor/editor~Editor#locale} instance. | ||
* @param {HTMLElement} [editableElement] The DOM element to be used as editable. | ||
* @param {HTMLElement} [editableElement] The editable element. If not specified, it will be automatically created by | ||
* {@link module:ui/editableui/editableuiview~EditableUIView}. Otherwise, the given element will be used. | ||
*/ | ||
@@ -34,0 +35,0 @@ constructor( locale, editableElement ) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20998
322
+ Added@ckeditor/ckeditor5-core@11.1.0(transitive)
+ Added@ckeditor/ckeditor5-engine@12.0.0(transitive)
+ Added@ckeditor/ckeditor5-theme-lark@11.1.012.0.0(transitive)
+ Added@ckeditor/ckeditor5-ui@11.2.0(transitive)
+ Added@ckeditor/ckeditor5-utils@11.1.0(transitive)
+ Addedlodash-es@4.17.21(transitive)
- Removed@ckeditor/ckeditor5-core@10.1.0(transitive)
- Removed@ckeditor/ckeditor5-theme-lark@10.1.0(transitive)
- Removed@ckeditor/ckeditor5-ui@10.1.0(transitive)