@harbour-enterprises/superdoc 0.12.35 → 0.12.36-next.2

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.
@@ -22038,12 +22038,7 @@ const getParagraphIndent = (node2, docx, styleId = "") => {
22038
22038
  return indent;
22039
22039
  };
22040
22040
  const getParagraphSpacing = (node2, docx, styleId = "", marks = []) => {
22041
- const spacing = {
22042
- lineSpaceAfter: 0,
22043
- lineSpaceBefore: 0,
22044
- line: 0,
22045
- lineRule: null
22046
- };
22041
+ const spacing = {};
22047
22042
  const { spacing: pDefaultSpacing = {} } = getDefaultParagraphStyle(docx, styleId);
22048
22043
  let lineSpaceAfter, lineSpaceBefore, line, lineRuleStyle;
22049
22044
  const pPr = node2.elements?.find((el) => el.name === "w:pPr");
@@ -23292,7 +23287,7 @@ const _SuperConverter = class _SuperConverter2 {
23292
23287
  return;
23293
23288
  }
23294
23289
  }
23295
- static updateDocumentVersion(docx = this.convertedXml, version2 = "0.12.35") {
23290
+ static updateDocumentVersion(docx = this.convertedXml, version2 = "0.12.36-next.2") {
23296
23291
  const customLocation = "docProps/custom.xml";
23297
23292
  if (!docx[customLocation]) {
23298
23293
  docx[customLocation] = generateCustomXml();
@@ -23759,7 +23754,7 @@ function storeSuperdocVersion(docx) {
23759
23754
  function generateCustomXml() {
23760
23755
  return DEFAULT_CUSTOM_XML;
23761
23756
  }
23762
- function generateSuperdocVersion(pid = 2, version2 = "0.12.35") {
23757
+ function generateSuperdocVersion(pid = 2, version2 = "0.12.36-next.2") {
23763
23758
  return {
23764
23759
  type: "element",
23765
23760
  name: "property",
@@ -40219,6 +40214,43 @@ const deleteHeaderFooterFieldAnnotations = ({ editor, fieldIdOrArray }) => {
40219
40214
  );
40220
40215
  });
40221
40216
  };
40217
+ const cleanUpListsWithAnnotations = (fieldsToDelete = [], editor) => {
40218
+ if (!Array.isArray(fieldsToDelete)) fieldsToDelete = [fieldsToDelete];
40219
+ const { doc: doc2 } = editor.state;
40220
+ const docxAnnotations = getAllFieldAnnotations(editor.state) || [];
40221
+ const nodesToDelete = [];
40222
+ fieldsToDelete.forEach((fieldId) => {
40223
+ const matched = docxAnnotations.find((a) => a.node.attrs.fieldId === fieldId);
40224
+ if (!matched) return;
40225
+ const listItem = findParentNodeClosestToPos(
40226
+ doc2.resolve(matched.pos),
40227
+ (node22) => node22.type.name === "listItem"
40228
+ );
40229
+ if (!listItem) return;
40230
+ let { pos, node: node2, depth } = listItem;
40231
+ let $pos = doc2.resolve(pos);
40232
+ while (depth > 0) {
40233
+ const parent = $pos.node(depth - 1);
40234
+ if (parent.childCount === 1) {
40235
+ depth -= 1;
40236
+ pos = $pos.before(depth);
40237
+ node2 = parent;
40238
+ $pos = doc2.resolve(pos);
40239
+ } else {
40240
+ break;
40241
+ }
40242
+ }
40243
+ if (!nodesToDelete.some((n) => n.pos === pos)) {
40244
+ nodesToDelete.push({ pos, node: node2 });
40245
+ }
40246
+ });
40247
+ if (!nodesToDelete.length) return;
40248
+ const tr = editor.state.tr;
40249
+ nodesToDelete.sort((a, b) => b.pos - a.pos).forEach(({ pos, node: node2 }) => {
40250
+ tr.delete(pos, pos + node2.nodeSize);
40251
+ });
40252
+ editor.view.dispatch(tr);
40253
+ };
40222
40254
  const AnnotatorHelpers = {
40223
40255
  getFieldAttrs,
40224
40256
  processTables,
@@ -40226,7 +40258,8 @@ const AnnotatorHelpers = {
40226
40258
  annotateHeadersAndFooters,
40227
40259
  getAllHeaderFooterEditors,
40228
40260
  updateHeaderFooterFieldAnnotations,
40229
- deleteHeaderFooterFieldAnnotations
40261
+ deleteHeaderFooterFieldAnnotations,
40262
+ cleanUpListsWithAnnotations
40230
40263
  };
40231
40264
  const CollaborationPluginKey = new PluginKey("collaboration");
40232
40265
  const Collaboration = Extension.create({
@@ -41036,7 +41069,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
41036
41069
  * @returns {Object | void} Migration results
41037
41070
  */
41038
41071
  processCollaborationMigrations() {
41039
- console.debug("[checkVersionMigrations] Current editor version", "0.12.35");
41072
+ console.debug("[checkVersionMigrations] Current editor version", "0.12.36-next.2");
41040
41073
  if (!this.options.ydoc) return;
41041
41074
  const metaMap = this.options.ydoc.getMap("meta");
41042
41075
  let docVersion = metaMap.get("version");
@@ -22055,12 +22055,7 @@ const getParagraphIndent = (node2, docx, styleId = "") => {
22055
22055
  return indent;
22056
22056
  };
22057
22057
  const getParagraphSpacing = (node2, docx, styleId = "", marks = []) => {
22058
- const spacing = {
22059
- lineSpaceAfter: 0,
22060
- lineSpaceBefore: 0,
22061
- line: 0,
22062
- lineRule: null
22063
- };
22058
+ const spacing = {};
22064
22059
  const { spacing: pDefaultSpacing = {} } = getDefaultParagraphStyle(docx, styleId);
22065
22060
  let lineSpaceAfter, lineSpaceBefore, line, lineRuleStyle;
22066
22061
  const pPr = node2.elements?.find((el) => el.name === "w:pPr");
@@ -23309,7 +23304,7 @@ const _SuperConverter = class _SuperConverter2 {
23309
23304
  return;
23310
23305
  }
23311
23306
  }
23312
- static updateDocumentVersion(docx = this.convertedXml, version2 = "0.12.35") {
23307
+ static updateDocumentVersion(docx = this.convertedXml, version2 = "0.12.36-next.2") {
23313
23308
  const customLocation = "docProps/custom.xml";
23314
23309
  if (!docx[customLocation]) {
23315
23310
  docx[customLocation] = generateCustomXml();
@@ -23776,7 +23771,7 @@ function storeSuperdocVersion(docx) {
23776
23771
  function generateCustomXml() {
23777
23772
  return DEFAULT_CUSTOM_XML;
23778
23773
  }
23779
- function generateSuperdocVersion(pid = 2, version2 = "0.12.35") {
23774
+ function generateSuperdocVersion(pid = 2, version2 = "0.12.36-next.2") {
23780
23775
  return {
23781
23776
  type: "element",
23782
23777
  name: "property",
@@ -40236,6 +40231,43 @@ const deleteHeaderFooterFieldAnnotations = ({ editor, fieldIdOrArray }) => {
40236
40231
  );
40237
40232
  });
40238
40233
  };
40234
+ const cleanUpListsWithAnnotations = (fieldsToDelete = [], editor) => {
40235
+ if (!Array.isArray(fieldsToDelete)) fieldsToDelete = [fieldsToDelete];
40236
+ const { doc: doc2 } = editor.state;
40237
+ const docxAnnotations = getAllFieldAnnotations(editor.state) || [];
40238
+ const nodesToDelete = [];
40239
+ fieldsToDelete.forEach((fieldId) => {
40240
+ const matched = docxAnnotations.find((a) => a.node.attrs.fieldId === fieldId);
40241
+ if (!matched) return;
40242
+ const listItem = findParentNodeClosestToPos(
40243
+ doc2.resolve(matched.pos),
40244
+ (node22) => node22.type.name === "listItem"
40245
+ );
40246
+ if (!listItem) return;
40247
+ let { pos, node: node2, depth } = listItem;
40248
+ let $pos = doc2.resolve(pos);
40249
+ while (depth > 0) {
40250
+ const parent = $pos.node(depth - 1);
40251
+ if (parent.childCount === 1) {
40252
+ depth -= 1;
40253
+ pos = $pos.before(depth);
40254
+ node2 = parent;
40255
+ $pos = doc2.resolve(pos);
40256
+ } else {
40257
+ break;
40258
+ }
40259
+ }
40260
+ if (!nodesToDelete.some((n) => n.pos === pos)) {
40261
+ nodesToDelete.push({ pos, node: node2 });
40262
+ }
40263
+ });
40264
+ if (!nodesToDelete.length) return;
40265
+ const tr = editor.state.tr;
40266
+ nodesToDelete.sort((a, b) => b.pos - a.pos).forEach(({ pos, node: node2 }) => {
40267
+ tr.delete(pos, pos + node2.nodeSize);
40268
+ });
40269
+ editor.view.dispatch(tr);
40270
+ };
40239
40271
  const AnnotatorHelpers = {
40240
40272
  getFieldAttrs,
40241
40273
  processTables,
@@ -40243,7 +40275,8 @@ const AnnotatorHelpers = {
40243
40275
  annotateHeadersAndFooters,
40244
40276
  getAllHeaderFooterEditors,
40245
40277
  updateHeaderFooterFieldAnnotations,
40246
- deleteHeaderFooterFieldAnnotations
40278
+ deleteHeaderFooterFieldAnnotations,
40279
+ cleanUpListsWithAnnotations
40247
40280
  };
40248
40281
  const CollaborationPluginKey = new PluginKey("collaboration");
40249
40282
  const Collaboration = Extension.create({
@@ -41053,7 +41086,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
41053
41086
  * @returns {Object | void} Migration results
41054
41087
  */
41055
41088
  processCollaborationMigrations() {
41056
- console.debug("[checkVersionMigrations] Current editor version", "0.12.35");
41089
+ console.debug("[checkVersionMigrations] Current editor version", "0.12.36-next.2");
41057
41090
  if (!this.options.ydoc) return;
41058
41091
  const metaMap = this.options.ydoc.getMap("meta");
41059
41092
  let docVersion = metaMap.get("version");
@@ -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-DQPyKWs_.js";
3
- import { _ as _export_sfc } from "./chunks/editor-B5TyAe8v.js";
2
+ import { T as TextSelection } from "./chunks/converter-C5gjeYUR.js";
3
+ import { _ as _export_sfc } from "./chunks/editor-DNTrx0IA.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 = {}) {
@@ -22057,12 +22057,7 @@ const getParagraphIndent = (node2, docx, styleId = "") => {
22057
22057
  return indent;
22058
22058
  };
22059
22059
  const getParagraphSpacing = (node2, docx, styleId = "", marks = []) => {
22060
- const spacing = {
22061
- lineSpaceAfter: 0,
22062
- lineSpaceBefore: 0,
22063
- line: 0,
22064
- lineRule: null
22065
- };
22060
+ const spacing = {};
22066
22061
  const { spacing: pDefaultSpacing = {} } = getDefaultParagraphStyle(docx, styleId);
22067
22062
  let lineSpaceAfter, lineSpaceBefore, line, lineRuleStyle;
22068
22063
  const pPr = node2.elements?.find((el) => el.name === "w:pPr");
@@ -23311,7 +23306,7 @@ const _SuperConverter = class _SuperConverter {
23311
23306
  return;
23312
23307
  }
23313
23308
  }
23314
- static updateDocumentVersion(docx = this.convertedXml, version = "0.12.35") {
23309
+ static updateDocumentVersion(docx = this.convertedXml, version = "0.12.36-next.2") {
23315
23310
  const customLocation = "docProps/custom.xml";
23316
23311
  if (!docx[customLocation]) {
23317
23312
  docx[customLocation] = generateCustomXml();
@@ -23781,7 +23776,7 @@ function storeSuperdocVersion(docx) {
23781
23776
  function generateCustomXml() {
23782
23777
  return DEFAULT_CUSTOM_XML;
23783
23778
  }
23784
- function generateSuperdocVersion(pid = 2, version = "0.12.35") {
23779
+ function generateSuperdocVersion(pid = 2, version = "0.12.36-next.2") {
23785
23780
  return {
23786
23781
  type: "element",
23787
23782
  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-DQPyKWs_.js";
1
+ import { x as process$1, a1 as commonjsGlobal, B as Buffer, a2 as getDefaultExportFromCjs, a3 as getContentTypesFromXml, a4 as xmljs } from "./converter-C5gjeYUR.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;
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-DQPyKWs_.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-C5gjeYUR.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-cJ42om_0.js";
17
+ import { D as DocxZipper } from "./docx-zipper-BepmAdiY.js";
18
18
  function getMarksFromSelection(state) {
19
19
  const { from: from2, to, empty: empty2 } = state.selection;
20
20
  const marks = [];
@@ -13950,6 +13950,43 @@ const deleteHeaderFooterFieldAnnotations = ({ editor, fieldIdOrArray }) => {
13950
13950
  );
13951
13951
  });
13952
13952
  };
13953
+ const cleanUpListsWithAnnotations = (fieldsToDelete = [], editor) => {
13954
+ if (!Array.isArray(fieldsToDelete)) fieldsToDelete = [fieldsToDelete];
13955
+ const { doc: doc2 } = editor.state;
13956
+ const docxAnnotations = getAllFieldAnnotations(editor.state) || [];
13957
+ const nodesToDelete = [];
13958
+ fieldsToDelete.forEach((fieldId) => {
13959
+ const matched = docxAnnotations.find((a) => a.node.attrs.fieldId === fieldId);
13960
+ if (!matched) return;
13961
+ const listItem = findParentNodeClosestToPos(
13962
+ doc2.resolve(matched.pos),
13963
+ (node2) => node2.type.name === "listItem"
13964
+ );
13965
+ if (!listItem) return;
13966
+ let { pos, node, depth } = listItem;
13967
+ let $pos = doc2.resolve(pos);
13968
+ while (depth > 0) {
13969
+ const parent = $pos.node(depth - 1);
13970
+ if (parent.childCount === 1) {
13971
+ depth -= 1;
13972
+ pos = $pos.before(depth);
13973
+ node = parent;
13974
+ $pos = doc2.resolve(pos);
13975
+ } else {
13976
+ break;
13977
+ }
13978
+ }
13979
+ if (!nodesToDelete.some((n) => n.pos === pos)) {
13980
+ nodesToDelete.push({ pos, node });
13981
+ }
13982
+ });
13983
+ if (!nodesToDelete.length) return;
13984
+ const tr = editor.state.tr;
13985
+ nodesToDelete.sort((a, b) => b.pos - a.pos).forEach(({ pos, node }) => {
13986
+ tr.delete(pos, pos + node.nodeSize);
13987
+ });
13988
+ editor.view.dispatch(tr);
13989
+ };
13953
13990
  const AnnotatorHelpers = {
13954
13991
  getFieldAttrs,
13955
13992
  processTables,
@@ -13957,7 +13994,8 @@ const AnnotatorHelpers = {
13957
13994
  annotateHeadersAndFooters,
13958
13995
  getAllHeaderFooterEditors,
13959
13996
  updateHeaderFooterFieldAnnotations,
13960
- deleteHeaderFooterFieldAnnotations
13997
+ deleteHeaderFooterFieldAnnotations,
13998
+ cleanUpListsWithAnnotations
13961
13999
  };
13962
14000
  const CollaborationPluginKey = new PluginKey("collaboration");
13963
14001
  const Collaboration = Extension.create({
@@ -14795,7 +14833,7 @@ const _Editor = class _Editor extends EventEmitter {
14795
14833
  * @returns {Object | void} Migration results
14796
14834
  */
14797
14835
  processCollaborationMigrations() {
14798
- console.debug("[checkVersionMigrations] Current editor version", "0.12.35");
14836
+ console.debug("[checkVersionMigrations] Current editor version", "0.12.36-next.2");
14799
14837
  if (!this.options.ydoc) return;
14800
14838
  const metaMap = this.options.ydoc.getMap("meta");
14801
14839
  let docVersion = metaMap.get("version");
@@ -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-DQPyKWs_.js";
3
- import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-B5TyAe8v.js";
2
+ import { x as process$1 } from "./converter-C5gjeYUR.js";
3
+ import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-DNTrx0IA.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-DQPyKWs_.js";
1
+ import { O } from "./chunks/converter-C5gjeYUR.js";
2
2
  export {
3
3
  O as SuperConverter
4
4
  };
@@ -12,6 +12,7 @@ export function annotateDocument({ annotationValues, hiddenFieldIds, removeEmpty
12
12
  tr: any;
13
13
  editor: any;
14
14
  }): any;
15
+ export function cleanUpListsWithAnnotations(fieldsToDelete: any[], editor: any): void;
15
16
  export namespace AnnotatorHelpers {
16
17
  export { getFieldAttrs };
17
18
  export { processTables };
@@ -20,6 +21,7 @@ export namespace AnnotatorHelpers {
20
21
  export { getAllHeaderFooterEditors };
21
22
  export { updateHeaderFooterFieldAnnotations };
22
23
  export { deleteHeaderFooterFieldAnnotations };
24
+ export { cleanUpListsWithAnnotations };
23
25
  }
24
26
  /**
25
27
  * Annotate headers and footers in the document
@@ -1 +1 @@
1
- {"version":3,"file":"annotator.d.ts","sourceRoot":"","sources":["../../../src/core/helpers/annotator.js"],"names":[],"mappings":"AAWO,uEAiBN;AAiCM,+DAHJ;IAAuB,MAAM;IACP,gBAAgB;CACxC,OAkBA;AA8FM,kDAHI,MAAM,GACJ,KAAQ,CAsCpB;AAwBM;;;;;;;QAyFN;;;;;;;;;;AA/GD;;;;;;;;GAQG;AACH,4GALG;IAAuB,MAAM;IACP,gBAAgB;IAChB,cAAc;CACpC,GAAU,IAAI,CAahB;AAuHD;;;;SAeC;AAED;;;SAeC"}
1
+ {"version":3,"file":"annotator.d.ts","sourceRoot":"","sources":["../../../src/core/helpers/annotator.js"],"names":[],"mappings":"AAYO,uEAiBN;AAiCM,+DAHJ;IAAuB,MAAM;IACP,gBAAgB;CACxC,OAkBA;AA8FM,kDAHI,MAAM,GACJ,KAAQ,CAsCpB;AAwBM;;;;;;;QAyFN;AA+DM,sFAoDN;;;;;;;;;;;AAlOD;;;;;;;;GAQG;AACH,4GALG;IAAuB,MAAM;IACP,gBAAgB;IAChB,cAAc;CACpC,GAAU,IAAI,CAahB;AAuHD;;;;SAeC;AAED;;;SAgBC"}
@@ -54,10 +54,10 @@ export function getParagraphIndent(node: any, docx: any, styleId?: string): {
54
54
  textIndent: number;
55
55
  };
56
56
  export function getParagraphSpacing(node: any, docx: any, styleId?: string, marks?: any[]): {
57
- lineSpaceAfter: number;
58
- lineSpaceBefore: number;
59
- line: number;
57
+ line: string | number;
60
58
  lineRule: any;
59
+ lineSpaceBefore: number;
60
+ lineSpaceAfter: number;
61
61
  };
62
62
  /**
63
63
  * @type {import("docxImporter").NodeHandlerEntry}
@@ -1 +1 @@
1
- {"version":3,"file":"paragraphNodeImporter.d.ts","sourceRoot":"","sources":["../../../../../src/core/super-converter/v2/importer/paragraphNodeImporter.js"],"names":[],"mappings":"AA0SA;;;GAGG;AACH,0DAHW,MAAM,QACN,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;EAuGpB;AAED;;;;;;GAMG;AACH,kDAHW,OAAO,EAAE,SA4CnB;AA9bD;;;;;;;GAOG;AACH,sCAqIE;AAEK;;;;;;EAwCN;AAEM;;;;;EAkDN;AAgDD;;GAEG;AACH,6CAGE"}
1
+ {"version":3,"file":"paragraphNodeImporter.d.ts","sourceRoot":"","sources":["../../../../../src/core/super-converter/v2/importer/paragraphNodeImporter.js"],"names":[],"mappings":"AAqSA;;;GAGG;AACH,0DAHW,MAAM,QACN,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;EAuGpB;AAED;;;;;;GAMG;AACH,kDAHW,OAAO,EAAE,SA4CnB;AAzbD;;;;;;;GAOG;AACH,sCAqIE;AAEK;;;;;;EAwCN;AAEM;;;;;EA6CN;AAgDD;;GAEG;AACH,6CAGE"}
@@ -1,5 +1,5 @@
1
- import "./chunks/converter-DQPyKWs_.js";
2
- import { D } from "./chunks/docx-zipper-cJ42om_0.js";
1
+ import "./chunks/converter-C5gjeYUR.js";
2
+ import { D } from "./chunks/docx-zipper-BepmAdiY.js";
3
3
  export {
4
4
  D as default
5
5
  };
@@ -1,6 +1,6 @@
1
- import { E } from "./chunks/editor-B5TyAe8v.js";
2
- import "./chunks/converter-DQPyKWs_.js";
3
- import "./chunks/docx-zipper-cJ42om_0.js";
1
+ import { E } from "./chunks/editor-DNTrx0IA.js";
2
+ import "./chunks/converter-C5gjeYUR.js";
3
+ import "./chunks/docx-zipper-BepmAdiY.js";
4
4
  export {
5
5
  E as Editor
6
6
  };
@@ -1,4 +1,4 @@
1
- import { J as JSZip } from "./chunks/docx-zipper-cJ42om_0.js";
1
+ import { J as JSZip } from "./chunks/docx-zipper-BepmAdiY.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 { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, I as ImagePlaceholderPluginKey, f as findPlaceholder, c as findParentNode, 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-B5TyAe8v.js";
13
- import { o, C, T, m, p, l, n } from "./chunks/editor-B5TyAe8v.js";
14
- import { a2 as getDefaultExportFromCjs, E as v4, a5 as vClickOutside, T as TextSelection, a as Plugin } from "./chunks/converter-DQPyKWs_.js";
15
- import { O } from "./chunks/converter-DQPyKWs_.js";
12
+ import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, I as ImagePlaceholderPluginKey, f as findPlaceholder, c as findParentNode, 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-DNTrx0IA.js";
13
+ import { o, C, T, m, p, l, n } from "./chunks/editor-DNTrx0IA.js";
14
+ import { a2 as getDefaultExportFromCjs, E as v4, a5 as vClickOutside, T as TextSelection, a as Plugin } from "./chunks/converter-C5gjeYUR.js";
15
+ import { O } from "./chunks/converter-C5gjeYUR.js";
16
16
  import { ref, createElementBlock, openBlock, normalizeClass, unref, createElementVNode, getCurrentInstance, computed, watch, onMounted, createCommentVNode, withDirectives, withKeys, withModifiers, vModelText, createTextVNode, toDisplayString, Fragment, renderList, 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-CDeO5r_T.js";
17
+ import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, N as NSkeleton } from "./chunks/toolbar-CJjamz6y.js";
18
18
  import AIWriter from "./ai-writer.es.js";
19
- import { D } from "./chunks/docx-zipper-cJ42om_0.js";
19
+ import { D } from "./chunks/docx-zipper-BepmAdiY.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-CDeO5r_T.js";
3
- import "./chunks/editor-B5TyAe8v.js";
2
+ import { T } from "./chunks/toolbar-CJjamz6y.js";
3
+ import "./chunks/editor-DNTrx0IA.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-B4SPMXXo.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-aBzjShYE.cjs");
4
4
  require("./chunks/vue-DPZkajuO.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-D8BL6ojY.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-B-Ph0oqq.es.js";
2
2
  import "./chunks/vue-IIIZMHTg.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-B4SPMXXo.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-aBzjShYE.cjs");
4
4
  const vue = require("./chunks/vue-DPZkajuO.cjs");
5
5
  const jszip = require("./chunks/jszip-Bwu_om3F.cjs");
6
6
  const blankDocx = require("./chunks/blank-docx-CPqX9RF5.cjs");
@@ -46571,7 +46571,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
46571
46571
  this.config.colors = shuffleArray(this.config.colors);
46572
46572
  this.userColorMap = /* @__PURE__ */ new Map();
46573
46573
  this.colorIndex = 0;
46574
- this.version = "0.12.35";
46574
+ this.version = "0.12.36-next.2";
46575
46575
  console.debug("🦋 [superdoc] Using SuperDoc version:", this.version);
46576
46576
  this.superdocId = config.superdocId || uuid.v4();
46577
46577
  this.colors = this.config.colors;
@@ -1,5 +1,5 @@
1
- import { o as index$1, C as CommentsPluginKey, f as TrackChangesBasePluginKey, E as Editor, l as getRichTextExtensions, d as SuperInput, A as AIWriter, c as SuperEditor, e as SuperToolbar, g as createZip } from "./chunks/super-editor.es-D8BL6ojY.es.js";
2
- import { a, S, i, n } from "./chunks/super-editor.es-D8BL6ojY.es.js";
1
+ import { o as index$1, C as CommentsPluginKey, f as TrackChangesBasePluginKey, E as Editor, l as getRichTextExtensions, d as SuperInput, A as AIWriter, c as SuperEditor, e as SuperToolbar, g as createZip } from "./chunks/super-editor.es-B-Ph0oqq.es.js";
2
+ import { a, S, i, n } from "./chunks/super-editor.es-B-Ph0oqq.es.js";
3
3
  import { Y as effectScope, r as ref, Z as markRaw, p as process$1, _ as toRaw, a as computed, $ as isRef, a0 as isReactive, D as toRef, i as inject, q as getCurrentInstance, l as watch, y as unref, a1 as hasInjectionContext, N as reactive, u as nextTick, a2 as getCurrentScope, a3 as onScopeDispose, a4 as toRefs, g as global$1, K as shallowRef, O as readonly, j as onMounted, k as onBeforeUnmount, h as onBeforeMount, U as onActivated, s as onDeactivated, A as createTextVNode, F as Fragment, R as Comment, m as defineComponent, E as provide, I as withDirectives, C as h, V as Teleport, S as renderSlot, W as isVNode, J as watchEffect, P as Transition, G as mergeProps, Q as vShow, H as cloneVNode, T as Text, b as createElementBlock, o as openBlock, t as toDisplayString, x as createVNode, z as withCtx, f as createBaseVNode, B as normalizeStyle, e as createCommentVNode, v as createBlock, w as withModifiers, n as normalizeClass, a5 as resolveDirective, d as renderList, c as createApp, X as onUnmounted, a6 as resolveDynamicComponent } from "./chunks/vue-IIIZMHTg.es.js";
4
4
  import { B as Buffer$2 } from "./chunks/jszip-BmWWPxfF.es.js";
5
5
  import { B as BlankDOCX } from "./chunks/blank-docx-iwdyG9RH.es.js";
@@ -46570,7 +46570,7 @@ class SuperDoc extends EventEmitter {
46570
46570
  this.config.colors = shuffleArray(this.config.colors);
46571
46571
  this.userColorMap = /* @__PURE__ */ new Map();
46572
46572
  this.colorIndex = 0;
46573
- this.version = "0.12.35";
46573
+ this.version = "0.12.36-next.2";
46574
46574
  console.debug("🦋 [superdoc] Using SuperDoc version:", this.version);
46575
46575
  this.superdocId = config.superdocId || v4();
46576
46576
  this.colors = this.config.colors;
@@ -29415,12 +29415,7 @@
29415
29415
  return indent;
29416
29416
  };
29417
29417
  const getParagraphSpacing = (node2, docx, styleId = "", marks = []) => {
29418
- const spacing = {
29419
- lineSpaceAfter: 0,
29420
- lineSpaceBefore: 0,
29421
- line: 0,
29422
- lineRule: null
29423
- };
29418
+ const spacing = {};
29424
29419
  const { spacing: pDefaultSpacing = {} } = getDefaultParagraphStyle(docx, styleId);
29425
29420
  let lineSpaceAfter, lineSpaceBefore, line, lineRuleStyle;
29426
29421
  const pPr = node2.elements?.find((el) => el.name === "w:pPr");
@@ -30669,7 +30664,7 @@
30669
30664
  return;
30670
30665
  }
30671
30666
  }
30672
- static updateDocumentVersion(docx = this.convertedXml, version2 = "0.12.35") {
30667
+ static updateDocumentVersion(docx = this.convertedXml, version2 = "0.12.36-next.2") {
30673
30668
  const customLocation = "docProps/custom.xml";
30674
30669
  if (!docx[customLocation]) {
30675
30670
  docx[customLocation] = generateCustomXml();
@@ -31136,7 +31131,7 @@
31136
31131
  function generateCustomXml() {
31137
31132
  return DEFAULT_CUSTOM_XML;
31138
31133
  }
31139
- function generateSuperdocVersion(pid = 2, version2 = "0.12.35") {
31134
+ function generateSuperdocVersion(pid = 2, version2 = "0.12.36-next.2") {
31140
31135
  return {
31141
31136
  type: "element",
31142
31137
  name: "property",
@@ -47596,6 +47591,43 @@
47596
47591
  );
47597
47592
  });
47598
47593
  };
47594
+ const cleanUpListsWithAnnotations = (fieldsToDelete = [], editor) => {
47595
+ if (!Array.isArray(fieldsToDelete)) fieldsToDelete = [fieldsToDelete];
47596
+ const { doc: doc2 } = editor.state;
47597
+ const docxAnnotations = getAllFieldAnnotations(editor.state) || [];
47598
+ const nodesToDelete = [];
47599
+ fieldsToDelete.forEach((fieldId) => {
47600
+ const matched = docxAnnotations.find((a) => a.node.attrs.fieldId === fieldId);
47601
+ if (!matched) return;
47602
+ const listItem = findParentNodeClosestToPos(
47603
+ doc2.resolve(matched.pos),
47604
+ (node22) => node22.type.name === "listItem"
47605
+ );
47606
+ if (!listItem) return;
47607
+ let { pos, node: node2, depth } = listItem;
47608
+ let $pos = doc2.resolve(pos);
47609
+ while (depth > 0) {
47610
+ const parent = $pos.node(depth - 1);
47611
+ if (parent.childCount === 1) {
47612
+ depth -= 1;
47613
+ pos = $pos.before(depth);
47614
+ node2 = parent;
47615
+ $pos = doc2.resolve(pos);
47616
+ } else {
47617
+ break;
47618
+ }
47619
+ }
47620
+ if (!nodesToDelete.some((n) => n.pos === pos)) {
47621
+ nodesToDelete.push({ pos, node: node2 });
47622
+ }
47623
+ });
47624
+ if (!nodesToDelete.length) return;
47625
+ const tr = editor.state.tr;
47626
+ nodesToDelete.sort((a, b) => b.pos - a.pos).forEach(({ pos, node: node2 }) => {
47627
+ tr.delete(pos, pos + node2.nodeSize);
47628
+ });
47629
+ editor.view.dispatch(tr);
47630
+ };
47599
47631
  const AnnotatorHelpers = {
47600
47632
  getFieldAttrs,
47601
47633
  processTables,
@@ -47603,7 +47635,8 @@
47603
47635
  annotateHeadersAndFooters,
47604
47636
  getAllHeaderFooterEditors,
47605
47637
  updateHeaderFooterFieldAnnotations,
47606
- deleteHeaderFooterFieldAnnotations
47638
+ deleteHeaderFooterFieldAnnotations,
47639
+ cleanUpListsWithAnnotations
47607
47640
  };
47608
47641
  const CollaborationPluginKey = new PluginKey("collaboration");
47609
47642
  const Collaboration = Extension.create({
@@ -48413,7 +48446,7 @@
48413
48446
  * @returns {Object | void} Migration results
48414
48447
  */
48415
48448
  processCollaborationMigrations() {
48416
- console.debug("[checkVersionMigrations] Current editor version", "0.12.35");
48449
+ console.debug("[checkVersionMigrations] Current editor version", "0.12.36-next.2");
48417
48450
  if (!this.options.ydoc) return;
48418
48451
  const metaMap = this.options.ydoc.getMap("meta");
48419
48452
  let docVersion = metaMap.get("version");
@@ -89965,7 +89998,7 @@ ${style2}
89965
89998
  this.config.colors = shuffleArray(this.config.colors);
89966
89999
  this.userColorMap = /* @__PURE__ */ new Map();
89967
90000
  this.colorIndex = 0;
89968
- this.version = "0.12.35";
90001
+ this.version = "0.12.36-next.2";
89969
90002
  console.debug("🦋 [superdoc] Using SuperDoc version:", this.version);
89970
90003
  this.superdocId = config.superdocId || v4();
89971
90004
  this.colors = this.config.colors;