@ckeditor/ckeditor5-widget 43.1.0-alpha.1 → 43.1.0-alpha.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.js +13 -3
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/src/widget.js +14 -3
package/dist/index.js
CHANGED
@@ -1984,9 +1984,19 @@ function selectionWillShrink(selection, isForward) {
|
|
1984
1984
|
if (!viewPosition.parent) {
|
1985
1985
|
return null;
|
1986
1986
|
}
|
1987
|
-
|
1988
|
-
|
1989
|
-
|
1987
|
+
let viewNode = viewPosition.parent;
|
1988
|
+
if (viewPosition.parent.is('editableElement')) {
|
1989
|
+
if (viewPosition.isAtEnd && viewPosition.nodeBefore) {
|
1990
|
+
// Click after a widget tend to return position at the end of the editable element
|
1991
|
+
// so use the node before it if range is at the end of a parent.
|
1992
|
+
viewNode = viewPosition.nodeBefore;
|
1993
|
+
} else if (viewPosition.isAtStart && viewPosition.nodeAfter) {
|
1994
|
+
// Click before a widget tend to return position at the start of the editable element
|
1995
|
+
// so use the node after it if range is at the start of a parent.
|
1996
|
+
// See more: https://github.com/ckeditor/ckeditor5/issues/16992
|
1997
|
+
viewNode = viewPosition.nodeAfter;
|
1998
|
+
}
|
1999
|
+
}
|
1990
2000
|
if (viewNode.is('$text')) {
|
1991
2001
|
return viewNode.parent;
|
1992
2002
|
}
|