@harbour-enterprises/superdoc 0.13.0-next.3 → 0.13.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/{super-editor.es-CaiAvJmI.es.js → super-editor.es-BLihY9I3.es.js} +33 -10
  2. package/dist/chunks/{super-editor.es-C1r2fKvd.cjs → super-editor.es-C8bnXrNN.cjs} +33 -10
  3. package/dist/stores/comments-store.d.ts.map +1 -1
  4. package/dist/super-editor/ai-writer.es.js +2 -2
  5. package/dist/super-editor/chunks/{converter-DifQiKXL.js → converter-IP9PazoB.js} +2 -2
  6. package/dist/super-editor/chunks/{docx-zipper-0V4s80fa.js → docx-zipper-CesiGAcg.js} +1 -1
  7. package/dist/super-editor/chunks/{editor-Cu6WivrX.js → editor-2jdmUJVn.js} +33 -10
  8. package/dist/super-editor/chunks/{toolbar-VX_23hqe.js → toolbar-BwVRLL78.js} +2 -2
  9. package/dist/super-editor/converter.es.js +1 -1
  10. package/dist/super-editor/docx-zipper.es.js +2 -2
  11. package/dist/super-editor/editor.es.js +3 -3
  12. package/dist/super-editor/extensions/image/imageHelpers/imagePositionPlugin.d.ts.map +1 -1
  13. package/dist/super-editor/extensions/ordered-list/helpers/orderedListSyncPlugin.d.ts.map +1 -1
  14. package/dist/super-editor/extensions/paragraph/paragraph.d.ts.map +1 -1
  15. package/dist/super-editor/extensions/tab/tab.d.ts.map +1 -1
  16. package/dist/super-editor/file-zipper.es.js +1 -1
  17. package/dist/super-editor/super-editor.es.js +6 -6
  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 +23 -7
  22. package/dist/superdoc.es.js +24 -8
  23. package/dist/superdoc.umd.js +55 -16
  24. package/dist/superdoc.umd.js.map +1 -1
  25. package/package.json +1 -1
@@ -23393,7 +23393,7 @@ const _SuperConverter = class _SuperConverter2 {
23393
23393
  return;
23394
23394
  }
23395
23395
  }
