slate 0.128.0 → 0.128.2-20261007172858

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.es.js CHANGED
@@ -3970,6 +3970,26 @@ var shouldMergeNodesRemovePrevNode = (editor, _ref, _ref2) => {
3970
3970
  return Node.isElement(prevNode) && Editor.isEmpty(editor, prevNode) || Node.isText(prevNode) && prevNode.text === '' && prevPath[prevPath.length - 1] !== 0;
3971
3971
  };
3972
3972
 
3973
+ var isEmptyInline = (editor, node) => Node.isElement(node) && Editor.isInline(editor, node) && !Editor.isVoid(editor, node) && Editor.isEmpty(editor, node);
3974
+ var findEmptyInlineToDelete = (editor, point, reverse) => {
3975
+ var inlinePath = Path.parent(point.path);
3976
+ if (inlinePath.length > 0 && isEmptyInline(editor, Node.get(editor, inlinePath))) {
3977
+ return inlinePath;
3978
+ }
3979
+ var text = Node.get(editor, point.path);
3980
+ var atEdge = reverse ? point.offset === 0 : Node.isText(text) && point.offset === text.text.length;
3981
+ if (!atEdge) {
3982
+ return undefined;
3983
+ }
3984
+ if (reverse && !Path.hasPrevious(point.path)) {
3985
+ return undefined;
3986
+ }
3987
+ var siblingPath = reverse ? Path.previous(point.path) : Path.next(point.path);
3988
+ if (Node.has(editor, siblingPath) && isEmptyInline(editor, Node.get(editor, siblingPath))) {
3989
+ return siblingPath;
3990
+ }
3991
+ return undefined;
3992
+ };
3973
3993
  var deleteText = function deleteText(editor) {
3974
3994
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
3975
3995
  Editor.withoutNormalizing(editor, () => {
@@ -3997,9 +4017,12 @@ var deleteText = function deleteText(editor) {
3997
4017
  at,
3998
4018
  mode: 'highest'
3999
4019
  });
4020
+ var emptyInlinePath = unit === 'character' && distance === 1 ? findEmptyInlineToDelete(editor, at, reverse) : undefined;
4000
4021
  if (!voids && furthestVoid) {
4001
4022
  var [, voidPath] = furthestVoid;
4002
4023
  at = voidPath;
4024
+ } else if (emptyInlinePath) {
4025
+ at = emptyInlinePath;
4003
4026
  } else {
4004
4027
  var opts = {
4005
4028
  unit,