@portabletext/editor 7.3.0 → 7.3.2

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
@@ -3270,13 +3270,15 @@ const RestoreDOM = IS_ANDROID ? RestoreDOMComponent : ({
3270
3270
  }
3271
3271
  }
3272
3272
  if ((!type.startsWith("delete") || type.startsWith("deleteBy")) && !editor.isNodeMapDirty) {
3273
- const [targetRange2] = event.getTargetRanges();
3274
- if (targetRange2) {
3275
- const range2 = DOMEditor.toEditorSelection(editor, targetRange2, {
3273
+ const [targetRange2] = event.getTargetRanges(), domSelection = getSelection(DOMEditor.findDocumentOrShadowRoot(editor)), inputTarget = targetRange2 ?? (domSelection && domSelection.rangeCount > 0 ? domSelection : void 0);
3274
+ if (inputTarget) {
3275
+ const range2 = DOMEditor.toEditorSelection(editor, inputTarget, {
3276
3276
  exactMatch: !1,
3277
- suppressThrow: !1
3277
+ // The DOM selection fallback is not guaranteed to be a valid
3278
+ // editor range, so don't throw on it.
3279
+ suppressThrow: !targetRange2
3278
3280
  });
3279
- if (!selection || !rangeEquals(selection, range2)) {
3281
+ if (range2 && (!selection || !rangeEquals(selection, range2))) {
3280
3282
  native = !1;
3281
3283
  const selectionRef = !isCompositionChange && editor.snapshot.context.selection && rangeRef(editor, editor.snapshot.context.selection);
3282
3284
  editor.select(range2), selectionRef && (editor.userSelection = selectionRef);
@@ -16368,6 +16370,8 @@ function isTypeAlreadyRegistered(maps, attempting, type) {
16368
16370
  };
16369
16371
  if (claimedAs(attempting))
16370
16372
  return console.warn(`registerNode: type "${type}" is already registered as a ${attempting}. Registration skipped.`), !0;
16373
+ if (type === "*")
16374
+ return !1;
16371
16375
  const exclusiveKinds = ["container", "textBlock", "span"], allKinds = ["container", "textBlock", "span", "blockObject", "inlineObject"];
16372
16376
  for (const otherKind of allKinds) {
16373
16377
  if (otherKind === attempting || attempting === "blockObject" && otherKind === "inlineObject" || attempting === "inlineObject" && otherKind === "blockObject")