@harbour-enterprises/superdoc 0.17.1 → 0.17.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/dist/chunks/{PdfViewer-B8JzHLrU.cjs → PdfViewer-B5bEH-lD.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-CdQaViwe.es.js → PdfViewer-P3OSs9iX.es.js} +1 -1
  3. package/dist/chunks/{index-B1qS_V43.es.js → index-CHQbeTTv.es.js} +3 -3
  4. package/dist/chunks/{index-CVp87_VW.cjs → index-LZjTD5KG.cjs} +3 -3
  5. package/dist/chunks/{super-editor.es-Cx4I-VrC.es.js → super-editor.es-C-nn3bMY.es.js} +38 -7
  6. package/dist/chunks/{super-editor.es-CHzSx5FH.cjs → super-editor.es-D8CRzfwC.cjs} +38 -7
  7. package/dist/super-editor/ai-writer.es.js +2 -2
  8. package/dist/super-editor/chunks/{converter-B_IuCnqV.js → converter-Bcg2-svq.js} +37 -6
  9. package/dist/super-editor/chunks/{docx-zipper-C_Qak38x.js → docx-zipper-X-fYIxPZ.js} +1 -1
  10. package/dist/super-editor/chunks/{editor-DrBQYZYl.js → editor-D4fBb3em.js} +3 -3
  11. package/dist/super-editor/chunks/{toolbar-CnAXgAhs.js → toolbar-C6KdVRS2.js} +2 -2
  12. package/dist/super-editor/converter.es.js +1 -1
  13. package/dist/super-editor/docx-zipper.es.js +2 -2
  14. package/dist/super-editor/editor.es.js +3 -3
  15. package/dist/super-editor/file-zipper.es.js +1 -1
  16. package/dist/super-editor/src/core/super-converter/v2/importer/docxImporter.d.ts +15 -0
  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 +2 -2
  22. package/dist/superdoc.es.js +2 -2
  23. package/dist/superdoc.umd.js +39 -8
  24. package/dist/superdoc.umd.js.map +1 -1
  25. package/package.json +1 -1
@@ -30724,17 +30724,22 @@ Please report this to https://github.com/markedjs/marked.`, e) {
30724
30724
  const { abstract } = ListHelpers.getListDefinitionDetails({ numId, level, listType, editor });
30725
30725
  const numbering = editor.converter.numbering;
30726
30726
  const newNumbering = { ...numbering };
30727
+ if (!abstract) {
30728
+ ListHelpers.generateNewListDefinition({ numId: newId, listType, editor });
30729
+ return newId;
30730
+ }
30727
30731
  const newAbstractId = getNewListId(editor, "abstracts");
30728
30732
  const newAbstractDef = {
30729
30733
  ...abstract,
30730
30734
  attributes: {
30731
- ...abstract.attributes,
30735
+ ...abstract.attributes || {},
30732
30736
  "w:abstractNumId": String(newAbstractId)
30733
30737
  }
30734
30738
  };
30735
30739
  newNumbering.abstracts[newAbstractId] = newAbstractDef;
30736
30740
  const newNumDef = getBasicNumIdTag(newId, newAbstractId);
30737
30741
  newNumbering.definitions[newId] = newNumDef;
30742
+ editor.converter.numbering = newNumbering;
30738
30743
  return newId;
30739
30744
  };
