@harbour-enterprises/superdoc 1.6.0-next.2 → 1.6.0-next.3

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,6 +1,6 @@
1
1
  import { d as defineComponent, h, T as Transition, p as process$1, w as watchEffect, c as computed, r as ref, f as onMounted, X as onUnmounted, E as createElementBlock, G as openBlock, K as createBaseVNode, M as createCommentVNode, I as createVNode, v as unref } from "./vue-BnBKJwCW.es.js";
2
- import { N as NBaseLoading, u as useSuperdocStore, s as storeToRefs, a as useSelection } from "./index-ajHpG3f-.es.js";
3
- import { C as derived, r as c, q as cB, aF as fadeInTransition, y as cM, I as warnOnce, J as useConfig, N as useTheme, aG as pxfy, P as createKey, Q as useThemeClass, aH as useCompitable, ai as _export_sfc } from "./index-fbohTSaQ.es.js";
2
+ import { N as NBaseLoading, u as useSuperdocStore, s as storeToRefs, a as useSelection } from "./index-DEYAgfRu.es.js";
3
+ import { C as derived, r as c, q as cB, aF as fadeInTransition, y as cM, I as warnOnce, J as useConfig, N as useTheme, aG as pxfy, P as createKey, Q as useThemeClass, aH as useCompitable, ai as _export_sfc } from "./index-BB7PV6qA.es.js";
4
4
  function self(vars) {
5
5
  const {
6
6
  opacityDisabled,
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const vue = require("./vue-De9wkgLl.cjs");
4
- const superdoc = require("./index-CyiEB9wO.cjs");
5
- const index = require("./index-D-7HfDnq.cjs");
4
+ const superdoc = require("./index-CM_lykaH.cjs");
5
+ const index = require("./index-vSyQ2hF9.cjs");
6
6
  function self(vars) {
7
7
  const {
8
8
  opacityDisabled,
@@ -32669,7 +32669,7 @@ class SuperConverter {
32669
32669
  static getStoredSuperdocVersion(docx) {
32670
32670
  return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
32671
32671
  }
32672
- static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.6.0-next.2") {
32672
+ static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.6.0-next.3") {
32673
32673
  return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
32674
32674
  }
32675
32675
  /**
@@ -32670,7 +32670,7 @@ class SuperConverter {
32670
32670
  static getStoredSuperdocVersion(docx) {
32671
32671
  return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
32672
32672
  }
32673
- static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.6.0-next.2") {
32673
+ static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.6.0-next.3") {
32674
32674
  return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
32675
32675
  }
32676
32676
  /**
@@ -1,6 +1,6 @@
1
1
  import { B as Buffer$2 } from "./jszip-B1fkPkPJ.es.js";
2
2
  import { t as twipsToInches, i as inchesToTwips, p as ptToTwips, l as linesToTwips, a as twipsToLines, b as pixelsToTwips, h as halfPointToPoints, c as twipsToPixels$2, d as convertSizeToCSS, e as inchesToPixels } from "./helpers-C8e9wR5l.es.js";
3
- import { g as generateDocxRandomId, T as TextSelection$1, o as objectIncludes, w as wrapTextsInRuns, D as DOMParser$1, c as createDocFromMarkdown, a as createDocFromHTML, b as chainableEditorState, d as convertMarkdownToHTML, f as findParentNode, e as findParentNodeClosestToPos, h as generateRandom32BitHex, i as generateRandomSigned32BitIntStrId, P as PluginKey, j as Plugin, M as Mapping, N as NodeSelection, k as Selection, l as Slice, m as DOMSerializer, F as Fragment, n as Mark$1, p as dropPoint, A as AllSelection, q as Schema$1, s as canSplit, t as resolveRunProperties, u as encodeMarksFromRPr, v as liftTarget, x as canJoin, y as joinPoint, z as replaceStep$1, R as ReplaceAroundStep$1, B as htmlHandler, C as ReplaceStep, E as getResolvedParagraphProperties, G as changeListLevel, H as isList$1, I as updateNumberingProperties, L as ListHelpers, J as inputRulesPlugin, K as TrackDeleteMarkName$1, O as TrackInsertMarkName$1, Q as TrackFormatMarkName$1, U as AddMarkStep, V as RemoveMarkStep, W as CommandService, S as SuperConverter, X as EditorState, Y as unflattenListsInHtml, Z as SelectionRange, _ as Transform, $ as createOoxmlResolver, a0 as translator, a1 as translator$1, a2 as resolveDocxFontFamily, a3 as combineIndentProperties, a4 as _getReferencedTableStyles, a5 as decodeRPrFromMarks, a6 as calculateResolvedParagraphProperties, a7 as encodeCSSFromPPr, a8 as encodeCSSFromRPr, a9 as generateOrderedListIndex, aa as docxNumberingHelpers, ab as InputRule, ac as insertNewRelationship, ad as kebabCase$1, ae as getUnderlineCssString } from "./SuperConverter-BAUfsE-s.es.js";
3
+ import { g as generateDocxRandomId, T as TextSelection$1, o as objectIncludes, w as wrapTextsInRuns, D as DOMParser$1, c as createDocFromMarkdown, a as createDocFromHTML, b as chainableEditorState, d as convertMarkdownToHTML, f as findParentNode, e as findParentNodeClosestToPos, h as generateRandom32BitHex, i as generateRandomSigned32BitIntStrId, P as PluginKey, j as Plugin, M as Mapping, N as NodeSelection, k as Selection, l as Slice, m as DOMSerializer, F as Fragment, n as Mark$1, p as dropPoint, A as AllSelection, q as Schema$1, s as canSplit, t as resolveRunProperties, u as encodeMarksFromRPr, v as liftTarget, x as canJoin, y as joinPoint, z as replaceStep$1, R as ReplaceAroundStep$1, B as htmlHandler, C as ReplaceStep, E as getResolvedParagraphProperties, G as changeListLevel, H as isList$1, I as updateNumberingProperties, L as ListHelpers, J as inputRulesPlugin, K as TrackDeleteMarkName$1, O as TrackInsertMarkName$1, Q as TrackFormatMarkName$1, U as AddMarkStep, V as RemoveMarkStep, W as CommandService, S as SuperConverter, X as EditorState, Y as unflattenListsInHtml, Z as SelectionRange, _ as Transform, $ as createOoxmlResolver, a0 as translator, a1 as translator$1, a2 as resolveDocxFontFamily, a3 as combineIndentProperties, a4 as _getReferencedTableStyles, a5 as decodeRPrFromMarks, a6 as calculateResolvedParagraphProperties, a7 as encodeCSSFromPPr, a8 as encodeCSSFromRPr, a9 as generateOrderedListIndex, aa as docxNumberingHelpers, ab as InputRule, ac as insertNewRelationship, ad as kebabCase$1, ae as getUnderlineCssString } from "./SuperConverter-B4dnd1SO.es.js";
4
4
  import { p as process$1, r as ref, C as global$1, c as computed, E as createElementBlock, F as Fragment$1, S as renderList, O as withModifiers, G as openBlock, P as normalizeClass, M as createCommentVNode, H as toDisplayString, K as createBaseVNode, U as createApp, f as onMounted, X as onUnmounted, R as withDirectives, v as unref, Y as vModelText, y as nextTick, L as normalizeStyle, u as watch, Z as withKeys, _ as createTextVNode, I as createVNode, h as h$1, $ as readonly, s as getCurrentInstance, o as onBeforeUnmount, j as reactive, b as onBeforeMount, i as inject, a0 as onActivated, a1 as onDeactivated, a2 as Comment, d as defineComponent, a as provide, g as Teleport, t as toRef, a3 as renderSlot, a4 as isVNode, D as shallowRef, w as watchEffect, T as Transition, a5 as mergeProps, a6 as vShow, a7 as cloneVNode, a8 as Text$2, m as markRaw, N as createBlock, J as withCtx, a9 as useCssVars, V as resolveDynamicComponent, aa as normalizeProps, ab as guardReactiveProps } from "./vue-BnBKJwCW.es.js";
5
5
  import "./jszip.min-DCl8qkFO.es.js";
6
6
  import { E as EventEmitter$1 } from "./eventemitter3-CwrdEv8r.es.js";
@@ -13244,6 +13244,90 @@ const CommentsPlugin = Extension.create({
13244
13244
  name: "comments",
13245
13245
  addCommands() {
13246
13246
  return {
13247
+ /**
13248
+ * Add a comment to the current selection
13249
+ * @category Command
13250
+ * @param {string|Object} contentOrOptions - Comment content as a string, or an options object
13251
+ * @param {string} [contentOrOptions.content] - The comment content (text or HTML)
13252
+ * @param {string} [contentOrOptions.author] - Author name (defaults to user from editor config)
13253
+ * @param {string} [contentOrOptions.authorEmail] - Author email (defaults to user from editor config)
13254
+ * @param {string} [contentOrOptions.authorImage] - Author image URL (defaults to user from editor config)
13255
+ * @param {boolean} [contentOrOptions.isInternal=false] - Whether the comment is internal/private
13256
+ * @returns {boolean} True if the comment was added successfully, false otherwise
13257
+ * @example
13258
+ * // Simple usage with just content
13259
+ * editor.commands.addComment('This needs review')
13260
+ *
13261
+ * // With options
13262
+ * editor.commands.addComment({
13263
+ * content: 'Please clarify this section',
13264
+ * author: 'Jane Doe',
13265
+ * isInternal: true
13266
+ * })
13267
+ *
13268
+ * // To get the comment ID, listen to the commentsUpdate event
13269
+ * editor.on('commentsUpdate', (event) => {
13270
+ * if (event.type === 'add') {
13271
+ * console.log('New comment ID:', event.activeCommentId)
13272
+ * }
13273
+ * })
13274
+ */
13275
+ addComment: (contentOrOptions) => ({ tr, dispatch, editor }) => {
13276
+ const { selection } = tr;
13277
+ const { $from, $to } = selection;
13278
+ if ($from.pos === $to.pos) {
13279
+ console.warn("addComment requires a text selection. Please select text before adding a comment.");
13280
+ return false;
13281
+ }
13282
+ let content, author, authorEmail, authorImage, isInternal;
13283
+ if (typeof contentOrOptions === "string") {
13284
+ content = contentOrOptions;
13285
+ } else if (contentOrOptions && typeof contentOrOptions === "object") {
13286
+ content = contentOrOptions.content;
13287
+ author = contentOrOptions.author;
13288
+ authorEmail = contentOrOptions.authorEmail;
13289
+ authorImage = contentOrOptions.authorImage;
13290
+ isInternal = contentOrOptions.isInternal;
13291
+ }
13292
+ const commentId = v4();
13293
+ const resolvedInternal = isInternal ?? false;
13294
+ const configUser = editor.options?.user || {};
13295
+ tr.setMeta(CommentsPluginKey, { event: "add" });
13296
+ tr.addMark(
13297
+ $from.pos,
13298
+ $to.pos,
13299
+ editor.schema.marks[CommentMarkName$1].create({
13300
+ commentId,
13301
+ internal: resolvedInternal
13302
+ })
13303
+ );
13304
+ if (dispatch) dispatch(tr);
13305
+ const commentPayload = normalizeCommentEventPayload({
13306
+ conversation: {
13307
+ commentId,
13308
+ isInternal: resolvedInternal,
13309
+ commentText: content,
13310
+ creatorName: author ?? configUser.name,
13311
+ creatorEmail: authorEmail ?? configUser.email,
13312
+ creatorImage: authorImage ?? configUser.image,
13313
+ createdTime: Date.now()
13314
+ },
13315
+ editorOptions: editor.options,
13316
+ fallbackCommentId: commentId,
13317
+ fallbackInternal: resolvedInternal
13318
+ });
13319
+ editor.emit("commentsUpdate", {
13320
+ type: comments_module_events.ADD,
13321
+ comment: commentPayload,
13322
+ activeCommentId: commentId
13323
+ });
13324
+ return true;
13325
+ },
13326
+ /**
13327
+ * @private
13328
+ * Internal command to insert a comment mark at the current selection.
13329
+ * Use `addComment` for the public API.
13330
+ */
13247
13331
  insertComment: (conversation = {}) => ({ tr, dispatch }) => {
13248
13332
  const { selection } = tr;
13249
13333
  const { $from, $to } = selection;
@@ -15687,7 +15771,7 @@ const canUseDOM = () => {
15687
15771
  return false;
15688
15772
  }
15689
15773
  };
15690
- const summaryVersion = "1.6.0-next.2";
15774
+ const summaryVersion = "1.6.0-next.3";
15691
15775
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
15692
15776
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
15693
15777
  function mapAttributes(attrs) {
@@ -18354,7 +18438,7 @@ class Editor extends EventEmitter {
18354
18438
  * Process collaboration migrations
18355
18439
  */
18356
18440
  processCollaborationMigrations() {
18357
- console.debug("[checkVersionMigrations] Current editor version", "1.6.0-next.2");
18441
+ console.debug("[checkVersionMigrations] Current editor version", "1.6.0-next.3");
18358
18442
  if (!this.options.ydoc) return;
18359
18443
  const metaMap = this.options.ydoc.getMap("meta");
18360
18444
  let docVersion = metaMap.get("version");
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
- const index = require("./index-D-7HfDnq.cjs");
3
- require("./SuperConverter-DrhNM5Cd.cjs");
2
+ const index = require("./index-vSyQ2hF9.cjs");
3
+ require("./SuperConverter-UL6mfKlt.cjs");
4
4
  const blankDocx = require("./blank-docx-DfW3Eeh2.cjs");
5
5
  const eventemitter3 = require("./eventemitter3-BQuRcMPI.cjs");
6
6
  const provider = require("@hocuspocus/provider");
@@ -7530,7 +7530,7 @@ const _sfc_main = {
7530
7530
  __name: "SuperDoc",
7531
7531
  emits: ["selection-update"],
7532
7532
  setup(__props, { emit: __emit }) {
7533
- const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-D_YseVgi.cjs")));
7533
+ const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-Dy4TDA_a.cjs")));
7534
7534
  const superdocStore = useSuperdocStore();
7535
7535
  const commentsStore = useCommentsStore();
7536
7536
  const {
@@ -8484,7 +8484,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
8484
8484
  this.config.colors = shuffleArray(this.config.colors);
8485
8485
  this.userColorMap = /* @__PURE__ */ new Map();
8486
8486
  this.colorIndex = 0;
8487
- this.version = "1.6.0-next.2";
8487
+ this.version = "1.6.0-next.3";
8488
8488
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
8489
8489
  this.superdocId = config.superdocId || uuid.v4();
8490
8490
  this.colors = this.config.colors;
@@ -1,5 +1,5 @@
1
- import { B as BIT8, M as MAX_SAFE_INTEGER, c as create, a as BITS7, u as utf8TextDecoder, b as create$1, s as setIfUndefined, d as create$2, f as from, e as floor$1, g as equalityDeep, w as writeVarUint, h as writeVarString, t as toUint8Array, i as createEncoder, j as createInjectionKey, k as toString, l as throwError, m as useSsrAdapter, n as configProviderInjectionKey, o as cssrAnchorMetaName, p as globalStyle, q as cB, r as c, v as isMounted, x as commonVariables$2, y as cM, z as cNotM, A as cE, C as derived, D as changeColor, E as insideModal, F as insidePopover, G as resolveWrappedSlot, H as on, I as warnOnce, J as useConfig, K as useMergedState, L as useMemo, N as useTheme, O as useRtl, P as createKey, Q as useThemeClass, R as createId, S as call, T as render, U as messageProviderInjectionKey, V as messageApiInjectionKey, W as fromBase64, X as onChange, Y as varStorage, Z as toBase64, _ as createUint8ArrayFromArrayBuffer, $ as offChange, a0 as writeVarUint8Array, a1 as map, a2 as length, a3 as isNode, a4 as min, a5 as pow, a6 as comments_module_events, a7 as getFileObject, a8 as getTrackChanges, a9 as CommentsPluginKey, aa as TrackChangesBasePluginKey, ab as Editor, ac as getRichTextExtensions, ad as ellipsisVerticalSvg, ae as xmarkIconSvg, af as checkIconSvg, ag as caretDownIconSvg, ah as commentIconSvg, ai as _export_sfc, aj as NDropdown, ak as SuperInput, al as vClickOutside, am as PresentationEditor, an as SuperEditor, ao as AIWriter, ap as NConfigProvider, aq as SuperToolbar } from "./index-fbohTSaQ.es.js";
2
- import "./SuperConverter-BAUfsE-s.es.js";
1
+ import { B as BIT8, M as MAX_SAFE_INTEGER, c as create, a as BITS7, u as utf8TextDecoder, b as create$1, s as setIfUndefined, d as create$2, f as from, e as floor$1, g as equalityDeep, w as writeVarUint, h as writeVarString, t as toUint8Array, i as createEncoder, j as createInjectionKey, k as toString, l as throwError, m as useSsrAdapter, n as configProviderInjectionKey, o as cssrAnchorMetaName, p as globalStyle, q as cB, r as c, v as isMounted, x as commonVariables$2, y as cM, z as cNotM, A as cE, C as derived, D as changeColor, E as insideModal, F as insidePopover, G as resolveWrappedSlot, H as on, I as warnOnce, J as useConfig, K as useMergedState, L as useMemo, N as useTheme, O as useRtl, P as createKey, Q as useThemeClass, R as createId, S as call, T as render, U as messageProviderInjectionKey, V as messageApiInjectionKey, W as fromBase64, X as onChange, Y as varStorage, Z as toBase64, _ as createUint8ArrayFromArrayBuffer, $ as offChange, a0 as writeVarUint8Array, a1 as map, a2 as length, a3 as isNode, a4 as min, a5 as pow, a6 as comments_module_events, a7 as getFileObject, a8 as getTrackChanges, a9 as CommentsPluginKey, aa as TrackChangesBasePluginKey, ab as Editor, ac as getRichTextExtensions, ad as ellipsisVerticalSvg, ae as xmarkIconSvg, af as checkIconSvg, ag as caretDownIconSvg, ah as commentIconSvg, ai as _export_sfc, aj as NDropdown, ak as SuperInput, al as vClickOutside, am as PresentationEditor, an as SuperEditor, ao as AIWriter, ap as NConfigProvider, aq as SuperToolbar } from "./index-BB7PV6qA.es.js";
2
+ import "./SuperConverter-B4dnd1SO.es.js";
3
3
  import { B as BlankDOCX } from "./blank-docx-ABm6XYAA.es.js";
4
4
  import { E as EventEmitter } from "./eventemitter3-CwrdEv8r.es.js";
5
5
  import { HocuspocusProvider, HocuspocusProviderWebsocket } from "@hocuspocus/provider";
@@ -7513,7 +7513,7 @@ const _sfc_main = {
7513
7513
  __name: "SuperDoc",
7514
7514
  emits: ["selection-update"],
7515
7515
  setup(__props, { emit: __emit }) {
7516
- const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-Djd4zd7C.es.js"));
7516
+ const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-DpUAoC7K.es.js"));
7517
7517
  const superdocStore = useSuperdocStore();
7518
7518
  const commentsStore = useCommentsStore();
7519
7519
  const {
@@ -8467,7 +8467,7 @@ class SuperDoc extends EventEmitter {
8467
8467
  this.config.colors = shuffleArray(this.config.colors);
8468
8468
  this.userColorMap = /* @__PURE__ */ new Map();
8469
8469
  this.colorIndex = 0;
8470
- this.version = "1.6.0-next.2";
8470
+ this.version = "1.6.0-next.3";
8471
8471
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
8472
8472
  this.superdocId = config.superdocId || v4();
8473
8473
  this.colors = this.config.colors;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  const jszip = require("./jszip-C8_CqJxM.cjs");
3
3
  const helpers$1 = require("./helpers-nOdwpmwb.cjs");
4
- const superEditor_converter = require("./SuperConverter-DrhNM5Cd.cjs");
4
+ const superEditor_converter = require("./SuperConverter-UL6mfKlt.cjs");
5
5
  const vue = require("./vue-De9wkgLl.cjs");
6
6
  require("./jszip.min-BPh2MMAa.cjs");
7
7
  const eventemitter3 = require("./eventemitter3-BQuRcMPI.cjs");
@@ -13261,6 +13261,90 @@ const CommentsPlugin = Extension.create({
13261
13261
  name: "comments",
13262
13262
  addCommands() {
13263
13263
  return {
13264
+ /**
13265
+ * Add a comment to the current selection
13266
+ * @category Command
13267
+ * @param {string|Object} contentOrOptions - Comment content as a string, or an options object
13268
+ * @param {string} [contentOrOptions.content] - The comment content (text or HTML)
13269
+ * @param {string} [contentOrOptions.author] - Author name (defaults to user from editor config)
13270
+ * @param {string} [contentOrOptions.authorEmail] - Author email (defaults to user from editor config)
13271
+ * @param {string} [contentOrOptions.authorImage] - Author image URL (defaults to user from editor config)
13272
+ * @param {boolean} [contentOrOptions.isInternal=false] - Whether the comment is internal/private
13273
+ * @returns {boolean} True if the comment was added successfully, false otherwise
13274
+ * @example
13275
+ * // Simple usage with just content
13276
+ * editor.commands.addComment('This needs review')
13277
+ *
13278
+ * // With options
13279
+ * editor.commands.addComment({
13280
+ * content: 'Please clarify this section',
13281
+ * author: 'Jane Doe',
13282
+ * isInternal: true
13283
+ * })
13284
+ *
13285
+ * // To get the comment ID, listen to the commentsUpdate event
13286
+ * editor.on('commentsUpdate', (event) => {
13287
+ * if (event.type === 'add') {
13288
+ * console.log('New comment ID:', event.activeCommentId)
13289
+ * }
13290
+ * })
13291
+ */
13292
+ addComment: (contentOrOptions) => ({ tr, dispatch, editor }) => {
13293
+ const { selection } = tr;
13294
+ const { $from, $to } = selection;
13295
+ if ($from.pos === $to.pos) {
13296
+ console.warn("addComment requires a text selection. Please select text before adding a comment.");
13297
+ return false;
13298
+ }
13299
+ let content, author, authorEmail, authorImage, isInternal;
13300
+ if (typeof contentOrOptions === "string") {
13301
+ content = contentOrOptions;
13302
+ } else if (contentOrOptions && typeof contentOrOptions === "object") {
13303
+ content = contentOrOptions.content;
13304
+ author = contentOrOptions.author;
13305
+ authorEmail = contentOrOptions.authorEmail;
13306
+ authorImage = contentOrOptions.authorImage;
13307
+ isInternal = contentOrOptions.isInternal;
13308
+ }
13309
+ const commentId = uuid.v4();
13310
+ const resolvedInternal = isInternal ?? false;
13311
+ const configUser = editor.options?.user || {};
13312
+ tr.setMeta(CommentsPluginKey, { event: "add" });
13313
+ tr.addMark(
13314
+ $from.pos,
13315
+ $to.pos,
13316
+ editor.schema.marks[CommentMarkName$1].create({
13317
+ commentId,
13318
+ internal: resolvedInternal
13319
+ })
13320
+ );
13321
+ if (dispatch) dispatch(tr);
13322
+ const commentPayload = normalizeCommentEventPayload({
13323
+ conversation: {
13324
+ commentId,
13325
+ isInternal: resolvedInternal,
13326
+ commentText: content,
13327
+ creatorName: author ?? configUser.name,
13328
+ creatorEmail: authorEmail ?? configUser.email,
13329
+ creatorImage: authorImage ?? configUser.image,
13330
+ createdTime: Date.now()
13331
+ },
13332
+ editorOptions: editor.options,
13333
+ fallbackCommentId: commentId,
13334
+ fallbackInternal: resolvedInternal
13335
+ });
13336
+ editor.emit("commentsUpdate", {
13337
+ type: comments_module_events.ADD,
13338
+ comment: commentPayload,
13339
+ activeCommentId: commentId
13340
+ });
13341
+ return true;
13342
+ },
13343
+ /**
13344
+ * @private
13345
+ * Internal command to insert a comment mark at the current selection.
13346
+ * Use `addComment` for the public API.
13347
+ */
13264
13348
  insertComment: (conversation = {}) => ({ tr, dispatch }) => {
13265
13349
  const { selection } = tr;
13266
13350
  const { $from, $to } = selection;
@@ -15704,7 +15788,7 @@ const canUseDOM = () => {
15704
15788
  return false;
15705
15789
  }
15706
15790
  };
15707
- const summaryVersion = "1.6.0-next.2";
15791
+ const summaryVersion = "1.6.0-next.3";
15708
15792
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
15709
15793
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
15710
15794
  function mapAttributes(attrs) {
@@ -18371,7 +18455,7 @@ class Editor extends EventEmitter {
18371
18455
  * Process collaboration migrations
18372
18456
  */
18373
18457
  processCollaborationMigrations() {
18374
- console.debug("[checkVersionMigrations] Current editor version", "1.6.0-next.2");
18458
+ console.debug("[checkVersionMigrations] Current editor version", "1.6.0-next.3");
18375
18459
  if (!this.options.ydoc) return;
18376
18460
  const metaMap = this.options.ydoc.getMap("meta");
18377
18461
  let docVersion = metaMap.get("version");
@@ -2,6 +2,6 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  require("../chunks/jszip-C8_CqJxM.cjs");
4
4
  require("../chunks/helpers-nOdwpmwb.cjs");
5
- const superEditor_converter = require("../chunks/SuperConverter-DrhNM5Cd.cjs");
5
+ const superEditor_converter = require("../chunks/SuperConverter-UL6mfKlt.cjs");
6
6
  require("../chunks/uuid-R7L08bOx.cjs");
7
7
  exports.SuperConverter = superEditor_converter.SuperConverter;
@@ -1,6 +1,6 @@
1
1
  import "../chunks/jszip-B1fkPkPJ.es.js";
2
2
  import "../chunks/helpers-C8e9wR5l.es.js";
3
- import { S } from "../chunks/SuperConverter-BAUfsE-s.es.js";
3
+ import { S } from "../chunks/SuperConverter-B4dnd1SO.es.js";
4
4
  import "../chunks/uuid-CjlX8hrF.es.js";
5
5
  export {
6
6
  S as SuperConverter
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./chunks/index-D-7HfDnq.cjs");
3
+ const index = require("./chunks/index-vSyQ2hF9.cjs");
4
4
  const superEditor_docxZipper = require("./super-editor/docx-zipper.cjs");
5
5
  const superEditor_fileZipper = require("./super-editor/file-zipper.cjs");
6
6
  const vue = require("./chunks/vue-De9wkgLl.cjs");
7
- const superEditor_converter = require("./chunks/SuperConverter-DrhNM5Cd.cjs");
7
+ const superEditor_converter = require("./chunks/SuperConverter-UL6mfKlt.cjs");
8
8
  function isNodeType(node, name) {
9
9
  return node.type.name === name;
10
10
  }
@@ -1,9 +1,9 @@
1
- import { ax as Node, ay as Mark } from "./chunks/index-fbohTSaQ.es.js";
2
- import { ao, au, a9, ab, aw, am, av, aA, an, ak, aq, az, aa, as, aC, aE, aB, ac, aD, ar, at } from "./chunks/index-fbohTSaQ.es.js";
1
+ import { ax as Node, ay as Mark } from "./chunks/index-BB7PV6qA.es.js";
2
+ import { ao, au, a9, ab, aw, am, av, aA, an, ak, aq, az, aa, as, aC, aE, aB, ac, aD, ar, at } from "./chunks/index-BB7PV6qA.es.js";
3
3
  import { default as default2 } from "./super-editor/docx-zipper.es.js";
4
4
  import { createZip } from "./super-editor/file-zipper.es.js";
5
5
  import { d as defineComponent, E as createElementBlock, G as openBlock, K as createBaseVNode } from "./chunks/vue-BnBKJwCW.es.js";
6
- import { S, r } from "./chunks/SuperConverter-BAUfsE-s.es.js";
6
+ import { S, r } from "./chunks/SuperConverter-B4dnd1SO.es.js";
7
7
  function isNodeType(node, name) {
8
8
  return node.type.name === name;
9
9
  }
package/dist/superdoc.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./chunks/index-D-7HfDnq.cjs");
4
- const superdoc = require("./chunks/index-CyiEB9wO.cjs");
5
- const superEditor_converter = require("./chunks/SuperConverter-DrhNM5Cd.cjs");
3
+ const index = require("./chunks/index-vSyQ2hF9.cjs");
4
+ const superdoc = require("./chunks/index-CM_lykaH.cjs");
5
+ const superEditor_converter = require("./chunks/SuperConverter-UL6mfKlt.cjs");
6
6
  const blankDocx = require("./chunks/blank-docx-DfW3Eeh2.cjs");
7
7
  require("./chunks/jszip-C8_CqJxM.cjs");
8
8
  require("./chunks/helpers-nOdwpmwb.cjs");
@@ -1,6 +1,6 @@
1
- import { au, ab, aw, av, as, a7, ac, ar, at } from "./chunks/index-fbohTSaQ.es.js";
2
- import { D, H, P, S, c } from "./chunks/index-ajHpG3f-.es.js";
3
- import { S as S2, r } from "./chunks/SuperConverter-BAUfsE-s.es.js";
1
+ import { au, ab, aw, av, as, a7, ac, ar, at } from "./chunks/index-BB7PV6qA.es.js";
2
+ import { D, H, P, S, c } from "./chunks/index-DEYAgfRu.es.js";
3
+ import { S as S2, r } from "./chunks/SuperConverter-B4dnd1SO.es.js";
4
4
  import { B } from "./chunks/blank-docx-ABm6XYAA.es.js";
5
5
  import "./chunks/jszip-B1fkPkPJ.es.js";
6
6
  import "./chunks/helpers-C8e9wR5l.es.js";
@@ -38097,7 +38097,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
38097
38097
  static getStoredSuperdocVersion(docx) {
38098
38098
  return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
38099
38099
  }
38100
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.6.0-next.2") {
38100
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.6.0-next.3") {
38101
38101
  return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
38102
38102
  }
38103
38103
  /**
@@ -51265,6 +51265,90 @@ Please report this to https://github.com/markedjs/marked.`, e) {
51265
51265
  name: "comments",
51266
51266
  addCommands() {
51267
51267
  return {
51268
+ /**
51269
+ * Add a comment to the current selection
51270
+ * @category Command
51271
+ * @param {string|Object} contentOrOptions - Comment content as a string, or an options object
51272
+ * @param {string} [contentOrOptions.content] - The comment content (text or HTML)
51273
+ * @param {string} [contentOrOptions.author] - Author name (defaults to user from editor config)
51274
+ * @param {string} [contentOrOptions.authorEmail] - Author email (defaults to user from editor config)
51275
+ * @param {string} [contentOrOptions.authorImage] - Author image URL (defaults to user from editor config)
51276
+ * @param {boolean} [contentOrOptions.isInternal=false] - Whether the comment is internal/private
51277
+ * @returns {boolean} True if the comment was added successfully, false otherwise
51278
+ * @example
51279
+ * // Simple usage with just content
51280
+ * editor.commands.addComment('This needs review')
51281
+ *
51282
+ * // With options
51283
+ * editor.commands.addComment({
51284
+ * content: 'Please clarify this section',
51285
+ * author: 'Jane Doe',
51286
+ * isInternal: true
51287
+ * })
51288
+ *
51289
+ * // To get the comment ID, listen to the commentsUpdate event
51290
+ * editor.on('commentsUpdate', (event) => {
51291
+ * if (event.type === 'add') {
51292
+ * console.log('New comment ID:', event.activeCommentId)
51293
+ * }
51294
+ * })
51295
+ */
51296
+ addComment: (contentOrOptions) => ({ tr, dispatch, editor }) => {
51297
+ const { selection } = tr;
51298
+ const { $from, $to } = selection;
51299
+ if ($from.pos === $to.pos) {
51300
+ console.warn("addComment requires a text selection. Please select text before adding a comment.");
51301
+ return false;
51302
+ }
51303
+ let content2, author, authorEmail, authorImage, isInternal;
51304
+ if (typeof contentOrOptions === "string") {
51305
+ content2 = contentOrOptions;
51306
+ } else if (contentOrOptions && typeof contentOrOptions === "object") {
51307
+ content2 = contentOrOptions.content;
51308
+ author = contentOrOptions.author;
51309
+ authorEmail = contentOrOptions.authorEmail;
51310
+ authorImage = contentOrOptions.authorImage;
51311
+ isInternal = contentOrOptions.isInternal;
51312
+ }
51313
+ const commentId = v4();
51314
+ const resolvedInternal = isInternal ?? false;
51315
+ const configUser = editor.options?.user || {};
51316
+ tr.setMeta(CommentsPluginKey, { event: "add" });
51317
+ tr.addMark(
51318
+ $from.pos,
51319
+ $to.pos,
51320
+ editor.schema.marks[CommentMarkName$1].create({
51321
+ commentId,
51322
+ internal: resolvedInternal
51323
+ })
51324
+ );
51325
+ if (dispatch) dispatch(tr);
51326
+ const commentPayload = normalizeCommentEventPayload({
51327
+ conversation: {
51328
+ commentId,
51329
+ isInternal: resolvedInternal,
51330
+ commentText: content2,
51331
+ creatorName: author ?? configUser.name,
51332
+ creatorEmail: authorEmail ?? configUser.email,
51333
+ creatorImage: authorImage ?? configUser.image,
51334
+ createdTime: Date.now()
51335
+ },
51336
+ editorOptions: editor.options,
51337
+ fallbackCommentId: commentId,
51338
+ fallbackInternal: resolvedInternal
51339
+ });
51340
+ editor.emit("commentsUpdate", {
51341
+ type: comments_module_events.ADD,
51342
+ comment: commentPayload,
51343
+ activeCommentId: commentId
51344
+ });
51345
+ return true;
51346
+ },
51347
+ /**
51348
+ * @private
51349
+ * Internal command to insert a comment mark at the current selection.
51350
+ * Use `addComment` for the public API.
51351
+ */
51268
51352
  insertComment: (conversation = {}) => ({ tr, dispatch }) => {
51269
51353
  const { selection } = tr;
51270
51354
  const { $from, $to } = selection;
@@ -64183,7 +64267,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64183
64267
  return false;
64184
64268
  }
64185
64269
  };
64186
- const summaryVersion = "1.6.0-next.2";
64270
+ const summaryVersion = "1.6.0-next.3";
64187
64271
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
64188
64272
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
64189
64273
  function mapAttributes(attrs) {
@@ -66851,7 +66935,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
66851
66935
  * Process collaboration migrations
66852
66936
  */
66853
66937
  processCollaborationMigrations() {
66854
- console.debug("[checkVersionMigrations] Current editor version", "1.6.0-next.2");
66938
+ console.debug("[checkVersionMigrations] Current editor version", "1.6.0-next.3");
66855
66939
  if (!this.options.ydoc) return;
66856
66940
  const metaMap = this.options.ydoc.getMap("meta");
66857
66941
  let docVersion = metaMap.get("version");
@@ -150269,7 +150353,7 @@ ${reason}`);
150269
150353
  this.config.colors = shuffleArray(this.config.colors);
150270
150354
  this.userColorMap = /* @__PURE__ */ new Map();
150271
150355
  this.colorIndex = 0;
150272
- this.version = "1.6.0-next.2";
150356
+ this.version = "1.6.0-next.3";
150273
150357
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
150274
150358
  this.superdocId = config2.superdocId || v4();
150275
150359
  this.colors = this.config.colors;