@harbour-enterprises/superdoc 0.23.0-next.5 → 0.23.0-next.7

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.
@@ -1,5 +1,5 @@
1
1
  import { m as defineComponent, B as h, O as Transition, $ as process$1, I as watchEffect, d as computed, r as ref, j as onMounted, W as onUnmounted, c as createElementBlock, o as openBlock, a as createBaseVNode, f as createCommentVNode, v as createVNode, x as unref } from "./vue-ZWZLQtoU.es.js";
2
- import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-DTw4eF5D.es.js";
2
+ import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-CwYBNJbv.es.js";
3
3
  function self(vars) {
4
4
  const {
5
5
  opacityDisabled,
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const vue = require("./vue-DKMj1I9B.cjs");
4
- const superdoc = require("./index-9hY1WuxT.cjs");
4
+ const superdoc = require("./index-D7Qk15SC.cjs");
5
5
  function self(vars) {
6
6
  const {
7
7
  opacityDisabled,
@@ -1,4 +1,4 @@
1
- import { q as index$1, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-C9Ql0kHS.es.js";
1
+ import { q as index$1, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-BlwYYqj5.es.js";
2
2
  import { a0 as effectScope, r as ref, _ as markRaw, $ as process$1, a1 as toRaw, d as computed, a2 as isRef, a3 as isReactive, C as toRef, i as inject, p as getCurrentInstance, l as watch, x as unref, a4 as hasInjectionContext, M as reactive, s as nextTick, a5 as getCurrentScope, a6 as onScopeDispose, a7 as toRefs, g as global$1, J as shallowRef, N as readonly, j as onMounted, k as onBeforeUnmount, h as onBeforeMount, S as onActivated, q as onDeactivated, z as createTextVNode, F as Fragment, Q as Comment, m as defineComponent, D as provide, H as withDirectives, B as h, U as Teleport, R as renderSlot, V as isVNode, I as watchEffect, O as Transition, a8 as TransitionGroup, E as mergeProps, P as vShow, G as cloneVNode, T as Text, c as createElementBlock, o as openBlock, t as toDisplayString, v as createVNode, y as withCtx, a as createBaseVNode, A as normalizeStyle, f as createCommentVNode, u as createBlock, w as withModifiers, n as normalizeClass, a9 as resolveDirective, e as renderList, b as createApp, X as resolveDynamicComponent, aa as defineAsyncComponent } from "./vue-ZWZLQtoU.es.js";
3
3
  import { B as Buffer$2 } from "./jszip-DAXEPCUv.es.js";
4
4
  import { B as BlankDOCX } from "./blank-docx-iwdyG9RH.es.js";
@@ -17400,7 +17400,7 @@ const _sfc_main = {
17400
17400
  __name: "SuperDoc",
17401
17401
  emits: ["selection-update"],
17402
17402
  setup(__props, { emit: __emit }) {
17403
- const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-BlOezZGN.es.js"));
17403
+ const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-C6jt6oYd.es.js"));
17404
17404
  const superdocStore = useSuperdocStore();
17405
17405
  const commentsStore = useCommentsStore();
17406
17406
  const {
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const superEditor_es = require("./super-editor.es-C8gNFcB_.cjs");
2
+ const superEditor_es = require("./super-editor.es-DjFmu9z4.cjs");
3
3
  const vue = require("./vue-DKMj1I9B.cjs");
4
4
  const jszip = require("./jszip-B4LDL19y.cjs");
5
5
  const blankDocx = require("./blank-docx-CPqX9RF5.cjs");
@@ -17417,7 +17417,7 @@ const _sfc_main = {
17417
17417
  __name: "SuperDoc",
17418
17418
  emits: ["selection-update"],
17419
17419
  setup(__props, { emit: __emit }) {
17420
- const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-D89-VJvM.cjs")));
17420
+ const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-DdqBWhu-.cjs")));
17421
17421
  const superdocStore = useSuperdocStore();
17422
17422
  const commentsStore = useCommentsStore();
17423
17423
  const {
@@ -54386,7 +54386,7 @@ const StructuredContentCommands = Extension.create({
54386
54386
  * This will update every field that matches the given alias.
54387
54387
  * If any updated node does not match the schema, no updates will be applied.
54388
54388
  * @category Command
54389
- * @param {string} alias - Shared identifier for fields (e.g., "customer_name")
54389
+ * @param {string | string[]} alias - Shared identifier for fields (e.g., "customer_name")
54390
54390
  * @param {StructuredContentUpdate} options
54391
54391
  */
54392
54392
  updateStructuredContentByAlias: (alias, options = {}) => ({ editor, dispatch, state: state2, tr }) => {
@@ -54395,35 +54395,39 @@ const StructuredContentCommands = Extension.create({
54395
54395
  return true;
54396
54396
  }
54397
54397
  const { schema } = editor;
54398
- const updates = [];
54399
- for (const { pos, node } of structuredContentTags) {
54400
- let content = null;
54398
+ const createContent = (node) => {
54401
54399
  if (options.text) {
54402
- content = schema.text(options.text);
54400
+ return schema.text(options.text);
54403
54401
  }
54404
54402
  if (options.html) {
54405
54403
  const html = htmlHandler(options.html, editor);
54406
54404
  const doc2 = DOMParser$1.fromSchema(schema).parse(html);
54407
- content = doc2.content;
54405
+ return doc2.content;
54408
54406
  }
54409
54407
  if (options.json) {
54410
- content = schema.nodeFromJSON(options.json);
54411
- }
54412
- if (!content) {
54413
- content = node.content;
54408
+ return schema.nodeFromJSON(options.json);
54414
54409
  }
54410
+ return node.content;
54411
+ };
54412
+ for (const { node } of structuredContentTags) {
54413
+ const content = createContent(node);
54415
54414
  const updatedNode = node.type.create({ ...node.attrs, ...options.attrs }, content, node.marks);
54416
54415
  try {
54417
54416
  updatedNode.check();
54418
- updates.push({ pos, node: updatedNode, size: node.nodeSize });
54419
54417
  } catch {
54420
54418
  console.error("Updated node does not conform to the schema");
54421
54419
  return false;
54422
54420
  }
54423
54421
  }
54424
54422
  if (dispatch) {
54425
- updates.reverse().forEach(({ pos, node, size: size2 }) => {
54426
- tr.replaceWith(pos, pos + size2, node);
54423
+ structuredContentTags.forEach(({ pos, node }) => {
54424
+ const mappedPos = tr.mapping.map(pos);
54425
+ const currentNode = tr.doc.nodeAt(mappedPos);
54426
+ if (currentNode && node.eq(currentNode)) {
54427
+ const content = createContent(node);
54428
+ const updatedNode = node.type.create({ ...node.attrs, ...options.attrs }, content, node.marks);
54429
+ tr.replaceWith(mappedPos, mappedPos + node.nodeSize, updatedNode);
54430
+ }
54427
54431
  });
54428
54432
  }
54429
54433
  return true;
@@ -54403,7 +54403,7 @@ const StructuredContentCommands = Extension.create({
54403
54403
  * This will update every field that matches the given alias.
54404
54404
  * If any updated node does not match the schema, no updates will be applied.
54405
54405
  * @category Command
54406
- * @param {string} alias - Shared identifier for fields (e.g., "customer_name")
54406
+ * @param {string | string[]} alias - Shared identifier for fields (e.g., "customer_name")
54407
54407
  * @param {StructuredContentUpdate} options
54408
54408
  */
54409
54409
  updateStructuredContentByAlias: (alias, options = {}) => ({ editor, dispatch, state: state2, tr }) => {
@@ -54412,35 +54412,39 @@ const StructuredContentCommands = Extension.create({
54412
54412
  return true;
54413
54413
  }
54414
54414
  const { schema } = editor;
54415
- const updates = [];
54416
- for (const { pos, node } of structuredContentTags) {
54417
- let content = null;
54415
+ const createContent = (node) => {
54418
54416
  if (options.text) {
54419
- content = schema.text(options.text);
54417
+ return schema.text(options.text);
54420
54418
  }
54421
54419
  if (options.html) {
54422
54420
  const html = htmlHandler(options.html, editor);
54423
54421
  const doc2 = DOMParser$1.fromSchema(schema).parse(html);
54424
- content = doc2.content;
54422
+ return doc2.content;
54425
54423
  }
54426
54424
  if (options.json) {
54427
- content = schema.nodeFromJSON(options.json);
54428
- }
54429
- if (!content) {
54430
- content = node.content;
54425
+ return schema.nodeFromJSON(options.json);
54431
54426
  }
54427
+ return node.content;
54428
+ };
54429
+ for (const { node } of structuredContentTags) {
54430
+ const content = createContent(node);
54432
54431
  const updatedNode = node.type.create({ ...node.attrs, ...options.attrs }, content, node.marks);
54433
54432
  try {
54434
54433
  updatedNode.check();
54435
- updates.push({ pos, node: updatedNode, size: node.nodeSize });
54436
54434
  } catch {
54437
54435
  console.error("Updated node does not conform to the schema");
54438
54436
  return false;
54439
54437
  }
54440
54438
  }
54441
54439
  if (dispatch) {
54442
- updates.reverse().forEach(({ pos, node, size: size2 }) => {
54443
- tr.replaceWith(pos, pos + size2, node);
54440
+ structuredContentTags.forEach(({ pos, node }) => {
54441
+ const mappedPos = tr.mapping.map(pos);
54442
+ const currentNode = tr.doc.nodeAt(mappedPos);
54443
+ if (currentNode && node.eq(currentNode)) {
54444
+ const content = createContent(node);
54445
+ const updatedNode = node.type.create({ ...node.attrs, ...options.attrs }, content, node.marks);
54446
+ tr.replaceWith(mappedPos, mappedPos + node.nodeSize, updatedNode);
54447
+ }
54444
54448
  });
54445
54449
  }
54446
54450
  return true;
package/dist/style.css CHANGED
@@ -1497,6 +1497,13 @@ on the right if it is inside shape textbox.
1497
1497
  white-space: nowrap;
1498
1498
  text-overflow: ellipsis;
1499
1499
  }
1500
+ .ProseMirror.view-mode .sd-document-section-block {
1501
+ background: none;
1502
+ border: none;
1503
+ }
1504
+ .ProseMirror.view-mode .sd-document-section-block-info {
1505
+ display: none;
1506
+ }
1500
1507
  .sd-structured-content,
1501
1508
  .sd-structured-content-block {
1502
1509
  padding: 1px;
@@ -1505,6 +1512,10 @@ on the right if it is inside shape textbox.
1505
1512
  border: 1px solid #629be7;
1506
1513
  position: relative;
1507
1514
  }
1515
+ .sd-structured-content:has(img),
1516
+ .sd-structured-content:has(img) .sd-structured-content__content {
1517
+ display: inline-block;
1518
+ }
1508
1519
  .sd-structured-content-draggable {
1509
1520
  font-size: 10px;
1510
1521
  align-items: center;
@@ -1536,6 +1547,14 @@ on the right if it is inside shape textbox.
1536
1547
  .sd-structured-content-block:hover .sd-structured-content-draggable {
1537
1548
  display: inline-flex;
1538
1549
  }
1550
+ .ProseMirror.view-mode .sd-structured-content,
1551
+ .ProseMirror.view-mode .sd-structured-content-block {
1552
+ padding: 0;
1553
+ border: none;
1554
+ }
1555
+ .ProseMirror.view-mode .sd-structured-content-draggable {
1556
+ display: none;
1557
+ }
1539
1558
 
1540
1559
  .alignment-buttons[data-v-d84f57b6] {
1541
1560
  display: flex;
@@ -1,6 +1,6 @@
1
1
  import { ref, onMounted, onUnmounted, computed, createElementBlock, openBlock, withModifiers, createElementVNode, withDirectives, unref, vModelText, createCommentVNode, nextTick } from "vue";
2
2
  import { T as TextSelection } from "./chunks/converter-ClnqoStR.js";
3
- import { _ as _export_sfc } from "./chunks/editor-DLan-MJ6.js";
3
+ import { _ as _export_sfc } from "./chunks/editor-Co2_vpme.js";
4
4
  const DEFAULT_API_ENDPOINT = "https://sd-dev-express-gateway-i6xtm.ondigitalocean.app/insights";
5
5
  const SYSTEM_PROMPT = "You are an expert copywriter and you are immersed in a document editor. You are to provide document related text responses based on the user prompts. Only write what is asked for. Do not provide explanations. Try to keep placeholders as short as possible. Do not output your prompt. Your instructions are: ";
6
6
  async function baseInsightsFetch(payload, options = {}) {
@@ -17525,7 +17525,7 @@ const StructuredContentCommands = Extension.create({
17525
17525
  * This will update every field that matches the given alias.
17526
17526
  * If any updated node does not match the schema, no updates will be applied.
17527
17527
  * @category Command
17528
- * @param {string} alias - Shared identifier for fields (e.g., "customer_name")
17528
+ * @param {string | string[]} alias - Shared identifier for fields (e.g., "customer_name")
17529
17529
  * @param {StructuredContentUpdate} options
17530
17530
  */
17531
17531
  updateStructuredContentByAlias: (alias, options = {}) => ({ editor, dispatch, state, tr }) => {
@@ -17534,35 +17534,39 @@ const StructuredContentCommands = Extension.create({
17534
17534
  return true;
17535
17535
  }
17536
17536
  const { schema } = editor;
17537
- const updates = [];
17538
- for (const { pos, node } of structuredContentTags) {
17539
- let content = null;
17537
+ const createContent = (node) => {
17540
17538
  if (options.text) {
17541
- content = schema.text(options.text);
17539
+ return schema.text(options.text);
17542
17540
  }
17543
17541
  if (options.html) {
17544
17542
  const html = htmlHandler(options.html, editor);
17545
17543
  const doc2 = DOMParser$1.fromSchema(schema).parse(html);
17546
- content = doc2.content;
17544
+ return doc2.content;
17547
17545
  }
17548
17546
  if (options.json) {
17549
- content = schema.nodeFromJSON(options.json);
17550
- }
17551
- if (!content) {
17552
- content = node.content;
17547
+ return schema.nodeFromJSON(options.json);
17553
17548
  }
17549
+ return node.content;
17550
+ };
17551
+ for (const { node } of structuredContentTags) {
17552
+ const content = createContent(node);
17554
17553
  const updatedNode = node.type.create({ ...node.attrs, ...options.attrs }, content, node.marks);
17555
17554
  try {
17556
17555
  updatedNode.check();
17557
- updates.push({ pos, node: updatedNode, size: node.nodeSize });
17558
17556
  } catch {
17559
17557
  console.error("Updated node does not conform to the schema");
17560
17558
  return false;
17561
17559
  }
17562
17560
  }
17563
17561
  if (dispatch) {
17564
- updates.reverse().forEach(({ pos, node, size }) => {
17565
- tr.replaceWith(pos, pos + size, node);
17562
+ structuredContentTags.forEach(({ pos, node }) => {
17563
+ const mappedPos = tr.mapping.map(pos);
17564
+ const currentNode = tr.doc.nodeAt(mappedPos);
17565
+ if (currentNode && node.eq(currentNode)) {
17566
+ const content = createContent(node);
17567
+ const updatedNode = node.type.create({ ...node.attrs, ...options.attrs }, content, node.marks);
17568
+ tr.replaceWith(mappedPos, mappedPos + node.nodeSize, updatedNode);
17569
+ }
17566
17570
  });
17567
17571
  }
17568
17572
  return true;
@@ -1,6 +1,6 @@
1
1
  import { computed, createElementBlock, openBlock, createElementVNode, createCommentVNode, normalizeClass, normalizeStyle, ref, withKeys, unref, withModifiers, createBlock, toDisplayString, withDirectives, vModelText, nextTick, getCurrentInstance, createVNode, readonly, watch, onMounted, onBeforeUnmount, reactive, onBeforeMount, inject, onActivated, onDeactivated, createTextVNode, Fragment, Comment, defineComponent, provide, h, Teleport, toRef, renderSlot, isVNode, shallowRef, watchEffect, mergeProps, Transition, vShow, cloneVNode, Text, renderList, withCtx } from "vue";
2
2
  import { p as process$1 } from "./converter-ClnqoStR.js";
3
- import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-DLan-MJ6.js";
3
+ import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-Co2_vpme.js";
4
4
  const sanitizeNumber = (value, defaultNumber) => {
5
5
  let sanitized = value.replace(/[^0-9.]/g, "");
6
6
  sanitized = parseFloat(sanitized);
@@ -1,4 +1,4 @@
1
- import { E } from "./chunks/editor-DLan-MJ6.js";
1
+ import { E } from "./chunks/editor-Co2_vpme.js";
2
2
  import "./chunks/converter-ClnqoStR.js";
3
3
  import "./chunks/docx-zipper-DC28ucAi.js";
4
4
  export {
@@ -1123,6 +1123,13 @@ on the right if it is inside shape textbox.
1123
1123
  white-space: nowrap;
1124
1124
  text-overflow: ellipsis;
1125
1125
  }
1126
+ .ProseMirror.view-mode .sd-document-section-block {
1127
+ background: none;
1128
+ border: none;
1129
+ }
1130
+ .ProseMirror.view-mode .sd-document-section-block-info {
1131
+ display: none;
1132
+ }
1126
1133
  .sd-structured-content,
1127
1134
  .sd-structured-content-block {
1128
1135
  padding: 1px;
@@ -1131,6 +1138,10 @@ on the right if it is inside shape textbox.
1131
1138
  border: 1px solid #629be7;
1132
1139
  position: relative;
1133
1140
  }
1141
+ .sd-structured-content:has(img),
1142
+ .sd-structured-content:has(img) .sd-structured-content__content {
1143
+ display: inline-block;
1144
+ }
1134
1145
  .sd-structured-content-draggable {
1135
1146
  font-size: 10px;
1136
1147
  align-items: center;
@@ -1162,6 +1173,14 @@ on the right if it is inside shape textbox.
1162
1173
  .sd-structured-content-block:hover .sd-structured-content-draggable {
1163
1174
  display: inline-flex;
1164
1175
  }
1176
+ .ProseMirror.view-mode .sd-structured-content,
1177
+ .ProseMirror.view-mode .sd-structured-content-block {
1178
+ padding: 0;
1179
+ border: none;
1180
+ }
1181
+ .ProseMirror.view-mode .sd-structured-content-draggable {
1182
+ display: none;
1183
+ }
1165
1184
 
1166
1185
  .alignment-buttons[data-v-d84f57b6] {
1167
1186
  display: flex;
@@ -11,10 +11,10 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
11
11
  var _SuperToolbar_instances, initToolbarGroups_fn, _interceptedCommands, makeToolbarItems_fn, initDefaultFonts_fn, updateHighlightColors_fn, deactivateAll_fn, updateToolbarHistory_fn, runCommandWithArgumentOnly_fn;
12
12
  import { ax as getDefaultExportFromCjs, V as v4, T as TextSelection$1, v as getMarkRange, aA as vClickOutside, H as findParentNode, aB as getActiveFormatting, at as isInTable, aC as readFromClipboard, aD as handleClipboardPaste, aE as getFileObject, aF as runPropertyTranslators, aG as translator, aH as translator$1, aI as translator$2, aJ as translator$3, aK as translator$4, aL as translator$5, aM as translator$6, aN as translator$7, aO as translator$8, aP as translator$9, aQ as translator$a, aR as translator$b, aS as translator$c, aT as translator$d, aU as translator$e, aV as translator$f, aW as translator$g, aX as translator$h, aY as translator$i, aZ as translator$j, a_ as translator$k, a$ as translator$l, b0 as translator$m, b1 as translator$n, b2 as translator$o, b3 as translator$p, b4 as translator$q, b5 as translator$r, b6 as translator$s, b7 as translator$t, b8 as translator$u, b9 as translator$v, ba as translator$w, bb as translator$x, bc as translator$y, bd as translator$z, be as translator$A, bf as translator$B, bg as translator$C, bh as translator$D, bi as translator$E, bj as translator$F, bk as translator$G, bl as translator$H, bm as translator$I, bn as translator$J, bo as translator$K, bp as translator$L, bq as translator$M, br as translator$N, bs as translator$O, bt as translator$P, bu as translator$Q, bv as translator$R, bw as translator$S, bx as translator$T, by as translator$U, bz as translator$V, bA as translator$W, bB as translator$X, bC as translator$Y, bD as translator$Z, bE as translator$_, bF as translator$$, bG as translator$10, bH as translator$11, bI as translator$12, a as Plugin } from "./chunks/converter-ClnqoStR.js";
13
13
  import { bJ, a5, i, a2 } from "./chunks/converter-ClnqoStR.js";
14
- import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, c as getFileOpener, d as checkAndProcessImage, r as replaceSelectionWithImagePlaceholder, e as uploadAndInsertImage, y as yUndoPluginKey, f as undoDepth, h as redoDepth, s as shouldBypassContextMenu, S as SlashMenuPluginKey, E as Editor, i as getStarterExtensions, P as Placeholder, j as getRichTextExtensions, M as Mark, k as Extension, A as Attribute, N as Node } from "./chunks/editor-DLan-MJ6.js";
15
- import { n, C, o, T, l, p, m } from "./chunks/editor-DLan-MJ6.js";
14
+ import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, c as getFileOpener, d as checkAndProcessImage, r as replaceSelectionWithImagePlaceholder, e as uploadAndInsertImage, y as yUndoPluginKey, f as undoDepth, h as redoDepth, s as shouldBypassContextMenu, S as SlashMenuPluginKey, E as Editor, i as getStarterExtensions, P as Placeholder, j as getRichTextExtensions, M as Mark, k as Extension, A as Attribute, N as Node } from "./chunks/editor-Co2_vpme.js";
15
+ import { n, C, o, T, l, p, m } from "./chunks/editor-Co2_vpme.js";
16
16
  import { ref, onMounted, createElementBlock, openBlock, normalizeClass, unref, Fragment, renderList, createElementVNode, withModifiers, toDisplayString, createCommentVNode, normalizeStyle, computed, watch, withDirectives, withKeys, vModelText, createTextVNode, createVNode, h, createApp, markRaw, nextTick, onBeforeUnmount, reactive, onUnmounted, renderSlot, shallowRef, createBlock, withCtx, resolveDynamicComponent, normalizeProps, guardReactiveProps } from "vue";
17
- import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, m as magicWandIcon, p as plusIconSvg, a as trashIconSvg, l as linkIconSvg, b as tableIconSvg, c as scissorsIconSvg, d as copyIconSvg, e as pasteIconSvg, f as borderNoneIconSvg, g as arrowsToDotIconSvg, h as arrowsLeftRightIconSvg, w as wrenchIconSvg, u as useMessage, N as NSkeleton } from "./chunks/toolbar-CekMv4Mk.js";
17
+ import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, m as magicWandIcon, p as plusIconSvg, a as trashIconSvg, l as linkIconSvg, b as tableIconSvg, c as scissorsIconSvg, d as copyIconSvg, e as pasteIconSvg, f as borderNoneIconSvg, g as arrowsToDotIconSvg, h as arrowsLeftRightIconSvg, w as wrenchIconSvg, u as useMessage, N as NSkeleton } from "./chunks/toolbar-DSy-xZgn.js";
18
18
  import AIWriter from "./ai-writer.es.js";
19
19
  import { D } from "./chunks/docx-zipper-DC28ucAi.js";
20
20
  import { createZip } from "./file-zipper.es.js";
@@ -1,6 +1,6 @@
1
1
  import "vue";
2
- import { T } from "./chunks/toolbar-CekMv4Mk.js";
3
- import "./chunks/editor-DLan-MJ6.js";
2
+ import { T } from "./chunks/toolbar-DSy-xZgn.js";
3
+ import "./chunks/editor-Co2_vpme.js";
4
4
  export {
5
5
  T as default
6
6
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const superEditor_es = require("./chunks/super-editor.es-C8gNFcB_.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-DjFmu9z4.cjs");
4
4
  require("./chunks/vue-DKMj1I9B.cjs");
5
5
  exports.AIWriter = superEditor_es.AIWriter;
6
6
  exports.AnnotatorHelpers = superEditor_es.AnnotatorHelpers;
@@ -1,4 +1,4 @@
1
- import { A, a, _, C, D, E, b, S, c, d, e, f, g, T, h, i, j, k, l, m, n, o, p, r, q } from "./chunks/super-editor.es-C9Ql0kHS.es.js";
1
+ import { A, a, _, C, D, E, b, S, c, d, e, f, g, T, h, i, j, k, l, m, n, o, p, r, q } from "./chunks/super-editor.es-BlwYYqj5.es.js";
2
2
  import "./chunks/vue-ZWZLQtoU.es.js";
3
3
  export {
4
4
  A as AIWriter,
package/dist/superdoc.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const superEditor_es = require("./chunks/super-editor.es-C8gNFcB_.cjs");
4
- const superdoc = require("./chunks/index-9hY1WuxT.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-DjFmu9z4.cjs");
4
+ const superdoc = require("./chunks/index-D7Qk15SC.cjs");
5
5
  require("./chunks/vue-DKMj1I9B.cjs");
6
6
  require("./chunks/jszip-B4LDL19y.cjs");
7
7
  const blankDocx = require("./chunks/blank-docx-CPqX9RF5.cjs");
@@ -1,5 +1,5 @@
1
- import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-C9Ql0kHS.es.js";
2
- import { D, H, P, S as S2, m, l } from "./chunks/index-DTw4eF5D.es.js";
1
+ import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-BlwYYqj5.es.js";
2
+ import { D, H, P, S as S2, m, l } from "./chunks/index-CwYBNJbv.es.js";
3
3
  import "./chunks/vue-ZWZLQtoU.es.js";
4
4
  import "./chunks/jszip-DAXEPCUv.es.js";
5
5
  import { B } from "./chunks/blank-docx-iwdyG9RH.es.js";
@@ -62101,7 +62101,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
62101
62101
  * This will update every field that matches the given alias.
62102
62102
  * If any updated node does not match the schema, no updates will be applied.
62103
62103
  * @category Command
62104
- * @param {string} alias - Shared identifier for fields (e.g., "customer_name")
62104
+ * @param {string | string[]} alias - Shared identifier for fields (e.g., "customer_name")
62105
62105
  * @param {StructuredContentUpdate} options
62106
62106
  */
62107
62107
  updateStructuredContentByAlias: (alias, options = {}) => ({ editor, dispatch, state: state2, tr }) => {
@@ -62110,35 +62110,39 @@ Please report this to https://github.com/markedjs/marked.`, e) {
62110
62110
  return true;
62111
62111
  }
62112
62112
  const { schema } = editor;
62113
- const updates = [];
62114
- for (const { pos, node } of structuredContentTags) {
62115
- let content = null;
62113
+ const createContent = (node) => {
62116
62114
  if (options.text) {
62117
- content = schema.text(options.text);
62115
+ return schema.text(options.text);
62118
62116
  }
62119
62117
  if (options.html) {
62120
62118
  const html = htmlHandler(options.html, editor);
62121
62119
  const doc2 = DOMParser$1.fromSchema(schema).parse(html);
62122
- content = doc2.content;
62120
+ return doc2.content;
62123
62121
  }
62124
62122
  if (options.json) {
62125
- content = schema.nodeFromJSON(options.json);
62126
- }
62127
- if (!content) {
62128
- content = node.content;
62123
+ return schema.nodeFromJSON(options.json);
62129
62124
  }
62125
+ return node.content;
62126
+ };
62127
+ for (const { node } of structuredContentTags) {
62128
+ const content = createContent(node);
62130
62129
  const updatedNode = node.type.create({ ...node.attrs, ...options.attrs }, content, node.marks);
62131
62130
  try {
62132
62131
  updatedNode.check();
62133
- updates.push({ pos, node: updatedNode, size: node.nodeSize });
62134
62132
  } catch {
62135
62133
  console.error("Updated node does not conform to the schema");
62136
62134
  return false;
62137
62135
  }
62138
62136
  }
62139
62137
  if (dispatch) {
62140
- updates.reverse().forEach(({ pos, node, size: size2 }) => {
62141
- tr.replaceWith(pos, pos + size2, node);
62138
+ structuredContentTags.forEach(({ pos, node }) => {
62139
+ const mappedPos = tr.mapping.map(pos);
62140
+ const currentNode = tr.doc.nodeAt(mappedPos);
62141
+ if (currentNode && node.eq(currentNode)) {
62142
+ const content = createContent(node);
62143
+ const updatedNode = node.type.create({ ...node.attrs, ...options.attrs }, content, node.marks);
62144
+ tr.replaceWith(mappedPos, mappedPos + node.nodeSize, updatedNode);
62145
+ }
62142
62146
  });
62143
62147
  }
62144
62148
  return true;