@portabletext/editor 1.0.15 → 1.0.17

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/lib/index.js CHANGED
@@ -1160,13 +1160,7 @@ function createWithEditableAPI(portableTextEditor, types$1, keyGenerator) {
1160
1160
  at: editor.selection,
1161
1161
  match: (n) => n._type === types$1.span.name
1162
1162
  }
1163
- ), editor.onChange(), editor.selection && slate.Transforms.insertNodes(
1164
- editor,
1165
- [{ _type: "span", text: "", marks: [], _key: keyGenerator() }],
1166
- {
1167
- at: slate.Range.end(editor.selection)
1168
- }
1169
- );
1163
+ ), editor.onChange();
1170
1164
  const newPortableTextEditorSelection = toPortableTextRange(
1171
1165
  fromSlateValue(editor.children, types$1.block.name, KEY_TO_VALUE_ELEMENT.get(editor)),
1172
1166
  editor.selection,
@@ -2838,10 +2832,6 @@ function createWithPortableTextMarkModel(types2, change$, keyGenerator) {
2838
2832
  }
2839
2833
  }
2840
2834
  }
2841
- if (isSpan && Array.isArray(node.marks) && (!node.marks || node.marks.length > 0 && node.text === "")) {
2842
- slate.Transforms.setNodes(editor, { marks: [] }, { at: path, voids: !1 });
2843
- return;
2844
- }
2845
2835
  }
2846
2836
  if (editor.isTextBlock(node) && !editor.operations.some(
2847
2837
  (op) => op.type === "merge_node" && "markDefs" in op.properties && op.path.length === 1
@@ -2925,6 +2915,12 @@ function createWithPortableTextMarkModel(types2, change$, keyGenerator) {
2925
2915
  }), editor.onChange();
2926
2916
  return;
2927
2917
  }
2918
+ if (node.marks !== void 0 && node.marks.length > 0 && deletingAllText) {
2919
+ slate.Editor.withoutNormalizing(editor, () => {
2920
+ apply2(op), slate.Transforms.setNodes(editor, { marks: [] }, { at: op.path });
2921
+ }), editor.onChange();
2922
+ return;
2923
+ }
2928
2924
  }
2929
2925
  }
2930
2926
  apply2(op);