@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.js CHANGED
@@ -3031,7 +3031,7 @@ function createWithHotkeys(types$1, portableTextEditor, hotkeysFromOptions) {
3031
3031
  const reservedHotkeys = ["enter", "tab", "shift", "delete", "end"], activeHotkeys = hotkeysFromOptions || DEFAULT_HOTKEYS;
3032
3032
  return function(editor) {
3033
3033
  return editor.pteWithHotKeys = (event) => {
3034
- var _a, _b, _c, _d;
3034
+ var _a, _b, _c, _d, _e, _f;
3035
3035
  Object.keys(activeHotkeys).forEach((cat) => {
3036
3036
  if (cat === "marks")
3037
3037
  for (const hotkey in activeHotkeys[cat]) {
@@ -3104,8 +3104,8 @@ function createWithHotkeys(types$1, portableTextEditor, hotkeysFromOptions) {
3104
3104
  const nextBlock = slate.Node.descendant(
3105
3105
  editor,
3106
3106
  slate.Path.next(editor.selection.focus.path.slice(0, 1))
3107
- ), focusBlockPath = editor.selection.focus.path.slice(0, 1), focusBlock = slate.Node.descendant(editor, focusBlockPath);
3108
- if (nextBlock && focusBlock && !slate.Editor.isVoid(editor, focusBlock) && slate.Editor.isVoid(editor, nextBlock)) {
3107
+ ), focusBlockPath = editor.selection.focus.path.slice(0, 1), focusBlock = slate.Node.descendant(editor, focusBlockPath), isEmptyFocusBlock = types.isPortableTextTextBlock(focusBlock) && focusBlock.children.length === 1 && ((_f = (_e = focusBlock.children) == null ? void 0 : _e[0]) == null ? void 0 : _f.text) === "";
3108
+ if (nextBlock && focusBlock && !slate.Editor.isVoid(editor, focusBlock) && slate.Editor.isVoid(editor, nextBlock) && isEmptyFocusBlock) {
3109
3109
  debug$8("Preventing deleting void block below"), event.preventDefault(), event.stopPropagation(), slate.Transforms.removeNodes(editor, { match: (n) => n === focusBlock }), slate.Transforms.select(editor, focusBlockPath), editor.onChange();
3110
3110
  return;
3111
3111
  }
@@ -3984,7 +3984,7 @@ class PortableTextEditor extends react.Component {
3984
3984
  if (this.editable)
3985
3985
  return this.editable.getValue();
3986
3986
  }), !props.schemaType)
3987
- throw new Error('PortableTextEditor: missing "type" property');
3987
+ throw new Error('PortableTextEditor: missing "schemaType" property');
3988
3988
  props.incomingPatches$ && console.warn("The prop 'incomingPatches$' is deprecated and renamed to 'patches$'"), this.change$.next({ type: "loading", isLoading: !0 }), this.schemaTypes = getPortableTextMemberSchemaTypes(
3989
3989
  props.schemaType.hasOwnProperty("jsonType") ? props.schemaType : compileType(props.schemaType)
3990
3990
  );