30740
30745
  const getBasicNumIdTag = (numId, abstractId) => {
@@ -37317,7 +37322,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
37317
37322
  const content = pruneIgnoredNodes(contentElements);
37318
37323
  const comments = importCommentData({ docx, converter, editor });
37319
37324
  const lists = {};
37320
- const parsedContent = nodeListHandler2.handler({
37325
+ let parsedContent = nodeListHandler2.handler({
37321
37326
  nodes: content,
37322
37327
  nodeListHandler: nodeListHandler2,
37323
37328
  docx,
@@ -37325,6 +37330,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
37325
37330
  editor,
37326
37331
  lists
37327
37332
  });
37333
+ parsedContent = filterOutRootInlineNodes(parsedContent);
37328
37334
  const result = {
37329
37335
  type: "doc",
37330
37336
  content: parsedContent,
@@ -37600,7 +37606,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
37600
37606
  let sectionType = sectPrHeader?.attributes["w:type"];
37601
37607
  if (converter.headerIds[sectionType]) sectionType = null;
37602
37608
  const nodeListHandler2 = defaultNodeListHandler();
37603
- const schema = nodeListHandler2.handler({
37609
+ let schema = nodeListHandler2.handler({
37604
37610
  nodes: referenceFile.elements[0].elements,
37605
37611
  nodeListHandler: nodeListHandler2,
37606
37612
  docx,
@@ -37608,6 +37614,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
37608
37614
  editor,
37609
37615
  filename: currentFileName
37610
37616
  });
37617
+ schema = filterOutRootInlineNodes(schema);
37611
37618
  if (!converter.headerIds.ids) converter.headerIds.ids = [];
37612
37619
  converter.headerIds.ids.push(rId);
37613
37620
  converter.headers[rId] = { type: "doc", content: [...schema] };
@@ -37622,7 +37629,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
37622
37629
  );
37623
37630
  const sectionType = sectPrFooter?.attributes["w:type"];
37624
37631
  const nodeListHandler2 = defaultNodeListHandler();
37625
- const schema = nodeListHandler2.handler({
37632
+ let schema = nodeListHandler2.handler({
37626
37633
  nodes: referenceFile.elements[0].elements,
37627
37634
  nodeListHandler: nodeListHandler2,
37628
37635
  docx,
@@ -37630,6 +37637,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
37630
37637
  editor,
37631
37638
  filename: currentFileName
37632
37639
  });
37640
+ schema = filterOutRootInlineNodes(schema);
37633
37641
  if (!converter.footerIds.ids) converter.footerIds.ids = [];
37634
37642
  converter.footerIds.ids.push(rId);
37635
37643
  converter.footers[rId] = { type: "doc", content: [...schema] };
@@ -37657,6 +37665,29 @@ Please report this to https://github.com/markedjs/marked.`, e) {
37657
37665
  currentFileName
37658
37666
  };
37659
37667
  };
37668
+ function filterOutRootInlineNodes(content = []) {
37669
+ if (!Array.isArray(content) || content.length === 0) return content;
37670
+ const INLINE_TYPES = /* @__PURE__ */ new Set([
37671
+ "text",
37672
+ "bookmarkStart",
37673
+ "lineBreak",
37674
+ "hardBreak",
37675
+ "pageNumber",
37676
+ "totalPageCount",
37677
+ "runItem",
37678
+ "image",
37679
+ "tab",
37680
+ "fieldAnnotation",
37681
+ "mention",
37682
+ "contentBlock",
37683
+ "aiLoaderNode",
37684
+ "commentRangeStart",
37685
+ "commentRangeEnd",
37686
+ "commentReference",
37687
+ "structuredContent"
37688
+ ]);
37689
+ return content.filter((node2) => node2 && typeof node2.type === "string" && !INLINE_TYPES.has(node2.type));
37690
+ }
37660
37691
  function getNumberingDefinitions(docx) {
37661
37692
  let numbering = docx["word/numbering.xml"];
37662
37693
  if (!numbering || !numbering.elements?.length || !numbering.elements[0].elements?.length) numbering = baseNumbering;
@@ -37883,7 +37914,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
37883
37914
  return;
37884
37915
  }
37885
37916
  }
37886
- static updateDocumentVersion(docx = this.convertedXml, version2 = "0.17.0") {
37917
+ static updateDocumentVersion(docx = this.convertedXml, version2 = "0.17.2") {
37887
37918
  const customLocation = "docProps/custom.xml";
37888
37919
  if (!docx[customLocation]) {
37889
37920
  docx[customLocation] = generateCustomXml();
@@ -38365,7 +38396,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
38365
38396
  function generateCustomXml() {
38366
38397
  return DEFAULT_CUSTOM_XML;
38367
38398
  }
38368
- function generateSuperdocVersion(pid = 2, version2 = "0.17.0") {
38399
+ function generateSuperdocVersion(pid = 2, version2 = "0.17.2") {
38369
38400
  return {
38370
38401
  type: "element",
38371
38402
  name: "property",
@@ -55225,7 +55256,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
55225
55256
  * @returns {Object | void} Migration results
55226
55257
  */
55227
55258
  processCollaborationMigrations() {
55228
- console.debug("[checkVersionMigrations] Current editor version", "0.17.0");
55259
+ console.debug("[checkVersionMigrations] Current editor version", "0.17.2");
55229
55260
  if (!this.options.ydoc) return;
55230
55261
  const metaMap = this.options.ydoc.getMap("meta");
55231
55262
  let docVersion = metaMap.get("version");
@@ -104911,7 +104942,7 @@ ${style2}
104911
104942
  this.config.colors = shuffleArray(this.config.colors);
104912
104943
  this.userColorMap = /* @__PURE__ */ new Map();
104913
104944
  this.colorIndex = 0;
104914
- this.version = "0.17.0";
104945
+ this.version = "0.17.2";
104915
104946
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
104916
104947
  this.superdocId = config.superdocId || v4();
104917
104948
  this.colors = this.config.colors;