@bettercms-ai/kit 3.1.15 → 3.1.16

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.
@@ -7,7 +7,7 @@ import { Textarea } from "../../ui/input.js";
7
7
  import { LinkPopoverBody } from "../link.js";
8
8
  import { ExpandedEditorModal } from "../../ui/expanded-editor-modal.js";
9
9
  import { COMPONENT_INSERT_TOAST } from "../component-services.js";
10
- import { closestBlock, createIsland, defaultModel, editingHost, esc, hydrate, isEmptyHtml, placeCaret, rangeRect, rid, sanitize, serialize, textBeforeCaret, topBlock } from "./dom.js";
10
+ import { closestBlock, createIsland, defaultModel, editingHost, esc, hydrate, isEmptyHtml, ownsMenu, placeCaret, rangeRect, rid, sanitize, serialize, textBeforeCaret, topBlock } from "./dom.js";
11
11
  import { eventKey } from "../../lib/key-event.js";
12
12
  import { ALL_FEATURES } from "./codec.js";
13
13
  import { createOutlineStore, outlineOf } from "./toc.js";
@@ -875,8 +875,8 @@ function RichTextEditor({ value, onChange, readOnly, placeholder, docKey, featur
875
875
  emit();
876
876
  return;
877
877
  }
878
- if (ne.inputType === "insertText" && ne.data === "`" && allows("code")) liveInlineCode();
879
- else if (ne.inputType === "insertText" && (ne.data === "*" || ne.data === "_")) liveInlineEmphasis(ne.data, allows);
878
+ if (ne.inputType === "insertText" && ne.data === "`" && allows("code")) liveInlineCode(ref.current);
879
+ else if (ne.inputType === "insertText" && (ne.data === "*" || ne.data === "_")) liveInlineEmphasis(ne.data, allows, ref.current);
880
880
  const s = window.getSelection();
881
881
  if (!s || !s.rangeCount) {
882
882
  emit();
@@ -1361,7 +1361,9 @@ function RichTextEditor({ value, onChange, readOnly, placeholder, docKey, featur
1361
1361
  window.clearTimeout(blurTimer.current);
1362
1362
  blurTimer.current = window.setTimeout(() => {
1363
1363
  const a = document.activeElement;
1364
- if (wrap.current?.contains(a) || a?.closest("[role=menu],[role=dialog],[role=listbox],[data-floating-layer]")) return;
1364
+ if (wrap.current?.contains(a) || a?.closest("[role=dialog],[role=listbox],[data-floating-layer]")) return;
1365
+ const menu = a?.closest("[role=menu]");
1366
+ if (menu && ownsMenu(menu, [wrap.current, document.querySelector("[data-floating-layer][aria-label=\"Selection formatting\"]")])) return;
1365
1367
  setFocused(false);
1366
1368
  setBubble(null);
1367
1369
  ref.current?.querySelectorAll("[data-hint]").forEach((n) => n.removeAttribute("data-hint"));