@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.esm.js CHANGED
@@ -1176,13 +1176,7 @@ function createWithEditableAPI(portableTextEditor, types, keyGenerator) {
1176
1176
  at: editor.selection,
1177
1177
  match: (n) => n._type === types.span.name
1178
1178
  }
1179
- ), editor.onChange(), editor.selection && Transforms.insertNodes(
1180
- editor,
1181
- [{ _type: "span", text: "", marks: [], _key: keyGenerator() }],
1182
- {
1183
- at: Range.end(editor.selection)
1184
- }
1185
- );
1179
+ ), editor.onChange();
1186
1180
  const newPortableTextEditorSelection = toPortableTextRange(
1187
1181
  fromSlateValue(editor.children, types.block.name, KEY_TO_VALUE_ELEMENT.get(editor)),
1188
1182
  editor.selection,
@@ -2854,10 +2848,6 @@ function createWithPortableTextMarkModel(types, change$, keyGenerator) {
2854
2848
  }
2855
2849
  }
2856
2850
  }
2857
- if (isSpan && Array.isArray(node.marks) && (!node.marks || node.marks.length > 0 && node.text === "")) {
2858
- Transforms.setNodes(editor, { marks: [] }, { at: path, voids: !1 });
2859
- return;
2860
- }
2861
2851
  }
2862
2852
  if (editor.isTextBlock(node) && !editor.operations.some(
2863
2853
  (op) => op.type === "merge_node" && "markDefs" in op.properties && op.path.length === 1
@@ -2941,6 +2931,12 @@ function createWithPortableTextMarkModel(types, change$, keyGenerator) {
2941
2931
  }), editor.onChange();
2942
2932
  return;
2943
2933
  }
2934
+ if (node.marks !== void 0 && node.marks.length > 0 && deletingAllText) {
2935
+ Editor.withoutNormalizing(editor, () => {
2936
+ apply2(op), Transforms.setNodes(editor, { marks: [] }, { at: op.path });
2937
+ }), editor.onChange();
2938
+ return;
2939
+ }
2944
2940
  }
2945
2941
  }
2946
2942
  apply2(op);