@ckeditor/ckeditor5-engine
Advanced tools
Comparing version 43.1.1 to 43.2.0-alpha.0
@@ -53,2 +53,7 @@ /** | ||
/** | ||
* If set to `true`, indicates that the function specified by listener will never call `preventDefault()`. | ||
* Default value is `false`. | ||
*/ | ||
usePassive: boolean; | ||
/** | ||
* Callback which should be called when the DOM event occurred. Note that the callback will not be called if | ||
@@ -55,0 +60,0 @@ * observer {@link #isEnabled is not enabled}. |
{ | ||
"name": "@ckeditor/ckeditor5-engine", | ||
"version": "43.1.1", | ||
"version": "43.2.0-alpha.0", | ||
"description": "The editing engine of CKEditor 5 – the best browser-based rich text editor.", | ||
@@ -27,3 +27,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@ckeditor/ckeditor5-utils": "43.1.1", | ||
"@ckeditor/ckeditor5-utils": "43.2.0-alpha.0", | ||
"lodash-es": "4.17.21" | ||
@@ -30,0 +30,0 @@ }, |
@@ -70,3 +70,10 @@ /** | ||
const index = this.getNodeIndex(node); | ||
return index === null ? null : this._nodes.slice(0, index).reduce((sum, node) => sum + node.offsetSize, 0); | ||
if (index === null) { | ||
return null; | ||
} | ||
let sum = 0; | ||
for (let i = 0; i < index; i++) { | ||
sum += this._nodes[i].offsetSize; | ||
} | ||
return sum; | ||
} | ||
@@ -73,0 +80,0 @@ /** |
@@ -823,3 +823,3 @@ /** | ||
const ref = ranges[0]; | ||
// 2. Sort all the ranges so it's easier to process them. | ||
// 2. Sort all the ranges, so it's easier to process them. | ||
ranges.sort((a, b) => { | ||
@@ -831,3 +831,3 @@ return a.start.isAfter(b.start) ? 1 : -1; | ||
// 4. At this moment we don't need the original range. | ||
// We are going to modify the result and we need to return a new instance of Range. | ||
// We are going to modify the result, and we need to return a new instance of Range. | ||
// We have to create a copy of the reference range. | ||
@@ -837,13 +837,10 @@ const result = new this(ref.start, ref.end); | ||
// Since ranges are sorted, start with the range with index that is closest to reference range index. | ||
if (refIndex > 0) { | ||
// eslint-disable-next-line no-constant-condition | ||
for (let i = refIndex - 1; true; i++) { | ||
if (ranges[i].end.isEqual(result.start)) { | ||
result.start = Position._createAt(ranges[i].start); | ||
} | ||
else { | ||
// If ranges are not starting/ending at the same position there is no point in looking further. | ||
break; | ||
} | ||
for (let i = refIndex - 1; i >= 0; i--) { | ||
if (ranges[i].end.isEqual(result.start)) { | ||
result.start = Position._createAt(ranges[i].start); | ||
} | ||
else { | ||
// If ranges are not starting/ending at the same position there is no point in looking further. | ||
break; | ||
} | ||
} | ||
@@ -850,0 +847,0 @@ // 6. Ranges should be checked and glued starting from the range that is closest to the reference range. |
@@ -49,2 +49,7 @@ /** | ||
/** | ||
* If set to `true`, indicates that the function specified by listener will never call `preventDefault()`. | ||
* Default value is `false`. | ||
*/ | ||
usePassive: boolean; | ||
/** | ||
* Callback which should be called when the DOM event occurred. Note that the callback will not be called if | ||
@@ -51,0 +56,0 @@ * observer {@link #isEnabled is not enabled}. |
@@ -45,2 +45,7 @@ /** | ||
this.useCapture = false; | ||
/** | ||
* If set to `true`, indicates that the function specified by listener will never call `preventDefault()`. | ||
* Default value is `false`. | ||
*/ | ||
this.usePassive = false; | ||
} | ||
@@ -57,3 +62,3 @@ /** | ||
} | ||
}, { useCapture: this.useCapture }); | ||
}, { useCapture: this.useCapture, usePassive: this.usePassive }); | ||
}); | ||
@@ -60,0 +65,0 @@ } |
@@ -73,3 +73,3 @@ /** | ||
this.listenTo(domDocument, 'mouseup', endDocumentIsSelecting, { priority: 'highest', useCapture: true }); | ||
this.listenTo(domDocument, 'selectionchange', (evt, domEvent) => { | ||
this.listenTo(domDocument, 'selectionchange', () => { | ||
// @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) { | ||
@@ -76,0 +76,0 @@ // @if CK_DEBUG_TYPING // _debouncedLine(); |
@@ -452,10 +452,9 @@ /** | ||
} | ||
const domAttrKeys = Array.from(domElement.attributes).map(attr => attr.name); | ||
const viewAttrKeys = viewElement.getAttributeKeys(); | ||
// Add or overwrite attributes. | ||
for (const key of viewAttrKeys) { | ||
this.domConverter.setDomElementAttribute(domElement, key, viewElement.getAttribute(key), viewElement); | ||
} | ||
// Remove from DOM attributes which do not exists in the view. | ||
for (const key of domAttrKeys) { | ||
// Remove attributes from DOM elements if they do not exist in the view. | ||
// | ||
// Note: It is important to first remove DOM attributes and then set new ones, because some view attributes may be renamed | ||
// as they are set on DOM (due to unsafe attributes handling). If we set the view attribute first, and then remove | ||
// non-existing DOM attributes, then we would remove the attribute that we just set. | ||
for (const domAttr of domElement.attributes) { | ||
const key = domAttr.name; | ||
// All other attributes not present in the DOM should be removed. | ||
@@ -466,2 +465,6 @@ if (!viewElement.hasAttribute(key)) { | ||
} | ||
// Add or overwrite attributes. | ||
for (const key of viewElement.getAttributeKeys()) { | ||
this.domConverter.setDomElementAttribute(domElement, key, viewElement.getAttribute(key), viewElement); | ||
} | ||
} | ||
@@ -468,0 +471,0 @@ /** |
@@ -470,16 +470,15 @@ /** | ||
getStyleNames(styles) { | ||
const styleNamesKeysSet = new Set(); | ||
// Find all extractable styles that have a value. | ||
const expandedStyleNames = Array.from(this._consumables.keys()).filter(name => { | ||
for (const name of this._consumables.keys()) { | ||
const style = this.getNormalized(name, styles); | ||
if (style && typeof style == 'object') { | ||
return Object.keys(style).length; | ||
if (style && (typeof style != 'object' || Object.keys(style).length)) { | ||
styleNamesKeysSet.add(name); | ||
} | ||
return style; | ||
}); | ||
} | ||
// For simple styles (for example `color`) we don't have a map of those styles | ||
// but they are 1 to 1 with normalized object keys. | ||
const styleNamesKeysSet = new Set([ | ||
...expandedStyleNames, | ||
...Object.keys(styles) | ||
]); | ||
for (const name of Object.keys(styles)) { | ||
styleNamesKeysSet.add(name); | ||
} | ||
return Array.from(styleNamesKeysSet); | ||
@@ -486,0 +485,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 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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
13471604
126651
1
+ Added@ckeditor/ckeditor5-utils@43.2.0-alpha.0(transitive)
- Removed@ckeditor/ckeditor5-utils@43.1.1(transitive)