@ckeditor/ckeditor5-engine
Advanced tools
Comparing version 16.0.0 to 17.0.0
@@ -5,3 +5,3 @@ Software License Agreement | ||
**CKEditor 5 Editing Engine** – https://github.com/ckeditor/ckeditor5-engine <br> | ||
Copyright (c) 2003-2019, [CKSource](http://cksource.com) Frederico Knabben. All rights reserved. | ||
Copyright (c) 2003-2020, [CKSource](http://cksource.com) Frederico Knabben. All rights reserved. | ||
@@ -8,0 +8,0 @@ Licensed under the terms of [GNU General Public License Version 2 or later](http://www.gnu.org/licenses/gpl.html). |
{ | ||
"name": "@ckeditor/ckeditor5-engine", | ||
"version": "16.0.0", | ||
"version": "17.0.0", | ||
"description": "The editing engine of CKEditor 5 – the best browser-based rich text editor.", | ||
@@ -24,20 +24,20 @@ "keywords": [ | ||
"dependencies": { | ||
"@ckeditor/ckeditor5-utils": "^16.0.0", | ||
"@ckeditor/ckeditor5-utils": "^17.0.0", | ||
"lodash-es": "^4.17.10" | ||
}, | ||
"devDependencies": { | ||
"@ckeditor/ckeditor5-basic-styles": "^16.0.0", | ||
"@ckeditor/ckeditor5-block-quote": "^16.0.0", | ||
"@ckeditor/ckeditor5-core": "^16.0.0", | ||
"@ckeditor/ckeditor5-editor-classic": "^16.0.0", | ||
"@ckeditor/ckeditor5-enter": "^16.0.0", | ||
"@ckeditor/ckeditor5-essentials": "^16.0.0", | ||
"@ckeditor/ckeditor5-heading": "^16.0.0", | ||
"@ckeditor/ckeditor5-link": "^16.0.0", | ||
"@ckeditor/ckeditor5-list": "^16.0.0", | ||
"@ckeditor/ckeditor5-paragraph": "^16.0.0", | ||
"@ckeditor/ckeditor5-theme-lark": "^16.0.0", | ||
"@ckeditor/ckeditor5-typing": "^16.0.0", | ||
"@ckeditor/ckeditor5-undo": "^16.0.0", | ||
"@ckeditor/ckeditor5-widget": "^16.0.0", | ||
"@ckeditor/ckeditor5-basic-styles": "^17.0.0", | ||
"@ckeditor/ckeditor5-block-quote": "^17.0.0", | ||
"@ckeditor/ckeditor5-core": "^17.0.0", | ||
"@ckeditor/ckeditor5-editor-classic": "^17.0.0", | ||
"@ckeditor/ckeditor5-enter": "^17.0.0", | ||
"@ckeditor/ckeditor5-essentials": "^17.0.0", | ||
"@ckeditor/ckeditor5-heading": "^17.0.0", | ||
"@ckeditor/ckeditor5-link": "^17.0.0", | ||
"@ckeditor/ckeditor5-list": "^17.0.0", | ||
"@ckeditor/ckeditor5-paragraph": "^17.0.0", | ||
"@ckeditor/ckeditor5-theme-lark": "^17.0.0", | ||
"@ckeditor/ckeditor5-typing": "^17.0.0", | ||
"@ckeditor/ckeditor5-undo": "^17.0.0", | ||
"@ckeditor/ckeditor5-widget": "^17.0.0", | ||
"eslint": "^5.5.0", | ||
@@ -44,0 +44,0 @@ "eslint-config-ckeditor5": "^2.0.0", |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -207,3 +207,3 @@ */ | ||
* | ||
* *Note:* Downcasting to a style property requires providing `value` as an object: | ||
* **Note**: Downcasting to a style property requires providing `value` as an object: | ||
* | ||
@@ -210,0 +210,0 @@ * editor.conversion.for( 'downcast' ).attributeToAttribute( { |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -12,2 +12,3 @@ */ | ||
import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror'; | ||
import StylesMap from '../view/stylesmap'; | ||
@@ -511,2 +512,8 @@ /** | ||
consumables.set( name, true ); | ||
if ( type === 'styles' ) { | ||
for ( const alsoName of StylesMap.getRelatedStyles( name ) ) { | ||
consumables.set( alsoName, true ); | ||
} | ||
} | ||
} | ||
@@ -573,2 +580,8 @@ } | ||
consumables.set( name, false ); | ||
if ( type == 'styles' ) { | ||
for ( const toConsume of StylesMap.getRelatedStyles( name ) ) { | ||
consumables.set( toConsume, false ); | ||
} | ||
} | ||
} | ||
@@ -575,0 +588,0 @@ } |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -66,2 +66,3 @@ */ | ||
this._selection.delegate( 'change:attribute' ).to( this ); | ||
this._selection.delegate( 'change:marker' ).to( this ); | ||
} | ||
@@ -546,2 +547,13 @@ | ||
/** | ||
* Fired when selection marker(s) changed. | ||
* | ||
* @event change:marker | ||
* @param {Boolean} directChange This is always set to `false` in case of `change:marker` event as there is no possibility | ||
* to change markers directly through {@link module:engine/model/documentselection~DocumentSelection} API. | ||
* See also {@link module:engine/model/documentselection~DocumentSelection#event:change:range} and | ||
* {@link module:engine/model/documentselection~DocumentSelection#event:change:attribute}. | ||
* @param {Array.<module:engine/model/markercollection~Marker>} oldMarkers Markers in which the selection was before the change. | ||
*/ | ||
// `LiveSelection` is used internally by {@link module:engine/model/documentselection~DocumentSelection} and shouldn't be used directly. | ||
@@ -726,2 +738,3 @@ // | ||
this._updateAttributes( true ); | ||
this._updateMarkers(); | ||
} | ||
@@ -732,2 +745,3 @@ | ||
this._updateAttributes( true ); | ||
this._updateMarkers(); | ||
} | ||
@@ -837,2 +851,3 @@ | ||
const markers = []; | ||
let changed = false; | ||
@@ -849,5 +864,9 @@ for ( const marker of this._model.markers ) { | ||
const oldMarkers = Array.from( this.markers ); | ||
for ( const marker of markers ) { | ||
if ( !this.markers.has( marker ) ) { | ||
this.markers.add( marker ); | ||
changed = true; | ||
} | ||
@@ -859,4 +878,10 @@ } | ||
this.markers.remove( marker ); | ||
changed = true; | ||
} | ||
} | ||
if ( changed ) { | ||
this.fire( 'change:marker', { oldMarkers, directChange: false } ); | ||
} | ||
} | ||
@@ -863,0 +888,0 @@ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -21,2 +21,3 @@ */ | ||
import ModelSelection from './selection'; | ||
import OperationFactory from './operation/operationfactory'; | ||
@@ -760,2 +761,14 @@ import insertContent from './utils/insertcontent'; | ||
/** | ||
* Creates an operation instance from a JSON object (parsed JSON string). | ||
* | ||
* This is an alias for {@link module:engine/model/operation/operationfactory~OperationFactory.fromJSON `OperationFactory.fromJSON()`}. | ||
* | ||
* @param {Object} json Deserialized JSON object. | ||
* @returns {module:engine/model/operation/operation~Operation} | ||
*/ | ||
createOperationFromJSON( json ) { | ||
return OperationFactory.fromJSON( json, this.document ); | ||
} | ||
/** | ||
* Removes all events listeners set by model instance and destroys {@link module:engine/model/document~Document}. | ||
@@ -762,0 +775,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -40,3 +40,3 @@ */ | ||
/** | ||
* Creates concrete `Operation` object from deserialized object, i.e. from parsed JSON string. | ||
* Creates an operation instance from a JSON object (parsed JSON string). | ||
* | ||
@@ -43,0 +43,0 @@ * @param {Object} json Deserialized JSON object. |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -390,3 +390,2 @@ */ | ||
* | ||
* @method getItems | ||
* @param {Object} options Object with configuration options. See {@link module:engine/model/treewalker~TreeWalker}. | ||
@@ -393,0 +392,0 @@ * @returns {Iterable.<module:engine/model/item~Item>} |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -1271,2 +1271,19 @@ */ | ||
} | ||
/** | ||
* Checks whether the context starts with the given nodes. | ||
* | ||
* const ctx = new SchemaContext( [ rootElement, paragraphElement, textNode ] ); | ||
* | ||
* ctx.endsWith( '$root' ); // -> true | ||
* ctx.endsWith( '$root paragraph' ); // -> true | ||
* ctx.endsWith( '$text' ); // -> false | ||
* ctx.endsWith( 'paragraph' ); // -> false | ||
* | ||
* @param {String} query | ||
* @returns {Boolean} | ||
*/ | ||
startsWith( query ) { | ||
return Array.from( this.getNames() ).join( ' ' ).startsWith( query ); | ||
} | ||
} | ||
@@ -1273,0 +1290,0 @@ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -95,16 +95,3 @@ */ | ||
if ( wasFixed ) { | ||
// The above algorithm might create ranges that intersects each other when selection contains more then one range. | ||
// This is case happens mostly on Firefox which creates multiple ranges for selected table. | ||
let fixedRanges = ranges; | ||
// Fixing selection with many ranges usually breaks the selection in Firefox. As only Firefox supports multiple selection ranges | ||
// we simply create one continuous range from fixed selection ranges (even if they are not adjacent). | ||
if ( ranges.length > 1 ) { | ||
const selectionStart = ranges[ 0 ].start; | ||
const selectionEnd = ranges[ ranges.length - 1 ].end; | ||
fixedRanges = [ new Range( selectionStart, selectionEnd ) ]; | ||
} | ||
writer.setSelection( fixedRanges, { backward: selection.isBackward } ); | ||
writer.setSelection( mergeIntersectingRanges( ranges ), { backward: selection.isBackward } ); | ||
} | ||
@@ -144,2 +131,6 @@ } | ||
if ( !nearestSelectionRange.isCollapsed ) { | ||
return nearestSelectionRange; | ||
} | ||
const fixedPosition = nearestSelectionRange.start; | ||
@@ -152,7 +143,2 @@ | ||
// Check single node selection (happens in tables). | ||
if ( fixedPosition.nodeAfter && schema.isLimit( fixedPosition.nodeAfter ) ) { | ||
return new Range( fixedPosition, Position._createAfter( fixedPosition.nodeAfter ) ); | ||
} | ||
return new Range( fixedPosition ); | ||
@@ -269,2 +255,31 @@ } | ||
// Returns a minimal non-intersecting array of ranges. | ||
// | ||
// @param {Array.<module:engine/model/range~Range>} ranges | ||
// @returns {Array.<module:engine/model/range~Range>} | ||
function mergeIntersectingRanges( ranges ) { | ||
const nonIntersectingRanges = []; | ||
// First range will always be fine. | ||
nonIntersectingRanges.push( ranges.shift() ); | ||
for ( const range of ranges ) { | ||
const previousRange = nonIntersectingRanges.pop(); | ||
if ( range.isIntersecting( previousRange ) ) { | ||
// Get the sum of two ranges. | ||
const start = previousRange.start.isAfter( range.start ) ? range.start : previousRange.start; | ||
const end = previousRange.end.isAfter( range.end ) ? previousRange.end : range.end; | ||
const merged = new Range( start, end ); | ||
nonIntersectingRanges.push( merged ); | ||
} else { | ||
nonIntersectingRanges.push( previousRange ); | ||
nonIntersectingRanges.push( range ); | ||
} | ||
} | ||
return nonIntersectingRanges; | ||
} | ||
// Checks if node exists and if it's an object. | ||
@@ -278,2 +293,1 @@ // | ||
} | ||
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -14,2 +14,3 @@ */ | ||
import ObservableMixin from '@ckeditor/ckeditor5-utils/src/observablemixin'; | ||
import StylesMap from './stylesmap'; | ||
@@ -165,2 +166,18 @@ // @if CK_DEBUG_ENGINE // const { logDocument } = require( '../dev-utils/utils' ); | ||
/** | ||
* Adds a style processor normalization rules. | ||
* | ||
* The available style processors: | ||
* | ||
* * background: {@link module:engine/view/styles/background~addBackgroundRules} | ||
* * border: {@link module:engine/view/styles/border~addBorderRules} | ||
* * margin: {@link module:engine/view/styles/margin~addMarginRules} | ||
* * padding: {@link module:engine/view/styles/padding~addPaddingRules} | ||
* | ||
* @param {Function} callback | ||
*/ | ||
addStyleProcessorRules( callback ) { | ||
callback( StylesMap._styleProcessor ); | ||
} | ||
/** | ||
* Performs post-fixer loops. Executes post-fixer callbacks as long as none of them has done any changes to the model. | ||
@@ -167,0 +184,0 @@ * |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -13,6 +13,6 @@ */ | ||
import TextProxy from './textproxy'; | ||
import objectToMap from '@ckeditor/ckeditor5-utils/src/objecttomap'; | ||
import toMap from '@ckeditor/ckeditor5-utils/src/tomap'; | ||
import isIterable from '@ckeditor/ckeditor5-utils/src/isiterable'; | ||
import Matcher from './matcher'; | ||
import { isPlainObject } from 'lodash-es'; | ||
import StylesMap from './stylesmap'; | ||
@@ -109,12 +109,13 @@ // @if CK_DEBUG_ENGINE // const { convertMapToTags } = require( '../dev-utils/utils' ); | ||
/** | ||
* Map of styles. | ||
* Normalized styles. | ||
* | ||
* @protected | ||
* @member {Map} module:engine/view/element~Element#_styles | ||
* @member {module:engine/view/stylesmap~StylesMap} module:engine/view/element~Element#_styles | ||
*/ | ||
this._styles = new Map(); | ||
this._styles = new StylesMap(); | ||
if ( this._attrs.has( 'style' ) ) { | ||
// Remove style attribute and handle it by styles map. | ||
parseInlineStyles( this._styles, this._attrs.get( 'style' ) ); | ||
this._styles.setTo( this._attrs.get( 'style' ) ); | ||
this._attrs.delete( 'style' ); | ||
@@ -226,3 +227,3 @@ } | ||
if ( this._styles.size > 0 ) { | ||
if ( !this._styles.isEmpty ) { | ||
yield 'style'; | ||
@@ -249,3 +250,3 @@ } | ||
if ( this._styles.size > 0 ) { | ||
if ( !this._styles.isEmpty ) { | ||
yield [ 'style', this.getAttribute( 'style' ) ]; | ||
@@ -271,13 +272,5 @@ } | ||
if ( key == 'style' ) { | ||
if ( this._styles.size > 0 ) { | ||
let styleString = ''; | ||
const inlineStyle = this._styles.toString(); | ||
for ( const [ property, value ] of this._styles ) { | ||
styleString += `${ property }:${ value };`; | ||
} | ||
return styleString; | ||
} | ||
return undefined; | ||
return inlineStyle == '' ? undefined : inlineStyle; | ||
} | ||
@@ -300,3 +293,3 @@ | ||
if ( key == 'style' ) { | ||
return this._styles.size > 0; | ||
return !this._styles.isEmpty; | ||
} | ||
@@ -351,4 +344,7 @@ | ||
// Check if styles are the same. | ||
for ( const [ property, value ] of this._styles ) { | ||
if ( !otherElement._styles.has( property ) || otherElement._styles.get( property ) !== value ) { | ||
for ( const property of this._styles.getStyleNames() ) { | ||
if ( | ||
!otherElement._styles.has( property ) || | ||
otherElement._styles.getAsString( property ) !== this._styles.getAsString( property ) | ||
) { | ||
return false; | ||
@@ -390,5 +386,24 @@ } | ||
/** | ||
* Returns style value for given property. | ||
* Undefined is returned if style does not exist. | ||
* Returns style value for the given property mae. | ||
* If the style does not exist `undefined` is returned. | ||
* | ||
* **Note**: This method can work with normalized style names if | ||
* {@link module:engine/view/document~Document#addStyleProcessorRules a particular style processor rule is enabled}. | ||
* See {@link module:engine/view/stylesmap~StylesMap#getAsString `StylesMap#getAsString()`} for details. | ||
* | ||
* For an element with style set to `'margin:1px'`: | ||
* | ||
* // Enable 'margin' shorthand processing: | ||
* editor.editing.view.document.addStyleProcessorRules( addMarginRules ); | ||
* | ||
* const element = view.change( writer => { | ||
* const element = writer.createElement(); | ||
* writer.setStyle( 'margin', '1px' ); | ||
* writer.setStyle( 'margin-bottom', '3em' ); | ||
* | ||
* return element; | ||
* } ); | ||
* | ||
* element.getStyle( 'margin' ); // -> 'margin: 1px 1px 3em;' | ||
* | ||
* @param {String} property | ||
@@ -398,6 +413,40 @@ * @returns {String|undefined} | ||
getStyle( property ) { | ||
return this._styles.get( property ); | ||
return this._styles.getAsString( property ); | ||
} | ||
/** | ||
* Returns a normalized style object or single style value. | ||
* | ||
* For an element with style set to: margin:1px 2px 3em; | ||
* | ||
* element.getNormalizedStyle( 'margin' ) ); | ||
* | ||
* will return: | ||
* | ||
* { | ||
* top: '1px', | ||
* right: '2px', | ||
* bottom: '3em', | ||
* left: '2px' // a normalized value from margin shorthand | ||
* } | ||
* | ||
* and reading for single style value: | ||
* | ||
* styles.getNormalizedStyle( 'margin-left' ); | ||
* | ||
* Will return a `2px` string. | ||
* | ||
* **Note**: This method will return normalized values only if | ||
* {@link module:engine/view/document~Document#addStyleProcessorRules a particular style processor rule is enabled}. | ||
* See {@link module:engine/view/stylesmap~StylesMap#getNormalized `StylesMap#getNormalized()`} for details. | ||
* | ||
* | ||
* @param {String} property Name of CSS property | ||
* @returns {Object|String|undefined} | ||
*/ | ||
getNormalizedStyle( property ) { | ||
return this._styles.getNormalized( property ); | ||
} | ||
/** | ||
* Returns iterator that contains all style names. | ||
@@ -408,3 +457,3 @@ * | ||
getStyleNames() { | ||
return this._styles.keys(); | ||
return this._styles.getStyleNames(); | ||
} | ||
@@ -494,3 +543,3 @@ | ||
* | ||
* NOTE: Classes, styles and other attributes are sorted alphabetically. | ||
* **Note**: Classes, styles and other attributes are sorted alphabetically. | ||
* | ||
@@ -501,3 +550,3 @@ * @returns {String} | ||
const classes = Array.from( this._classes ).sort().join( ',' ); | ||
const styles = Array.from( this._styles ).map( i => `${ i[ 0 ] }:${ i[ 1 ] }` ).sort().join( ';' ); | ||
const styles = this._styles.toString(); | ||
const attributes = Array.from( this._attrs ).map( i => `${ i[ 0 ] }="${ i[ 1 ] }"` ).sort().join( ' ' ); | ||
@@ -507,3 +556,3 @@ | ||
( classes == '' ? '' : ` class="${ classes }"` ) + | ||
( styles == '' ? '' : ` style="${ styles }"` ) + | ||
( !styles ? '' : ` style="${ styles }"` ) + | ||
( attributes == '' ? '' : ` ${ attributes }` ); | ||
@@ -535,3 +584,3 @@ } | ||
cloned._classes = new Set( this._classes ); | ||
cloned._styles = new Map( this._styles ); | ||
cloned._styles.set( this._styles.getNormalized() ); | ||
@@ -633,3 +682,3 @@ // Clone custom properties. | ||
} else if ( key == 'style' ) { | ||
parseInlineStyles( this._styles, value ); | ||
this._styles.setTo( value ); | ||
} else { | ||
@@ -665,3 +714,3 @@ this._attrs.set( key, value ); | ||
if ( key == 'style' ) { | ||
if ( this._styles.size > 0 ) { | ||
if ( !this._styles.isEmpty ) { | ||
this._styles.clear(); | ||
@@ -724,2 +773,6 @@ | ||
* | ||
* **Note**: This method can work with normalized style names if | ||
* {@link module:engine/view/document~Document#addStyleProcessorRules a particular style processor rule is enabled}. | ||
* See {@link module:engine/view/stylesmap~StylesMap#set `StylesMap#set()`} for details. | ||
* | ||
* @see module:engine/view/downcastwriter~DowncastWriter#setStyle | ||
@@ -734,11 +787,3 @@ * @protected | ||
if ( isPlainObject( property ) ) { | ||
const keys = Object.keys( property ); | ||
for ( const key of keys ) { | ||
this._styles.set( key, property[ key ] ); | ||
} | ||
} else { | ||
this._styles.set( property, value ); | ||
} | ||
this._styles.set( property, value ); | ||
} | ||
@@ -752,2 +797,6 @@ | ||
* | ||
* **Note**: This method can work with normalized style names if | ||
* {@link module:engine/view/document~Document#addStyleProcessorRules a particular style processor rule is enabled}. | ||
* See {@link module:engine/view/stylesmap~StylesMap#remove `StylesMap#remove()`} for details. | ||
* | ||
* @see module:engine/view/downcastwriter~DowncastWriter#removeStyle | ||
@@ -762,3 +811,3 @@ * @protected | ||
property = Array.isArray( property ) ? property : [ property ]; | ||
property.forEach( name => this._styles.delete( name ) ); | ||
property.forEach( name => this._styles.remove( name ) ); | ||
} | ||
@@ -826,13 +875,9 @@ | ||
// Parses attributes provided to the element constructor before they are applied to an element. If attributes are passed | ||
// as an object (instead of `Map`), the object is transformed to the map. Attributes with `null` value are removed. | ||
// as an object (instead of `Iterable`), the object is transformed to the map. Attributes with `null` value are removed. | ||
// Attributes with non-`String` value are converted to `String`. | ||
// | ||
// @param {Object|Map} attrs Attributes to parse. | ||
// @param {Object|Iterable} attrs Attributes to parse. | ||
// @returns {Map} Parsed attributes. | ||
function parseAttributes( attrs ) { | ||
if ( isPlainObject( attrs ) ) { | ||
attrs = objectToMap( attrs ); | ||
} else { | ||
attrs = new Map( attrs ); | ||
} | ||
attrs = toMap( attrs ); | ||
@@ -850,78 +895,2 @@ for ( const [ key, value ] of attrs ) { | ||
// Parses inline styles and puts property - value pairs into styles map. | ||
// Styles map is cleared before insertion. | ||
// | ||
// @param {Map.<String, String>} stylesMap Map to insert parsed properties and values. | ||
// @param {String} stylesString Styles to parse. | ||
function parseInlineStyles( stylesMap, stylesString ) { | ||
// `null` if no quote was found in input string or last found quote was a closing quote. See below. | ||
let quoteType = null; | ||
let propertyNameStart = 0; | ||
let propertyValueStart = 0; | ||
let propertyName = null; | ||
stylesMap.clear(); | ||
// Do not set anything if input string is empty. | ||
if ( stylesString === '' ) { | ||
return; | ||
} | ||
// Fix inline styles that do not end with `;` so they are compatible with algorithm below. | ||
if ( stylesString.charAt( stylesString.length - 1 ) != ';' ) { | ||
stylesString = stylesString + ';'; | ||
} | ||
// Seek the whole string for "special characters". | ||
for ( let i = 0; i < stylesString.length; i++ ) { | ||
const char = stylesString.charAt( i ); | ||
if ( quoteType === null ) { | ||
// No quote found yet or last found quote was a closing quote. | ||
switch ( char ) { | ||
case ':': | ||
// Most of time colon means that property name just ended. | ||
// Sometimes however `:` is found inside property value (for example in background image url). | ||
if ( !propertyName ) { | ||
// Treat this as end of property only if property name is not already saved. | ||
// Save property name. | ||
propertyName = stylesString.substr( propertyNameStart, i - propertyNameStart ); | ||
// Save this point as the start of property value. | ||
propertyValueStart = i + 1; | ||
} | ||
break; | ||
case '"': | ||
case '\'': | ||
// Opening quote found (this is an opening quote, because `quoteType` is `null`). | ||
quoteType = char; | ||
break; | ||
case ';': { | ||
// Property value just ended. | ||
// Use previously stored property value start to obtain property value. | ||
const propertyValue = stylesString.substr( propertyValueStart, i - propertyValueStart ); | ||
if ( propertyName ) { | ||
// Save parsed part. | ||
stylesMap.set( propertyName.trim(), propertyValue.trim() ); | ||
} | ||
propertyName = null; | ||
// Save this point as property name start. Property name starts immediately after previous property value ends. | ||
propertyNameStart = i + 1; | ||
break; | ||
} | ||
} | ||
} else if ( char === quoteType ) { | ||
// If a quote char is found and it is a closing quote, mark this fact by `null`-ing `quoteType`. | ||
quoteType = null; | ||
} | ||
} | ||
} | ||
// Parses class attribute and puts all classes into classes set. | ||
@@ -928,0 +897,0 @@ // Classes set s cleared before insertion. |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md. | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -247,7 +247,10 @@ */ | ||
this.document.fire( 'mutations', viewMutations, viewSelection ); | ||
// In case only non-relevant mutations were recorded it skips the event and force render (#5600). | ||
if ( viewMutations.length ) { | ||
this.document.fire( 'mutations', viewMutations, viewSelection ); | ||
// If nothing changes on `mutations` event, at this point we have "dirty DOM" (changed) and de-synched | ||
// view (which has not been changed). In order to "reset DOM" we render the view again. | ||
this.view.forceRender(); | ||
// If nothing changes on `mutations` event, at this point we have "dirty DOM" (changed) and de-synched | ||
// view (which has not been changed). In order to "reset DOM" we render the view again. | ||
this.view.forceRender(); | ||
} | ||
@@ -254,0 +257,0 @@ function sameNodes( child1, child2 ) { |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -129,6 +129,3 @@ */ | ||
_handleSelectionChange( domDocument ) { | ||
// Selection is handled when document is not focused but is read-only. This is because in read-only | ||
// mode contenteditable is set as false and editor won't receive focus but we still need to know | ||
// selection position. | ||
if ( !this.isEnabled || ( !this.document.isFocused && !this.document.isReadOnly ) ) { | ||
if ( !this.isEnabled ) { | ||
return; | ||
@@ -145,2 +142,10 @@ } | ||
// Do not convert selection change if the new view selection has no ranges in it. | ||
// | ||
// It means that the DOM selection is in some way incorrect. Ranges that were in the DOM selection could not be | ||
// converted to the view. This happens when the DOM selection was moved outside of the editable element. | ||
if ( newViewSelection.rangeCount == 0 ) { | ||
return; | ||
} | ||
if ( this.selection.isEqual( newViewSelection ) && this.domConverter.isDomSelectionCorrect( domSelection ) ) { | ||
@@ -147,0 +152,0 @@ return; |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -126,2 +126,6 @@ */ | ||
* | ||
* If changes in your UI element should trigger some editor UI update you should call | ||
* the {@link module:core/editor/editorui~EditorUI#update `editor.ui.update()`} method | ||
* after rendering your UI element. | ||
* | ||
* @param {Document} domDocument | ||
@@ -128,0 +132,0 @@ * @returns {HTMLElement} |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -273,2 +273,6 @@ */ | ||
* | ||
* **Note**: This method can work with normalized style names if | ||
* {@link module:engine/view/document~Document#addStyleProcessorRules a particular style processor rule is enabled}. | ||
* See {@link module:engine/view/stylesmap~StylesMap#set `StylesMap#set()`} for details. | ||
* | ||
* @see module:engine/view/element~Element#_setStyle | ||
@@ -292,2 +296,6 @@ * @param {String|Object} property Property name or object with key - value pairs. | ||
* | ||
* **Note**: This method can work with normalized style names if | ||
* {@link module:engine/view/document~Document#addStyleProcessorRules a particular style processor rule is enabled}. | ||
* See {@link module:engine/view/stylesmap~StylesMap#remove `StylesMap#remove()`} for details. | ||
* | ||
* @see module:engine/view/element~Element#_removeStyle | ||
@@ -294,0 +302,0 @@ * @param {Array.<String>|String} property Style property name or names to be removed. |
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
1690353
113
38356
+ Added@ckeditor/ckeditor5-utils@17.0.0(transitive)
- Removed@ckeditor/ckeditor5-utils@16.0.0(transitive)