@ckeditor/ckeditor5-html-support 48.5.2 → 48.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +11 -7
- package/dist/index.js.map +1 -1
- package/package.json +12 -12
package/dist/index.js
CHANGED
|
@@ -89,10 +89,13 @@ function modifyGhsAttribute(writer, item, ghsAttributeName, subject, callback) {
|
|
|
89
89
|
callback(values);
|
|
90
90
|
if (values.size) newValue[kind] = Object.fromEntries(values);
|
|
91
91
|
}
|
|
92
|
-
if (Object.keys(newValue).length)
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
else
|
|
92
|
+
if (Object.keys(newValue).length) {
|
|
93
|
+
if (item.is("documentSelection")) writer.setSelectionAttribute(ghsAttributeName, newValue);
|
|
94
|
+
else writer.setAttribute(ghsAttributeName, newValue, item);
|
|
95
|
+
} else if (oldValue) {
|
|
96
|
+
if (item.is("documentSelection")) writer.removeSelectionAttribute(ghsAttributeName);
|
|
97
|
+
else writer.removeAttribute(ghsAttributeName, item);
|
|
98
|
+
}
|
|
96
99
|
}
|
|
97
100
|
/**
|
|
98
101
|
* Strips the `styles`, and `classes` keys from the GHS attribute value on the given item.
|
|
@@ -3439,9 +3442,10 @@ function* getItemsToUpdateGhsAttribute(model, selectable, ghsAttributeName) {
|
|
|
3439
3442
|
* Translates a given selectable to an iterable of ranges.
|
|
3440
3443
|
*/
|
|
3441
3444
|
function getValidRangesForSelectable(model, selectable, ghsAttributeName) {
|
|
3442
|
-
if (!(Symbol.iterator in selectable) && (selectable.is("node") || selectable.is("$text") || selectable.is("$textProxy")))
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
+
if (!(Symbol.iterator in selectable) && (selectable.is("node") || selectable.is("$text") || selectable.is("$textProxy"))) {
|
|
3446
|
+
if (model.schema.checkAttribute(selectable, ghsAttributeName)) return [model.createRangeOn(selectable)];
|
|
3447
|
+
else return [];
|
|
3448
|
+
} else return model.schema.getValidRanges(model.createSelection(selectable).getRanges(), ghsAttributeName);
|
|
3445
3449
|
}
|
|
3446
3450
|
|
|
3447
3451
|
/**
|