superdoc 0.34.9 → 0.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/chunks/{PdfViewer-C2rB3UFf.es.js → PdfViewer-CRDOUMbZ.es.js} +1 -1
  2. package/dist/chunks/{PdfViewer-DE24U_pv.cjs → PdfViewer-Dky_6waU.cjs} +1 -1
  3. package/dist/chunks/{index-CHtB4uAl-D-zQo-Zr.cjs → index-Bqh6Mowj-Dh0tnahT.cjs} +1 -1
  4. package/dist/chunks/{index-CHtB4uAl-BS8u99OE.es.js → index-Bqh6Mowj-jTsSenoz.es.js} +1 -1
  5. package/dist/chunks/{index-myYbO6wO.cjs → index-DV1fybAb.cjs} +46 -5
  6. package/dist/chunks/{index-tHw-DC34.es.js → index-DuDHnypH.es.js} +46 -5
  7. package/dist/chunks/{super-editor.es-Cs1TKdep.cjs → super-editor.es-Bgv1UKa4.cjs} +32 -8
  8. package/dist/chunks/{super-editor.es-C8J_Vybd.es.js → super-editor.es-PZocCf8E.es.js} +32 -8
  9. package/dist/packages/superdoc/src/composables/use-document.d.ts.map +1 -1
  10. package/dist/packages/superdoc/src/core/SuperDoc.d.ts.map +1 -1
  11. package/dist/packages/superdoc/src/core/collaboration/collaboration.d.ts +11 -0
  12. package/dist/packages/superdoc/src/core/collaboration/collaboration.d.ts.map +1 -1
  13. package/dist/packages/superdoc/src/core/types/index.d.ts +64 -1
  14. package/dist/packages/superdoc/src/core/types/index.d.ts.map +1 -1
  15. package/dist/style.css +6 -6
  16. package/dist/super-editor/ai-writer.es.js +2 -2
  17. package/dist/super-editor/chunks/{converter-9FsB3Hi4.js → converter-DSvlTZFv.js} +1 -1
  18. package/dist/super-editor/chunks/{docx-zipper-C_3Ejzf5.js → docx-zipper-t0kg81zK.js} +1 -1
  19. package/dist/super-editor/chunks/{editor-BMv3Pr_v.js → editor-CAnFQ1yt.js} +10 -4
  20. package/dist/super-editor/chunks/{index-CHtB4uAl.js → index-Bqh6Mowj.js} +1 -1
  21. package/dist/super-editor/chunks/{toolbar-B9ZfgQpl.js → toolbar-BMXKBmbt.js} +2 -2
  22. package/dist/super-editor/converter.es.js +1 -1
  23. package/dist/super-editor/docx-zipper.es.js +2 -2
  24. package/dist/super-editor/editor.es.js +3 -3
  25. package/dist/super-editor/file-zipper.es.js +1 -1
  26. package/dist/super-editor/style.css +6 -6
  27. package/dist/super-editor/super-editor/src/core/commands/deleteSelection.d.ts.map +1 -1
  28. package/dist/super-editor/super-editor/src/extensions/track-changes/permission-helpers.d.ts.map +1 -1
  29. package/dist/super-editor/super-editor.es.js +29 -11
  30. package/dist/super-editor/toolbar.es.js +2 -2
  31. package/dist/super-editor.cjs +1 -1
  32. package/dist/super-editor.es.js +1 -1
  33. package/dist/superdoc.cjs +2 -2
  34. package/dist/superdoc.es.js +2 -2
  35. package/dist/superdoc.umd.js +77 -12
  36. package/dist/superdoc.umd.js.map +1 -1
  37. package/package.json +1 -1
@@ -12,8 +12,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
12
12
  var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, checkFonts_fn, determineUnsupportedFonts_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, initPagination_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _DocumentSectionView_instances, init_fn2, addToolTip_fn, _ListItemNodeView_instances, init_fn3, applyIndentStyling_fn, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn;
13
13
  import * as Y from "yjs";
14
14
  import { UndoManager, Item as Item$1, ContentType, Text as Text$1, XmlElement, encodeStateAsUpdate } from "yjs";
