@threadlabs/looma 0.43.2 → 0.44.1

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.
Files changed (47) hide show
  1. package/components/ui-callout/ui-callout.html +4 -4
  2. package/components/ui-dialog/ui-dialog.html +0 -4
  3. package/components/ui-editor-footnote-editor/ui-editor-footnote-editor.html +4 -50
  4. package/components/ui-editor-footnote-editor/ui-editor-footnote-editor.js +10 -31
  5. package/dist/index.js +1 -1
  6. package/docs/README.md +55 -17
  7. package/docs/card.html +1 -1
  8. package/docs/catalog-view.js +11 -5
  9. package/docs/catalog-view.mjs +4 -3
  10. package/docs/catalog.json +73 -109
  11. package/docs/catalog.mjs +1 -1
  12. package/docs/customizer-render.mjs +9 -8
  13. package/docs/customizer.js +8 -8
  14. package/docs/documentation.css +2 -2
  15. package/docs/examples/ui-editor-footnote-editor/examples/01-note.behavior.js +9 -0
  16. package/docs/fonts.mjs +1 -1
  17. package/docs/index.mjs +1 -1
  18. package/docs/render.mjs +17 -6
  19. package/docs/site.mjs +14 -5
  20. package/docs/theme.mjs +96 -16
  21. package/editor/chunks/extensions.js +10 -0
  22. package/editor/extensions/footnote.d.ts +1 -0
  23. package/editor/footnote-editing.d.ts +16 -27
  24. package/package.json +4 -3
  25. package/styles/ui-callout.css +4 -4
  26. package/styles/ui-dialog.css +0 -8
  27. package/theme-dark.css +9 -9
  28. package/theme-high-contrast.css +4 -0
  29. package/theme-light.css +6 -6
  30. package/tokens.css +20 -18
  31. package/vanilla/UiEditorFootnoteEditor.d.ts +0 -5
  32. package/vanilla/UiEditorFootnoteEditor.js +20 -68
  33. package/vue/UiCallout.vue +4 -4
  34. package/vue/UiDialog.vue +0 -7
  35. package/vue/UiEditorFootnoteEditor.d.ts +11 -29
  36. package/vue/UiEditorFootnoteEditor.vue +21 -173
  37. package/vue/chunks/UiCallout.js +1 -1
  38. package/vue/chunks/UiDialog.js +1 -1
  39. package/vue/chunks/UiEditorFootnoteEditor.js +34 -226
  40. package/vue/chunks/UiEditorImageToolbar.js +1 -1
  41. package/vue/chunks/UiEditorLinkForm.js +1 -1
  42. package/vue/chunks/compact.js +565 -0
  43. package/vue/components.css +320 -327
  44. package/vue/editor/LoomaEditor.d.ts +2 -2
  45. package/vue/editor/compact/index.js +1 -562
  46. package/vue/editor/index.js +173 -80
  47. package/vue/index.js +2 -2
@@ -1,6 +1,7 @@
1
+ import { n as LoomaCompactEditor } from "../chunks/compact.js";
1
2
  import { Teleport, computed, defineComponent, h, nextTick, onBeforeUnmount, onMounted, onUpdated, reactive, ref, shallowRef, useId, watch } from "vue";
2
3
  import { DEFAULT_MENTION_RESULT_LIMIT, LOOMA_ICONS, createLoomaMentionExtension, createLoomaSlashCommandExtension, getActiveTableUiState, getDefaultEditorExtensions, getDefaultSlashCommands, getTableOfContentsEntries, getVisualViewportRect, handleTableAction, handleTableOverlayAction, measureTableOverlayGeometry, normalizeActiveTableColumnWidths, normalizeTableOfContentsConfig } from "@threadlabs/looma/editor";
