@estiva-app/ui 0.82.1 → 0.83.0

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/dist/editor.js CHANGED
@@ -529,33 +529,143 @@ function ComposeBox({ editor, onSend, placeholder, tools, attachments, ready = f
529
529
 
530
530
  // src/CommentBox.tsx
531
531
  import { Fragment as Fragment2, useCallback as useCallback4, useEffect as useEffect4, useRef as useRef3, useState as useState4 } from "react";
532
- import { Extension as Extension10 } from "@tiptap/core";
532
+ import { Extension as Extension11 } from "@tiptap/core";
533
533
  import { EditorContent as EditorContent2, useEditor } from "@tiptap/react";
534
534
  import { IconLock, IconPaperclip, IconSquareRounded } from "@tabler/icons-react";
535
535
  import { AttachmentCard } from "@estiva-app/ui";
536
536
 
537
537
  // src/BlockNodes.tsx
538
- import { Extension as Extension6, InputRule, Node as Node2 } from "@tiptap/core";
538
+ import { Extension as Extension7, InputRule, Node as Node2 } from "@tiptap/core";
539
539
  import { DOMSerializer } from "@tiptap/pm/model";
540
- import { Plugin as Plugin5, PluginKey as PluginKey5 } from "@tiptap/pm/state";
540
+ import { Plugin as Plugin6, PluginKey as PluginKey6 } from "@tiptap/pm/state";
541
541
  import { Mapping, ReplaceAroundStep } from "@tiptap/pm/transform";
542
542
  import { NodeViewWrapper, ReactNodeViewRenderer, ReactRenderer as ReactRenderer2 } from "@tiptap/react";
543
543
  import { Checkbox } from "@estiva-app/ui";
544
544
  import { calloutLook } from "@estiva-app/ui";
545
545
 
546
+ // src/LinkPlaces.ts
547
+ import { Extension as Extension3 } from "@tiptap/core";
548
+ import { Plugin as Plugin2, PluginKey as PluginKey2 } from "@tiptap/pm/state";
549
+ import { Decoration as Decoration2, DecorationSet as DecorationSet2 } from "@tiptap/pm/view";
550
+ var CONTAINERS = /* @__PURE__ */ new Set(["bulletList", "orderedList", "listItem"]);
551
+ var BECH32 = "qpzry9x8gf2tvdw0s3jn54khce6mua7l";
552
+ function bech32Words(text) {
553
+ const at = text.lastIndexOf("1");
554
+ if (at < 1 || text.length - at < 7) return null;
555
+ const words = [];
556
+ for (const char of text.slice(at + 1, -6)) {
557
+ const word = BECH32.indexOf(char);
558
+ if (word < 0) return null;
559
+ words.push(word);
560
+ }
561
+ return words;
562
+ }
563
+ function naddrKind(naddr) {
564
+ const words = bech32Words(naddr);
565
+ if (!words) return null;
566
+ const bytes = [];
567
+ let acc = 0;
568
+ let bits = 0;
569
+ for (const word of words) {
570
+ acc = acc << 5 | word;
571
+ bits += 5;
572
+ while (bits >= 8) {
573
+ bits -= 8;
574
+ bytes.push(acc >> bits & 255);
575
+ }
576
+ }
577
+ for (let i = 0; i + 1 < bytes.length; ) {
578
+ const type = bytes[i];
579
+ const length = bytes[i + 1];
580
+ if (type === 3 && length === 4 && i + 6 <= bytes.length) return (bytes[i + 2] << 24 | bytes[i + 3] << 16 | bytes[i + 4] << 8 | bytes[i + 5]) >>> 0;
581
+ i += 2 + length;
582
+ }
583
+ return null;
584
+ }
585
+ var FOLDER = 39e3;
586
+ function staysChip(uri) {
587
+ const bare = uri.toLowerCase().replace(/^nostr:/, "");
588
+ if (bare.startsWith("npub1") || bare.startsWith("nprofile1")) return true;
589
+ return bare.startsWith("naddr1") && naddrKind(bare) === FOLDER;
590
+ }
591
+ function keepsLineRule(doc2, pos) {
592
+ const $pos = doc2.resolve(pos);
593
+ if ($pos.parent.type.name !== "paragraph" && $pos.parent.type.name !== "listItem") return false;
594
+ for (let depth = 1; depth < $pos.depth; depth++) if (!CONTAINERS.has($pos.node(depth).type.name)) return false;
595
+ return true;
596
+ }
597
+ function aloneOnLine(block, index) {
598
+ for (const step of [-1, 1]) {
599
+ for (let i = index + step; i >= 0 && i < block.childCount; i += step) {
600
+ const child = block.child(i);
601
+ if (child.type.name === "hardBreak") break;
602
+ if (!child.isText || (child.text ?? "").trim() !== "") return false;
603
+ }
604
+ }
605
+ return true;
606
+ }
607
+ function linkPlaceAt(doc2, pos) {
608
+ const node = doc2.nodeAt(pos);
609
+ if (!node || node.type.name !== "reference") return "chip";
610
+ const uri = String(node.attrs.uri ?? "");
611
+ if (!uri || staysChip(uri)) return "chip";
612
+ if (Array.isArray(node.attrs.marks) && node.attrs.marks.length > 0) return "chip";
613
+ if (!keepsLineRule(doc2, pos)) return "chip";
614
+ const $pos = doc2.resolve(pos);
615
+ if (!aloneOnLine($pos.parent, $pos.index())) return "chip";
616
+ return node.attrs.embed === "detailed" ? "card" : "row";
617
+ }
618
+ function linkPlaces(doc2) {
619
+ const out = [];
620
+ doc2.descendants((node, pos) => {
621
+ if (node.type.name !== "reference") return true;
622
+ const place2 = linkPlaceAt(doc2, pos);
623
+ if (place2 !== "chip") out.push({ pos, size: node.nodeSize, place: place2 });
624
+ return false;
625
+ });
626
+ return out;
627
+ }
628
+ function placeOf(decorations) {
629
+ for (const decoration of decorations ?? []) {
630
+ const place2 = decoration.spec.linkPlace;
631
+ if (place2) return place2;
632
+ }
633
+ return "chip";
634
+ }
635
+ var key = new PluginKey2("linkPlaces");
636
+ var LinkPlaces = Extension3.create({
637
+ name: "linkPlaces",
638
+ addProseMirrorPlugins() {
639
+ const decorate = (doc2) => DecorationSet2.create(
640
+ doc2,
641
+ linkPlaces(doc2).map(({ pos, size, place: place2 }) => Decoration2.node(pos, pos + size, { "data-link-place": place2 }, { linkPlace: place2 }))
642
+ );
643
+ return [
644
+ new Plugin2({
645
+ key,
646
+ state: {
647
+ init: (_, state) => decorate(state.doc),
648
+ apply: (tr, set) => tr.docChanged ? decorate(tr.doc) : set
649
+ },
650
+ props: { decorations: (state) => key.getState(state) }
651
+ })
652
+ ];
653
+ }
654
+ });
655
+
546
656
  // src/ReferenceMenu.tsx
547
657
  import { useCallback as useCallback3 } from "react";
548
- import { Extension as Extension5 } from "@tiptap/core";
658
+ import { Extension as Extension6 } from "@tiptap/core";
549
659
  import { useEditorState } from "@tiptap/react";
550
- import { NodeSelection as NodeSelection2, Plugin as Plugin4, PluginKey as PluginKey4, TextSelection } from "@tiptap/pm/state";
660
+ import { NodeSelection as NodeSelection2, Plugin as Plugin5, PluginKey as PluginKey5, TextSelection } from "@tiptap/pm/state";
551
661
  import { ReplaceStep } from "@tiptap/pm/transform";
552
- import { IconCheck } from "@tabler/icons-react";
662
+ import { IconCheck, IconExternalLink } from "@tabler/icons-react";
553
663
 
554
664
  // src/LinkChips.ts
555
- import { Extension as Extension3 } from "@tiptap/core";
665
+ import { Extension as Extension4 } from "@tiptap/core";
556
666
  import { closeHistory } from "@tiptap/pm/history";
557
- import { Plugin as Plugin2, PluginKey as PluginKey2 } from "@tiptap/pm/state";
558
- var key = new PluginKey2("linkChips");
667
+ import { Plugin as Plugin3, PluginKey as PluginKey3 } from "@tiptap/pm/state";
668
+ var key2 = new PluginKey3("linkChips");
559
669
  var CHIPS_MADE = "linkChipsMade";
560
670
  var PASTES_KEPT = 8;
561
671
  var LINK_OR_URL = /(\[[^[\]\n]+\]\((?:https?:\/\/|mailto:)[^\s)]+\))|(https?:\/\/[^\s<>"'`]+)/g;
@@ -625,12 +735,12 @@ function apply(state, found) {
625
735
  }
626
736
  function refreshLinkChips(editor) {
627
737
  if (editor.isDestroyed) return;
628
- const chips = key.getState(editor.state);
738
+ const chips = key2.getState(editor.state);
629
739
  if (!chips) return;
630
740
  const tr = apply(editor.state, findLinkChips(editor.state.doc, editor.state.selection, chips.options.referenceOf, chips.pasted));
631
741
  if (tr) editor.view.dispatch(tr);
632
742
  }
633
- var LinkChips = Extension3.create({
743
+ var LinkChips = Extension4.create({
634
744
  name: "linkChips",
635
745
  addOptions() {
636
746
  return { referenceOf: null, ask: null, limit: 24 };
@@ -639,8 +749,8 @@ var LinkChips = Extension3.create({
639
749
  const options = this.options;
640
750
  const editor = this.editor;
641
751
  return [
642
- new Plugin2({
643
- key,
752
+ new Plugin3({
753
+ key: key2,
644
754
  // The options, where `refreshLinkChips` can read them from the state alone, and where the last pastes landed.
645
755
  state: {
646
756
  init: () => ({ options, pasted: [] }),
@@ -656,13 +766,13 @@ var LinkChips = Extension3.create({
656
766
  },
657
767
  appendTransaction: (trs, _old, state) => {
658
768
  if (!trs.some((tr) => tr.docChanged || tr.selectionSet)) return null;
659
- return apply(state, findLinkChips(state.doc, state.selection, options.referenceOf, key.getState(state)?.pasted));
769
+ return apply(state, findLinkChips(state.doc, state.selection, options.referenceOf, key2.getState(state)?.pasted));
660
770
  },
661
771
  view: (view) => {
662
772
  const asked = /* @__PURE__ */ new Set();
663
773
  const look = (state) => {
664
774
  if (!options.ask) return;
665
- const { open } = findLinkChips(state.doc, state.selection, options.referenceOf, key.getState(state)?.pasted);
775
+ const { open } = findLinkChips(state.doc, state.selection, options.referenceOf, key2.getState(state)?.pasted);
666
776
  const waiting = new Set(open);
667
777
  for (const url of asked) if (!waiting.has(url)) asked.delete(url);
668
778
  const fresh = open.filter((url) => !asked.has(url)).slice(0, Math.max(0, options.limit - asked.size));
@@ -703,9 +813,9 @@ import { MenuItem, MenuSection, MenuSeparator } from "@estiva-app/ui";
703
813
  import { Popover as Popover2 } from "@estiva-app/ui";
704
814
 
705
815
  // src/ReferenceCards.ts
706
- import { Extension as Extension4 } from "@tiptap/core";
707
- import { NodeSelection, Plugin as Plugin3, PluginKey as PluginKey3 } from "@tiptap/pm/state";
708
- import { Decoration as Decoration2, DecorationSet as DecorationSet2 } from "@tiptap/pm/view";
816
+ import { Extension as Extension5 } from "@tiptap/core";
817
+ import { NodeSelection, Plugin as Plugin4, PluginKey as PluginKey4 } from "@tiptap/pm/state";
818
+ import { Decoration as Decoration3, DecorationSet as DecorationSet3 } from "@tiptap/pm/view";
709
819
  import { useEffect as useEffect3, useState as useState3 } from "react";
710
820
  function layoutOf(raw) {
711
821
  if (typeof raw !== "string" || raw === "" || raw === "none") return void 0;
@@ -733,7 +843,7 @@ function referenceCardPlacements(doc2) {
733
843
  });
734
844
  return out;
735
845
  }
736
- var key2 = new PluginKey3("referenceCards");
846
+ var key3 = new PluginKey4("referenceCards");
737
847
  function elementFor(storage, slotKey) {
738
848
  let element = storage.elements.get(slotKey);
739
849
  if (!element) {
@@ -747,17 +857,17 @@ function elementFor(storage, slotKey) {
747
857
  function storageOf(editor) {
748
858
  return editor.storage.referenceCards;
749
859
  }
750
- var ReferenceCards = Extension4.create({
860
+ var ReferenceCards = Extension5.create({
751
861
  name: "referenceCards",
752
862
  addStorage() {
753
863
  return { elements: /* @__PURE__ */ new Map() };
754
864
  },
755
865
  addProseMirrorPlugins() {
756
866
  const storage = this.storage;
757
- const decorate = (doc2) => DecorationSet2.create(
867
+ const decorate = (doc2) => DecorationSet3.create(
758
868
  doc2,
759
869
  referenceCardPlacements(doc2).map(
760
- (p) => Decoration2.widget(p.pos, () => elementFor(storage, p.key), {
870
+ (p) => Decoration3.widget(p.pos, () => elementFor(storage, p.key), {
761
871
  key: p.key,
762
872
  side: 1,
763
873
  ignoreSelection: true,
@@ -767,13 +877,13 @@ var ReferenceCards = Extension4.create({
767
877
  )
768
878
  );
769
879
  return [
770
- new Plugin3({
771
- key: key2,
880
+ new Plugin4({
881
+ key: key3,
772
882
  state: {
773
883
  init: (_, state) => decorate(state.doc),
774
884
  apply: (tr, set) => tr.docChanged ? decorate(tr.doc) : set
775
885
  },
776
- props: { decorations: (state) => key2.getState(state) }
886
+ props: { decorations: (state) => key3.getState(state) }
777
887
  })
778
888
  ];
779
889
  }
@@ -846,11 +956,10 @@ function setReferenceCardAt(editor, pos, layout) {
846
956
 
847
957
  // src/ReferenceMenu.tsx
848
958
  import { Fragment, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
849
- var key3 = new PluginKey4("referenceMenu");
850
- var LAYOUTS = [
851
- { layout: "none", label: "None" },
852
- { layout: "compact", label: "Compact" },
853
- { layout: "detailed", label: "Detailed" }
959
+ var key4 = new PluginKey5("referenceMenu");
960
+ var SHOW_AS = [
961
+ { as: "row", label: "Row" },
962
+ { as: "card", label: "Card" }
854
963
  ];
855
964
  function chipTarget(view, pos) {
856
965
  const dom = view.nodeDOM(pos);
@@ -861,8 +970,9 @@ function webHref(view, pos) {
861
970
  return typeof href === "string" && /^https?:\/\//i.test(href) ? href : "";
862
971
  }
863
972
  function rowsOf(view, pos) {
864
- const open = chipTarget(view, pos) || webHref(view, pos) ? ["open"] : [];
865
- return view.state.doc.nodeAt(pos)?.attrs.uri ? [...open, ...LAYOUTS.map((card) => card.layout)] : open;
973
+ const drawn = !!view.state.doc.nodeAt(pos)?.attrs.uri && !!view.someProp("nodeViews", (views) => views?.reference);
974
+ const open = drawn || chipTarget(view, pos) || webHref(view, pos) ? ["open"] : [];
975
+ return linkPlaceAt(view.state.doc, pos) === "chip" ? open : [...open, ...SHOW_AS.map((show) => show.as)];
866
976
  }
867
977
  function chipAt(state, pos) {
868
978
  const node = state.doc.nodeAt(pos);
@@ -887,10 +997,11 @@ function justPlaced(tr, state) {
887
997
  const old = tr.mapping.invert().map(pos);
888
998
  const was = tr.before.nodeAt(old);
889
999
  if (was && was.type.name === "reference" && was.attrs.uri === before.attrs.uri && tr.mapping.map(old, 1) === pos) return null;
1000
+ if (linkPlaceAt(state.doc, pos) === "chip") return null;
890
1001
  return pos;
891
1002
  }
892
1003
  function dispatchMenu(view, next) {
893
- view.dispatch(view.state.tr.setMeta(key3, next));
1004
+ view.dispatch(view.state.tr.setMeta(key4, next));
894
1005
  }
895
1006
  var passing = false;
896
1007
  function openChip(view, pos) {
@@ -910,34 +1021,34 @@ function openChip(view, pos) {
910
1021
  function choose(editor, pos, row) {
911
1022
  dispatchMenu(editor.view, null);
912
1023
  if (row === "open") openChip(editor.view, pos);
913
- else if (row) setReferenceCardAt(editor, pos, row);
1024
+ else if (row) setReferenceCardAt(editor, pos, row === "card" ? "detailed" : "none");
914
1025
  }
915
1026
  function isReferenceMenuOpen(state) {
916
- return !!key3.getState(state);
1027
+ return !!key4.getState(state);
917
1028
  }
918
1029
  function referenceMenuClick(editor, pos) {
919
- if (passing || editor.isDestroyed || !editor.isEditable || key3.getState(editor.state) === void 0) return false;
1030
+ if (passing || editor.isDestroyed || !editor.isEditable || key4.getState(editor.state) === void 0) return false;
920
1031
  if (!chipAt(editor.state, pos) || rowsOf(editor.view, pos).length === 0) return false;
921
- editor.view.dispatch(caretAfter(editor.state, pos).setMeta(key3, { pos, active: -1 }));
1032
+ editor.view.dispatch(caretAfter(editor.state, pos).setMeta(key4, { pos, active: -1 }));
922
1033
  return true;
923
1034
  }
924
1035
  function caretAfter(state, pos) {
925
1036
  const node = state.doc.nodeAt(pos);
926
1037
  return state.tr.setSelection(TextSelection.create(state.doc, pos + (node?.nodeSize ?? 1)));
927
1038
  }
928
- var ReferenceMenu = Extension5.create({
1039
+ var ReferenceMenu = Extension6.create({
929
1040
  name: "referenceMenu",
930
1041
  // Before the editor's own keys, so Enter on a highlighted row is the row's, not a new line.
931
1042
  priority: 1e3,
932
1043
  addProseMirrorPlugins() {
933
1044
  const editor = this.editor;
934
1045
  return [
935
- new Plugin4({
936
- key: key3,
1046
+ new Plugin5({
1047
+ key: key4,
937
1048
  state: {
938
1049
  init: () => null,
939
1050
  apply: (tr, value, before, after) => {
940
- const meta = tr.getMeta(key3);
1051
+ const meta = tr.getMeta(key4);
941
1052
  if (meta !== void 0) return meta;
942
1053
  const placed = justPlaced(tr, after);
943
1054
  if (placed !== null) return { pos: placed, active: -1 };
@@ -954,18 +1065,18 @@ var ReferenceMenu = Extension5.create({
954
1065
  handleDOMEvents: {
955
1066
  // Focus gone, the keys no longer reach the menu, and a card chosen now would miss the save on leaving (code review).
956
1067
  blur: (view) => {
957
- if (key3.getState(view.state)) dispatchMenu(view, null);
1068
+ if (key4.getState(view.state)) dispatchMenu(view, null);
958
1069
  return false;
959
1070
  }
960
1071
  },
961
1072
  handleKeyDown: (view, event) => {
962
1073
  if (event.shiftKey || event.ctrlKey || event.metaKey || event.altKey) return false;
963
- const open = key3.getState(view.state);
1074
+ const open = key4.getState(view.state);
964
1075
  if (!open) {
965
1076
  const { selection } = view.state;
966
1077
  if (event.key !== "Enter" || !view.editable || !(selection instanceof NodeSelection2) || selection.node.type.name !== "reference") return false;
967
1078
  if (rowsOf(view, selection.from).length === 0) return false;
968
- view.dispatch(caretAfter(view.state, selection.from).setMeta(key3, { pos: selection.from, active: 0 }));
1079
+ view.dispatch(caretAfter(view.state, selection.from).setMeta(key4, { pos: selection.from, active: 0 }));
969
1080
  return true;
970
1081
  }
971
1082
  const rows = rowsOf(view, open.pos);
@@ -998,13 +1109,10 @@ function ReferenceMenuView({ editor }) {
998
1109
  editor,
999
1110
  selector: ({ editor: ed }) => {
1000
1111
  if (!ed || ed.isDestroyed) return null;
1001
- const open = key3.getState(ed.state);
1112
+ const open = key4.getState(ed.state);
1002
1113
  if (!open) return null;
1003
- const node = chipAt(ed.state, open.pos);
1004
- if (!node) return null;
1005
- const embed = node.attrs.embed;
1006
- const layout = embed === "detailed" ? "detailed" : typeof embed === "string" && embed !== "" && embed !== "none" ? "compact" : "none";
1007
- return { pos: open.pos, active: open.active, named: !!node.attrs.uri, layout };
1114
+ if (!chipAt(ed.state, open.pos)) return null;
1115
+ return { pos: open.pos, active: open.active, shownAs: linkPlaceAt(ed.state.doc, open.pos) === "card" ? "card" : "row" };
1008
1116
  }
1009
1117
  });
1010
1118
  const keepFocus2 = useCallback3((list) => {
@@ -1019,6 +1127,7 @@ function ReferenceMenuView({ editor }) {
1019
1127
  const anchor = dom instanceof HTMLElement ? dom : null;
1020
1128
  const rows = live && shown ? rowsOf(live.view, shown.pos) : [];
1021
1129
  const opens = rows[0] === "open";
1130
+ const showAs = rows.includes("card");
1022
1131
  const run = (row) => {
1023
1132
  if (editor && shown) choose(editor, shown.pos, row);
1024
1133
  };
@@ -1030,7 +1139,7 @@ function ReferenceMenuView({ editor }) {
1030
1139
  anchor,
1031
1140
  open: !!shown && !!anchor && rows.length > 0,
1032
1141
  onOpenChange: (next) => {
1033
- if (!next && editor && !editor.isDestroyed && key3.getState(editor.state)) dispatchMenu(editor.view, null);
1142
+ if (!next && editor && !editor.isDestroyed && key4.getState(editor.state)) dispatchMenu(editor.view, null);
1034
1143
  },
1035
1144
  side: "bottom",
1036
1145
  align: "left",
@@ -1043,6 +1152,7 @@ function ReferenceMenuView({ editor }) {
1043
1152
  role: "menuitem",
1044
1153
  tabIndex: -1,
1045
1154
  label: "Open",
1155
+ leading: /* @__PURE__ */ jsx4(IconExternalLink, { size: 16 }),
1046
1156
  selected: shown.active === 0,
1047
1157
  onMouseDown: (event) => {
1048
1158
  event.preventDefault();
@@ -1050,23 +1160,23 @@ function ReferenceMenuView({ editor }) {
1050
1160
  }
1051
1161
  }
1052
1162
  ),
1053
- shown.named && /* @__PURE__ */ jsxs3(Fragment, { children: [
1163
+ showAs && /* @__PURE__ */ jsxs3(Fragment, { children: [
1054
1164
  opens && /* @__PURE__ */ jsx4(MenuSeparator, {}),
1055
- /* @__PURE__ */ jsx4("div", { role: "group", "aria-label": "Card", children: /* @__PURE__ */ jsx4(MenuSection, { label: "Card", children: LAYOUTS.map(({ layout, label }, i) => /* @__PURE__ */ jsx4(
1165
+ /* @__PURE__ */ jsx4("div", { role: "group", "aria-label": "Show as", children: /* @__PURE__ */ jsx4(MenuSection, { label: "Show as", children: SHOW_AS.map(({ as, label }, i) => /* @__PURE__ */ jsx4(
1056
1166
  MenuItem,
1057
1167
  {
1058
1168
  role: "menuitemradio",
1059
- "aria-checked": shown.layout === layout,
1169
+ "aria-checked": shown.shownAs === as,
1060
1170
  tabIndex: -1,
1061
1171
  label,
1062
1172
  selected: shown.active === i + (opens ? 1 : 0),
1063
- trailing: shown.layout === layout ? /* @__PURE__ */ jsx4(IconCheck, { size: 16, "aria-hidden": true }) : void 0,
1173
+ trailing: shown.shownAs === as ? /* @__PURE__ */ jsx4(IconCheck, { size: 16, "aria-hidden": true }) : void 0,
1064
1174
  onMouseDown: (event) => {
1065
1175
  event.preventDefault();
1066
- run(layout);
1176
+ run(as);
1067
1177
  }
1068
1178
  },
1069
- layout
1179
+ as
1070
1180
  )) }) })
1071
1181
  ] })
1072
1182
  ] })
@@ -1234,7 +1344,7 @@ function bringsInBlocks(transactions) {
1234
1344
  })
1235
1345
  );
1236
1346
  }
1237
- var BlockId = Extension6.create({
1347
+ var BlockId = Extension7.create({
1238
1348
  name: "blockId",
1239
1349
  onCreate() {
1240
1350
  const { state, view } = this.editor;
@@ -1246,8 +1356,8 @@ var BlockId = Extension6.create({
1246
1356
  },
1247
1357
  addProseMirrorPlugins() {
1248
1358
  return [
1249
- new Plugin5({
1250
- key: new PluginKey5("blockIdSplit"),
1359
+ new Plugin6({
1360
+ key: new PluginKey6("blockIdSplit"),
1251
1361
  appendTransaction: (transactions, old, state) => {
1252
1362
  if (!bringsInBlocks(transactions)) return null;
1253
1363
  const mapping = new Mapping();
@@ -1319,23 +1429,34 @@ var ReferenceNode = Node2.create({
1319
1429
  addNodeView() {
1320
1430
  const View = this.options.view;
1321
1431
  if (!View) return null;
1322
- return ReactNodeViewRenderer(({ node, editor, getPos }) => {
1432
+ return ReactNodeViewRenderer(({ node, editor, getPos, decorations }) => {
1323
1433
  const uri = String(node.attrs.uri ?? "");
1324
1434
  const href = typeof node.attrs.href === "string" && node.attrs.href ? node.attrs.href : void 0;
1435
+ const place2 = placeOf(decorations);
1325
1436
  return /* @__PURE__ */ jsx5(
1326
1437
  NodeViewWrapper,
1327
1438
  {
1328
1439
  as: "span",
1329
- className: "inline",
1440
+ className: place2 === "chip" ? "inline" : "block w-full",
1330
1441
  onClickCapture: (event) => {
1331
1442
  const pos = getPos();
1332
- if (typeof pos !== "number" || !referenceMenuClick(editor, pos)) return;
1443
+ if (typeof pos !== "number") return;
1444
+ const own = editor.view.nodeDOM(pos);
1445
+ if (!(event.target instanceof Element) || !own || !own.contains(event.target)) return;
1446
+ if (place2 === "card" && event.target.closest('button, input, select, [role="combobox"]')) return;
1447
+ if (!referenceMenuClick(editor, pos)) return;
1333
1448
  event.preventDefault();
1334
1449
  event.stopPropagation();
1335
1450
  },
1336
- children: uri ? /* @__PURE__ */ jsx5(View, { uri, ...href ? { href } : {} }) : /* @__PURE__ */ jsx5("span", { children: href })
1451
+ children: uri ? /* @__PURE__ */ jsx5(View, { uri, ...href ? { href } : {}, place: place2, editing: editor.isEditable }) : /* @__PURE__ */ jsx5("span", { children: href })
1337
1452
  }
1338
1453
  );
1454
+ }, {
1455
+ // Words typed beside a link leave its node as it was, and Tiptap then skips the redraw; its place has changed (code review).
1456
+ update: ({ oldNode, newNode, oldDecorations, newDecorations, updateProps }) => {
1457
+ if (oldNode !== newNode || placeOf(oldDecorations) !== placeOf(newDecorations)) updateProps();
1458
+ return true;
1459
+ }
1339
1460
  });
1340
1461
  }
1341
1462
  });
@@ -1422,7 +1543,7 @@ function itemAtCaret(state) {
1422
1543
  if (item.type.name !== "listItem" || $from.index(-1) !== 0) return null;
1423
1544
  return { node: item, pos: $from.before(-1) };
1424
1545
  }
1425
- var sameAttrs = (a, b) => Object.keys({ ...a.attrs, ...b.attrs }).every((key4) => a.attrs[key4] === b.attrs[key4]);
1546
+ var sameAttrs = (a, b) => Object.keys({ ...a.attrs, ...b.attrs }).every((key5) => a.attrs[key5] === b.attrs[key5]);
1426
1547
  function listItemView(editor, node, view, getPos) {
1427
1548
  const toDOM = node.type.spec.toDOM;
1428
1549
  const { dom, contentDOM } = toDOM ? DOMSerializer.renderSpec(document, toDOM(node)) : { dom: document.createElement("li"), contentDOM: void 0 };
@@ -1473,7 +1594,7 @@ function listItemView(editor, node, view, getPos) {
1473
1594
  }
1474
1595
  };
1475
1596
  }
1476
- var Checklist = Extension6.create({
1597
+ var Checklist = Extension7.create({
1477
1598
  name: "checklist",
1478
1599
  // Before the list item's own Enter and Backspace.
1479
1600
  priority: 101,
@@ -1538,14 +1659,14 @@ var Checklist = Extension6.create({
1538
1659
  addProseMirrorPlugins() {
1539
1660
  const editor = this.editor;
1540
1661
  return [
1541
- new Plugin5({
1542
- key: new PluginKey5("checklist"),
1662
+ new Plugin6({
1663
+ key: new PluginKey6("checklist"),
1543
1664
  props: { nodeViews: { listItem: (node, view, getPos) => listItemView(editor, node, view, getPos) } }
1544
1665
  })
1545
1666
  ];
1546
1667
  }
1547
1668
  });
1548
- var Callout = Extension6.create({
1669
+ var Callout = Extension7.create({
1549
1670
  name: "callout",
1550
1671
  addGlobalAttributes() {
1551
1672
  return [
@@ -1571,8 +1692,8 @@ import { CardUnder } from "@estiva-app/ui";
1571
1692
  import { cn as cn2 } from "@estiva-app/ui";
1572
1693
 
1573
1694
  // src/ComposerTriggers.tsx
1574
- import { Extension as Extension7 } from "@tiptap/core";
1575
- import { PluginKey as PluginKey6 } from "@tiptap/pm/state";
1695
+ import { Extension as Extension8 } from "@tiptap/core";
1696
+ import { PluginKey as PluginKey7 } from "@tiptap/pm/state";
1576
1697
  import Mention from "@tiptap/extension-mention";
1577
1698
  import Suggestion from "@tiptap/suggestion";
1578
1699
  import { NodeViewWrapper as NodeViewWrapper2, ReactNodeViewRenderer as ReactNodeViewRenderer2 } from "@tiptap/react";
@@ -1690,7 +1811,7 @@ function urgentPubkeys(editor) {
1690
1811
  });
1691
1812
  return urgent.length > 0 ? urgent : void 0;
1692
1813
  }
1693
- var PersonReference = Extension7.create({
1814
+ var PersonReference = Extension8.create({
1694
1815
  name: "personReference",
1695
1816
  addOptions() {
1696
1817
  return { people: () => [], uriOf: () => null, nodeName: "reference" };
@@ -1701,7 +1822,7 @@ var PersonReference = Extension7.create({
1701
1822
  Suggestion({
1702
1823
  editor: this.editor,
1703
1824
  char: "@",
1704
- pluginKey: new PluginKey6("personReference"),
1825
+ pluginKey: new PluginKey7("personReference"),
1705
1826
  ...listening("@"),
1706
1827
  // As `[`'s: only where the chip may go.
1707
1828
  allow: ({ state, range }) => {
@@ -1798,7 +1919,7 @@ function referenceMenu({ ariaLabel, sectionLabel, icon, iconFor }) {
1798
1919
  };
1799
1920
  }
1800
1921
  var listed = (options, query) => options.sections ? options.sections(query).flatMap((section) => section.items.map((item) => ({ ...item, section: section.label }))) : filterReferences(options.items(), query);
1801
- var ReferenceTrigger = Extension7.create({
1922
+ var ReferenceTrigger = Extension8.create({
1802
1923
  name: "referenceTrigger",
1803
1924
  addOptions() {
1804
1925
  return { items: () => [], nodeName: "captionedReference", ariaLabel: "References", sectionLabel: "References", icon: null };
@@ -1809,7 +1930,7 @@ var ReferenceTrigger = Extension7.create({
1809
1930
  Suggestion({
1810
1931
  editor: this.editor,
1811
1932
  char: "[",
1812
- pluginKey: new PluginKey6("referenceTrigger"),
1933
+ pluginKey: new PluginKey7("referenceTrigger"),
1813
1934
  ...listening("]"),
1814
1935
  // As a mention's: only where the chip may go.
1815
1936
  allow: ({ state, range }) => {
@@ -1914,7 +2035,7 @@ function filterSlashSections(sections, query) {
1914
2035
  const q = query.toLowerCase();
1915
2036
  return sections.map((section) => ({ ...section, commands: q ? section.commands.filter((command) => matches(command, q)) : section.commands }));
1916
2037
  }
1917
- var SlashCommands = Extension7.create({
2038
+ var SlashCommands = Extension8.create({
1918
2039
  name: "slashCommands",
1919
2040
  addOptions() {
1920
2041
  return { sections: [formatSection()] };
@@ -1926,7 +2047,7 @@ var SlashCommands = Extension7.create({
1926
2047
  editor: this.editor,
1927
2048
  char: "/",
1928
2049
  startOfLine: false,
1929
- pluginKey: new PluginKey6("slashCommands"),
2050
+ pluginKey: new PluginKey7("slashCommands"),
1930
2051
  items: ({ query, editor }) => filterSlashSections(sections, query).flatMap(
1931
2052
  (section, at) => section.commands.filter((command) => offers(editor, command)).map((command) => ({ ...command, section: at }))
1932
2053
  ),
@@ -1953,18 +2074,18 @@ import { FilePicker } from "@estiva-app/ui";
1953
2074
  import { Kbd } from "@estiva-app/ui";
1954
2075
 
1955
2076
  // src/links.ts
1956
- import { Extension as Extension8 } from "@tiptap/core";
1957
- import { Plugin as Plugin6, PluginKey as PluginKey7, TextSelection as TextSelection2 } from "@tiptap/pm/state";
1958
- import { Decoration as Decoration3, DecorationSet as DecorationSet3 } from "@tiptap/pm/view";
2077
+ import { Extension as Extension9 } from "@tiptap/core";
2078
+ import { Plugin as Plugin7, PluginKey as PluginKey8, TextSelection as TextSelection2 } from "@tiptap/pm/state";
2079
+ import { Decoration as Decoration4, DecorationSet as DecorationSet4 } from "@tiptap/pm/view";
1959
2080
  import StarterKit from "@tiptap/starter-kit";
1960
2081
  var LINK_ON_WORDS_TARGET = /^https?:\/\/[^\s)]+$/;
1961
- var PasteOverWords = Extension8.create({
2082
+ var PasteOverWords = Extension9.create({
1962
2083
  name: "commentBoxPasteOverWords",
1963
2084
  priority: 1001,
1964
2085
  addProseMirrorPlugins() {
1965
2086
  return [
1966
- new Plugin6({
1967
- key: new PluginKey7("commentBoxPasteOverWords"),
2087
+ new Plugin7({
2088
+ key: new PluginKey8("commentBoxPasteOverWords"),
1968
2089
  props: {
1969
2090
  handlePaste: (view, event) => {
1970
2091
  const url = (event.clipboardData?.getData("text/plain").trim() ?? "").replace(/[.,;:!?]+$/, "");
@@ -2016,12 +2137,12 @@ var LINK_CLASS = "text-info-default underline underline-offset-2 cursor-pointer"
2016
2137
  var OPENABLE = /^(https?:\/\/|mailto:)/i;
2017
2138
  var LINK_MARK_ATTRIBUTES = { class: LINK_CLASS, "data-link-mark": "", target: "_blank", rel: "noopener noreferrer nofollow" };
2018
2139
  var LINK_TARGET = /\]\(([^\s)]+)\)$/;
2019
- var BareLinks = Extension8.create({
2140
+ var BareLinks = Extension9.create({
2020
2141
  name: "bareLinks",
2021
2142
  addProseMirrorPlugins() {
2022
2143
  return [
2023
- new Plugin6({
2024
- key: new PluginKey7("bareLinks"),
2144
+ new Plugin7({
2145
+ key: new PluginKey8("bareLinks"),
2025
2146
  props: {
2026
2147
  // The one way a click opens an address: a bare one's decoration, or, while editing, a link on words (read only,
2027
2148
  // the link is a plain anchor and opens itself). Only its own attributes are read — never a chip's — and only an
@@ -2045,10 +2166,10 @@ var BareLinks = Extension8.create({
2045
2166
  if (match.index === void 0) continue;
2046
2167
  const text = match[0].startsWith("[") ? match[0] : match[0].replace(TRAILING2, "");
2047
2168
  const href = text.startsWith("[") ? LINK_TARGET.exec(text)?.[1] ?? "" : text;
2048
- found.push(Decoration3.inline(pos + match.index, pos + match.index + text.length, { class: LINK_CLASS, ...href ? { "data-bare-link": href } : {} }));
2169
+ found.push(Decoration4.inline(pos + match.index, pos + match.index + text.length, { class: LINK_CLASS, ...href ? { "data-bare-link": href } : {} }));
2049
2170
  }
2050
2171
  });
2051
- return found.length ? DecorationSet3.create(doc2, found) : null;
2172
+ return found.length ? DecorationSet4.create(doc2, found) : null;
2052
2173
  }
2053
2174
  }
2054
2175
  })
@@ -2057,8 +2178,8 @@ var BareLinks = Extension8.create({
2057
2178
  });
2058
2179
 
2059
2180
  // src/PastedImages.ts
2060
- import { Extension as Extension9 } from "@tiptap/core";
2061
- import { Plugin as Plugin7, PluginKey as PluginKey8 } from "@tiptap/pm/state";
2181
+ import { Extension as Extension10 } from "@tiptap/core";
2182
+ import { Plugin as Plugin8, PluginKey as PluginKey9 } from "@tiptap/pm/state";
2062
2183
  var IMAGE_EXTENSIONS = {
2063
2184
  "image/png": "png",
2064
2185
  "image/jpeg": "jpg",
@@ -2093,7 +2214,7 @@ function pastedImages(source, at = /* @__PURE__ */ new Date()) {
2093
2214
  (file) => hasUsableName(file.name) ? file : new File([file], pastedImageName(file.type, at, generated++), { type: file.type, lastModified: file.lastModified })
2094
2215
  );
2095
2216
  }
2096
- var PastedImages = Extension9.create({
2217
+ var PastedImages = Extension10.create({
2097
2218
  name: "pastedImages",
2098
2219
  addOptions() {
2099
2220
  return { onImages: () => false };
@@ -2101,8 +2222,8 @@ var PastedImages = Extension9.create({
2101
2222
  addProseMirrorPlugins() {
2102
2223
  const options = this.options;
2103
2224
  return [
2104
- new Plugin7({
2105
- key: new PluginKey8("pastedImages"),
2225
+ new Plugin8({
2226
+ key: new PluginKey9("pastedImages"),
2106
2227
  props: {
2107
2228
  handlePaste: (_view, event) => {
2108
2229
  const files = pastedImages(event.clipboardData);
@@ -2125,7 +2246,7 @@ var commentBoxRows = {
2125
2246
  urgent: { key: "insert-urgent", row: { label: "Urgent", shortcut: "!@" }, keywords: ["!@", "Urgent mention"], run: typeTrigger("!@") },
2126
2247
  reference: { key: "insert-reference", row: { label: "Reference", shortcut: "[" }, keywords: ["[", "Reference"], run: typeTrigger("[") }
2127
2248
  };
2128
- var BoxKeys = Extension10.create({
2249
+ var BoxKeys = Extension11.create({
2129
2250
  name: "commentBoxKeys",
2130
2251
  addOptions() {
2131
2252
  return { onEscape: () => false };
@@ -2441,7 +2562,7 @@ function CommentBox({
2441
2562
 
2442
2563
  // src/InlineText.tsx
2443
2564
  import { useCallback as useCallback5, useEffect as useEffect5, useImperativeHandle as useImperativeHandle2, useRef as useRef4, useState as useState5 } from "react";
2444
- import { Extension as Extension11, Node as Node3 } from "@tiptap/core";
2565
+ import { Extension as Extension12, Node as Node3 } from "@tiptap/core";
2445
2566
  import { history, redo, undo } from "@tiptap/pm/history";
2446
2567
  import { EditorContent as EditorContent3, useEditor as useEditor2 } from "@tiptap/react";
2447
2568
  import { cn as cn3 } from "@estiva-app/ui";
@@ -2459,7 +2580,7 @@ var Paragraph = Node3.create({
2459
2580
  renderHTML: () => ["p", 0]
2460
2581
  });
2461
2582
  var Text = Node3.create({ name: "text" });
2462
- var Undo = Extension11.create({
2583
+ var Undo = Extension12.create({
2463
2584
  name: "inlineTextUndo",
2464
2585
  addProseMirrorPlugins: () => [history()],
2465
2586
  addKeyboardShortcuts() {
@@ -2559,10 +2680,10 @@ function InlineText({ value, placeholder, label, onCommit, onText, onEnter, vari
2559
2680
  }
2560
2681
 
2561
2682
  // src/CommentHighlights.ts
2562
- import { Extension as Extension12 } from "@tiptap/core";
2563
- import { Plugin as Plugin8, PluginKey as PluginKey9 } from "@tiptap/pm/state";
2564
- import { Decoration as Decoration4, DecorationSet as DecorationSet4 } from "@tiptap/pm/view";
2565
- var commentHighlightsKey = new PluginKey9("commentHighlights");
2683
+ import { Extension as Extension13 } from "@tiptap/core";
2684
+ import { Plugin as Plugin9, PluginKey as PluginKey10 } from "@tiptap/pm/state";
2685
+ import { Decoration as Decoration5, DecorationSet as DecorationSet5 } from "@tiptap/pm/view";
2686
+ var commentHighlightsKey = new PluginKey10("commentHighlights");
2566
2687
  var COMMENT_HIGHLIGHT_CLASSES = {
2567
2688
  rest: "cursor-pointer rounded-sm bg-warning-muted",
2568
2689
  active: "cursor-pointer rounded-sm bg-warning-muted underline decoration-warning-default decoration-2 underline-offset-4"
@@ -2650,7 +2771,7 @@ function runIn(doc2, places, ids) {
2650
2771
  });
2651
2772
  return run;
2652
2773
  }
2653
- function placeOf(doc2, anchor, places = placesIn(doc2)) {
2774
+ function placeOf2(doc2, anchor, places = placesIn(doc2)) {
2654
2775
  const run = runIn(doc2, places, anchor.blocks);
2655
2776
  if (!run) return { state: "detached" };
2656
2777
  const from = run[0].pos;
@@ -2681,7 +2802,7 @@ function placeOf(doc2, anchor, places = placesIn(doc2)) {
2681
2802
  if (endAt === -1 || quote.end === "") return reworded;
2682
2803
  return { state: "resolved", from: a.starts[startAt], to: b.ends[endAt + quote.end.length - 1], words: true };
2683
2804
  }
2684
- var CommentHighlights = Extension12.create({
2805
+ var CommentHighlights = Extension13.create({
2685
2806
  name: "commentHighlights",
2686
2807
  addOptions() {
2687
2808
  return { onSelect: null };
@@ -2690,7 +2811,7 @@ var CommentHighlights = Extension12.create({
2690
2811
  const options = this.options;
2691
2812
  const editor = this.editor;
2692
2813
  return [
2693
- new Plugin8({
2814
+ new Plugin9({
2694
2815
  key: commentHighlightsKey,
2695
2816
  state: {
2696
2817
  init: () => ({ anchors: [], active: null }),
@@ -2704,26 +2825,26 @@ var CommentHighlights = Extension12.create({
2704
2825
  const { anchors, active } = commentHighlightsKey.getState(state) ?? { anchors: [], active: null };
2705
2826
  const places = placesIn(state.doc);
2706
2827
  const drawn = anchors.flatMap((anchor) => {
2707
- const place2 = placeOf(state.doc, anchor, places);
2828
+ const place2 = placeOf2(state.doc, anchor, places);
2708
2829
  if (place2.state !== "resolved") return [];
2709
2830
  const attrs = { class: anchor.id === active ? COMMENT_HIGHLIGHT_CLASSES.active : COMMENT_HIGHLIGHT_CLASSES.rest, "data-comment-id": anchor.id };
2710
- if (place2.words) return [Decoration4.inline(place2.from, place2.to, attrs)];
2831
+ if (place2.words) return [Decoration5.inline(place2.from, place2.to, attrs)];
2711
2832
  const blocks = [];
2712
2833
  state.doc.nodesBetween(place2.from, place2.to, (node, pos) => {
2713
2834
  if (pos < place2.from || pos + node.nodeSize > place2.to) return true;
2714
- blocks.push(Decoration4.node(pos, pos + node.nodeSize, attrs));
2835
+ blocks.push(Decoration5.node(pos, pos + node.nodeSize, attrs));
2715
2836
  return false;
2716
2837
  });
2717
2838
  return blocks;
2718
2839
  });
2719
- return drawn.length ? DecorationSet4.create(state.doc, drawn) : null;
2840
+ return drawn.length ? DecorationSet5.create(state.doc, drawn) : null;
2720
2841
  },
2721
2842
  handleClick(view, pos) {
2722
2843
  const { anchors } = commentHighlightsKey.getState(view.state) ?? { anchors: [] };
2723
2844
  const places = placesIn(view.state.doc);
2724
2845
  let hit = null;
2725
2846
  for (const anchor of anchors) {
2726
- const place2 = placeOf(view.state.doc, anchor, places);
2847
+ const place2 = placeOf2(view.state.doc, anchor, places);
2727
2848
  if (place2.state !== "resolved" || pos < place2.from || pos >= place2.to) continue;
2728
2849
  const size = place2.to - place2.from;
2729
2850
  if (!hit || size < hit.size) hit = { id: anchor.id, size };
@@ -2744,12 +2865,12 @@ function setCommentAnchors(editor, anchors, active = null) {
2744
2865
  editor.view.dispatch(editor.state.tr.setMeta(commentHighlightsKey, { anchors, active }));
2745
2866
  }
2746
2867
  function commentPlace(editor, anchor) {
2747
- return placeOf(editor.state.doc, anchor);
2868
+ return placeOf2(editor.state.doc, anchor);
2748
2869
  }
2749
2870
  function commentElement(editor, anchor) {
2750
2871
  const drawn = editor.view.dom.querySelector(`[data-comment-id="${CSS.escape(anchor.id)}"]`);
2751
2872
  if (drawn) return drawn;
2752
- const place2 = placeOf(editor.state.doc, anchor);
2873
+ const place2 = placeOf2(editor.state.doc, anchor);
2753
2874
  if (place2.state === "detached") return null;
2754
2875
  const dom = editor.view.nodeDOM(place2.from);
2755
2876
  return dom instanceof HTMLElement ? dom : null;
@@ -2841,9 +2962,9 @@ function anchorOfSelection(editor) {
2841
2962
  }
2842
2963
 
2843
2964
  // src/PastedMarkdown.ts
2844
- import { Extension as Extension13 } from "@tiptap/core";
2965
+ import { Extension as Extension14 } from "@tiptap/core";
2845
2966
  import { Slice } from "@tiptap/pm/model";
2846
- import { Plugin as Plugin9, PluginKey as PluginKey10 } from "@tiptap/pm/state";
2967
+ import { Plugin as Plugin10, PluginKey as PluginKey11 } from "@tiptap/pm/state";
2847
2968
  function inTableCell($context) {
2848
2969
  for (let depth = $context.depth; depth > 0; depth--) {
2849
2970
  const role = $context.node(depth).type.spec.tableRole;
@@ -2852,7 +2973,7 @@ function inTableCell($context) {
2852
2973
  return false;
2853
2974
  }
2854
2975
  var hasTable = (blocks) => blocks.some((block) => block.type === "table" || hasTable(block.content ?? []));
2855
- var PastedMarkdown = Extension13.create({
2976
+ var PastedMarkdown = Extension14.create({
2856
2977
  name: "pastedMarkdown",
2857
2978
  addOptions() {
2858
2979
  return { read: () => void 0 };
@@ -2860,8 +2981,8 @@ var PastedMarkdown = Extension13.create({
2860
2981
  addProseMirrorPlugins() {
2861
2982
  const options = this.options;
2862
2983
  return [
2863
- new Plugin9({
2864
- key: new PluginKey10("pastedMarkdown"),
2984
+ new Plugin10({
2985
+ key: new PluginKey11("pastedMarkdown"),
2865
2986
  props: {
2866
2987
  // Reached only for a text paste outside code; `plain` is the Shift paste.
2867
2988
  clipboardTextParser: (text, $context, plain, view) => {
@@ -3285,8 +3406,8 @@ import { FieldLine as FieldLine2 } from "@estiva-app/ui";
3285
3406
  import { FilePicker as FilePicker2 } from "@estiva-app/ui";
3286
3407
  import { richTextClassName as richTextClassName2 } from "@estiva-app/ui";
3287
3408
  import { Fragment as Fragment6, jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
3288
- function heldDocument(hold, key4) {
3289
- const text = hold && key4 ? hold.text(key4) : void 0;
3409
+ function heldDocument(hold, key5) {
3410
+ const text = hold && key5 ? hold.text(key5) : void 0;
3290
3411
  if (!text) return null;
3291
3412
  try {
3292
3413
  const doc2 = JSON.parse(text);
@@ -3317,7 +3438,6 @@ function DocumentEditor({
3317
3438
  blockRows,
3318
3439
  referenceView,
3319
3440
  attachmentView,
3320
- cards,
3321
3441
  wrap,
3322
3442
  onEditor,
3323
3443
  extensions = []
@@ -3456,9 +3576,9 @@ function DocumentEditor({
3456
3576
  Checklist,
3457
3577
  Callout,
3458
3578
  ReferenceNode.configure({ view: referenceView ?? null }),
3459
- // The card a chip asks for, after its line (SPEC §13.3); drawn by the app's `cards`.
3460
- ReferenceCards,
3461
- // A click on a chip offers Open and its card.
3579
+ // A link's chip in a sentence, its row alone on its line, its card in the row's place (SPEC §13.3).
3580
+ LinkPlaces,
3581
+ // A click on a link offers Open, and alone on its line Show as Row or Card.
3462
3582
  ReferenceMenu,
3463
3583
  UnknownBlock,
3464
3584
  AttachmentNode.configure({ view: attachmentView ?? null }),
@@ -3498,7 +3618,15 @@ function DocumentEditor({
3498
3618
  editable: !readOnly,
3499
3619
  editorProps: {
3500
3620
  // Focusable when read only too: the selection strip, and so Comment on its words, shows only in a focused view.
3501
- attributes: { "aria-label": label, role: "textbox", "aria-multiline": "true", tabindex: "0", class: richTextClassName2("default", "outline-none") },
3621
+ attributes: {
3622
+ "aria-label": label,
3623
+ role: "textbox",
3624
+ "aria-multiline": "true",
3625
+ tabindex: "0",
3626
+ // A row or a card is its whole line (`LinkPlaces`), drawn on that line: a block inside it would push the
3627
+ // separator and trailing break ProseMirror puts beside it onto empty lines of their own (code review).
3628
+ class: richTextClassName2("default", "outline-none [&_[data-link-place]]:inline-block [&_[data-link-place]]:w-full [&_[data-link-place]]:align-top")
3629
+ },
3502
3630
  handleKeyDown: (view, event) => {
3503
3631
  if (event.key !== "Escape") return false;
3504
3632
  if (isSuggestionOpen() || isReferenceMenuOpen(view.state)) return false;
@@ -3563,7 +3691,6 @@ function DocumentEditor({
3563
3691
  /* @__PURE__ */ jsx11(EditorTableControls, { editor, children: /* @__PURE__ */ jsx11(EditorContent4, { editor, className: "-mx-2 cursor-text px-2 py-1", "data-document-editor": "" }) }),
3564
3692
  empty && !readOnly && placeholder && /* @__PURE__ */ jsx11("span", { "aria-hidden": true, className: "pointer-events-none absolute left-0 top-1 text-body-2 text-text-muted", children: placeholder })
3565
3693
  ] }),
3566
- cards?.(editor),
3567
3694
  (!readOnly || onCommentOnSelection) && /* @__PURE__ */ jsx11(
3568
3695
  SelectionToolbar,
3569
3696
  {
@@ -3628,6 +3755,7 @@ export {
3628
3755
  InlineText,
3629
3756
  KeptSelection,
3630
3757
  LinkChips,
3758
+ LinkPlaces,
3631
3759
  PastedImages,
3632
3760
  PastedMarkdown,
3633
3761
  PersonMention,
@@ -3663,6 +3791,7 @@ export {
3663
3791
  isSuggestionActive,
3664
3792
  isSuggestionOpen,
3665
3793
  keepSelection,
3794
+ linkPlaceAt,
3666
3795
  moveBlock,
3667
3796
  normalizeHref,
3668
3797
  pastedImageName,
@@ -3679,6 +3808,7 @@ export {
3679
3808
  setReferenceCard,
3680
3809
  setReferenceCardAt,
3681
3810
  startBlockDrag,
3811
+ staysChip,
3682
3812
  suggestionPopup,
3683
3813
  toggleTableHeaderRow,
3684
3814
  turnIntoRows,