23396
- static updateDocumentVersion(docx = this.convertedXml, version2 = "0.13.0-next.3") {
23396
+ static updateDocumentVersion(docx = this.convertedXml, version2 = "0.13.0-next.4") {
23397
23397
  const customLocation = "docProps/custom.xml";
23398
23398
  if (!docx[customLocation]) {
23399
23399
  docx[customLocation] = generateCustomXml();
@@ -23860,7 +23860,7 @@ function storeSuperdocVersion(docx) {
23860
23860
  function generateCustomXml() {
23861
23861
  return DEFAULT_CUSTOM_XML;
23862
23862
  }
23863
- function generateSuperdocVersion(pid = 2, version2 = "0.13.0-next.3") {
23863
+ function generateSuperdocVersion(pid = 2, version2 = "0.13.0-next.4") {
23864
23864
  return {
23865
23865
  type: "element",
23866
23866
  name: "property",
@@ -39382,7 +39382,7 @@ const CommentsPlugin = Extension.create({
39382
39382
  if (isPaginationInit) shouldUpdate = true;
39383
39383
  const meta = tr.getMeta(CommentsPluginKey);
39384
39384
  const { type: type2 } = meta || {};
39385
- if (type2 === "force") shouldUpdate = true;
39385
+ if (type2 === "force" || type2 === "forceTrackChanges") shouldUpdate = true;
39386
39386
  if (!isPaginationInit && !shouldUpdate && meta && meta.decorations) {
39387
39387
  return {
39388
39388
  ...pluginState,
@@ -41237,7 +41237,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
41237
41237
  * @returns {Object | void} Migration results
41238
41238
  */
41239
41239
  processCollaborationMigrations() {
41240
- console.debug("[checkVersionMigrations] Current editor version", "0.13.0-next.3");
41240
+ console.debug("[checkVersionMigrations] Current editor version", "0.13.0-next.4");
41241
41241
  if (!this.options.ydoc) return;
41242
41242
  const metaMap = this.options.ydoc.getMap("meta");
41243
41243
  let docVersion = metaMap.get("version");
@@ -42936,6 +42936,9 @@ function orderedListSync(options2 = {}) {
42936
42936
  let { doc: doc2, tr } = newState;
42937
42937
  let listsBySyncId = {};
42938
42938
  doc2.descendants((node2, pos) => {
42939
+ if (node2.type.name === "paragraph") {
42940
+ return false;
42941
+ }
42939
42942
  if (node2.type.name === "orderedList" && !!node2.attrs.syncId) {
42940
42943
  let syncId = node2.attrs.syncId;
42941
42944
  if (!listsBySyncId[syncId]) listsBySyncId[syncId] = [];
@@ -43065,6 +43068,9 @@ function getOrderedListItemsByList(state2) {
43065
43068
  let { doc: doc2 } = state2;
43066
43069
  let map22 = /* @__PURE__ */ new Map();
43067
43070
  doc2.descendants((node2, pos) => {
43071
+ if (node2.type.name === "paragraph") {
43072
+ return false;
43073
+ }
43068
43074
  let { attrs } = node2;
43069
43075
  let isListItem = node2.type.name === "listItem";
43070
43076
  let hasListLevel = !!attrs.listLevel?.length;
@@ -43085,6 +43091,9 @@ function getAllChildListItemsOfList({ state: state2, list }) {
43085
43091
  let { doc: doc2 } = state2;
43086
43092
  let allItems = [];
43087
43093
  doc2.descendants((node2, pos) => {
43094
+ if (node2.type.name === "paragraph") {
43095
+ return false;
43096
+ }
43088
43097
  let isListItem = node2.type.name === "listItem";
43089
43098
  let $pos = doc2.resolve(pos);
43090
43099
  if (isListItem && $pos.parent === list) {
@@ -43460,7 +43469,15 @@ function getListMarkerDecorations(state2, marks = []) {
43460
43469
  let { doc: doc2, storedMarks } = state2;
43461
43470
  let decorations = [];
43462
43471
  if (Array.isArray(storedMarks)) marks.push(...storedMarks);
43463
- let listItems = findChildren$4(doc2, (node2) => node2.type.name === "listItem");
43472
+ let listItems = [];
43473
+ doc2.descendants((node2, pos) => {
43474
+ if (node2.type.name === "paragraph") {
43475
+ return false;
43476
+ }
43477
+ if (node2.type.name === "listItem") {
43478
+ listItems.push({ node: node2, pos });
43479
+ }
43480
+ });
43464
43481
  if (!listItems.length) {
43465
43482
  return decorations;
43466
43483
  }
@@ -44037,6 +44054,7 @@ const Paragraph = Node$1.create({
44037
44054
  return DecorationSet.create(state2.doc, decorations);
44038
44055
  },
44039
44056
  apply(tr, oldDecorationSet, oldState, newState) {
44057
+ if (!tr.docChanged) return oldDecorationSet;
44040
44058
  const decorations = getDropcapDecorations(newState, view);
44041
44059
  return DecorationSet.create(newState.doc, decorations);
44042
44060
  }
@@ -44053,11 +44071,14 @@ const Paragraph = Node$1.create({
44053
44071
  const getDropcapDecorations = (state2, view) => {
44054
44072
  let decorations = [];
44055
44073
  state2.doc.descendants((node2, pos) => {
44056
- if (node2.attrs.dropcap?.type === "margin") {
44057
- const width = getDropcapWidth(view, pos);
44058
- decorations.push(
44059
- Decoration.inline(pos, pos + node2.nodeSize, { style: `margin-left: -${width}px;` })
44060
- );
44074
+ if (node2.type.name === "paragraph") {
44075
+ if (node2.attrs.dropcap?.type === "margin") {
44076
+ const width = getDropcapWidth(view, pos);
44077
+ decorations.push(
44078
+ Decoration.inline(pos, pos + node2.nodeSize, { style: `margin-left: -${width}px;` })
44079
+ );
44080
+ }
44081
+ return false;
44061
44082
  }
44062
44083
  });
44063
44084
  return decorations;
@@ -44293,6 +44314,7 @@ const TabNode = Node$1.create({
44293
44314
  return DecorationSet.create(state2.doc, decorations);
44294
44315
  },
44295
44316
  apply(tr, oldDecorationSet, oldState, newState) {
44317
+ if (!tr.docChanged) return oldDecorationSet;
44296
44318
  const decorations = getTabDecorations(newState, view);
44297
44319
  return DecorationSet.create(newState.doc, decorations);
44298
44320
  }
@@ -48628,6 +48650,7 @@ const ImagePositionPlugin = ({ editor }) => {
48628
48650
  return DecorationSet.empty;
48629
48651
  },
48630
48652
  apply(tr, oldDecorationSet, oldState, newState) {
48653
+ if (!tr.docChanged) return oldDecorationSet;
48631
48654
  const decorations = getImagePositionDecorations(newState, view);
48632
48655
  return DecorationSet.create(newState.doc, decorations);
48633
48656
  }
@@ -23410,7 +23410,7 @@ const _SuperConverter = class _SuperConverter2 {
23410
23410
  return;
23411
23411
  }
23412
23412
  }
23413
- static updateDocumentVersion(docx = this.convertedXml, version2 = "0.13.0-next.3") {
23413
+ static updateDocumentVersion(docx = this.convertedXml, version2 = "0.13.0-next.4") {
23414
23414
  const customLocation = "docProps/custom.xml";
23415
23415
  if (!docx[customLocation]) {
23416
23416
  docx[customLocation] = generateCustomXml();
@@ -23877,7 +23877,7 @@ function storeSuperdocVersion(docx) {
23877
23877
  function generateCustomXml() {
23878
23878
  return DEFAULT_CUSTOM_XML;
23879
23879
  }
23880
- function generateSuperdocVersion(pid = 2, version2 = "0.13.0-next.3") {
23880
+ function generateSuperdocVersion(pid = 2, version2 = "0.13.0-next.4") {
23881
23881
  return {
23882
23882
  type: "element",
23883
23883
  name: "property",
@@ -39399,7 +39399,7 @@ const CommentsPlugin = Extension.create({
39399
39399
  if (isPaginationInit) shouldUpdate = true;
39400
39400
  const meta = tr.getMeta(CommentsPluginKey);
39401
39401
  const { type: type2 } = meta || {};
39402
- if (type2 === "force") shouldUpdate = true;
39402
+ if (type2 === "force" || type2 === "forceTrackChanges") shouldUpdate = true;
39403
39403
  if (!isPaginationInit && !shouldUpdate && meta && meta.decorations) {
39404
39404
  return {
39405
39405
  ...pluginState,
@@ -41254,7 +41254,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
41254
41254
  * @returns {Object | void} Migration results
41255
41255
  */
41256
41256
  processCollaborationMigrations() {
41257
- console.debug("[checkVersionMigrations] Current editor version", "0.13.0-next.3");
41257
+ console.debug("[checkVersionMigrations] Current editor version", "0.13.0-next.4");
41258
41258
  if (!this.options.ydoc) return;
41259
41259
  const metaMap = this.options.ydoc.getMap("meta");
41260
41260
  let docVersion = metaMap.get("version");
@@ -42953,6 +42953,9 @@ function orderedListSync(options2 = {}) {
42953
42953
  let { doc: doc2, tr } = newState;
42954
42954
  let listsBySyncId = {};
42955
42955
  doc2.descendants((node2, pos) => {
42956
+ if (node2.type.name === "paragraph") {
42957
+ return false;
42958
+ }
42956
42959
  if (node2.type.name === "orderedList" && !!node2.attrs.syncId) {
42957
42960
  let syncId = node2.attrs.syncId;
42958
42961
  if (!listsBySyncId[syncId]) listsBySyncId[syncId] = [];
@@ -43082,6 +43085,9 @@ function getOrderedListItemsByList(state2) {
43082
43085
  let { doc: doc2 } = state2;
43083
43086
  let map22 = /* @__PURE__ */ new Map();
43084
43087
  doc2.descendants((node2, pos) => {
43088
+ if (node2.type.name === "paragraph") {
43089
+ return false;
43090
+ }
43085
43091
  let { attrs } = node2;
43086
43092
  let isListItem = node2.type.name === "listItem";
43087
43093
  let hasListLevel = !!attrs.listLevel?.length;
@@ -43102,6 +43108,9 @@ function getAllChildListItemsOfList({ state: state2, list }) {
43102
43108
  let { doc: doc2 } = state2;
43103
43109
  let allItems = [];
43104
43110
  doc2.descendants((node2, pos) => {
43111
+ if (node2.type.name === "paragraph") {
43112
+ return false;
43113
+ }
43105
43114
  let isListItem = node2.type.name === "listItem";
43106
43115
  let $pos = doc2.resolve(pos);
43107
43116
  if (isListItem && $pos.parent === list) {
@@ -43477,7 +43486,15 @@ function getListMarkerDecorations(state2, marks = []) {
43477
43486
  let { doc: doc2, storedMarks } = state2;
43478
43487
  let decorations = [];
43479
43488
  if (Array.isArray(storedMarks)) marks.push(...storedMarks);
43480
- let listItems = findChildren$4(doc2, (node2) => node2.type.name === "listItem");
43489
+ let listItems = [];
43490
+ doc2.descendants((node2, pos) => {
43491
+ if (node2.type.name === "paragraph") {
43492
+ return false;
43493
+ }
43494
+ if (node2.type.name === "listItem") {
43495
+ listItems.push({ node: node2, pos });
43496
+ }
43497
+ });
43481
43498
  if (!listItems.length) {
43482
43499
  return decorations;
43483
43500
  }
@@ -44054,6 +44071,7 @@ const Paragraph = Node$1.create({
44054
44071
  return DecorationSet.create(state2.doc, decorations);
44055
44072
  },
44056
44073
  apply(tr, oldDecorationSet, oldState, newState) {
44074
+ if (!tr.docChanged) return oldDecorationSet;
44057
44075
  const decorations = getDropcapDecorations(newState, view);
44058
44076
  return DecorationSet.create(newState.doc, decorations);
44059
44077
  }
@@ -44070,11 +44088,14 @@ const Paragraph = Node$1.create({
44070
44088
  const getDropcapDecorations = (state2, view) => {
44071
44089
  let decorations = [];
44072
44090
  state2.doc.descendants((node2, pos) => {
44073
- if (node2.attrs.dropcap?.type === "margin") {
44074
- const width = getDropcapWidth(view, pos);
44075
- decorations.push(
44076
- Decoration.inline(pos, pos + node2.nodeSize, { style: `margin-left: -${width}px;` })
44077
- );
44091
+ if (node2.type.name === "paragraph") {
44092
+ if (node2.attrs.dropcap?.type === "margin") {
44093
+ const width = getDropcapWidth(view, pos);
44094
+ decorations.push(
44095
+ Decoration.inline(pos, pos + node2.nodeSize, { style: `margin-left: -${width}px;` })
44096
+ );
44097
+ }
44098
+ return false;
44078
44099
  }
44079
44100
  });
44080
44101
  return decorations;
@@ -44310,6 +44331,7 @@ const TabNode = Node$1.create({
44310
44331
  return DecorationSet.create(state2.doc, decorations);
44311
44332
  },
44312
44333
  apply(tr, oldDecorationSet, oldState, newState) {
44334
+ if (!tr.docChanged) return oldDecorationSet;
44313
44335
  const decorations = getTabDecorations(newState, view);
44314
44336
  return DecorationSet.create(newState.doc, decorations);
44315
44337
  }
@@ -48645,6 +48667,7 @@ const ImagePositionPlugin = ({ editor }) => {
48645
48667
  return DecorationSet.empty;
48646
48668
  },
48647
48669
  apply(tr, oldDecorationSet, oldState, newState) {
48670
+ if (!tr.docChanged) return oldDecorationSet;
48648
48671
  const decorations = getImagePositionDecorations(newState, view);
48649
48672
  return DecorationSet.create(newState.doc, decorations);
48650
48673
  }
@@ -1 +1 @@
1
- {"version":3,"file":"comments-store.d.ts","sourceRoot":"","sources":["../../src/stores/comments-store.js"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BA2Ce,IAAI;qBAiBN,MAAM;2BAWN,MAAM,GAAG,SAAS,GAAG,IAAI,KACvB,IAAI;;;;;;;gFA0Nd;QAAuB,SAAS;QACT,UAAU;QACV,eAAe;KACtC;;wCAoDA;QAAuB,QAAQ;KAC/B,KAAU,IAAI;sCA2EJ,IAAI;;;;;6CA3FJ,IAAI;4EAwGd;QAAsB,QAAQ;QACP,UAAU;KACjC,KAAU,IAAI;;oFAqGJ,IAAI;sDAhcd;QAAuB,QAAQ;QACR,MAAM;KAC7B,KAAU,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAhDJ,IAAI;qBAiBN,MAAM;2BAWN,MAAM,GAAG,SAAS,GAAG,IAAI,KACvB,IAAI;;;;;;;gFA0Nd;QAAuB,SAAS;QACT,UAAU;QACV,eAAe;KACtC;;wCAoDA;QAAuB,QAAQ;KAC/B,KAAU,IAAI;sCA2EJ,IAAI;;;;;6CA3FJ,IAAI;4EAwGd;QAAsB,QAAQ;QACP,UAAU;KACjC,KAAU,IAAI;;oFAqGJ,IAAI;sDAhcd;QAAuB,QAAQ;QACR,MAAM;KAC7B,KAAU,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAhDJ,IAAI;qBAiBN,MAAM;2BAWN,MAAM,GAAG,SAAS,GAAG,IAAI,KACvB,IAAI;;;;;;;gFA0Nd;QAAuB,SAAS;QACT,UAAU;QACV,eAAe;KACtC;;wCAoDA;QAAuB,QAAQ;KAC/B,KAAU,IAAI;sCA2EJ,IAAI;;;;;6CA3FJ,IAAI;4EAwGd;QAAsB,QAAQ;QACP,UAAU;KACjC,KAAU,IAAI;;oFAqGJ,IAAI;sDAhcd;QAAuB,QAAQ;QACR,MAAM;KAC7B,KAAU,IAAI;0VA6hBhB"}
1
+ {"version":3,"file":"comments-store.d.ts","sourceRoot":"","sources":["../../src/stores/comments-store.js"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BA2Ce,IAAI;qBAiBN,MAAM;2BAWN,MAAM,GAAG,SAAS,GAAG,IAAI,KACvB,IAAI;;;;;;;gFA0Nd;QAAuB,SAAS;QACT,UAAU;QACV,eAAe;KACtC;;wCAoDA;QAAuB,QAAQ;KAC/B,KAAU,IAAI;sCA2EJ,IAAI;;;;;6CA3FJ,IAAI;4EAwGd;QAAsB,QAAQ;QACP,UAAU;KACjC,KAAU,IAAI;;oFA0HJ,IAAI;sDArdd;QAAuB,QAAQ;QACR,MAAM;KAC7B,KAAU,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAhDJ,IAAI;qBAiBN,MAAM;2BAWN,MAAM,GAAG,SAAS,GAAG,IAAI,KACvB,IAAI;;;;;;;gFA0Nd;QAAuB,SAAS;QACT,UAAU;QACV,eAAe;KACtC;;wCAoDA;QAAuB,QAAQ;KAC/B,KAAU,IAAI;sCA2EJ,IAAI;;;;;6CA3FJ,IAAI;4EAwGd;QAAsB,QAAQ;QACP,UAAU;KACjC,KAAU,IAAI;;oFA0HJ,IAAI;sDArdd;QAAuB,QAAQ;QACR,MAAM;KAC7B,KAAU,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAhDJ,IAAI;qBAiBN,MAAM;2BAWN,MAAM,GAAG,SAAS,GAAG,IAAI,KACvB,IAAI;;;;;;;gFA0Nd;QAAuB,SAAS;QACT,UAAU;QACV,eAAe;KACtC;;wCAoDA;QAAuB,QAAQ;KAC/B,KAAU,IAAI;sCA2EJ,IAAI;;;;;6CA3FJ,IAAI;4EAwGd;QAAsB,QAAQ;QACP,UAAU;KACjC,KAAU,IAAI;;oFA0HJ,IAAI;sDArdd;QAAuB,QAAQ;QACR,MAAM;KAC7B,KAAU,IAAI;0VAkjBhB"}
@@ -1,6 +1,6 @@
1
1
  import { ref, onMounted, onUnmounted, computed, createElementBlock, openBlock, withModifiers, createElementVNode, withDirectives, unref, vModelText, createCommentVNode, nextTick } from "vue";
2
- import { T as TextSelection } from "./chunks/converter-DifQiKXL.js";
3
- import { _ as _export_sfc } from "./chunks/editor-Cu6WivrX.js";
2
+ import { T as TextSelection } from "./chunks/converter-IP9PazoB.js";
3
+ import { _ as _export_sfc } from "./chunks/editor-2jdmUJVn.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 = {}) {
@@ -23412,7 +23412,7 @@ const _SuperConverter = class _SuperConverter {
23412
23412
  return;
23413
23413
  }
23414
23414
  }
23415
- static updateDocumentVersion(docx = this.convertedXml, version = "0.13.0-next.3") {
23415
+ static updateDocumentVersion(docx = this.convertedXml, version = "0.13.0-next.4") {
23416
23416
  const customLocation = "docProps/custom.xml";
23417
23417
  if (!docx[customLocation]) {
23418
23418
  docx[customLocation] = generateCustomXml();
@@ -23882,7 +23882,7 @@ function storeSuperdocVersion(docx) {
23882
23882
  function generateCustomXml() {
23883
23883
  return DEFAULT_CUSTOM_XML;
23884
23884
  }
23885
- function generateSuperdocVersion(pid = 2, version = "0.13.0-next.3") {
23885
+ function generateSuperdocVersion(pid = 2, version = "0.13.0-next.4") {
23886
23886
  return {
23887
23887
  type: "element",
23888
23888
  name: "property",
@@ -1,4 +1,4 @@
1
- import { x as process$1, a1 as commonjsGlobal, B as Buffer, a2 as getDefaultExportFromCjs, a3 as getContentTypesFromXml, a4 as xmljs } from "./converter-DifQiKXL.js";
1
+ import { x as process$1, a1 as commonjsGlobal, B as Buffer, a2 as getDefaultExportFromCjs, a3 as getContentTypesFromXml, a4 as xmljs } from "./converter-IP9PazoB.js";
2
2
  function commonjsRequire(path) {
3
3
  throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
4
4
  }
@@ -12,9 +12,9 @@ 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, _commandService, _css, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, insertNewFileData_fn, registerPluginByNameIfNotExists_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, createSchema_fn, generatePmData_fn, createDocFromHTML_fn, createView_fn, onCollaborationReady_fn, initComments_fn, initPagination_fn, dispatchTransaction_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_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, c as callOrGet, i as isEmptyObject, S as Schema$1, T as TextSelection, b as canSplit, l as liftTarget, A as AllSelection, d as canJoin, j as joinPoint, N as NodeSelection, r as replaceStep$1, e as Selection, F as Fragment, R as ReplaceAroundStep, f as Slice, o as objectIncludes, g as deleteProps, D as DOMParser$1, h as ReplaceStep, k as NodeRange, m as findWrapping, n as isMacOS, p as isIOS, q as generateDocxRandomId, s as minMax, t as generateRandom32BitHex, u as DOMSerializer, v as Mark$1, w as dropPoint, x as process$1, B as Buffer2, y as isRegExp, z as TrackDeleteMarkName, C as TrackInsertMarkName, E as v4, G as TrackFormatMarkName, H as comments_module_events, I as AddMarkStep, J as RemoveMarkStep, K as twipsToLines, L as pixelsToTwips, O as SuperConverter, Q as EditorState, U as hasSomeParentWithClass, V as parseSizeUnit, W as getLineHeightValueString, X as toKebabCase, Y as kebabCase, Z as getColStyleDeclaration, _ as SelectionRange, $ as Transform, a0 as createColGroup } from "./converter-DifQiKXL.js";
15
+ import { P as PluginKey, a as Plugin, M as Mapping, c as callOrGet, i as isEmptyObject, S as Schema$1, T as TextSelection, b as canSplit, l as liftTarget, A as AllSelection, d as canJoin, j as joinPoint, N as NodeSelection, r as replaceStep$1, e as Selection, F as Fragment, R as ReplaceAroundStep, f as Slice, o as objectIncludes, g as deleteProps, D as DOMParser$1, h as ReplaceStep, k as NodeRange, m as findWrapping, n as isMacOS, p as isIOS, q as generateDocxRandomId, s as minMax, t as generateRandom32BitHex, u as DOMSerializer, v as Mark$1, w as dropPoint, x as process$1, B as Buffer2, y as isRegExp, z as TrackDeleteMarkName, C as TrackInsertMarkName, E as v4, G as TrackFormatMarkName, H as comments_module_events, I as AddMarkStep, J as RemoveMarkStep, K as twipsToLines, L as pixelsToTwips, O as SuperConverter, Q as EditorState, U as hasSomeParentWithClass, V as parseSizeUnit, W as getLineHeightValueString, X as toKebabCase, Y as kebabCase, Z as getColStyleDeclaration, _ as SelectionRange, $ as Transform, a0 as createColGroup } from "./converter-IP9PazoB.js";
16
16
  import { ref, computed, createElementBlock, openBlock, withModifiers, Fragment as Fragment$1, renderList, normalizeClass, createCommentVNode, toDisplayString, createElementVNode, createApp } from "vue";
17
- import { D as DocxZipper } from "./docx-zipper-0V4s80fa.js";
17
+ import { D as DocxZipper } from "./docx-zipper-CesiGAcg.js";
18
18
  function getMarksFromSelection(state) {
19
19
  const { from: from2, to, empty: empty2 } = state.selection;
20
20
  const marks = [];
@@ -13012,7 +13012,7 @@ const CommentsPlugin = Extension.create({
13012
13012
  if (isPaginationInit) shouldUpdate = true;
13013
13013
  const meta = tr.getMeta(CommentsPluginKey);
13014
13014
  const { type } = meta || {};
13015
- if (type === "force") shouldUpdate = true;
13015
+ if (type === "force" || type === "forceTrackChanges") shouldUpdate = true;
13016
13016
  if (!isPaginationInit && !shouldUpdate && meta && meta.decorations) {
13017
13017
  return {
13018
13018
  ...pluginState,
@@ -14895,7 +14895,7 @@ const _Editor = class _Editor extends EventEmitter {
14895
14895
  * @returns {Object | void} Migration results
14896
14896
  */
14897
14897
  processCollaborationMigrations() {
14898
- console.debug("[checkVersionMigrations] Current editor version", "0.13.0-next.3");
14898
+ console.debug("[checkVersionMigrations] Current editor version", "0.13.0-next.4");
14899
14899
  if (!this.options.ydoc) return;
14900
14900
  const metaMap = this.options.ydoc.getMap("meta");
14901
14901
  let docVersion = metaMap.get("version");
@@ -16728,6 +16728,9 @@ function orderedListSync(options = {}) {
16728
16728
  let { doc: doc2, tr } = newState;
16729
16729
  let listsBySyncId = {};
16730
16730
  doc2.descendants((node, pos) => {
16731
+ if (node.type.name === "paragraph") {
16732
+ return false;
16733
+ }
16731
16734
  if (node.type.name === "orderedList" && !!node.attrs.syncId) {
16732
16735
  let syncId = node.attrs.syncId;
16733
16736
  if (!listsBySyncId[syncId]) listsBySyncId[syncId] = [];
@@ -16857,6 +16860,9 @@ function getOrderedListItemsByList(state) {
16857
16860
  let { doc: doc2 } = state;
16858
16861
  let map2 = /* @__PURE__ */ new Map();
16859
16862
  doc2.descendants((node, pos) => {
16863
+ if (node.type.name === "paragraph") {
16864
+ return false;
16865
+ }
16860
16866
  let { attrs } = node;
16861
16867
  let isListItem = node.type.name === "listItem";
16862
16868
  let hasListLevel = !!attrs.listLevel?.length;
@@ -16877,6 +16883,9 @@ function getAllChildListItemsOfList({ state, list }) {
16877
16883
  let { doc: doc2 } = state;
16878
16884
  let allItems = [];
16879
16885
  doc2.descendants((node, pos) => {
16886
+ if (node.type.name === "paragraph") {
16887
+ return false;
16888
+ }
16880
16889
  let isListItem = node.type.name === "listItem";
16881
16890
  let $pos = doc2.resolve(pos);
16882
16891
  if (isListItem && $pos.parent === list) {
@@ -17252,7 +17261,15 @@ function getListMarkerDecorations(state, marks = []) {
17252
17261
  let { doc: doc2, storedMarks } = state;
17253
17262
  let decorations = [];
17254
17263
  if (Array.isArray(storedMarks)) marks.push(...storedMarks);
17255
- let listItems = findChildren$4(doc2, (node) => node.type.name === "listItem");
17264
+ let listItems = [];
17265
+ doc2.descendants((node, pos) => {
17266
+ if (node.type.name === "paragraph") {
17267
+ return false;
17268
+ }
17269
+ if (node.type.name === "listItem") {
17270
+ listItems.push({ node, pos });
17271
+ }
17272
+ });
17256
17273
  if (!listItems.length) {
17257
17274
  return decorations;
17258
17275
  }
@@ -17829,6 +17846,7 @@ const Paragraph = Node$1.create({
17829
17846
  return DecorationSet.create(state.doc, decorations);
17830
17847
  },
17831
17848
  apply(tr, oldDecorationSet, oldState, newState) {
17849
+ if (!tr.docChanged) return oldDecorationSet;
17832
17850
  const decorations = getDropcapDecorations(newState, view);
17833
17851
  return DecorationSet.create(newState.doc, decorations);
17834
17852
  }
@@ -17845,11 +17863,14 @@ const Paragraph = Node$1.create({
17845
17863
  const getDropcapDecorations = (state, view) => {
17846
17864
  let decorations = [];
17847
17865
  state.doc.descendants((node, pos) => {
17848
- if (node.attrs.dropcap?.type === "margin") {
17849
- const width = getDropcapWidth(view, pos);
17850
- decorations.push(
17851
- Decoration.inline(pos, pos + node.nodeSize, { style: `margin-left: -${width}px;` })
17852
- );
17866
+ if (node.type.name === "paragraph") {
17867
+ if (node.attrs.dropcap?.type === "margin") {
17868
+ const width = getDropcapWidth(view, pos);
17869
+ decorations.push(
17870
+ Decoration.inline(pos, pos + node.nodeSize, { style: `margin-left: -${width}px;` })
17871
+ );
17872
+ }
17873
+ return false;
17853
17874
  }
17854
17875
  });
17855
17876
  return decorations;
@@ -18085,6 +18106,7 @@ const TabNode = Node$1.create({
18085
18106
  return DecorationSet.create(state.doc, decorations);
18086
18107
  },
18087
18108
  apply(tr, oldDecorationSet, oldState, newState) {
18109
+ if (!tr.docChanged) return oldDecorationSet;
18088
18110
  const decorations = getTabDecorations(newState, view);
18089
18111
  return DecorationSet.create(newState.doc, decorations);
18090
18112
  }
@@ -22420,6 +22442,7 @@ const ImagePositionPlugin = ({ editor }) => {
22420
22442
  return DecorationSet.empty;
22421
22443
  },
22422
22444
  apply(tr, oldDecorationSet, oldState, newState) {
22445
+ if (!tr.docChanged) return oldDecorationSet;
22423
22446
  const decorations = getImagePositionDecorations(newState, view);
22424
22447
  return DecorationSet.create(newState.doc, decorations);
22425
22448
  }
@@ -1,6 +1,6 @@
1
1
  import { computed, createElementBlock, openBlock, createElementVNode, createCommentVNode, normalizeClass, normalizeStyle, ref, withKeys, unref, withModifiers, createBlock, toDisplayString, withDirectives, vModelText, getCurrentInstance, createVNode, readonly, watch, onMounted, onBeforeUnmount, reactive, onBeforeMount, inject, onActivated, onDeactivated, createTextVNode, Fragment, Comment, defineComponent, provide, h, Teleport, toRef, nextTick, renderSlot, isVNode, shallowRef, watchEffect, mergeProps, Transition, vShow, cloneVNode, Text, renderList, withCtx } from "vue";
2
- import { x as process$1 } from "./converter-DifQiKXL.js";
3
- import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-Cu6WivrX.js";
2
+ import { x as process$1 } from "./converter-IP9PazoB.js";
3
+ import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-2jdmUJVn.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 { O } from "./chunks/converter-DifQiKXL.js";
1
+ import { O } from "./chunks/converter-IP9PazoB.js";
2
2
  export {
3
3
  O as SuperConverter
4
4
  };
@@ -1,5 +1,5 @@
1
- import "./chunks/converter-DifQiKXL.js";
2
- import { D } from "./chunks/docx-zipper-0V4s80fa.js";
1
+ import "./chunks/converter-IP9PazoB.js";
2
+ import { D } from "./chunks/docx-zipper-CesiGAcg.js";
3
3
  export {
4
4
  D as default
5
5
  };
@@ -1,6 +1,6 @@
1
- import { E } from "./chunks/editor-Cu6WivrX.js";
2
- import "./chunks/converter-DifQiKXL.js";
3
- import "./chunks/docx-zipper-0V4s80fa.js";
1
+ import { E } from "./chunks/editor-2jdmUJVn.js";
2
+ import "./chunks/converter-IP9PazoB.js";
3
+ import "./chunks/docx-zipper-CesiGAcg.js";
4
4
  export {
5
5
  E as Editor
6
6
  };
@@ -1 +1 @@
1
- {"version":3,"file":"imagePositionPlugin.d.ts","sourceRoot":"","sources":["../../../../src/extensions/image/imageHelpers/imagePositionPlugin.js"],"names":[],"mappings":"AAKO;;0BAyCN;8BA7CyC,kBAAkB;uBAD1B,mBAAmB"}
1
+ {"version":3,"file":"imagePositionPlugin.d.ts","sourceRoot":"","sources":["../../../../src/extensions/image/imageHelpers/imagePositionPlugin.js"],"names":[],"mappings":"AAKO;;0BA0CN;8BA9CyC,kBAAkB;uBAD1B,mBAAmB"}
@@ -1 +1 @@
1
- {"version":3,"file":"orderedListSyncPlugin.d.ts","sourceRoot":"","sources":["../../../../src/extensions/ordered-list/helpers/orderedListSyncPlugin.js"],"names":[],"mappings":"AAEA;;GAEG;AACH,2DAoEC;AAED,mCAEC;uBA7EiC,mBAAmB"}
1
+ {"version":3,"file":"orderedListSyncPlugin.d.ts","sourceRoot":"","sources":["../../../../src/extensions/ordered-list/helpers/orderedListSyncPlugin.js"],"names":[],"mappings":"AAEA;;GAEG;AACH,2DAyEC;AAED,mCAEC;uBAlFiC,mBAAmB"}
@@ -1 +1 @@
1
- {"version":3,"file":"paragraph.d.ts","sourceRoot":"","sources":["../../../src/extensions/paragraph/paragraph.js"],"names":[],"mappings":"AAMA,4BAmJG"}
1
+ {"version":3,"file":"paragraph.d.ts","sourceRoot":"","sources":["../../../src/extensions/paragraph/paragraph.js"],"names":[],"mappings":"AAMA,4BAoJG"}
@@ -1 +1 @@
1
- {"version":3,"file":"tab.d.ts","sourceRoot":"","sources":["../../../src/extensions/tab/tab.js"],"names":[],"mappings":"AAIA,0BAiEG"}
1
+ {"version":3,"file":"tab.d.ts","sourceRoot":"","sources":["../../../src/extensions/tab/tab.js"],"names":[],"mappings":"AAIA,0BAkEG"}
@@ -1,4 +1,4 @@
1
- import { J as JSZip } from "./chunks/docx-zipper-0V4s80fa.js";
1
+ import { J as JSZip } from "./chunks/docx-zipper-CesiGAcg.js";
2
2
  async function createZip(blobs, fileNames) {
3
3
  const zip = new JSZip();
4
4
  blobs.forEach((blob, index) => {
@@ -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, runCommandWithArgumentOnly_fn;
12
- import { a2 as getDefaultExportFromCjs, E as v4, a5 as vClickOutside, T as TextSelection, a as Plugin } from "./chunks/converter-DifQiKXL.js";
13
- import { O } from "./chunks/converter-DifQiKXL.js";
14
- import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, f as findParentNode, c as getFileOpener, s as startImageUpload, d as getActiveFormatting, i as isInTable, e as undoDepth, r as redoDepth, E as Editor, h as getStarterExtensions, P as Placeholder, j as getRichTextExtensions, M as Mark, k as Extension, A as Attribute, N as Node } from "./chunks/editor-Cu6WivrX.js";
15
- import { o, C, T, m, q, p, l, n } from "./chunks/editor-Cu6WivrX.js";
12
+ import { a2 as getDefaultExportFromCjs, E as v4, a5 as vClickOutside, T as TextSelection, a as Plugin } from "./chunks/converter-IP9PazoB.js";
13
+ import { O } from "./chunks/converter-IP9PazoB.js";
14
+ import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, f as findParentNode, c as getFileOpener, s as startImageUpload, d as getActiveFormatting, i as isInTable, e as undoDepth, r as redoDepth, E as Editor, h as getStarterExtensions, P as Placeholder, j as getRichTextExtensions, M as Mark, k as Extension, A as Attribute, N as Node } from "./chunks/editor-2jdmUJVn.js";
15
+ import { o, C, T, m, q, p, l, n } from "./chunks/editor-2jdmUJVn.js";
16
16
  import { ref, onMounted, createElementBlock, openBlock, normalizeClass, unref, Fragment, renderList, createElementVNode, withModifiers, getCurrentInstance, computed, watch, createCommentVNode, withDirectives, withKeys, vModelText, createTextVNode, toDisplayString, normalizeStyle, createVNode, h, createApp, reactive, onUnmounted, shallowRef, onBeforeUnmount, createBlock } from "vue";
17
- import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, N as NSkeleton } from "./chunks/toolbar-VX_23hqe.js";
17
+ import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, N as NSkeleton } from "./chunks/toolbar-BwVRLL78.js";
18
18
  import AIWriter from "./ai-writer.es.js";
19
- import { D } from "./chunks/docx-zipper-0V4s80fa.js";
19
+ import { D } from "./chunks/docx-zipper-CesiGAcg.js";
20
20
  import { createZip } from "./file-zipper.es.js";
21
21
  var eventemitter3 = { exports: {} };
22
22
  (function(module) {
@@ -1,6 +1,6 @@
1
1
  import "vue";
2
- import { T } from "./chunks/toolbar-VX_23hqe.js";
3
- import "./chunks/editor-Cu6WivrX.js";
2
+ import { T } from "./chunks/toolbar-BwVRLL78.js";
3
+ import "./chunks/editor-2jdmUJVn.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-C1r2fKvd.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-C8bnXrNN.cjs");
4
4
  require("./chunks/vue-HIY1g7dm.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, T, f, g, i, h, j, k, l, m, n, o } from "./chunks/super-editor.es-CaiAvJmI.es.js";
1
+ import { A, a, _, C, D, E, b, S, c, d, e, T, f, g, i, h, j, k, l, m, n, o } from "./chunks/super-editor.es-BLihY9I3.es.js";
2
2
  import "./chunks/vue-Bi1uWinj.es.js";
3
3
  export {
4
4
  A as AIWriter,
package/dist/superdoc.cjs CHANGED
@@ -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-C1r2fKvd.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-C8bnXrNN.cjs");
4
4
  const vue = require("./chunks/vue-HIY1g7dm.cjs");
5
5
  const jszip = require("./chunks/jszip-BTAcmbVg.cjs");
6
6
  const blankDocx = require("./chunks/blank-docx-CPqX9RF5.cjs");
@@ -4351,14 +4351,29 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
4351
4351
  });
4352
4352
  addComment({ superdoc: superdoc2, comment: newComment });
4353
4353
  });
4354
- const trackedChanges = superEditor_es.index.getTrackChanges(editor.state);
4355
- trackedChanges.forEach(({ mark }) => {
4354
+ setTimeout(() => {
4355
+ createCommentForTrackChanges(editor);
4356
+ }, 0);
4357
+ };
4358
+ const createCommentForTrackChanges = (editor) => {
4359
+ let trackedChanges = superEditor_es.index.getTrackChanges(editor.state);
4360
+ let isLargeDoc = editor.state.doc.nodeSize >= 1e5;
4361
+ if (isLargeDoc && trackedChanges.length) {
4362
+ trackedChanges = trackedChanges.slice(0, 100);
4363
+ }
4364
+ trackedChanges.forEach(({ mark }, index2) => {
4365
+ console.debug(`Create comment for track change: ${index2}`);
4366
+ const { dispatch } = editor.view;
4367
+ const { tr } = editor.view.state;
4356
4368
  const foundComment = commentsList.value.find((i) => i.commentId === mark.attrs.id);
4369
+ const isLastIteration = trackedChanges.length === index2 + 1;
4357
4370
  if (foundComment) {
4371
+ if (isLastIteration) {
4372
+ tr.setMeta(superEditor_es.CommentsPluginKey, { type: "force" });
4373
+ dispatch(tr);
4374
+ }
4358
4375
  return;
4359
4376
  }
4360
- const { dispatch } = editor.view;
4361
- const { tr } = editor.view.state;
4362
4377
  const markMetaKeys = {
4363
4378
  trackInsert: "insertedMark",
4364
4379
  trackDelete: "deletionMark",
@@ -4366,7 +4381,8 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
4366
4381
  };
4367
4382
  const markKeyName = markMetaKeys[mark.type.name];
4368
4383
  if (markKeyName) {
4369
- tr.setMeta(superEditor_es.CommentsPluginKey, { type: "force" });
4384
+ if (isLastIteration) tr.setMeta(superEditor_es.CommentsPluginKey, { type: "force" });
4385
+ tr.setMeta(superEditor_es.CommentsPluginKey, { type: "forceTrackChanges" });
4370
4386
  tr.setMeta(superEditor_es.TrackChangesBasePluginKey, { [markKeyName]: mark });
4371
4387
  dispatch(tr);
4372
4388
  }
@@ -47790,7 +47806,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
47790
47806
  this.config.colors = shuffleArray(this.config.colors);
47791
47807
  this.userColorMap = /* @__PURE__ */ new Map();
47792
47808
  this.colorIndex = 0;
47793
- this.version = "0.13.0-next.3";
47809
+ this.version = "0.13.0-next.4";
47794
47810
  console.debug("🦋 [superdoc] Using SuperDoc version:", this.version);
47795
47811
  this.superdocId = config.superdocId || uuid.v4();
47796
47812
  this.colors = this.config.colors;