@ckeditor/ckeditor5-engine
Advanced tools
Comparing version 0.0.0-nightly-20240924.0 to 0.0.0-nightly-20240925.0
{ | ||
"name": "@ckeditor/ckeditor5-engine", | ||
"version": "0.0.0-nightly-20240924.0", | ||
"version": "0.0.0-nightly-20240925.0", | ||
"description": "The editing engine of CKEditor 5 – the best browser-based rich text editor.", | ||
@@ -27,3 +27,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@ckeditor/ckeditor5-utils": "0.0.0-nightly-20240924.0", | ||
"@ckeditor/ckeditor5-utils": "0.0.0-nightly-20240925.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 @@ /** |
@@ -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
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
13471093
126651
+ Added@ckeditor/ckeditor5-utils@0.0.0-nightly-20240925.0(transitive)
- Removed@ckeditor/ckeditor5-utils@0.0.0-nightly-20240924.0(transitive)