@ckeditor/ckeditor5-widget 0.0.0-nightly-20251014.0 → 0.0.0-nightly-20251016.0
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.
Potentially problematic release.
This version of @ckeditor/ckeditor5-widget might be problematic. Click here for more details.
- package/README.md +1 -1
- package/dist/index.js +15 -8
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
- package/src/widget.js +18 -9
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@ CKEditor 5 widget API
|
|
|
2
2
|
========================================
|
|
3
3
|
|
|
4
4
|
[](https://www.npmjs.com/package/@ckeditor/ckeditor5-widget)
|
|
5
|
-
[](https://codecov.io/gh/ckeditor/ckeditor5)
|
|
6
6
|
[](https://app.circleci.com/pipelines/github/ckeditor/ckeditor5?branch=master)
|
|
7
7
|
|
|
8
8
|
This package implements the widget API for CKEditor 5.
|
package/dist/index.js
CHANGED
|
@@ -1654,6 +1654,7 @@ function selectionWillShrink(selection, isForward) {
|
|
|
1654
1654
|
evt.stop();
|
|
1655
1655
|
}
|
|
1656
1656
|
}, {
|
|
1657
|
+
context: (node)=>node.is('editableElement'),
|
|
1657
1658
|
priority: 'low'
|
|
1658
1659
|
});
|
|
1659
1660
|
// Add the information about the keystrokes to the accessibility database.
|
|
@@ -1980,12 +1981,8 @@ function selectionWillShrink(selection, isForward) {
|
|
|
1980
1981
|
direction
|
|
1981
1982
|
})){
|
|
1982
1983
|
const item = nextPosition.parent;
|
|
1983
|
-
//
|
|
1984
|
-
if (item
|
|
1985
|
-
continue;
|
|
1986
|
-
}
|
|
1987
|
-
// Some widget along the way.
|
|
1988
|
-
if (isWidget(item)) {
|
|
1984
|
+
// Some widget along the way except the currently selected one.
|
|
1985
|
+
if (isWidget(item) && item != selectedElement) {
|
|
1989
1986
|
const modelElement = editing.mapper.toModelElement(item);
|
|
1990
1987
|
// Do not select inline widgets.
|
|
1991
1988
|
if (!model.schema.isBlock(modelElement)) {
|
|
@@ -1996,16 +1993,26 @@ function selectionWillShrink(selection, isForward) {
|
|
|
1996
1993
|
return model.createRangeOn(modelElement);
|
|
1997
1994
|
}
|
|
1998
1995
|
} else if (item.is('editableElement')) {
|
|
1996
|
+
// Ignore the current editable for text selection,
|
|
1997
|
+
// but use it when widget was selected to be able to jump after the widget.
|
|
1998
|
+
if (item == editableElement && !selectedElement) {
|
|
1999
|
+
continue;
|
|
2000
|
+
}
|
|
1999
2001
|
const modelPosition = editing.mapper.toModelPosition(nextPosition);
|
|
2000
|
-
|
|
2002
|
+
const newRange = model.schema.getNearestSelectionRange(modelPosition, direction);
|
|
2001
2003
|
// There is nothing to select so just jump to the next one.
|
|
2002
2004
|
if (!newRange) {
|
|
2003
2005
|
continue;
|
|
2004
2006
|
}
|
|
2007
|
+
// In the same editable while widget was selected - do not select the editable content.
|
|
2008
|
+
if (item == editableElement && selectedElement) {
|
|
2009
|
+
return newRange;
|
|
2010
|
+
}
|
|
2005
2011
|
// Select the content of editable element when iterating over sibling editable elements
|
|
2006
2012
|
// or going deeper into nested widgets.
|
|
2007
2013
|
if (compareArrays(editablePath, item.getPath()) != 'extension') {
|
|
2008
|
-
|
|
2014
|
+
// Find a limit element closest to the new selection range.
|
|
2015
|
+
return model.createRangeIn(model.schema.getLimitElement(newRange));
|
|
2009
2016
|
}
|
|
2010
2017
|
return newRange;
|
|
2011
2018
|
}
|