15
- import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as ReplaceStep, E as NodeRange, G as findWrapping, L as ListHelpers, H as findParentNode, I as isMacOS, J as isIOS, K as getSchemaTypeByName, O as inputRulesPlugin, Q as TrackDeleteMarkName, U as TrackInsertMarkName, V as v4, W as TrackFormatMarkName, X as comments_module_events, Y as findMark, Z as objectIncludes, _ as AddMarkStep, $ as RemoveMarkStep, a0 as twipsToLines, a1 as pixelsToTwips, a2 as helpers, a3 as posToDOMRect, a4 as CommandService, a5 as SuperConverter, a6 as createDocument, a7 as createDocFromMarkdown, a8 as createDocFromHTML, a9 as EditorState, aa as hasSomeParentWithClass, ab as isActive, ac as unflattenListsInHtml, ad as parseSizeUnit, ae as minMax, af as getLineHeightValueString, ag as updateDOMAttributes, ah as findChildren$5, ai as htmlHandler, aj as generateRandomSigned32BitIntStrId, ak as InputRule, al as kebabCase, am as findParentNodeClosestToPos, an as getListItemStyleDefinitions, ao as docxNumberingHelpers, ap as parseIndentElement, aq as combineIndents, ar as twipsToPixels, as as PIXELS_PER_INCH, at as SelectionRange, au as Transform, av as isInTable$1, aw as generateDocxRandomId, ax as insertNewRelationship, ay as inchesToPixels } from "./converter-9FsB3Hi4.js";
16
- import { D as DocxZipper } from "./docx-zipper-C_3Ejzf5.js";
15
+ import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as ReplaceStep, E as NodeRange, G as findWrapping, L as ListHelpers, H as findParentNode, I as isMacOS, J as isIOS, K as getSchemaTypeByName, O as inputRulesPlugin, Q as TrackDeleteMarkName, U as TrackInsertMarkName, V as v4, W as TrackFormatMarkName, X as comments_module_events, Y as findMark, Z as objectIncludes, _ as AddMarkStep, $ as RemoveMarkStep, a0 as twipsToLines, a1 as pixelsToTwips, a2 as helpers, a3 as posToDOMRect, a4 as CommandService, a5 as SuperConverter, a6 as createDocument, a7 as createDocFromMarkdown, a8 as createDocFromHTML, a9 as EditorState, aa as hasSomeParentWithClass, ab as isActive, ac as unflattenListsInHtml, ad as parseSizeUnit, ae as minMax, af as getLineHeightValueString, ag as updateDOMAttributes, ah as findChildren$5, ai as htmlHandler, aj as generateRandomSigned32BitIntStrId, ak as InputRule, al as kebabCase, am as findParentNodeClosestToPos, an as getListItemStyleDefinitions, ao as docxNumberingHelpers, ap as parseIndentElement, aq as combineIndents, ar as twipsToPixels, as as PIXELS_PER_INCH, at as SelectionRange, au as Transform, av as isInTable$1, aw as generateDocxRandomId, ax as insertNewRelationship, ay as inchesToPixels } from "./converter-DSvlTZFv.js";
16
+ import { D as DocxZipper } from "./docx-zipper-t0kg81zK.js";
17
17
  import { ref, computed, createElementBlock, openBlock, withModifiers, Fragment as Fragment$1, renderList, normalizeClass, createCommentVNode, toDisplayString, createElementVNode, createApp } from "vue";
18
18
  var GOOD_LEAF_SIZE = 200;
