@ckeditor/ckeditor5-engine
Advanced tools
Comparing version 18.0.0 to 19.0.0
{ | ||
"name": "@ckeditor/ckeditor5-engine", | ||
"version": "18.0.0", | ||
"version": "19.0.0", | ||
"description": "The editing engine of CKEditor 5 – the best browser-based rich text editor.", | ||
@@ -24,20 +24,21 @@ "keywords": [ | ||
"dependencies": { | ||
"@ckeditor/ckeditor5-utils": "^18.0.0", | ||
"@ckeditor/ckeditor5-utils": "^19.0.0", | ||
"lodash-es": "^4.17.10" | ||
}, | ||
"devDependencies": { | ||
"@ckeditor/ckeditor5-basic-styles": "^18.0.0", | ||
"@ckeditor/ckeditor5-block-quote": "^18.0.0", | ||
"@ckeditor/ckeditor5-core": "^18.0.0", | ||
"@ckeditor/ckeditor5-editor-classic": "^18.0.0", | ||
"@ckeditor/ckeditor5-enter": "^18.0.0", | ||
"@ckeditor/ckeditor5-essentials": "^18.0.0", | ||
"@ckeditor/ckeditor5-heading": "^18.0.0", | ||
"@ckeditor/ckeditor5-link": "^18.0.0", | ||
"@ckeditor/ckeditor5-list": "^18.0.0", | ||
"@ckeditor/ckeditor5-paragraph": "^18.0.0", | ||
"@ckeditor/ckeditor5-theme-lark": "^18.0.0", | ||
"@ckeditor/ckeditor5-typing": "^18.0.0", | ||
"@ckeditor/ckeditor5-undo": "^18.0.0", | ||
"@ckeditor/ckeditor5-widget": "^18.0.0", | ||
"@ckeditor/ckeditor5-basic-styles": "^19.0.0", | ||
"@ckeditor/ckeditor5-block-quote": "^19.0.0", | ||
"@ckeditor/ckeditor5-core": "^19.0.0", | ||
"@ckeditor/ckeditor5-editor-classic": "^19.0.0", | ||
"@ckeditor/ckeditor5-enter": "^19.0.0", | ||
"@ckeditor/ckeditor5-essentials": "^19.0.0", | ||
"@ckeditor/ckeditor5-heading": "^19.0.0", | ||
"@ckeditor/ckeditor5-link": "^19.0.0", | ||
"@ckeditor/ckeditor5-list": "^19.0.0", | ||
"@ckeditor/ckeditor5-paragraph": "^19.0.0", | ||
"@ckeditor/ckeditor5-table": "^19.0.0", | ||
"@ckeditor/ckeditor5-theme-lark": "^19.0.0", | ||
"@ckeditor/ckeditor5-typing": "^19.0.0", | ||
"@ckeditor/ckeditor5-undo": "^19.0.0", | ||
"@ckeditor/ckeditor5-widget": "^19.0.0", | ||
"eslint": "^5.5.0", | ||
@@ -44,0 +45,0 @@ "eslint-config-ckeditor5": "^2.0.0", |
@@ -136,3 +136,3 @@ /** | ||
is( type ) { | ||
return type == 'documentFragment' || type == 'model:documentFragment'; | ||
return type === 'documentFragment' || type === 'model:documentFragment'; | ||
} | ||
@@ -139,0 +139,0 @@ |
@@ -385,3 +385,3 @@ /** | ||
is( type ) { | ||
return type == 'selection' || | ||
return type === 'selection' || | ||
type == 'model:selection' || | ||
@@ -1141,3 +1141,5 @@ type == 'documentSelection' || | ||
// If nearest valid selection range has been found - add it in the place of old range. | ||
if ( selectionRange ) { | ||
// If range is equal to any other selection ranges then it is probably due to contents | ||
// of a multi-range selection being removed. See ckeditor/ckeditor5#6501. | ||
if ( selectionRange && !isRangeCollidingWithSelection( selectionRange, this ) ) { | ||
// Check the range, convert it to live range, bind events, etc. | ||
@@ -1149,3 +1151,3 @@ const newRange = this._prepareRange( selectionRange ); | ||
} | ||
// If nearest valid selection range cannot be found - just removing the old range is fine. | ||
// If nearest valid selection range cannot be found or is intersecting with other selection ranges removing the old range is fine. | ||
} | ||
@@ -1170,3 +1172,2 @@ } | ||
// | ||
// @private | ||
// @param {module:engine/model/model~Model} model | ||
@@ -1197,1 +1198,6 @@ // @param {module:engine/model/batch~Batch} batch | ||
} | ||
// Checks if range collides with any of selection ranges. | ||
function isRangeCollidingWithSelection( range, selection ) { | ||
return !selection._ranges.every( selectionRange => !range.isEqual( selectionRange ) ); | ||
} |
@@ -119,9 +119,10 @@ /** | ||
is( type, name = null ) { | ||
const cutType = type.replace( /^model:/, '' ); | ||
if ( !name ) { | ||
return cutType == 'element' || cutType == this.name || super.is( type ); | ||
} else { | ||
return cutType == 'element' && name == this.name; | ||
return type === 'element' || type === 'model:element' || | ||
type === this.name || type === 'model:' + this.name || | ||
// From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529. | ||
type === 'node' || type === 'model:node'; | ||
} | ||
return name === this.name && ( type === 'element' || type === 'model:element' ); | ||
} | ||
@@ -128,0 +129,0 @@ |
@@ -83,3 +83,5 @@ /** | ||
is( type ) { | ||
return type == 'livePosition' || type == 'model:livePosition' || super.is( type ); | ||
return type === 'livePosition' || type === 'model:livePosition' || | ||
// From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529. | ||
type == 'position' || type === 'model:position'; | ||
} | ||
@@ -86,0 +88,0 @@ |
@@ -60,3 +60,5 @@ /** | ||
is( type ) { | ||
return type == 'liveRange' || type == 'model:liveRange' || super.is( type ); | ||
return type === 'liveRange' || type === 'model:liveRange' || | ||
// From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529. | ||
type == 'range' || type === 'model:range'; | ||
} | ||
@@ -63,0 +65,0 @@ |
@@ -466,3 +466,3 @@ /** | ||
is( type ) { | ||
return type == 'marker' || type == 'model:marker'; | ||
return type === 'marker' || type === 'model:marker'; | ||
} | ||
@@ -469,0 +469,0 @@ |
@@ -199,2 +199,5 @@ /** | ||
* | ||
* In addition to that, the changes enqueued with `enqueueChange()` will be converted separately from the changes | ||
* done in the outer `change()` block. | ||
* | ||
* Second, it lets you define the {@link module:engine/model/batch~Batch} into which you want to add your changes. | ||
@@ -210,3 +213,4 @@ * By default, a new batch is created. In the sample above, `change` and `enqueueChange` blocks use a different | ||
* | ||
* The batch instance can be obtained from {@link module:engine/model/writer~Writer#batch the writer}. | ||
* In order to make a nested `enqueueChange()` create a single undo step together with the changes done in the outer `change()` | ||
* block, you can obtain the batch instance from the {@link module:engine/model/writer~Writer#batch writer} of the outer block. | ||
* | ||
@@ -213,0 +217,0 @@ * @param {module:engine/model/batch~Batch|'transparent'|'default'} batchOrType Batch or batch type should be used in the callback. |
@@ -13,3 +13,2 @@ /** | ||
import compareArrays from '@ckeditor/ckeditor5-utils/src/comparearrays'; | ||
// To check if component is loaded more than once. | ||
@@ -436,3 +435,3 @@ import '@ckeditor/ckeditor5-utils/src/version'; | ||
is( type ) { | ||
return type == 'node' || type == 'model:node'; | ||
return type === 'node' || type === 'model:node'; | ||
} | ||
@@ -505,9 +504,1 @@ | ||
} | ||
/** | ||
* The node's parent does not contain this node. | ||
* | ||
* This error may be thrown from corrupted trees. | ||
* | ||
* @error model-node-not-found-in-parent | ||
*/ |
@@ -13,4 +13,2 @@ /** | ||
import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror'; | ||
import Text from './text'; | ||
import { last } from 'lodash-es'; | ||
@@ -85,5 +83,9 @@ // To check if component is loaded more than once. | ||
// Normalize the root and path (if element was passed). | ||
path = root.getPath().concat( path ); | ||
root = root.root; | ||
// Normalize the root and path when element (not root) is passed. | ||
if ( root.is( 'rootElement' ) ) { | ||
path = path.slice(); | ||
} else { | ||
path = [ ...root.getPath(), ...path ]; | ||
root = root.root; | ||
} | ||
@@ -146,3 +148,3 @@ /** | ||
get offset() { | ||
return last( this.path ); | ||
return this.path[ this.path.length - 1 ]; | ||
} | ||
@@ -222,5 +224,3 @@ | ||
get textNode() { | ||
const node = this.parent.getChild( this.index ); | ||
return ( node instanceof Text && node.startOffset < this.offset ) ? node : null; | ||
return getTextNodeAtPosition( this, this.parent ); | ||
} | ||
@@ -235,3 +235,6 @@ | ||
get nodeAfter() { | ||
return this.textNode === null ? this.parent.getChild( this.index ) : null; | ||
// Cache the parent and reuse for performance reasons. See #6579 and #6582. | ||
const parent = this.parent; | ||
return getNodeAfterPosition( this, parent, getTextNodeAtPosition( this, parent ) ); | ||
} | ||
@@ -243,6 +246,9 @@ | ||
* @readonly | ||
* @type {Node} | ||
* @type {module:engine/model/node~Node|null} | ||
*/ | ||
get nodeBefore() { | ||
return this.textNode === null ? this.parent.getChild( this.index - 1 ) : null; | ||
// Cache the parent and reuse for performance reasons. See #6579 and #6582. | ||
const parent = this.parent; | ||
return getNodeBeforePosition( this, parent, getTextNodeAtPosition( this, parent ) ); | ||
} | ||
@@ -348,6 +354,8 @@ | ||
getAncestors() { | ||
if ( this.parent.is( 'documentFragment' ) ) { | ||
return [ this.parent ]; | ||
const parent = this.parent; | ||
if ( parent.is( 'documentFragment' ) ) { | ||
return [ parent ]; | ||
} else { | ||
return this.parent.getAncestors( { includeSelf: true } ); | ||
return parent.getAncestors( { includeSelf: true } ); | ||
} | ||
@@ -550,3 +558,3 @@ } | ||
is( type ) { | ||
return type == 'position' || type == 'model:position'; | ||
return type === 'position' || type === 'model:position'; | ||
} | ||
@@ -851,3 +859,3 @@ | ||
// If this position is at the same level as `from` position nothing will get added. | ||
combined.path = combined.path.concat( this.path.slice( i + 1 ) ); | ||
combined.path = [ ...combined.path, ...this.path.slice( i + 1 ) ]; | ||
@@ -1069,1 +1077,89 @@ return combined; | ||
*/ | ||
/** | ||
* Returns a text node at the given position. | ||
* | ||
* This is a helper function optimized to reuse the position parent instance for performance reasons. | ||
* | ||
* Normally, you should use {@link module:engine/model/position~Position#textNode `Position#textNode`}. | ||
* If you start hitting performance issues with {@link module:engine/model/position~Position#parent `Position#parent`} | ||
* check if your algorithm does not access it multiple times (which can happen directly or indirectly via other position properties). | ||
* | ||
* See https://github.com/ckeditor/ckeditor5/issues/6579. | ||
* | ||
* See also: | ||
* | ||
* * {@link module:engine/model/position~getNodeAfterPosition} | ||
* * {@link module:engine/model/position~getNodeBeforePosition} | ||
* | ||
* @param {module:engine/model/position~Position} position | ||
* @param {module:engine/model/element~Element|module:engine/model/documentfragment~DocumentFragment} positionParent The parent of the | ||
* given position. | ||
* @returns {module:engine/model/text~Text|null} | ||
*/ | ||
export function getTextNodeAtPosition( position, positionParent ) { | ||
const node = positionParent.getChild( positionParent.offsetToIndex( position.offset ) ); | ||
if ( node && node.is( 'text' ) && node.startOffset < position.offset ) { | ||
return node; | ||
} | ||
return null; | ||
} | ||
/** | ||
* Returns the node after the given position. | ||
* | ||
* This is a helper function optimized to reuse the position parent instance and the calculation of the text node at the | ||
* specific position for performance reasons. | ||
* | ||
* Normally, you should use {@link module:engine/model/position~Position#nodeAfter `Position#nodeAfter`}. | ||
* If you start hitting performance issues with {@link module:engine/model/position~Position#parent `Position#parent`} and/or | ||
* {@link module:engine/model/position~Position#textNode `Position#textNode`} | ||
* check if your algorithm does not access those properties multiple times | ||
* (which can happen directly or indirectly via other position properties). | ||
* | ||
* See https://github.com/ckeditor/ckeditor5/issues/6579 and https://github.com/ckeditor/ckeditor5/issues/6582. | ||
* | ||
* See also: | ||
* | ||
* * {@link module:engine/model/position~getTextNodeAtPosition} | ||
* * {@link module:engine/model/position~getNodeBeforePosition} | ||
* | ||
* @param {module:engine/model/position~Position} position | ||
* @param {module:engine/model/element~Element|module:engine/model/documentfragment~DocumentFragment} positionParent The parent of the | ||
* given position. | ||
* @param {module:engine/model/text~Text|null} textNode Text node at the given position. | ||
* @returns {module:engine/model/node~Node|null} | ||
*/ | ||
export function getNodeAfterPosition( position, positionParent, textNode ) { | ||
if ( textNode !== null ) { | ||
return null; | ||
} | ||
return positionParent.getChild( positionParent.offsetToIndex( position.offset ) ); | ||
} | ||
/** | ||
* Returns the node before the given position. | ||
* | ||
* Refer to {@link module:engine/model/position~getNodeBeforePosition} for documentation on when to use this util method. | ||
* | ||
* See also: | ||
* | ||
* * {@link module:engine/model/position~getTextNodeAtPosition} | ||
* * {@link module:engine/model/position~getNodeAfterPosition} | ||
* | ||
* @param {module:engine/model/position~Position} position | ||
* @param {module:engine/model/element~Element|module:engine/model/documentfragment~DocumentFragment} positionParent The parent of the | ||
* given position. | ||
* @param {module:engine/model/text~Text|null} textNode Text node at the given position. | ||
* @returns {module:engine/model/node~Node|null} | ||
*/ | ||
export function getNodeBeforePosition( position, positionParent, textNode ) { | ||
if ( textNode !== null ) { | ||
return null; | ||
} | ||
return positionParent.getChild( positionParent.offsetToIndex( position.offset ) - 1 ); | ||
} |
@@ -161,3 +161,3 @@ /** | ||
is( type ) { | ||
return type == 'range' || type == 'model:range'; | ||
return type === 'range' || type === 'model:range'; | ||
} | ||
@@ -164,0 +164,0 @@ |
@@ -83,8 +83,15 @@ /** | ||
is( type, name ) { | ||
const cutType = type.replace( 'model:', '' ); | ||
if ( !name ) { | ||
return cutType == 'rootElement' || super.is( type ); | ||
} else { | ||
return ( cutType == 'rootElement' && name == this.name ) || super.is( type, name ); | ||
return type === 'rootElement' || type === 'model:rootElement' || | ||
// From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529. | ||
type === 'element' || type === 'model:element' || | ||
type === this.name || type === 'model:' + this.name || | ||
type === 'node' || type === 'model:node'; | ||
} | ||
return name === this.name && ( | ||
type === 'rootElement' || type === 'model:rootElement' || | ||
// From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529. | ||
type === 'element' || type === 'model:element' | ||
); | ||
} | ||
@@ -109,1 +116,2 @@ | ||
} | ||
@@ -635,3 +635,3 @@ /** | ||
is( type ) { | ||
return type == 'selection' || type == 'model:selection'; | ||
return type === 'selection' || type === 'model:selection'; | ||
} | ||
@@ -638,0 +638,0 @@ |
@@ -85,3 +85,5 @@ /** | ||
is( type ) { | ||
return type == 'text' || type == 'model:text' || super.is( type ); | ||
return type === 'text' || type === 'model:text' || | ||
// From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529. | ||
type === 'node' || type === 'model:node'; | ||
} | ||
@@ -88,0 +90,0 @@ |
@@ -181,3 +181,3 @@ /** | ||
is( type ) { | ||
return type == 'textProxy' || type == 'model:textProxy'; | ||
return type === 'textProxy' || type === 'model:textProxy'; | ||
} | ||
@@ -184,0 +184,0 @@ |
@@ -13,3 +13,8 @@ /** | ||
import Element from './element'; | ||
import Position from './position'; | ||
import { | ||
default as Position, | ||
getTextNodeAtPosition, | ||
getNodeAfterPosition, | ||
getNodeBeforePosition | ||
} from './position'; | ||
import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror'; | ||
@@ -229,3 +234,7 @@ | ||
const node = position.textNode ? position.textNode : position.nodeAfter; | ||
// Get node just after the current position. | ||
// Use a highly optimized version instead of checking the text node first and then getting the node after. See #6582. | ||
const positionParent = position.parent; | ||
const textNodeAtPosition = getTextNodeAtPosition( position, positionParent ); | ||
const node = textNodeAtPosition ? textNodeAtPosition : getNodeAfterPosition( position, positionParent, textNodeAtPosition ); | ||
@@ -304,4 +313,7 @@ if ( node instanceof Element ) { | ||
// Get node just before current position | ||
const node = position.textNode ? position.textNode : position.nodeBefore; | ||
// Get node just before the current position. | ||
// Use a highly optimized version instead of checking the text node first and then getting the node before. See #6582. | ||
const positionParent = position.parent; | ||
const textNodeAtPosition = getTextNodeAtPosition( position, positionParent ); | ||
const node = textNodeAtPosition ? textNodeAtPosition : getNodeBeforePosition( position, positionParent, textNodeAtPosition ); | ||
@@ -308,0 +320,0 @@ if ( node instanceof Element ) { |
@@ -1363,3 +1363,3 @@ /** | ||
if ( type == 'move' ) { | ||
if ( type === 'move' ) { | ||
isAffected = | ||
@@ -1371,3 +1371,3 @@ positionOrRange.containsPosition( markerRange.start ) || | ||
} else { | ||
// if type == 'merge'. | ||
// if type === 'merge'. | ||
const elementBefore = positionOrRange.nodeBefore; | ||
@@ -1374,0 +1374,0 @@ const elementAfter = positionOrRange.nodeAfter; |
@@ -160,8 +160,14 @@ /** | ||
is( type, name = null ) { | ||
const cutType = type && type.replace( /^view:/, '' ); | ||
if ( !name ) { | ||
return cutType == 'attributeElement' || super.is( type ); | ||
return type === 'attributeElement' || type === 'view:attributeElement' || | ||
// From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529. | ||
type === this.name || type === 'view:' + this.name || | ||
type === 'element' || type === 'view:element' || | ||
type === 'node' || type === 'view:node'; | ||
} else { | ||
return ( cutType == 'attributeElement' && name == this.name ) || super.is( type, name ); | ||
return name === this.name && ( | ||
type === 'attributeElement' || type === 'view:attributeElement' || | ||
// From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529. | ||
type === 'element' || type === 'view:element' | ||
); | ||
} | ||
@@ -168,0 +174,0 @@ } |
@@ -86,7 +86,14 @@ /** | ||
is( type, name = null ) { | ||
const cutType = type && type.replace( /^view:/, '' ); | ||
if ( !name ) { | ||
return cutType == 'containerElement' || super.is( type ); | ||
return type === 'containerElement' || type === 'view:containerElement' || | ||
// From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529. | ||
type === this.name || type === 'view:' + this.name || | ||
type === 'element' || type === 'view:element' || | ||
type === 'node' || type === 'view:node'; | ||
} else { | ||
return ( cutType == 'containerElement' && name == this.name ) || super.is( type, name ); | ||
return name === this.name && ( | ||
type === 'containerElement' || type === 'view:containerElement' || | ||
// From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529. | ||
type === 'element' || type === 'view:element' | ||
); | ||
} | ||
@@ -93,0 +100,0 @@ } |
@@ -121,3 +121,3 @@ /** | ||
is( type ) { | ||
return type == 'documentFragment' || type == 'view:documentFragment'; | ||
return type === 'documentFragment' || type === 'view:documentFragment'; | ||
} | ||
@@ -124,0 +124,0 @@ |
@@ -295,3 +295,3 @@ /** | ||
is( type ) { | ||
return type == 'selection' || | ||
return type === 'selection' || | ||
type == 'documentSelection' || | ||
@@ -298,0 +298,0 @@ type == 'view:selection' || |
@@ -172,4 +172,3 @@ /** | ||
// Use Array.from because of MS Edge (#923). | ||
for ( const child of Array.from( domElement.childNodes ) ) { | ||
for ( const child of domElement.childNodes ) { | ||
this.unbindDomElement( child ); | ||
@@ -176,0 +175,0 @@ } |
@@ -98,7 +98,16 @@ /** | ||
is( type, name = null ) { | ||
const cutType = type && type.replace( /^view:/, '' ); | ||
if ( !name ) { | ||
return cutType == 'editableElement' || super.is( type ); | ||
return type === 'editableElement' || type === 'view:editableElement' || | ||
// From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529. | ||
type === 'containerElement' || type === 'view:containerElement' || | ||
type === this.name || type === 'view:' + this.name || | ||
type === 'element' || type === 'view:element' || | ||
type === 'node' || type === 'view:node'; | ||
} else { | ||
return ( cutType == 'editableElement' && name == this.name ) || super.is( type, name ); | ||
return name === this.name && ( | ||
type === 'editableElement' || type === 'view:editableElement' || | ||
// From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529. | ||
type === 'containerElement' || type === 'view:containerElement' || | ||
type === 'element' || type === 'view:element' | ||
); | ||
} | ||
@@ -105,0 +114,0 @@ } |
@@ -179,7 +179,9 @@ /** | ||
is( type, name = null ) { | ||
const cutType = type.replace( /^view:/, '' ); | ||
if ( !name ) { | ||
return cutType == 'element' || cutType == this.name || super.is( type ); | ||
return type === this.name || type === 'view:' + this.name || | ||
type === 'element' || type === 'view:element' || | ||
// From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529. | ||
type === 'node' || type === 'view:node'; | ||
} else { | ||
return cutType == 'element' && name == this.name; | ||
return name === this.name && ( type === 'element' || type === 'view:element' ); | ||
} | ||
@@ -186,0 +188,0 @@ } |
@@ -77,7 +77,13 @@ /** | ||
is( type, name = null ) { | ||
const cutType = type.replace( /^view:/, '' ); | ||
if ( !name ) { | ||
return cutType == 'emptyElement' || super.is( type ); | ||
return type === 'emptyElement' || type === 'view:emptyElement' || | ||
// From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529. | ||
type === this.name || type === 'view:' + this.name || | ||
type === 'element' || type === 'view:element' || | ||
type === 'node' || type === 'view:node'; | ||
} else { | ||
return ( cutType == 'emptyElement' && name == this.name ) || super.is( type, name ); | ||
return name === this.name && ( | ||
type === 'emptyElement' || type === 'view:emptyElement' || | ||
type === 'element' || type === 'view:element' | ||
); | ||
} | ||
@@ -84,0 +90,0 @@ } |
@@ -342,3 +342,3 @@ /** | ||
is( type ) { | ||
return type == 'node' || type == 'view:node'; | ||
return type === 'node' || type === 'view:node'; | ||
} | ||
@@ -345,0 +345,0 @@ |
@@ -146,5 +146,9 @@ /** | ||
if ( newViewSelection.rangeCount == 0 ) { | ||
this.view.hasDomSelection = false; | ||
return; | ||
} | ||
this.view.hasDomSelection = true; | ||
if ( this.selection.isEqual( newViewSelection ) && this.domConverter.isDomSelectionCorrect( domSelection ) ) { | ||
@@ -151,0 +155,0 @@ return; |
@@ -225,3 +225,3 @@ /** | ||
is( type ) { | ||
return type == 'position' || type == 'view:position'; | ||
return type === 'position' || type === 'view:position'; | ||
} | ||
@@ -228,0 +228,0 @@ |
@@ -452,3 +452,3 @@ /** | ||
is( type ) { | ||
return type == 'range' || type == 'view:range'; | ||
return type === 'range' || type === 'view:range'; | ||
} | ||
@@ -455,0 +455,0 @@ |
@@ -44,7 +44,6 @@ /** | ||
* | ||
* rootEditableElement.is( 'rootEditableElement' ); // -> true | ||
* rootEditableElement.is( 'rootElement' ); // -> true | ||
* rootEditableElement.is( 'editableElement' ); // -> true | ||
* rootEditableElement.is( 'element' ); // -> true | ||
* rootEditableElement.is( 'node' ); // -> true | ||
* rootEditableElement.is( 'view:rootEditableElement' ); // -> true | ||
* rootEditableElement.is( 'view:editableElement' ); // -> true | ||
@@ -57,7 +56,7 @@ * rootEditableElement.is( 'view:element' ); // -> true | ||
* | ||
* Assuming that the object being checked is a root editbale element, you can also check its | ||
* Assuming that the object being checked is a root editable element, you can also check its | ||
* {@link module:engine/view/rooteditableelement~RootEditableElement#name name}: | ||
* | ||
* rootEditableElement.is( 'div' ); // -> true if this is a div root editable element | ||
* rootEditableElement.is( 'rootEditableElement', 'div' ); // -> same as above | ||
* rootEditableElement.is( 'rootElement', 'div' ); // -> same as above | ||
* text.is( 'div' ); -> false | ||
@@ -73,7 +72,18 @@ * | ||
is( type, name = null ) { | ||
const cutType = type.replace( /^view:/, '' ); | ||
if ( !name ) { | ||
return cutType == 'rootElement' || super.is( type ); | ||
return type === 'rootElement' || type === 'view:rootElement' || | ||
// From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529. | ||
type === 'editableElement' || type === 'view:editableElement' || | ||
type === 'containerElement' || type === 'view:containerElement' || | ||
type === this.name || type === 'view:' + this.name || | ||
type === 'element' || type === 'view:element' || | ||
type === 'node' || type === 'view:node'; | ||
} else { | ||
return ( cutType == 'rootElement' && name == this.name ) || super.is( type, name ); | ||
return name === this.name && ( | ||
type === 'rootElement' || type === 'view:rootElement' || | ||
// From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529. | ||
type === 'editableElement' || type === 'view:editableElement' || | ||
type === 'containerElement' || type === 'view:containerElement' || | ||
type === 'element' || type === 'view:element' | ||
); | ||
} | ||
@@ -80,0 +90,0 @@ } |
@@ -593,3 +593,3 @@ /** | ||
is( type ) { | ||
return type == 'selection' || type == 'view:selection'; | ||
return type === 'selection' || type === 'view:selection'; | ||
} | ||
@@ -596,0 +596,0 @@ |
@@ -63,3 +63,5 @@ /** | ||
is( type ) { | ||
return type == 'text' || type == 'view:text' || super.is( type ); | ||
return type === 'text' || type === 'view:text' || | ||
// From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529. | ||
type === 'node' || type === 'view:node'; | ||
} | ||
@@ -66,0 +68,0 @@ |
@@ -159,3 +159,3 @@ /** | ||
is( type ) { | ||
return type == 'textProxy' || type == 'view:textProxy'; | ||
return type === 'textProxy' || type === 'view:textProxy'; | ||
} | ||
@@ -162,0 +162,0 @@ |
@@ -90,7 +90,13 @@ /** | ||
is( type, name = null ) { | ||
const cutType = type.replace( /^view:/, '' ); | ||
if ( !name ) { | ||
return cutType == 'uiElement' || super.is( type ); | ||
return type === 'uiElement' || type === 'view:uiElement' || | ||
// From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529. | ||
type === this.name || type === 'view:' + this.name || | ||
type === 'element' || type === 'view:element' || | ||
type === 'node' || type === 'view:node'; | ||
} else { | ||
return ( cutType == 'uiElement' && name == this.name ) || super.is( type, name ); | ||
return name === this.name && ( | ||
type === 'uiElement' || type === 'view:uiElement' || | ||
type === 'element' || type === 'view:element' | ||
); | ||
} | ||
@@ -97,0 +103,0 @@ } |
@@ -104,2 +104,10 @@ /** | ||
/** | ||
* Informs whether the DOM selection is inside any of the DOM roots managed by the view. | ||
* | ||
* @readonly | ||
* @member {Boolean} #hasDomSelection | ||
*/ | ||
this.set( 'hasDomSelection', false ); | ||
/** | ||
* Instance of the {@link module:engine/view/renderer~Renderer renderer}. | ||
@@ -106,0 +114,0 @@ * |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
1708880
38588
21
+ Added@ckeditor/ckeditor5-utils@19.0.2(transitive)
- Removed@ckeditor/ckeditor5-utils@18.0.0(transitive)