@harbour-enterprises/superdoc 0.23.0-next.2 → 0.23.0-next.4

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 (25) hide show
  1. package/dist/chunks/{PdfViewer-BItyloFT.cjs → PdfViewer-D9qubRJ_.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-MPmm-SUD.es.js → PdfViewer-vQ-IdNED.es.js} +1 -1
  3. package/dist/chunks/{index-CdJOxoqt.cjs → index-BTv5rNmt.cjs} +4 -11
  4. package/dist/chunks/{index-OVF3JhUR.es.js → index-DGxFKkbG.es.js} +4 -11
  5. package/dist/chunks/{super-editor.es-DQnqUJZs.es.js → super-editor.es-DRBPtyog.es.js} +56 -0
  6. package/dist/chunks/{super-editor.es-C7stybby.cjs → super-editor.es-wyeeDloA.cjs} +56 -0
  7. package/dist/core/SuperDoc.d.ts +5 -18
  8. package/dist/core/SuperDoc.d.ts.map +1 -1
  9. package/dist/core/types/index.d.ts +29 -1
  10. package/dist/core/types/index.d.ts.map +1 -1
  11. package/dist/super-editor/ai-writer.es.js +1 -1
  12. package/dist/super-editor/chunks/{editor-DIINh50j.js → editor-CqnpAm6f.js} +56 -0
  13. package/dist/super-editor/chunks/{toolbar-CmDmkPHL.js → toolbar-DnEbb4lv.js} +1 -1
  14. package/dist/super-editor/editor.es.js +1 -1
  15. package/dist/super-editor/src/extensions/structured-content/structuredContentHelpers/getStructuredContentTagsByAlias.d.ts +8 -0
  16. package/dist/super-editor/src/extensions/structured-content/structuredContentHelpers/index.d.ts +1 -0
  17. package/dist/super-editor/super-editor.es.js +3 -3
  18. package/dist/super-editor/toolbar.es.js +2 -2
  19. package/dist/super-editor.cjs +1 -1
  20. package/dist/super-editor.es.js +1 -1
  21. package/dist/superdoc.cjs +2 -2
  22. package/dist/superdoc.es.js +2 -2
  23. package/dist/superdoc.umd.js +58 -9
  24. package/dist/superdoc.umd.js.map +1 -1
  25. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const vue = require("./vue-DWle4Cai.cjs");