19
19
  var RopeSequence = function RopeSequence2() {
@@ -8986,6 +8986,12 @@ const toggleNode = (typeOrName, toggleTypeOrName, attrs = {}) => ({ state, comma
8986
8986
  const selectAll = () => ({ state, dispatch }) => selectAll$1(state, dispatch);
8987
8987
  const deleteSelection = () => ({ state, tr, dispatch }) => {
8988
8988
  const { from: from2, to, empty: empty2 } = state.selection;
8989
+ if (document && document.getSelection) {
8990
+ const currentDomSelection = document.getSelection();
8991
+ if (currentDomSelection?.baseNode?.data?.length == 1) {
8992
+ return false;
8993
+ }
8994
+ }
8989
8995
  if (empty2) {
8990
8996
  return deleteSelection$1(state, dispatch);
8991
8997
  }
@@ -15192,7 +15198,7 @@ const _Editor = class _Editor extends EventEmitter {
15192
15198
  { default: remarkStringify },
15193
15199
  { default: remarkGfm }
15194
15200
  ] = await Promise.all([
15195
- import("./index-CHtB4uAl.js"),
15201
+ import("./index-Bqh6Mowj.js"),
15196
15202
  import("./index-DRCvimau.js"),
15197
15203
  import("./index-C_x_N6Uh.js"),
15198
15204
  import("./index-D_sWOSiG.js"),
@@ -15410,7 +15416,7 @@ const _Editor = class _Editor extends EventEmitter {
15410
15416
  * @returns {Object | void} Migration results
15411
15417
  */
15412
15418
  processCollaborationMigrations() {
15413
- console.debug("[checkVersionMigrations] Current editor version", "0.34.9");
15419
+ console.debug("[checkVersionMigrations] Current editor version", "0.35.0");
15414
15420
  if (!this.options.ydoc) return;
15415
15421
  const metaMap = this.options.ydoc.getMap("meta");
15416
15422
  let docVersion = metaMap.get("version");
@@ -1,4 +1,4 @@
1
- import { aA as getDefaultExportFromCjs } from "./converter-9FsB3Hi4.js";
1
+ import { aA as getDefaultExportFromCjs } from "./converter-DSvlTZFv.js";
2
2
  import { V as VFile } from "./index-CvBqQJbG.js";
3
3
  function bail(error) {
4
4
  if (error) {
@@ -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
- import { p as process$1 } from "./converter-9FsB3Hi4.js";
3
- import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-BMv3Pr_v.js";
2
+ import { p as process$1 } from "./converter-DSvlTZFv.js";
3
+ import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-CAnFQ1yt.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 { a5 } from "./chunks/converter-9FsB3Hi4.js";
1
+ import { a5 } from "./chunks/converter-DSvlTZFv.js";
2
2
  export {
3
3
  a5 as SuperConverter
4
4
  };
@@ -1,5 +1,5 @@
1
- import "./chunks/converter-9FsB3Hi4.js";
2
- import { D } from "./chunks/docx-zipper-C_3Ejzf5.js";
1
+ import "./chunks/converter-DSvlTZFv.js";
2
+ import { D } from "./chunks/docx-zipper-t0kg81zK.js";
3
3
  export {
4
4
  D as default
5
5
  };
@@ -1,6 +1,6 @@
1
- import { E } from "./chunks/editor-BMv3Pr_v.js";
2
- import "./chunks/converter-9FsB3Hi4.js";
3
- import "./chunks/docx-zipper-C_3Ejzf5.js";
1
+ import { E } from "./chunks/editor-CAnFQ1yt.js";
2
+ import "./chunks/converter-DSvlTZFv.js";
3
+ import "./chunks/docx-zipper-t0kg81zK.js";
4
4
  export {
5
5
  E as Editor
6
6
  };
@@ -1,4 +1,4 @@
1
- import { J as JSZip } from "./chunks/docx-zipper-C_3Ejzf5.js";
1
+ import { J as JSZip } from "./chunks/docx-zipper-t0kg81zK.js";
2
2
  async function createZip(blobs, fileNames) {
3
3
  const zip = new JSZip();
4
4
  blobs.forEach((blob, index) => {
@@ -1949,10 +1949,10 @@ on the right if it is inside shape textbox.
1949
1949
  min-height: 40px;
1950
1950
  }
1951
1951
 
1952
- .editor-element[data-v-cd3558fe] {
1952
+ .editor-element[data-v-86fdd359] {
1953
1953
  position: relative;
1954
1954
  }
1955
- .super-editor-container[data-v-cd3558fe] {
1955
+ .super-editor-container[data-v-86fdd359] {
1956
1956
  width: auto;
1957
1957
  height: auto;
1958
1958
  min-width: 8in;
@@ -1961,13 +1961,13 @@ on the right if it is inside shape textbox.
1961
1961
  display: flex;
1962
1962
  flex-direction: column;
1963
1963
  }
1964
- .ruler[data-v-cd3558fe] {
1964
+ .ruler[data-v-86fdd359] {
1965
1965
  margin-bottom: 2px;
1966
1966
  }
1967
- .super-editor[data-v-cd3558fe] {
1967
+ .super-editor[data-v-86fdd359] {
1968
1968
  color: initial;
1969
1969
  }
1970
- .placeholder-editor[data-v-cd3558fe] {
1970
+ .placeholder-editor[data-v-86fdd359] {
1971
1971
  position: absolute;
1972
1972
  top: 0;
1973
1973
  left: 0;
@@ -1979,7 +1979,7 @@ on the right if it is inside shape textbox.
1979
1979
  background-color: white;
1980
1980
  box-sizing: border-box;
1981
1981
  }
1982
- .placeholder-title[data-v-cd3558fe] {
1982
+ .placeholder-title[data-v-86fdd359] {
1983
1983
  display: flex;
1984
1984
  justify-content: center;
1985
1985
  margin-bottom: 40px;
@@ -1 +1 @@
1
- {"version":3,"file":"deleteSelection.d.ts","sourceRoot":"","sources":["../../../../../src/core/commands/deleteSelection.js"],"names":[],"mappings":"AAKO,oCAEJ;;;;CAAuB,aA2BvB"}
1
+ {"version":3,"file":"deleteSelection.d.ts","sourceRoot":"","sources":["../../../../../src/core/commands/deleteSelection.js"],"names":[],"mappings":"AAKO,oCAEJ;;;;CAAuB,aAuCvB"}
@@ -1 +1 @@
1
- {"version":3,"file":"permission-helpers.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/track-changes/permission-helpers.js"],"names":[],"mappings":"AAgDO,2DALJ;IAAwD,KAAK,EAArD,OAAO,mBAAmB,EAAE,WAAW;IACxB,IAAI,EAAnB,MAAM;IACS,EAAE,EAAjB,MAAM;CACd,GAAU,KAAK,KAAQ,CAkBzB;AA+BM,iFALJ;IAAmE,MAAM,EAAjE;;;;;;;;;;;;0BAsDu+hgB,aAAa;;;;2BAAgoB,IAAI;;;;;;;6BAAwmI,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mCAAwte,aAAa;0BAA3kyB,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;iDAAskpC,UAAU;kDAAuV,UAAU,aAA+E,UAAU;oCAAgZ,UAAU;;;;;;;;;KAtDtwiiB;IACxB,MAAM,EAAhC,QAAQ,GAAC,QAAQ;IACK,cAAc,EAApC,KAAK,KAAQ;CACrB,GAAU,OAAO,CAkCnB;AAWM,iFALJ;IAAwD,KAAK,EAArD,OAAO,mBAAmB,EAAE,WAAW;IACnB,GAAG,EAAvB,MAAM,GAAC,IAAI;IACS,eAAe,EAAnC,MAAM,GAAC,IAAI;CACnB,GAAU,KAAK,KAAQ,CAOzB"}
1
+ {"version":3,"file":"permission-helpers.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/track-changes/permission-helpers.js"],"names":[],"mappings":"AAgDO,2DALJ;IAAwD,KAAK,EAArD,OAAO,mBAAmB,EAAE,WAAW;IACxB,IAAI,EAAnB,MAAM;IACS,EAAE,EAAjB,MAAM;CACd,GAAU,KAAK,KAAQ,CAkBzB;AA+BM,iFALJ;IAAmE,MAAM,EAAjE;;;;;;;;;;;;0BAsDqqigB,aAAa;;;;2BAAgoB,IAAI;;;;;;;6BAAwmI,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mCAAwte,aAAa;0BAA3kyB,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;iDAAskpC,UAAU;kDAAuV,UAAU,aAA+E,UAAU;oCAAgZ,UAAU;;;;;;;;;KAtDp8iiB;IACxB,MAAM,EAAhC,QAAQ,GAAC,QAAQ;IACK,cAAc,EAApC,KAAK,KAAQ;CACrB,GAAU,OAAO,CAkCnB;AAWM,iFALJ;IAAwD,KAAK,EAArD,OAAO,mBAAmB,EAAE,WAAW;IACnB,GAAG,EAAvB,MAAM,GAAC,IAAI;IACS,eAAe,EAAnC,MAAM,GAAC,IAAI;CACnB,GAAU,KAAK,KAAQ,CAOzB"}
@@ -9,14 +9,14 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
9
9
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
10
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
11
11
  var _SuperToolbar_instances, initToolbarGroups_fn, _interceptedCommands, makeToolbarItems_fn, initDefaultFonts_fn, updateHighlightColors_fn, deactivateAll_fn, updateToolbarHistory_fn, enrichTrackedChanges_fn, runCommandWithArgumentOnly_fn;
12
- import { aA as getDefaultExportFromCjs, V as v4, T as TextSelection$1, v as getMarkRange, aD as vClickOutside, aE as getActiveFormatting, av as isInTable, aF as readFromClipboard, aG as handleClipboardPaste, aH as getFileObject, aI as runPropertyTranslators, aJ as translator, aK as translator$1, aL as translator$2, aM as translator$3, aN as translator$4, aO as translator$5, aP as translator$6, aQ as translator$7, aR as translator$8, aS as translator$9, aT as translator$a, aU as translator$b, aV as translator$c, aW as translator$d, aX as translator$e, aY as commentRangeEndTranslator, aZ as commentRangeStartTranslator, a_ as translator$f, a$ as translator$g, b0 as translator$h, b1 as translator$i, b2 as translator$j, b3 as translator$k, b4 as translator$l, b5 as translator$m, b6 as translator$n, b7 as translator$o, b8 as translator$p, b9 as translator$q, ba as translator$r, bb as translator$s, bc as translator$t, bd as translator$u, be as translator$v, bf as translator$w, bg as translator$x, bh as translator$y, bi as translator$z, bj as translator$A, bk as translator$B, bl as translator$C, bm as translator$D, bn as translator$E, bo as translator$F, bp as translator$G, bq as translator$H, br as translator$I, bs as translator$J, bt as translator$K, bu as translator$L, bv as translator$M, bw as translator$N, bx as translator$O, by as translator$P, bz as translator$Q, bA as translator$R, bB as translator$S, bC as translator$T, bD as translator$U, bE as translator$V, bF as translator$W, bG as translator$X, bH as translator$Y, bI as translator$Z, bJ as translator$_, bK as translator$$, bL as translator$10, bM as translator$11, bN as translator$12, bO as translator$13, bP as translator$14, bQ as translator$15, bR as translator$16, bS as translator$17, bT as translator$18, bU as translator$19, bV as translator$1a, bW as translator$1b, bX as translator$1c, bY as translator$1d, bZ as translator$1e, b_ as translator$1f, b$ as translator$1g, c0 as translator$1h, P as PluginKey, a as Plugin } from "./chunks/converter-9FsB3Hi4.js";
13
- import { a5, i, a2 } from "./chunks/converter-9FsB3Hi4.js";
14
- import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, c as collectTargetListItemPositions, d as getFileOpener, e as checkAndProcessImage, r as replaceSelectionWithImagePlaceholder, f as uploadAndInsertImage, h as collectTrackedChanges, i as isTrackedChangeActionAllowed, y as yUndoPluginKey, j as undoDepth, k as redoDepth, l as collectTrackedChangesForContext, s as shouldBypassContextMenu, S as SlashMenuPluginKey, m as isHeadless, E as Editor, n as getStarterExtensions, P as Placeholder, o as getRichTextExtensions, D as DecorationSet, p as Decoration, M as Mark, q as Extension, A as Attribute, N as Node } from "./chunks/editor-BMv3Pr_v.js";
15
- import { w, C, x, T, t, z, v } from "./chunks/editor-BMv3Pr_v.js";
12
+ import { aA as getDefaultExportFromCjs, V as v4, T as TextSelection$1, v as getMarkRange, aD as vClickOutside, aE as getActiveFormatting, av as isInTable, aF as readFromClipboard, aG as handleClipboardPaste, aH as getFileObject, aI as runPropertyTranslators, aJ as translator, aK as translator$1, aL as translator$2, aM as translator$3, aN as translator$4, aO as translator$5, aP as translator$6, aQ as translator$7, aR as translator$8, aS as translator$9, aT as translator$a, aU as translator$b, aV as translator$c, aW as translator$d, aX as translator$e, aY as commentRangeEndTranslator, aZ as commentRangeStartTranslator, a_ as translator$f, a$ as translator$g, b0 as translator$h, b1 as translator$i, b2 as translator$j, b3 as translator$k, b4 as translator$l, b5 as translator$m, b6 as translator$n, b7 as translator$o, b8 as translator$p, b9 as translator$q, ba as translator$r, bb as translator$s, bc as translator$t, bd as translator$u, be as translator$v, bf as translator$w, bg as translator$x, bh as translator$y, bi as translator$z, bj as translator$A, bk as translator$B, bl as translator$C, bm as translator$D, bn as translator$E, bo as translator$F, bp as translator$G, bq as translator$H, br as translator$I, bs as translator$J, bt as translator$K, bu as translator$L, bv as translator$M, bw as translator$N, bx as translator$O, by as translator$P, bz as translator$Q, bA as translator$R, bB as translator$S, bC as translator$T, bD as translator$U, bE as translator$V, bF as translator$W, bG as translator$X, bH as translator$Y, bI as translator$Z, bJ as translator$_, bK as translator$$, bL as translator$10, bM as translator$11, bN as translator$12, bO as translator$13, bP as translator$14, bQ as translator$15, bR as translator$16, bS as translator$17, bT as translator$18, bU as translator$19, bV as translator$1a, bW as translator$1b, bX as translator$1c, bY as translator$1d, bZ as translator$1e, b_ as translator$1f, b$ as translator$1g, c0 as translator$1h, P as PluginKey, a as Plugin } from "./chunks/converter-DSvlTZFv.js";
13
+ import { a5, i, a2 } from "./chunks/converter-DSvlTZFv.js";
14
+ import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, c as collectTargetListItemPositions, d as getFileOpener, e as checkAndProcessImage, r as replaceSelectionWithImagePlaceholder, f as uploadAndInsertImage, h as collectTrackedChanges, i as isTrackedChangeActionAllowed, y as yUndoPluginKey, j as undoDepth, k as redoDepth, l as collectTrackedChangesForContext, s as shouldBypassContextMenu, S as SlashMenuPluginKey, m as isHeadless, E as Editor, n as getStarterExtensions, P as Placeholder, o as getRichTextExtensions, D as DecorationSet, p as Decoration, M as Mark, q as Extension, A as Attribute, N as Node } from "./chunks/editor-CAnFQ1yt.js";
15
+ import { w, C, x, T, t, z, v } from "./chunks/editor-CAnFQ1yt.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, defineComponent, reactive, onUnmounted, renderSlot, shallowRef, createBlock, withCtx, resolveDynamicComponent, normalizeProps, guardReactiveProps } from "vue";
17
- import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, p as plusIconSvg, a as trashIconSvg, b as borderNoneIconSvg, c as arrowsToDotIconSvg, d as arrowsLeftRightIconSvg, w as wrenchIconSvg, m as magicWandIcon, e as checkIconSvg$1, x as xMarkIconSvg, l as linkIconSvg, f as tableIconSvg, g as scissorsIconSvg, h as copyIconSvg, i as pasteIconSvg, u as useMessage, N as NSkeleton } from "./chunks/toolbar-B9ZfgQpl.js";
17
+ import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, p as plusIconSvg, a as trashIconSvg, b as borderNoneIconSvg, c as arrowsToDotIconSvg, d as arrowsLeftRightIconSvg, w as wrenchIconSvg, m as magicWandIcon, e as checkIconSvg$1, x as xMarkIconSvg, l as linkIconSvg, f as tableIconSvg, g as scissorsIconSvg, h as copyIconSvg, i as pasteIconSvg, u as useMessage, N as NSkeleton } from "./chunks/toolbar-BMXKBmbt.js";
18
18
  import AIWriter from "./ai-writer.es.js";
19
- import { D } from "./chunks/docx-zipper-C_3Ejzf5.js";
19
+ import { D } from "./chunks/docx-zipper-t0kg81zK.js";
20
20
  import { createZip } from "./file-zipper.es.js";
21
21
  var eventemitter3 = { exports: {} };
22
22
  var hasRequiredEventemitter3;
@@ -4837,11 +4837,29 @@ const _sfc_main$1 = {
4837
4837
  delete props.options.content;
4838
4838
  const ydoc = props.options.ydoc;
4839
4839
  const provider = props.options.collaborationProvider;
4840
- const handleSynced = () => {
4841
- pollForMetaMapData(ydoc);
4842
- provider.off("synced", handleSynced);
4840
+ const waitForSync = () => {
4841
+ if (provider.isSynced || provider.synced) return Promise.resolve();
4842
+ return new Promise((resolve) => {
4843
+ const onSync = (synced) => {
4844
+ if (synced === false) return;
4845
+ provider.off("synced", onSync);
4846
+ provider.off("sync", onSync);
4847
+ resolve();
4848
+ };
4849
+ provider.on("synced", onSync);
4850
+ provider.on("sync", onSync);
4851
+ });
4843
4852
  };
4844
- provider.on("synced", handleSynced);
4853
+ waitForSync().then(async () => {
4854
+ const metaMap = ydoc.getMap("meta");
4855
+ if (metaMap.has("docx")) {
4856
+ pollForMetaMapData(ydoc);
4857
+ } else {
4858
+ props.options.isNewFile = true;
4859
+ const fileData = await loadNewFileData();
4860
+ if (fileData) initEditor(fileData);
4861
+ }
4862
+ });
4845
4863
  }
4846
4864
  };
4847
4865
  const getExtensions = () => {
@@ -5025,7 +5043,7 @@ const _sfc_main$1 = {
5025
5043
  };
5026
5044
  }
5027
5045
  };
5028
- const SuperEditor = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-cd3558fe"]]);
5046
+ const SuperEditor = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-86fdd359"]]);
5029
5047
  const _hoisted_1 = ["innerHTML"];
5030
5048
  const _sfc_main = {
5031
5049
  __name: "SuperInput",
@@ -1,6 +1,6 @@
1
1
  import "vue";
2
- import { T } from "./chunks/toolbar-B9ZfgQpl.js";
3
- import "./chunks/editor-BMv3Pr_v.js";
2
+ import { T } from "./chunks/toolbar-BMXKBmbt.js";
3
+ import "./chunks/editor-CAnFQ1yt.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-Cs1TKdep.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-Bgv1UKa4.cjs");
4
4
  require("./chunks/vue-Cwv-wUpm.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-C8J_Vybd.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-PZocCf8E.es.js";
2
2
  import "./chunks/vue-CKmzTNVs.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-Cs1TKdep.cjs");
4
- const superdoc = require("./chunks/index-myYbO6wO.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-Bgv1UKa4.cjs");
4
+ const superdoc = require("./chunks/index-DV1fybAb.cjs");
5
5
  const blankDocx = require("./chunks/blank-docx-DfW3Eeh2.cjs");
6
6
  exports.AnnotatorHelpers = superEditor_es.AnnotatorHelpers;
7
7
  exports.Editor = superEditor_es.Editor;
@@ -1,5 +1,5 @@
1
- import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-C8J_Vybd.es.js";
2
- import { D, H, P, S as S2, m, l } from "./chunks/index-tHw-DC34.es.js";
1
+ import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-PZocCf8E.es.js";
2
+ import { D, H, P, S as S2, m, l } from "./chunks/index-DuDHnypH.es.js";
3
3
  import { B } from "./chunks/blank-docx-ABm6XYAA.es.js";
4
4
  export {
5
5
  a as AnnotatorHelpers,
@@ -35798,7 +35798,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
35798
35798
  static getStoredSuperdocVersion(docx) {
35799
35799
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
35800
35800
  }
35801
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.34.9") {
35801
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.35.0") {
35802
35802
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
35803
35803
  }
35804
35804
  /**
@@ -55698,6 +55698,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
55698
55698
  const selectAll = () => ({ state: state2, dispatch }) => selectAll$1(state2, dispatch);
55699
55699
  const deleteSelection = () => ({ state: state2, tr, dispatch }) => {
55700
55700
  const { from: from2, to, empty: empty2 } = state2.selection;
55701
+ if (document && document.getSelection) {
55702
+ const currentDomSelection = document.getSelection();
55703
+ if (currentDomSelection?.baseNode?.data?.length == 1) {
55704
+ return false;
55705
+ }
55706
+ }
55701
55707
  if (empty2) {
55702
55708
  return deleteSelection$1(state2, dispatch);
55703
55709
  }
@@ -61848,7 +61854,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
61848
61854
  { default: remarkStringify2 },
61849
61855
  { default: remarkGfm2 }
61850
61856
  ] = await Promise.all([
61851
- Promise.resolve().then(() => indexCHtB4uAl),
61857
+ Promise.resolve().then(() => indexBqh6Mowj),
61852
61858
  Promise.resolve().then(() => indexDRCvimau),
61853
61859
  Promise.resolve().then(() => indexC_x_N6Uh),
61854
61860
  Promise.resolve().then(() => indexD_sWOSiG),
@@ -62066,7 +62072,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
62066
62072
  * @returns {Object | void} Migration results
62067
62073
  */
62068
62074
  processCollaborationMigrations() {
62069
- console.debug("[checkVersionMigrations] Current editor version", "0.34.9");
62075
+ console.debug("[checkVersionMigrations] Current editor version", "0.35.0");
62070
62076
  if (!this.options.ydoc) return;
62071
62077
  const metaMap = this.options.ydoc.getMap("meta");
62072
62078
  let docVersion = metaMap.get("version");
@@ -100932,11 +100938,29 @@ ${style2}
100932
100938
  delete props.options.content;
100933
100939
  const ydoc = props.options.ydoc;
100934
100940
  const provider2 = props.options.collaborationProvider;
100935
- const handleSynced = () => {
100936
- pollForMetaMapData(ydoc);
100937
- provider2.off("synced", handleSynced);
100941
+ const waitForSync = () => {
100942
+ if (provider2.isSynced || provider2.synced) return Promise.resolve();
100943
+ return new Promise((resolve2) => {
100944
+ const onSync = (synced) => {
100945
+ if (synced === false) return;
100946
+ provider2.off("synced", onSync);
100947
+ provider2.off("sync", onSync);
100948
+ resolve2();
100949
+ };
100950
+ provider2.on("synced", onSync);
100951
+ provider2.on("sync", onSync);
100952
+ });
100938
100953
  };
100939
- provider2.on("synced", handleSynced);
100954
+ waitForSync().then(async () => {
100955
+ const metaMap = ydoc.getMap("meta");
100956
+ if (metaMap.has("docx")) {
100957
+ pollForMetaMapData(ydoc);
100958
+ } else {
100959
+ props.options.isNewFile = true;
100960
+ const fileData = await loadNewFileData();
100961
+ if (fileData) initEditor(fileData);
100962
+ }
100963
+ });
100940
100964
  }
100941
100965
  };
100942
100966
  const getExtensions = () => {
@@ -101120,7 +101144,7 @@ ${style2}
101120
101144
  };
101121
101145
  }
101122
101146
  };
101123
- const SuperEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$1$1, [["__scopeId", "data-v-cd3558fe"]]);
101147
+ const SuperEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$1$1, [["__scopeId", "data-v-86fdd359"]]);
101124
101148
  const _hoisted_1$h = ["innerHTML"];
101125
101149
  const _sfc_main$i = {
101126
101150
  __name: "SuperInput",
@@ -103633,6 +103657,9 @@ ${reason}`);
103633
103657
  context.emit("awareness-update", payload);
103634
103658
  }
103635
103659
  function createProvider({ config: config2, user, documentId, socket, superdocInstance }) {
103660
+ console.warn(
103661
+ "[superdoc] Internal provider creation is deprecated. Pass { ydoc, provider } to modules.collaboration instead."
103662
+ );
103636
103663
  if (!config2.providerType) config2.providerType = "superdoc";
103637
103664
  const providers = {
103638
103665
  hocuspocus: () => createHocuspocusProvider({ config: config2, user, documentId, socket, superdocInstance }),
@@ -103689,6 +103716,22 @@ ${reason}`);
103689
103716
  const onDestroy = (superdocInstance, documentId) => {
103690
103717
  console.warn("🔌 [superdoc] Destroyed", documentId);
103691
103718
  };
103719
+ function setupAwarenessHandler(provider2, superdocInstance, user) {
103720
+ const awareness = provider2.awareness;
103721
+ if (!awareness) {
103722
+ console.warn("[superdoc] External provider missing awareness property");
103723
+ return;
103724
+ }
103725
+ if (user && awareness.setLocalStateField) {
103726
+ awareness.setLocalStateField("user", user);
103727
+ }
103728
+ awareness.on("change", (changes = {}) => {
103729
+ awarenessHandler(superdocInstance, {
103730
+ changes,
103731
+ states: awareness.getStates()
103732
+ });
103733
+ });
103734
+ }
103692
103735
  const addYComment = (yArray, ydoc, event) => {
103693
103736
  const { comment: comment2 } = event;
103694
103737
  const yComment = new Y.Map(Object.entries(comment2));
@@ -104047,8 +104090,8 @@ ${reason}`);
104047
104090
  const getEditor = () => editorRef.value;
104048
104091
  function initDocumentType({ type: type3, data: data2 }) {
104049
104092
  if (data2?.type) return data2.type;
104050
- if (type3) return type3 in documentTypes ? documentTypes[type3] : null;
104051
- throw new Error("Document type not specified for doc:", params2);
104093
+ if (type3) return documentTypes[type3] || type3;
104094
+ throw new Error("Document type not specified");
104052
104095
  }
104053
104096
  const removeComments = () => {
104054
104097
  conversationsBackup.value = conversations.value;
@@ -118535,7 +118578,7 @@ ${style2}
118535
118578
  this.config.colors = shuffleArray(this.config.colors);
118536
118579
  this.userColorMap = /* @__PURE__ */ new Map();
118537
118580
  this.colorIndex = 0;
118538
- this.version = "0.34.9";
118581
+ this.version = "0.35.0";
118539
118582
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
118540
118583
  this.superdocId = config2.superdocId || v4();
118541
118584
  this.colors = this.config.colors;
@@ -118696,6 +118739,28 @@ ${style2}
118696
118739
  async #initCollaboration({ collaboration: collaborationModuleConfig, comments: commentsConfig = {} } = {}) {
118697
118740
  if (!collaborationModuleConfig) return this.config.documents;
118698
118741
  this.isCollaborative = true;
118742
+ const { ydoc: externalYdoc, provider: externalProvider } = collaborationModuleConfig;
118743
+ if (externalYdoc && externalProvider) {
118744
+ this.ydoc = externalYdoc;
118745
+ this.provider = externalProvider;
118746
+ setupAwarenessHandler(externalProvider, this, this.config.user);
118747
+ if (!this.config.documents || this.config.documents.length === 0) {
118748
+ this.config.documents = [
118749
+ {
118750
+ id: v4(),
118751
+ type: DOCX,
118752
+ name: "document.docx"
118753
+ }
118754
+ ];
118755
+ }
118756
+ this.config.documents.forEach((doc2) => {
118757
+ doc2.ydoc = externalYdoc;
118758
+ doc2.provider = externalProvider;
118759
+ doc2.role = this.config.role;
118760
+ });
118761
+ initCollaborationComments(this);
118762
+ return this.config.documents;
118763
+ }
118699
118764
  if (collaborationModuleConfig.providerType === "hocuspocus") {
118700
118765
  this.config.socket = new provider.HocuspocusProviderWebsocket({
118701
118766
  url: collaborationModuleConfig.url
@@ -120935,7 +121000,7 @@ ${style2}
120935
121000
  value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
120936
121001
  );
120937
121002
  }
120938
- const indexCHtB4uAl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
121003
+ const indexBqh6Mowj = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
120939
121004
  __proto__: null,
120940
121005
  unified
120941
121006
  }, Symbol.toStringTag, { value: "Module" }));