@portabletext/editor 1.0.9 → 1.0.10

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.mjs CHANGED
@@ -3047,7 +3047,7 @@ function createWithHotkeys(types, portableTextEditor, hotkeysFromOptions) {
3047
3047
  const reservedHotkeys = ["enter", "tab", "shift", "delete", "end"], activeHotkeys = hotkeysFromOptions || DEFAULT_HOTKEYS;
3048
3048
  return function(editor) {
3049
3049
  return editor.pteWithHotKeys = (event) => {
3050
- var _a, _b, _c, _d;
3050
+ var _a, _b, _c, _d, _e, _f;
3051
3051
  Object.keys(activeHotkeys).forEach((cat) => {
3052
3052
  if (cat === "marks")
3053
3053
  for (const hotkey in activeHotkeys[cat]) {
@@ -3120,8 +3120,8 @@ function createWithHotkeys(types, portableTextEditor, hotkeysFromOptions) {
3120
3120
  const nextBlock = Node.descendant(
3121
3121
  editor,
3122
3122
  Path.next(editor.selection.focus.path.slice(0, 1))
3123
- ), focusBlockPath = editor.selection.focus.path.slice(0, 1), focusBlock = Node.descendant(editor, focusBlockPath);
3124
- if (nextBlock && focusBlock && !Editor.isVoid(editor, focusBlock) && Editor.isVoid(editor, nextBlock)) {
3123
+ ), focusBlockPath = editor.selection.focus.path.slice(0, 1), focusBlock = Node.descendant(editor, focusBlockPath), isEmptyFocusBlock = isPortableTextTextBlock(focusBlock) && focusBlock.children.length === 1 && ((_f = (_e = focusBlock.children) == null ? void 0 : _e[0]) == null ? void 0 : _f.text) === "";
3124
+ if (nextBlock && focusBlock && !Editor.isVoid(editor, focusBlock) && Editor.isVoid(editor, nextBlock) && isEmptyFocusBlock) {
3125
3125
  debug$8("Preventing deleting void block below"), event.preventDefault(), event.stopPropagation(), Transforms.removeNodes(editor, { match: (n) => n === focusBlock }), Transforms.select(editor, focusBlockPath), editor.onChange();
3126
3126
  return;
3127
3127
  }
@@ -4000,7 +4000,7 @@ class PortableTextEditor extends Component {
4000
4000
  if (this.editable)
4001
4001
  return this.editable.getValue();
4002
4002
  }), !props.schemaType)
4003
- throw new Error('PortableTextEditor: missing "type" property');
4003
+ throw new Error('PortableTextEditor: missing "schemaType" property');
4004
4004
  props.incomingPatches$ && console.warn("The prop 'incomingPatches$' is deprecated and renamed to 'patches$'"), this.change$.next({ type: "loading", isLoading: !0 }), this.schemaTypes = getPortableTextMemberSchemaTypes(
4005
4005
  props.schemaType.hasOwnProperty("jsonType") ? props.schemaType : compileType(props.schemaType)
4006
4006
  );