4
- const superdoc = require("./index-CdJOxoqt.cjs");
4
+ const superdoc = require("./index-BTv5rNmt.cjs");
5
5
  function self(vars) {
6
6
  const {
7
7
  opacityDisabled,
@@ -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-CXxsqYcP.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-OVF3JhUR.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-DGxFKkbG.es.js";
3
3
  function self(vars) {
4
4
  const {
5
5
  opacityDisabled,
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const superEditor_es = require("./super-editor.es-C7stybby.cjs");
2
+ const superEditor_es = require("./super-editor.es-wyeeDloA.cjs");
3
3
  const vue = require("./vue-DWle4Cai.cjs");
4
4
  const jszip = require("./jszip-b7l8QkfH.cjs");
5
5
  const blankDocx = require("./blank-docx-CPqX9RF5.cjs");
@@ -17414,7 +17414,7 @@ const _sfc_main = {
17414
17414
  __name: "SuperDoc",
17415
17415
  emits: ["selection-update"],
17416
17416
  setup(__props, { emit: __emit }) {
17417
- const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-BItyloFT.cjs")));
17417
+ const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-D9qubRJ_.cjs")));
17418
17418
  const superdocStore = useSuperdocStore();
17419
17419
  const commentsStore = useCommentsStore();
17420
17420
  const {
@@ -18542,15 +18542,8 @@ class SuperDoc extends eventemitter3.EventEmitter {
18542
18542
  }
18543
18543
  /**
18544
18544
  * Export the superdoc to a file
18545
- * @param {Object} params
18546
- * @param {string[]} [params.exportType]
18547
- * @param {string} [params.commentsType]
18548
- * @param {string} [params.exportedName]
18549
- * @param {Array} [params.additionalFiles]
18550
- * @param {Array} [params.additionalFileNames]
18551
- * @param {boolean} [params.isFinalDoc]
18552
- * @param {boolean} [params.triggerDownload] Whether to trigger the download of the exported file
18553
- * @returns {Promise<void | Blob>} Returns void if triggerDownload is false, otherwise returns the exported file
18545
+ * @param {ExportParams} params - Export configuration
18546
+ * @returns {Promise<void | Blob>}
18554
18547
  */
18555
18548
  async export({
18556
18549
  exportType = ["docx"],
@@ -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-DQnqUJZs.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-DRBPtyog.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-CXxsqYcP.es.js";
3
3
  import { B as Buffer$2 } from "./jszip-B8KIZSNe.es.js";
4
4
  import { B as BlankDOCX } from "./blank-docx-iwdyG9RH.es.js";
@@ -17397,7 +17397,7 @@ const _sfc_main = {
17397
17397
  __name: "SuperDoc",
17398
17398
  emits: ["selection-update"],
17399
17399
  setup(__props, { emit: __emit }) {
17400
- const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-MPmm-SUD.es.js"));
17400
+ const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-vQ-IdNED.es.js"));
17401
17401
  const superdocStore = useSuperdocStore();
17402
17402
  const commentsStore = useCommentsStore();
17403
17403
  const {
@@ -18525,15 +18525,8 @@ class SuperDoc extends EventEmitter {
18525
18525
  }
18526
18526
  /**
18527
18527
  * Export the superdoc to a file
18528
- * @param {Object} params
18529
- * @param {string[]} [params.exportType]
18530
- * @param {string} [params.commentsType]
18531
- * @param {string} [params.exportedName]
18532
- * @param {Array} [params.additionalFiles]
18533
- * @param {Array} [params.additionalFileNames]
18534
- * @param {boolean} [params.isFinalDoc]
18535
- * @param {boolean} [params.triggerDownload] Whether to trigger the download of the exported file
18536
- * @returns {Promise<void | Blob>} Returns void if triggerDownload is false, otherwise returns the exported file
18528
+ * @param {ExportParams} params - Export configuration
18529
+ * @returns {Promise<void | Blob>}
18537
18530
  */
18538
18531
  async export({
18539
18532
  exportType = ["docx"],
@@ -54220,6 +54220,17 @@ function getStructuredContentTagsById(idOrIds, state2) {
54220
54220
  });
54221
54221
  return result;
54222
54222
  }
54223
+ function getStructuredContentTagsByAlias(aliasOrAliases, state2) {
54224
+ const result = findChildren$5(state2.doc, (node) => {
54225
+ const isStructuredContent = ["structuredContent", "structuredContentBlock"].includes(node.type.name);
54226
+ if (Array.isArray(aliasOrAliases)) {
54227
+ return isStructuredContent && aliasOrAliases.includes(node.attrs.alias);
54228
+ } else {
54229
+ return isStructuredContent && node.attrs.alias === aliasOrAliases;
54230
+ }
54231
+ });
54232
+ return result;
54233
+ }
54223
54234
  function getStructuredContentTags(state2) {
54224
54235
  const result = findChildren$5(state2.doc, (node) => {
54225
54236
  return node.type.name === "structuredContent" || node.type.name === "structuredContentBlock";
@@ -54239,6 +54250,7 @@ const structuredContentHelpers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ O
54239
54250
  getStructuredContentBlockTags,
54240
54251
  getStructuredContentInlineTags,
54241
54252
  getStructuredContentTags,
54253
+ getStructuredContentTagsByAlias,
54242
54254
  getStructuredContentTagsById
54243
54255
  }, Symbol.toStringTag, { value: "Module" }));
54244
54256
  const STRUCTURED_CONTENT_NAMES = ["structuredContent", "structuredContentBlock"];
@@ -54370,6 +54382,50 @@ const StructuredContentCommands = Extension.create({
54370
54382
  }
54371
54383
  return true;
54372
54384
  },
54385
+ /**
54386
+ * Updates a structured content attributes or content by alias.
54387
+ * If the updated node does not match the schema, it will not be updated.
54388
+ * @category Command
54389
+ * @param {string} alias
54390
+ * @param {StructuredContentUpdate} options
54391
+ */
54392
+ updateStructuredContentByAlias: (alias, options = {}) => ({ editor, dispatch, state: state2, tr }) => {
54393
+ const structuredContentTags = getStructuredContentTagsByAlias(alias, state2);
54394
+ if (!structuredContentTags.length) {
54395
+ return true;
54396
+ }
54397
+ const { schema } = editor;
54398
+ if (dispatch) {
54399
+ const structuredContent = structuredContentTags[0];
54400
+ const { pos, node } = structuredContent;
54401
+ const posFrom = pos;
54402
+ const posTo = pos + node.nodeSize;
54403
+ let content = null;
54404
+ if (options.text) {
54405
+ content = schema.text(options.text);
54406
+ }
54407
+ if (options.html) {
54408
+ const html = htmlHandler(options.html, editor);
54409
+ const doc2 = DOMParser$1.fromSchema(schema).parse(html);
54410
+ content = doc2.content;
54411
+ }
54412
+ if (options.json) {
54413
+ content = schema.nodeFromJSON(options.json);
54414
+ }
54415
+ if (!content) {
54416
+ content = node.content;
54417
+ }
54418
+ const updatedNode = node.type.create({ ...node.attrs, ...options.attrs }, content, node.marks);
54419
+ try {
54420
+ updatedNode.check();
54421
+ } catch {
54422
+ console.error("Updated node does not conform to the schema");
54423
+ return false;
54424
+ }
54425
+ tr.replaceWith(posFrom, posTo, updatedNode);
54426
+ }
54427
+ return true;
54428
+ },
54373
54429
  /**
54374
54430
  * Removes a structured content.
54375
54431
  * @category Command
@@ -54237,6 +54237,17 @@ function getStructuredContentTagsById(idOrIds, state2) {
54237
54237
  });
54238
54238
  return result;
54239
54239
  }
54240
+ function getStructuredContentTagsByAlias(aliasOrAliases, state2) {
54241
+ const result = findChildren$5(state2.doc, (node) => {
54242
+ const isStructuredContent = ["structuredContent", "structuredContentBlock"].includes(node.type.name);
54243
+ if (Array.isArray(aliasOrAliases)) {
54244
+ return isStructuredContent && aliasOrAliases.includes(node.attrs.alias);
54245
+ } else {
54246
+ return isStructuredContent && node.attrs.alias === aliasOrAliases;
54247
+ }
54248
+ });
54249
+ return result;
54250
+ }
54240
54251
  function getStructuredContentTags(state2) {
54241
54252
  const result = findChildren$5(state2.doc, (node) => {
54242
54253
  return node.type.name === "structuredContent" || node.type.name === "structuredContentBlock";
@@ -54256,6 +54267,7 @@ const structuredContentHelpers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ O
54256
54267
  getStructuredContentBlockTags,
54257
54268
  getStructuredContentInlineTags,
54258
54269
  getStructuredContentTags,
54270
+ getStructuredContentTagsByAlias,
54259
54271
  getStructuredContentTagsById
54260
54272
  }, Symbol.toStringTag, { value: "Module" }));
54261
54273
  const STRUCTURED_CONTENT_NAMES = ["structuredContent", "structuredContentBlock"];
@@ -54387,6 +54399,50 @@ const StructuredContentCommands = Extension.create({
54387
54399
  }
54388
54400
  return true;
54389
54401
  },
54402
+ /**
54403
+ * Updates a structured content attributes or content by alias.
54404
+ * If the updated node does not match the schema, it will not be updated.
54405
+ * @category Command
54406
+ * @param {string} alias
54407
+ * @param {StructuredContentUpdate} options
54408
+ */
54409
+ updateStructuredContentByAlias: (alias, options = {}) => ({ editor, dispatch, state: state2, tr }) => {
54410
+ const structuredContentTags = getStructuredContentTagsByAlias(alias, state2);
54411
+ if (!structuredContentTags.length) {
54412
+ return true;
54413
+ }
54414
+ const { schema } = editor;
54415
+ if (dispatch) {
54416
+ const structuredContent = structuredContentTags[0];
54417
+ const { pos, node } = structuredContent;
54418
+ const posFrom = pos;
54419
+ const posTo = pos + node.nodeSize;
54420
+ let content = null;
54421
+ if (options.text) {
54422
+ content = schema.text(options.text);
54423
+ }
54424
+ if (options.html) {
54425
+ const html = htmlHandler(options.html, editor);
54426
+ const doc2 = DOMParser$1.fromSchema(schema).parse(html);
54427
+ content = doc2.content;
54428
+ }
54429
+ if (options.json) {
54430
+ content = schema.nodeFromJSON(options.json);
54431
+ }
54432
+ if (!content) {
54433
+ content = node.content;
54434
+ }
54435
+ const updatedNode = node.type.create({ ...node.attrs, ...options.attrs }, content, node.marks);
54436
+ try {
54437
+ updatedNode.check();
54438
+ } catch {
54439
+ console.error("Updated node does not conform to the schema");
54440
+ return false;
54441
+ }
54442
+ tr.replaceWith(posFrom, posTo, updatedNode);
54443
+ }
54444
+ return true;
54445
+ },
54390
54446
  /**
54391
54447
  * Removes a structured content.
54392
54448
  * @category Command
@@ -5,6 +5,7 @@
5
5
  /** @typedef {import('./types').Editor} Editor */
6
6
  /** @typedef {import('./types').DocumentMode} DocumentMode */
7
7
  /** @typedef {import('./types').Config} Config */
8
+ /** @typedef {import('./types').ExportParams} ExportParams */
8
9
  /**
9
10
  * SuperDoc class
10
11
  * Expects a config object
@@ -194,25 +195,10 @@ export class SuperDoc extends EventEmitter<string | symbol, any> {
194
195
  lockSuperdoc(isLocked: boolean, lockedBy: User): void;
195
196
  /**
196
197
  * Export the superdoc to a file
197
- * @param {Object} params
198
- * @param {string[]} [params.exportType]
199
- * @param {string} [params.commentsType]
200
- * @param {string} [params.exportedName]
201
- * @param {Array} [params.additionalFiles]
202
- * @param {Array} [params.additionalFileNames]
203
- * @param {boolean} [params.isFinalDoc]
204
- * @param {boolean} [params.triggerDownload] Whether to trigger the download of the exported file
205
- * @returns {Promise<void | Blob>} Returns void if triggerDownload is false, otherwise returns the exported file
198
+ * @param {ExportParams} params - Export configuration
199
+ * @returns {Promise<void | Blob>}
206
200
  */
207
- export({ exportType, commentsType, exportedName, additionalFiles, additionalFileNames, isFinalDoc, triggerDownload, fieldsHighlightColor, }?: {
208
- exportType?: string[];
209
- commentsType?: string;
210
- exportedName?: string;
211
- additionalFiles?: any[];
212
- additionalFileNames?: any[];
213
- isFinalDoc?: boolean;
214
- triggerDownload?: boolean;
215
- }): Promise<void | Blob>;
201
+ export({ exportType, commentsType, exportedName, additionalFiles, additionalFileNames, isFinalDoc, triggerDownload, fieldsHighlightColor, }?: ExportParams): Promise<void | Blob>;
216
202
  /**
217
203
  * Export editors to DOCX format.
218
204
  * @param {{ commentsType?: string, isFinalDoc?: boolean }} [options]
@@ -253,6 +239,7 @@ export type Modules = any;
253
239
  export type Editor = any;
254
240
  export type DocumentMode = any;
255
241
  export type Config = any;
242
+ export type ExportParams = any;
256
243
  import { EventEmitter } from 'eventemitter3';
257
244
  import { Telemetry } from '@harbour-enterprises/common/Telemetry.js';
258
245
  import { SuperToolbar } from '@harbour-enterprises/super-editor';
@@ -1 +1 @@
1
- {"version":3,"file":"SuperDoc.d.ts","sourceRoot":"","sources":["../../src/core/SuperDoc.js"],"names":[],"mappings":"AAgBA,6CAA6C;AAC7C,mEAAmE;AACnE,qDAAqD;AACrD,mDAAmD;AACnD,iDAAiD;AACjD,6DAA6D;AAC7D,iDAAiD;AAEjD;;;;;;GAMG;AACH;IACE,4BAA4B;IAC5B,qBADW,KAAK,CAAC,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;;;;;;;;6BAx2B4B,eAAe;0BASlB,0CAA0C;6BAJ5B,mCAAmC;8BAC7C,iEAAiE"}
@@ -178,7 +178,35 @@ export type Editor = {
178
178
  removeAllListeners(): void;
179
179
  };
180
180
  export type SuperDoc = import("../SuperDoc.js").SuperDoc;
181
- export type DocumentMode = string;
181
+ export type DocumentMode = "editing" | "viewing" | "suggesting";
182
+ export type ExportType = "docx" | "pdf" | "html";
183
+ /**
184
+ * - 'external': Include only external comments (default)
185
+ * - 'clean': Export without any comments
186
+ */
187
+ export type CommentsType = "external" | "clean";
188
+ export type ExportParams = {
189
+ /**
190
+ * - File formats to export
191
+ */
192
+ exportType?: ExportType[];
193
+ /**
194
+ * - How to handle comments
195
+ */
196
+ commentsType?: CommentsType;
197
+ /**
198
+ * - Custom filename (without extension)
199
+ */
200
+ exportedName?: string;
201
+ /**
202
+ * - Auto-download or return blob
203
+ */
204
+ triggerDownload?: boolean;
205
+ /**
206
+ * - Color for field highlights
207
+ */
208
+ fieldsHighlightColor?: string;
209
+ };
182
210
  export type Config = {
183
211
  /**
184
212
  * The ID of the SuperDoc
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/types/index.js"],"names":[],"mappings":";;;;;;;UAEc,MAAM;;;;WACN,MAAM;;;;YACN,MAAM,GAAG,IAAI;;;;;;;;;cAKb,OAAO;;;;iBACP,MAAM;;;;eACN,MAAM;;;;sBACN,MAAM;;;;;;SAKN,MAAM;;;;UACN,MAAM;;;;WACN,IAAI,GAAG,IAAI,GAAG,IAAI;;;;WAClB,MAAM;;;;UACN,MAAM;;;;gBACN,OAAO;;;;WACP,OAAO,KAAK,EAAE,GAAG;;;;eACjB,OAAO,sBAAsB,EAAE,kBAAkB;;;;;;;;;;SAO5D;QAAuB,MAAM,GAAlB,MAAM;QACM,QAAQ,GAApB,MAAM;KACjB;;;;;;;;;;;;gBAGA;QAA6B,WAAW;QACR,YAAY;QACb,mBAAmB,GAAvC,OAAO;KAC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MAAM,CAAC;;;;eAC/B,IAAI;;;;aACJ,OAAO;;;;gCACP,OAAO;;;;;;;;yBAEP,OAAO;;;;WACP,MAAM;;;;eACN,MAAM;;;;cACN,OAAO"}
@@ -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-BVirrB35.js";
3
- import { _ as _export_sfc } from "./chunks/editor-DIINh50j.js";
3
+ import { _ as _export_sfc } from "./chunks/editor-CqnpAm6f.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 = {}) {
@@ -17357,6 +17357,17 @@ function getStructuredContentTagsById(idOrIds, state) {
17357
17357
  });
17358
17358
  return result;
17359
17359
  }
17360
+ function getStructuredContentTagsByAlias(aliasOrAliases, state) {
17361
+ const result = findChildren$5(state.doc, (node) => {
17362
+ const isStructuredContent = ["structuredContent", "structuredContentBlock"].includes(node.type.name);
17363
+ if (Array.isArray(aliasOrAliases)) {
17364
+ return isStructuredContent && aliasOrAliases.includes(node.attrs.alias);
17365
+ } else {
17366
+ return isStructuredContent && node.attrs.alias === aliasOrAliases;
17367
+ }
17368
+ });
17369
+ return result;
17370
+ }
17360
17371
  function getStructuredContentTags(state) {
17361
17372
  const result = findChildren$5(state.doc, (node) => {
17362
17373
  return node.type.name === "structuredContent" || node.type.name === "structuredContentBlock";
@@ -17376,6 +17387,7 @@ const structuredContentHelpers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ O
17376
17387
  getStructuredContentBlockTags,
17377
17388
  getStructuredContentInlineTags,
17378
17389
  getStructuredContentTags,
17390
+ getStructuredContentTagsByAlias,
17379
17391
  getStructuredContentTagsById
17380
17392
  }, Symbol.toStringTag, { value: "Module" }));
17381
17393
  const STRUCTURED_CONTENT_NAMES = ["structuredContent", "structuredContentBlock"];
@@ -17507,6 +17519,50 @@ const StructuredContentCommands = Extension.create({
17507
17519
  }
17508
17520
  return true;
17509
17521
  },
17522
+ /**
17523
+ * Updates a structured content attributes or content by alias.
17524
+ * If the updated node does not match the schema, it will not be updated.
17525
+ * @category Command
17526
+ * @param {string} alias
17527
+ * @param {StructuredContentUpdate} options
17528
+ */
17529
+ updateStructuredContentByAlias: (alias, options = {}) => ({ editor, dispatch, state, tr }) => {
17530
+ const structuredContentTags = getStructuredContentTagsByAlias(alias, state);
17531
+ if (!structuredContentTags.length) {
17532
+ return true;
17533
+ }
17534
+ const { schema } = editor;
17535
+ if (dispatch) {
17536
+ const structuredContent = structuredContentTags[0];
17537
+ const { pos, node } = structuredContent;
17538
+ const posFrom = pos;
17539
+ const posTo = pos + node.nodeSize;
17540
+ let content = null;
17541
+ if (options.text) {
17542
+ content = schema.text(options.text);
17543
+ }
17544
+ if (options.html) {
17545
+ const html = htmlHandler(options.html, editor);
17546
+ const doc2 = DOMParser$1.fromSchema(schema).parse(html);
17547
+ content = doc2.content;
17548
+ }
17549
+ if (options.json) {
17550
+ content = schema.nodeFromJSON(options.json);
17551
+ }
17552
+ if (!content) {
17553
+ content = node.content;
17554
+ }
17555
+ const updatedNode = node.type.create({ ...node.attrs, ...options.attrs }, content, node.marks);
17556
+ try {
17557
+ updatedNode.check();
17558
+ } catch {
17559
+ console.error("Updated node does not conform to the schema");
17560
+ return false;
17561
+ }
17562
+ tr.replaceWith(posFrom, posTo, updatedNode);
17563
+ }
17564
+ return true;
17565
+ },
17510
17566
  /**
17511
17567
  * Removes a structured content.
17512
17568
  * @category Command
@@ -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-BVirrB35.js";
3
- import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-DIINh50j.js";
3
+ import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-CqnpAm6f.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-DIINh50j.js";
1
+ import { E } from "./chunks/editor-CqnpAm6f.js";
2
2
  import "./chunks/converter-BVirrB35.js";
3
3
  import "./chunks/docx-zipper-Cpb9d2an.js";
4
4
  export {
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Gets structured content tags by alias in the state.
3
+ * @param {string | string[]} aliasOrAliases
4
+ * @param {EditorState} state Editor state.
5
+ * @returns {Array}
6
+ */
7
+ export function getStructuredContentTagsByAlias(aliasOrAliases: string | string[], state: EditorState): any[];
8
+ import { EditorState } from 'prosemirror-state';
@@ -2,3 +2,4 @@ export * from "./getStructuredContentTags";
2
2
  export * from "./getStructuredContentInlineTags";
3
3
  export * from "./getStructuredContentBlockTags";
4
4
  export * from "./getStructuredContentTagsById";
5
+ export * from "./getStructuredContentTagsByAlias";
@@ -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-BVirrB35.js";
13
13
  import { bJ, a5, i, a2 } from "./chunks/converter-BVirrB35.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-DIINh50j.js";
15
- import { n, C, o, T, l, p, m } from "./chunks/editor-DIINh50j.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-CqnpAm6f.js";
15
+ import { n, C, o, T, l, p, m } from "./chunks/editor-CqnpAm6f.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-CmDmkPHL.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-DnEbb4lv.js";
18
18
  import AIWriter from "./ai-writer.es.js";
19
19
  import { D } from "./chunks/docx-zipper-Cpb9d2an.js";
20
20
  import { createZip } from "./file-zipper.es.js";
@@ -1,6 +1,6 @@
1
1
  import "vue";
2
- import { T } from "./chunks/toolbar-CmDmkPHL.js";
3
- import "./chunks/editor-DIINh50j.js";
2
+ import { T } from "./chunks/toolbar-DnEbb4lv.js";
3
+ import "./chunks/editor-CqnpAm6f.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-C7stybby.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-wyeeDloA.cjs");
4
4
  require("./chunks/vue-DWle4Cai.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-DQnqUJZs.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-DRBPtyog.es.js";
2
2
  import "./chunks/vue-CXxsqYcP.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-C7stybby.cjs");
4
- const superdoc = require("./chunks/index-CdJOxoqt.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-wyeeDloA.cjs");
4
+ const superdoc = require("./chunks/index-BTv5rNmt.cjs");
5
5
  require("./chunks/vue-DWle4Cai.cjs");
6
6
  require("./chunks/jszip-b7l8QkfH.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-DQnqUJZs.es.js";
2
- import { D, H, P, S as S2, m, l } from "./chunks/index-OVF3JhUR.es.js";
1
+ import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-DRBPtyog.es.js";
2
+ import { D, H, P, S as S2, m, l } from "./chunks/index-DGxFKkbG.es.js";
3
3
  import "./chunks/vue-CXxsqYcP.es.js";
4
4
  import "./chunks/jszip-B8KIZSNe.es.js";
5
5
  import { B } from "./chunks/blank-docx-iwdyG9RH.es.js";
@@ -61935,6 +61935,17 @@ Please report this to https://github.com/markedjs/marked.`, e) {
61935
61935
  });
61936
61936
  return result;
61937
61937
  }
61938
+ function getStructuredContentTagsByAlias(aliasOrAliases, state2) {
61939
+ const result = findChildren$5(state2.doc, (node) => {
61940
+ const isStructuredContent = ["structuredContent", "structuredContentBlock"].includes(node.type.name);
61941
+ if (Array.isArray(aliasOrAliases)) {
61942
+ return isStructuredContent && aliasOrAliases.includes(node.attrs.alias);
61943
+ } else {
61944
+ return isStructuredContent && node.attrs.alias === aliasOrAliases;
61945
+ }
61946
+ });
61947
+ return result;
61948
+ }
61938
61949
  function getStructuredContentTags(state2) {
61939
61950
  const result = findChildren$5(state2.doc, (node) => {
61940
61951
  return node.type.name === "structuredContent" || node.type.name === "structuredContentBlock";
@@ -61954,6 +61965,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
61954
61965
  getStructuredContentBlockTags,
61955
61966
  getStructuredContentInlineTags,
61956
61967
  getStructuredContentTags,
61968
+ getStructuredContentTagsByAlias,
61957
61969
  getStructuredContentTagsById
61958
61970
  }, Symbol.toStringTag, { value: "Module" }));
61959
61971
  const STRUCTURED_CONTENT_NAMES = ["structuredContent", "structuredContentBlock"];
@@ -62085,6 +62097,50 @@ Please report this to https://github.com/markedjs/marked.`, e) {
62085
62097
  }
62086
62098
  return true;
62087
62099
  },
62100
+ /**
62101
+ * Updates a structured content attributes or content by alias.
62102
+ * If the updated node does not match the schema, it will not be updated.
62103
+ * @category Command
62104
+ * @param {string} alias
62105
+ * @param {StructuredContentUpdate} options
62106
+ */
62107
+ updateStructuredContentByAlias: (alias, options = {}) => ({ editor, dispatch, state: state2, tr }) => {
62108
+ const structuredContentTags = getStructuredContentTagsByAlias(alias, state2);
62109
+ if (!structuredContentTags.length) {
62110
+ return true;
62111
+ }
62112
+ const { schema } = editor;
62113
+ if (dispatch) {
62114
+ const structuredContent = structuredContentTags[0];
62115
+ const { pos, node } = structuredContent;
62116
+ const posFrom = pos;
62117
+ const posTo = pos + node.nodeSize;
62118
+ let content = null;
62119
+ if (options.text) {
62120
+ content = schema.text(options.text);
62121
+ }
62122
+ if (options.html) {
62123
+ const html = htmlHandler(options.html, editor);
62124
+ const doc2 = DOMParser$1.fromSchema(schema).parse(html);
62125
+ content = doc2.content;
62126
+ }
62127
+ if (options.json) {
62128
+ content = schema.nodeFromJSON(options.json);
62129
+ }
62130
+ if (!content) {
62131
+ content = node.content;
62132
+ }
62133
+ const updatedNode = node.type.create({ ...node.attrs, ...options.attrs }, content, node.marks);
62134
+ try {
62135
+ updatedNode.check();
62136
+ } catch {
62137
+ console.error("Updated node does not conform to the schema");
62138
+ return false;
62139
+ }
62140
+ tr.replaceWith(posFrom, posTo, updatedNode);
62141
+ }
62142
+ return true;
62143
+ },
62088
62144
  /**
62089
62145
  * Removes a structured content.
62090
62146
  * @category Command
@@ -112142,15 +112198,8 @@ ${style2}
112142
112198
  }
112143
112199
  /**
112144
112200
  * Export the superdoc to a file
112145
- * @param {Object} params
112146
- * @param {string[]} [params.exportType]
112147
- * @param {string} [params.commentsType]
112148
- * @param {string} [params.exportedName]
112149
- * @param {Array} [params.additionalFiles]
112150
- * @param {Array} [params.additionalFileNames]
112151
- * @param {boolean} [params.isFinalDoc]
112152
- * @param {boolean} [params.triggerDownload] Whether to trigger the download of the exported file
112153
- * @returns {Promise<void | Blob>} Returns void if triggerDownload is false, otherwise returns the exported file
112201
+ * @param {ExportParams} params - Export configuration
112202
+ * @returns {Promise<void | Blob>}
112154
112203
  */
112155
112204
  async export({
112156
112205
  exportType = ["docx"],