3
- import { Button, Card, EditorBlockActions, EditorChipEditor, EditorCodeLanguage, EditorFootnoteEditor, EditorImageToolbar, EditorInsertTableGrid, EditorLinkCard, EditorLinkForm, EditorMentionMenu, EditorMentionMenuItem, EditorSlashMenu, EditorSlashMenuGroup, EditorSlashMenuItem, EditorSurface, EditorTableContextMenu, EditorTableOverlay, EditorTableToolbar, EditorToolbar, IconButton, Popover, Stack, StatusMessage, Text, Tooltip } from "@threadlabs/looma/vue";
4
+ import { Button, Card, Cluster, EditorBlockActions, EditorChipEditor, EditorCodeLanguage, EditorFootnoteEditor, EditorImageToolbar, EditorInsertTableGrid, EditorLinkCard, EditorLinkForm, EditorMentionMenu, EditorMentionMenuItem, EditorSlashMenu, EditorSlashMenuGroup, EditorSlashMenuItem, EditorSurface, EditorTableContextMenu, EditorTableOverlay, EditorTableToolbar, EditorToolbar, IconButton, Popover, Stack, StatusMessage, Text, Tooltip } from "@threadlabs/looma/vue";
4
5
  import { Editor, Extension, InputRule, Node as Node$1, PasteRule, getText, getTextSerializersFromSchema, isNodeSelection, mergeAttributes, nodeInputRule, posToDOMRect } from "@tiptap/core";
5
6
  import { Editor as Editor$1 } from "@tiptap/vue-3";
6
7
  import { AllSelection, NodeSelection, Plugin, PluginKey, Selection, TextSelection } from "@tiptap/pm/state";
@@ -8,9 +9,9 @@ import { Decoration, DecorationSet } from "@tiptap/pm/view";
8
9
  import { createLowlight } from "lowlight";
9
10
  import { RequestEvent, componentRegistry } from "@nextwebwg/html-next/runtime";
10
11
  import "@tiptap/pm/tables";
12
+ import { closeHistory } from "@tiptap/pm/history";
11
13
  import { DOMParser, DOMSerializer, Fragment as Fragment$1, Slice } from "@tiptap/pm/model";
12
14
  import "@tiptap/pm/transform";
13
- import { closeHistory } from "@tiptap/pm/history";
14
15
  import { IndexedList, NONCONFORMING, READY_INPUT, UNRESOLVED_INPUT, acceptProps, activateModule, armElement, attachGeneratedController, awaitInput, buildTemplate, checkBoolean, checkConstrained, checkFormat, checkInteger, checkNumber, checkObject, checkSelected, checkString, clearRegion, computedCycle, defineComponent as defineComponent$1, detailCheck, dispatchDeclared, dispose, evaluateInput, fillSlot, formatOf, generatedInputs, hostState, inputRead, keywordFormat, manageProps, notifyPropertySet, project, readIndex, readMember, readonlyView, readsChanged, rec, recordValue, replaceRoot, textCall, toAttribute, toText, trackContainer, truthy, writeAttribute, writeUrlAttribute } from "@nextwebwg/html-next/generated-runtime";
15
16
  export * from "@threadlabs/looma/editor";
16
17
  //#region \0rolldown/runtime.js
@@ -1779,6 +1780,7 @@ function createChipEditing(options) {
1779
1780
  var labelFrom = (href, prefix) => href?.startsWith(`#${prefix}`) ? href.slice(prefix.length + 1) : null;
1780
1781
  /** A footnote label as Looma Markdown reads it in `[^label]`: no whitespace and no `]`. */
1781
1782
  var LOOMA_FOOTNOTE_LABEL = /^[^\s\]]+$/;
1783
+ var LOOMA_FOOTNOTE_INSERTED = "loomaFootnoteInserted";
1782
1784
  var REFERENCE = "loomaFootnoteReference";
1783
1785
  var NOTES = "loomaFootnotes";
1784
1786
  var NOTE = "loomaFootnote";
@@ -2103,7 +2105,16 @@ Node$1.create({
2103
2105
  const { $from, $to } = state.selection;
2104
2106
  if (!isLabel(name) || !$from.parent.canReplaceWith($from.index(), $to.index(), state.schema.nodes[REFERENCE])) return false;
2105
2107
  if (!dispatch) return true;
2108
+ const position = tr.selection.from;
2106
2109
  tr.replaceSelectionWith(state.schema.nodes[REFERENCE].create({ label: name }));
2110
+ let occurrence = 0;
2111
+ tr.doc.descendants((node, offset) => {
2112
+ if (offset <= position && node.type.name === REFERENCE && node.attrs.label === name) occurrence++;
2113
+ });
2114
+ tr.setMeta(LOOMA_FOOTNOTE_INSERTED, {
2115
+ label: name,
2116
+ occurrence
2117
+ });
2107
2118
  if (!findLoomaFootnote(tr.doc, name)) {
2108
2119
  const note = state.schema.nodes[NOTE].create({ label: name }, state.schema.nodes.paragraph.create());
2109
2120
  if (tr.doc.lastChild?.type.name === NOTES) tr.insert(tr.doc.content.size - 1, note);
@@ -2190,39 +2201,72 @@ Node$1.create({
2190
2201
  });
2191
2202
  //#endregion
2192
2203
  //#region src/editor/footnote-editing.ts
2204
+ var content = (note) => ({
2205
+ type: "doc",
2206
+ content: note.content.toJSON()
2207
+ });
2193
2208
  var LOOMA_FOOTNOTE_EDITING_IDLE = Object.freeze({
2194
2209
  open: false,
2195
- label: "",
2196
- note: "",
2197
- editable: false,
2198
- error: ""
2210
+ note: {
2211
+ type: "doc",
2212
+ content: [{ type: "paragraph" }]
2213
+ }
2199
2214
  });
2200
- var plain = (note) => {
2201
- const paragraph = note.firstChild;
2202
- if (note.childCount !== 1 || paragraph?.type.name !== "paragraph") return false;
2203
- let text = true;
2204
- paragraph.forEach((child) => {
2205
- if (!child.isText || child.marks.length) text = false;
2215
+ /**
2216
+ * Reuses the parent content schema in a short-form field, including global attributes.
2217
+ * Document-wide normalizers and node-view callbacks stay with the parent editor.
2218
+ */
2219
+ function footnoteContentExtensions(editor) {
2220
+ return editor.extensionManager.extensions.filter((extension) => extension.type === "node" || extension.type === "mark").filter((extension) => !["loomaFootnotes", "loomaFootnote"].includes(extension.name)).map((extension) => {
2221
+ const attributes = Object.fromEntries(editor.extensionManager.attributes.filter((attribute) => attribute.type === extension.name).map((attribute) => [attribute.name, { ...attribute.attribute }]));
2222
+ const schema = {
2223
+ addAttributes: () => attributes,
2224
+ addGlobalAttributes: () => [],
2225
+ addProseMirrorPlugins: () => []
2226
+ };
2227
+ return extension.type === "node" ? extension.extend({
2228
+ ...schema,
2229
+ addNodeView: null
2230
+ }) : extension.extend(schema);
2206
2231
  });
2207
- return text;
2208
- };
2232
+ }
2209
2233
  function createFootnoteEditing(options) {
2210
2234
  const { editor } = options;
2211
2235
  const listeners = /* @__PURE__ */ new Set();
2212
2236
  let state = LOOMA_FOOTNOTE_EDITING_IDLE;
2213
2237
  let element = null;
2238
+ let identity = "";
2214
2239
  const set = (next) => {
2215
2240
  state = next;
2216
2241
  listeners.forEach((listener) => listener());
2217
2242
  };
2218
2243
  const close = () => {
2219
2244
  element = null;
2245
+ identity = "";
2220
2246
  if (state.open) set({
2221
2247
  ...state,
2222
2248
  open: false
2223
2249
  });
2224
2250
  };
2225
- const note = () => state.open && !editor.isDestroyed && element?.isConnected ? findLoomaFootnote(editor.state.doc, state.label) : null;
2251
+ const note = () => state.open && !editor.isDestroyed && element?.isConnected ? findLoomaFootnote(editor.state.doc, identity) : null;
2252
+ const sync = () => {
2253
+ if (!state.open) return;
2254
+ const found = note();
2255
+ if (!found) return close();
2256
+ const next = content(found.node);
2257
+ if (JSON.stringify(next) !== JSON.stringify(state.note)) set({
2258
+ ...state,
2259
+ note: next
2260
+ });
2261
+ };
2262
+ const destroy = () => {
2263
+ close();
2264
+ editor.off("transaction", sync);
2265
+ editor.off("destroy", destroy);
2266
+ listeners.clear();
2267
+ };
2268
+ editor.on("transaction", sync);
2269
+ editor.on("destroy", destroy);
2226
2270
  return {
2227
2271
  get state() {
2228
2272
  return state;
@@ -2238,54 +2282,25 @@ function createFootnoteEditing(options) {
2238
2282
  },
2239
2283
  open(position) {
2240
2284
  if (!options.isEditable() || editor.isDestroyed) return false;
2241
- const node = editor.state.doc.nodeAt(position);
2242
- const dom = editor.view.nodeDOM(position);
2285
+ const node = editor.state.doc.nodeAt(position), dom = editor.view.nodeDOM(position);
2243
2286
  if (node?.type.name !== "loomaFootnoteReference" || !(dom instanceof HTMLElement)) return false;
2244
- const label = String(node.attrs.label);
2245
- const found = findLoomaFootnote(editor.state.doc, label);
2287
+ const found = findLoomaFootnote(editor.state.doc, String(node.attrs.label));
2246
2288
  if (!found) return false;
2289
+ identity = String(node.attrs.label);
2247
2290
  element = dom;
2248
2291
  set({
2249
2292
  open: true,
2250
- label,
2251
- note: found.node.textBetween(0, found.node.content.size, "\n"),
2252
- editable: plain(found.node),
2253
- error: ""
2293
+ note: content(found.node)
2254
2294
  });
2255
2295
  return true;
2256
2296
  },
2257
- setNote(text) {
2297
+ setNote(value) {
2258
2298
  const found = note();
2259
2299
  if (!found) return close();
2260
- if (!state.editable) return;
2261
- const value = text.replace(/\s*\n\s*/g, " ");
2262
- const start = found.position + 2;
2263
- const end = start + found.node.firstChild.content.size;
2264
- editor.view.dispatch(editor.state.tr.replaceWith(start, end, value ? editor.schema.text(value) : Fragment$1.empty));
2265
- set({
2266
- ...state,
2267
- note: value
2268
- });
2269
- },
2270
- rename(label) {
2271
- if (!note()) return close();
2272
- if (label === state.label) return state.error ? set({
2273
- ...state,
2274
- error: ""
2275
- }) : void 0;
2276
- if (!LOOMA_FOOTNOTE_LABEL.test(label)) return set({
2277
- ...state,
2278
- error: "A label is one word, without ]."
2279
- });
2280
- if (!editor.commands.renameLoomaFootnote(state.label, label)) return set({
2281
- ...state,
2282
- error: "Another footnote uses this label."
2283
- });
2284
- set({
2285
- ...state,
2286
- label,
2287
- error: ""
2288
- });
2300
+ const next = editor.schema.nodeFromJSON(value);
2301
+ if (next.type !== editor.schema.topNodeType || !found.node.type.validContent(next.content)) throw new Error("Invalid footnote content.");
2302
+ if (found.node.content.eq(next.content)) return;
2303
+ editor.view.dispatch(editor.state.tr.replaceWith(found.position + 1, found.position + 1 + found.node.content.size, next.content));
2289
2304
  },
2290
2305
  goToNote() {
2291
2306
  const reference = element;
@@ -15450,13 +15465,14 @@ var LoomaEditor = defineComponent({
15450
15465
  let chipEditing;
15451
15466
  const chipState = shallowRef(LOOMA_CHIP_EDITING_IDLE);
15452
15467
  const footnoteAnchorId = `looma-editor-footnote-${useId().replace(/[^a-zA-Z0-9_-]/g, "")}`;
15453
- const footnoteEditorRoot = ref(null);
15454
- const setFootnoteEditorRoot = (instance) => {
15455
- const element = instance?.$el;
15456
- footnoteEditorRoot.value = element instanceof HTMLElement ? element : null;
15457
- };
15458
15468
  let footnoteEditing;
15459
15469
  const footnoteState = shallowRef(LOOMA_FOOTNOTE_EDITING_IDLE);
15470
+ const footnoteSurface = ref(null);
15471
+ let footnoteContentExtensions$1 = [];
15472
+ let footnoteField;
15473
+ const focusFootnoteField = () => {
15474
+ if (footnoteSurface.value === "editor" && footnoteField && !footnoteField.isDestroyed && footnoteField.view.dom.closest("[popover]")?.matches(":popover-open")) footnoteField.commands.focus("end");
15475
+ };
15460
15476
  const toolbarScope = `looma-editor-tool-${useId().replace(/[^a-zA-Z0-9_-]/g, "")}`;
15461
15477
  const toolbarTooltip = createToolbarTooltip((state) => {
15462
15478
  tooltip.value = state;
@@ -15543,14 +15559,17 @@ var LoomaEditor = defineComponent({
15543
15559
  chipEditing.element.id = chipAnchorId;
15544
15560
  nextTick(() => chipInput()?.focus());
15545
15561
  };
15546
- const openFootnoteEditor = (position) => {
15562
+ const openFootnoteSurface = (position, surface) => {
15547
15563
  if (!footnoteEditing?.open(position)) return;
15548
15564
  root.value?.querySelector(`#${footnoteAnchorId}`)?.removeAttribute("id");
15549
15565
  footnoteEditing.element.id = footnoteAnchorId;
15550
- nextTick(() => footnoteEditorRoot.value?.querySelector("[data-footnote-note]")?.focus());
15566
+ footnoteSurface.value = surface;
15567
+ if (surface === "editor") footnoteEditing.element.scrollIntoView({ block: "nearest" });
15551
15568
  };
15569
+ const openFootnoteEditor = (position) => openFootnoteSurface(position, "editor");
15552
15570
  const closeFootnote = (focusReference = false) => {
15553
15571
  const element = footnoteEditing?.element;
15572
+ footnoteSurface.value = null;
15554
15573
  footnoteEditing?.close();
15555
15574
  if (focusReference) element?.focus();
15556
15575
  };
@@ -15793,6 +15812,23 @@ var LoomaEditor = defineComponent({
15793
15812
  footnoteState.value = footnotes.state;
15794
15813
  });
15795
15814
  footnoteEditing = footnotes;
15815
+ footnoteContentExtensions$1 = footnoteContentExtensions(session.editor);
15816
+ const footnoteOwner = session.editor;
15817
+ const insertedFootnote = ({ transaction }) => {
15818
+ const inserted = transaction.getMeta(LOOMA_FOOTNOTE_INSERTED);
15819
+ if (!inserted) return;
15820
+ nextTick(() => {
15821
+ if (!editor.value || editor.value.isDestroyed) return;
15822
+ let position, occurrence = 0;
15823
+ editor.value.state.doc.descendants((node, offset) => {
15824
+ if (position !== void 0) return false;
15825
+ if (node.type.name === "loomaFootnoteReference" && node.attrs.label === inserted.label && ++occurrence === inserted.occurrence) position = offset;
15826
+ });
15827
+ if (position !== void 0) openFootnoteEditor(position);
15828
+ });
15829
+ };
15830
+ footnoteOwner.on("transaction", insertedFootnote);
15831
+ footnoteOwner.on("destroy", () => footnoteOwner.off("transaction", insertedFootnote));
15796
15832
  const imageUploads = createImageUploads({
15797
15833
  editor: session.editor,
15798
15834
  upload: () => (file, init) => ask("image-upload", { file }, init),
@@ -16287,7 +16323,7 @@ var LoomaEditor = defineComponent({
16287
16323
  };
16288
16324
  const imageElementForEvent = (event) => {
16289
16325
  const element = event.target instanceof Element ? event.target.closest("img[data-looma-image]") : null;
16290
- return element && root.value?.contains(element) ? element : null;
16326
+ return element && editor.value?.view.dom.contains(element) ? element : null;
16291
16327
  };
16292
16328
  const activateImage = (element, trigger) => {
16293
16329
  const image = imageForElement(element);
@@ -16298,18 +16334,18 @@ var LoomaEditor = defineComponent({
16298
16334
  };
16299
16335
  const chipElementForEvent = (event) => {
16300
16336
  const element = event.target instanceof Element ? event.target.closest("[data-looma-chip]") : null;
16301
- return element && root.value?.contains(element) ? element : null;
16337
+ return element && editor.value?.view.dom.contains(element) ? element : null;
16302
16338
  };
16303
16339
  const footnoteElementForEvent = (event) => {
16304
16340
  const element = event.target instanceof Element ? event.target.closest("[data-looma-footnote-ref]") : null;
16305
- return element && root.value?.contains(element) ? element : null;
16341
+ return element && editor.value?.view.dom.contains(element) ? element : null;
16306
16342
  };
16307
16343
  const onChipClickCapture = (event) => {
16308
16344
  const reference = footnoteElementForEvent(event);
16309
16345
  if (reference && editor.value && props.editable) {
16310
16346
  event.preventDefault();
16311
16347
  event.stopPropagation();
16312
- openFootnoteEditor(editor.value.view.posAtDOM(reference, 0));
16348
+ openFootnoteSurface(editor.value.view.posAtDOM(reference, 0), "actions");
16313
16349
  return;
16314
16350
  }
16315
16351
  const chip = chipElementForEvent(event);
@@ -16332,7 +16368,7 @@ var LoomaEditor = defineComponent({
16332
16368
  const reference = footnoteElementForEvent(event);
16333
16369
  if (reference && editor.value && props.editable) {
16334
16370
  event.preventDefault();
16335
- openFootnoteEditor(editor.value.view.posAtDOM(reference, 0));
16371
+ openFootnoteSurface(editor.value.view.posAtDOM(reference, 0), "actions");
16336
16372
  return;
16337
16373
  }
16338
16374
  const chip = chipElementForEvent(event);
@@ -16900,23 +16936,80 @@ var LoomaEditor = defineComponent({
16900
16936
  onColor: (event) => chipEditing?.setColor(event.detail.color),
16901
16937
  onDone: () => closeChip(true)
16902
16938
  })),
16903
- h(Popover, {
16904
- size: "sm",
16905
- open: footnoteState.value.open,
16939
+ footnoteState.value.open && footnoteSurface.value === "actions" ? h(Popover, {
16940
+ bare: true,
16941
+ open: true,
16906
16942
  for: footnoteAnchorId,
16943
+ role: "dialog",
16944
+ "aria-label": "Footnote actions",
16945
+ onToggle: (event) => {
16946
+ if (event.newState === "open" && footnoteSurface.value === "actions") event.target.querySelector("[aria-label=\"Go to note\"]")?.focus();
16947
+ },
16948
+ onClose: (event) => {
16949
+ if (footnoteSurface.value === "actions") closeFootnote(event.detail.reason === "escape");
16950
+ }
16951
+ }, () => h(Card, {
16952
+ variant: "elevated",
16953
+ padding: "xs",
16954
+ size: "sm"
16955
+ }, () => h(Cluster, {
16956
+ gap: "xs",
16957
+ wrap: "nowrap",
16958
+ role: "group",
16959
+ "aria-label": "Footnote actions"
16960
+ }, () => [
16961
+ h(IconButton, {
16962
+ id: `${footnoteAnchorId}-go`,
16963
+ label: "Go to note",
16964
+ variant: "ghost",
16965
+ tone: "neutral",
16966
+ size: "sm",
16967
+ onClick: () => {
16968
+ footnoteSurface.value = null;
16969
+ footnoteEditing?.goToNote();
16970
+ }
16971
+ }, () => loomaIcon("external-link")),
16972
+ h(Tooltip, { for: `${footnoteAnchorId}-go` }, () => "Go to note"),
16973
+ h(Button, {
16974
+ variant: "ghost",
16975
+ tone: "neutral",
16976
+ size: "sm",
16977
+ onClick: () => {
16978
+ footnoteSurface.value = null;
16979
+ nextTick(() => {
16980
+ if (footnoteState.value.open) footnoteSurface.value = "editor";
16981
+ });
16982
+ }
16983
+ }, () => [loomaIcon("pencil"), "Edit note"])
16984
+ ]))) : null,
16985
+ footnoteState.value.open && footnoteSurface.value === "editor" ? h(Popover, {
16986
+ size: "md",
16987
+ open: true,
16988
+ for: footnoteAnchorId,
16989
+ onToggle: (event) => {
16990
+ if (event.newState === "open") focusFootnoteField();
16991
+ },
16907
16992
  placement: mobile.value ? "top-start" : "bottom-start",
16908
- onClose: () => footnoteEditing?.close()
16909
- }, () => h(EditorFootnoteEditor, {
16910
- ref: setFootnoteEditorRoot,
16911
- label: footnoteState.value.label,
16912
- note: footnoteState.value.note,
16913
- editable: footnoteState.value.editable,
16914
- error: footnoteState.value.error,
16915
- onText: (event) => footnoteEditing?.setNote(event.detail.text),
16916
- onLabel: (event) => footnoteEditing?.rename(event.detail.label),
16917
- onGo: () => footnoteEditing?.goToNote(),
16918
- onDone: () => closeFootnote(true)
16919
- })),
16993
+ onClose: (event) => {
16994
+ if (footnoteSurface.value === "editor") closeFootnote(event.detail.reason === "escape");
16995
+ }
16996
+ }, () => h(EditorFootnoteEditor, { onDone: () => closeFootnote(true) }, () => h(LoomaCompactEditor, {
16997
+ label: "Footnote",
16998
+ modelValue: footnoteState.value.note,
16999
+ extensions: [...footnoteContentExtensions$1, Extension.create({
17000
+ name: "footnoteEditorDismiss",
17001
+ priority: 25,
17002
+ addKeyboardShortcuts: () => ({ Escape: () => {
17003
+ closeFootnote(true);
17004
+ return true;
17005
+ } })
17006
+ })],
17007
+ "onUpdate:modelValue": (value) => footnoteEditing?.setNote(value),
17008
+ onReady: (instance) => {
17009
+ footnoteField = instance;
17010
+ focusFootnoteField();
17011
+ }
17012
+ }))) : null,
16920
17013
  h(Popover, {
16921
17014
  class: "looma-editor__link-popover",
16922
17015
  size: "sm",
package/vue/index.js CHANGED
@@ -37,16 +37,16 @@ import { t as UiStack_default } from "./chunks/UiStack.js";
37
37
  import { t as UiSwatch_default } from "./chunks/UiSwatch.js";
38
38
  import { t as UiEditorChipEditor_default } from "./chunks/UiEditorChipEditor.js";
39
39
  import { t as UiEditorCodeLanguage_default } from "./chunks/UiEditorCodeLanguage.js";
40
- import { t as UiFormField_default } from "./chunks/UiFormField.js";
41
- import { t as UiInputGroup_default } from "./chunks/UiInputGroup.js";
42
40
  import { t as UiTextarea_default } from "./chunks/UiTextarea.js";
43
41
  import { t as UiEditorFootnoteEditor_default } from "./chunks/UiEditorFootnoteEditor.js";
44
42
  import { t as UiEditorToolbar_default } from "./chunks/UiEditorToolbar.js";
43
+ import { t as UiFormField_default } from "./chunks/UiFormField.js";
45
44
  import { t as UiPopover_default } from "./chunks/UiPopover.js";
46
45
  import { t as UiText_default } from "./chunks/UiText.js";
47
46
  import { t as UiEditorImageToolbar_default } from "./chunks/UiEditorImageToolbar.js";
48
47
  import { t as UiEditorInsertTableGrid_default } from "./chunks/UiEditorInsertTableGrid.js";
49
48
  import { t as UiEditorLinkCard_default } from "./chunks/UiEditorLinkCard.js";
49
+ import { t as UiInputGroup_default } from "./chunks/UiInputGroup.js";
50
50
  import { t as UiSearchResultRow_default } from "./chunks/UiSearchResultRow.js";
51
51
  import { t as UiEditorLinkForm_default } from "./chunks/UiEditorLinkForm.js";
52
52
  import { t as UiEditorMentionMenu_default } from "./chunks/UiEditorMentionMenu.js";