@harbour-enterprises/superdoc 0.16.0-next.1 → 0.16.0-next.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26429,7 +26429,7 @@ function translateImageNode(params2, imageSize) {
26429
26429
  let imageId = attrs.rId;
26430
26430
  const src = attrs.src || attrs.imageSrc;
26431
26431
  const { originalWidth, originalHeight } = getPngDimensions(src);
26432
- const imageName = params2.node.type === "image" ? src?.split("word/media/")[1] : attrs.fieldId?.replace("-", "_");
26432
+ const imageName = params2.node.type === "image" ? src.split("/").pop() : attrs.fieldId?.replace("-", "_");
26433
26433
  let size2 = attrs.size ? {
26434
26434
  w: pixelsToEmu(attrs.size.width),
26435
26435
  h: pixelsToEmu(attrs.size.height)
@@ -27690,7 +27690,9 @@ function handleImageImport(node2, currentFileName, params2) {
27690
27690
  const rel = elements.find((el) => el.attributes["Id"] === rEmbed);
27691
27691
  if (!rel) return null;
27692
27692
  const { attributes: relAttributes } = rel;
27693
- const path = `word/${relAttributes["Target"]}`;
27693
+ const targetPath = relAttributes["Target"];
27694
+ let path = `word/${targetPath}`;
27695
+ if (targetPath.startsWith("/word") || targetPath.startsWith("/media")) path = targetPath.substring(1);
27694
27696
  return {
27695
27697
  type: "image",
27696
27698
  attrs: {
@@ -30053,7 +30055,7 @@ const _SuperConverter = class _SuperConverter2 {
30053
30055
  return;
30054
30056
  }
30055
30057
  }
30056
- static updateDocumentVersion(docx = this.convertedXml, version2 = "0.16.0") {
30058
+ static updateDocumentVersion(docx = this.convertedXml, version2 = "0.16.0-next.2") {
30057
30059
  const customLocation = "docProps/custom.xml";
30058
30060
  if (!docx[customLocation]) {
30059
30061
  docx[customLocation] = generateCustomXml();
@@ -30451,8 +30453,7 @@ exportProcessMediaFiles_fn = async function(media, editor) {
30451
30453
  const processedData = {};
30452
30454
  for (const filePath in media) {
30453
30455
  if (typeof media[filePath] !== "string") continue;
30454
- const name = filePath.split("/").pop();
30455
- processedData[name] = await getArrayBufferFromUrl(media[filePath], editor.options.isHeadless);
30456
+ processedData[filePath] = await getArrayBufferFromUrl(media[filePath], editor.options.isHeadless);
30456
30457
  }
30457
30458
  this.convertedXml.media = {
30458
30459
  ...this.convertedXml.media,
@@ -30536,7 +30537,7 @@ function storeSuperdocVersion(docx) {
30536
30537
  function generateCustomXml() {
30537
30538
  return DEFAULT_CUSTOM_XML;
30538
30539
  }
30539
- function generateSuperdocVersion(pid = 2, version2 = "0.16.0") {
30540
+ function generateSuperdocVersion(pid = 2, version2 = "0.16.0-next.2") {
30540
30541
  return {
30541
30542
  type: "element",
30542
30543
  name: "property",
@@ -32905,7 +32906,6 @@ class DocxZipper {
32905
32906
  async getDocxData(file, isNode2 = false) {
32906
32907
  const extractedFiles = await this.unzip(file);
32907
32908
  const files = Object.entries(extractedFiles.files);
32908
- const mediaObjects = {};
32909
32909
  const validTypes = ["xml", "rels"];
32910
32910
  for (const file2 of files) {
32911
32911
  const [, zipEntry] = file2;
@@ -32915,11 +32915,11 @@ class DocxZipper {
32915
32915
  name: zipEntry.name,
32916
32916
  content
32917
32917
  });
32918
- } else if (zipEntry.name.startsWith("word/media") && zipEntry.name !== "word/media/") {
32918
+ } else if (zipEntry.name.startsWith("word/media") && zipEntry.name !== "word/media/" || zipEntry.name.startsWith("media") && zipEntry.name !== "media/") {
32919
32919
  if (isNode2) {
32920
32920
  const buffer2 = await zipEntry.async("nodebuffer");
32921
32921
  const fileBase64 = buffer2.toString("base64");
32922
- mediaObjects[zipEntry.name] = fileBase64;
32922
+ this.mediaFiles[zipEntry.name] = fileBase64;
32923
32923
  } else {
32924
32924
  const blob = await zipEntry.async("blob");
32925
32925
  const extension = this.getFileExtension(zipEntry.name);
@@ -33039,9 +33039,9 @@ class DocxZipper {
33039
33039
  const content = updatedDocs[key];
33040
33040
  zip.file(key, content);
33041
33041
  });
33042
- Object.keys(media).forEach((name) => {
33043
- const binaryData = Buffer2.from(media[name], "base64");
33044
- zip.file(`word/media/${name}`, binaryData);
33042
+ Object.keys(media).forEach((path) => {
33043
+ const binaryData = Buffer2.from(media[path], "base64");
33044
+ zip.file(path, binaryData);
33045
33045
  });
33046
33046
  for (const [fontName, fontUintArray] of Object.entries(fonts)) {
33047
33047
  zip.file(fontName, fontUintArray);
@@ -33069,8 +33069,8 @@ class DocxZipper {
33069
33069
  Object.keys(updatedDocs).forEach((key) => {
33070
33070
  unzippedOriginalDocx.file(key, updatedDocs[key]);
33071
33071
  });
33072
- Object.keys(media).forEach((name) => {
33073
- unzippedOriginalDocx.file(`word/media/${name}`, media[name]);
33072
+ Object.keys(media).forEach((path) => {
33073
+ unzippedOriginalDocx.file(path, media[path]);
33074
33074
  });
33075
33075
  await this.updateContentTypes(unzippedOriginalDocx, media);
33076
33076
  return unzippedOriginalDocx;
@@ -35545,16 +35545,19 @@ const decreaseListIndent = () => ({ editor, tr }) => {
35545
35545
  if (!parentList) return false;
35546
35546
  const attrs = currentItem.node.attrs || {};
35547
35547
  const currLevel = typeof attrs.level === "number" ? attrs.level : 0;
35548
- if (currLevel <= 0) {
35549
- return true;
35550
- }
35548
+ if (currLevel <= 0) return true;
35551
35549
  const newLevel = currLevel - 1;
35552
- let numId = attrs.numId ?? parentList.node?.attrs?.listId ?? (ListHelpers.getNewListId ? ListHelpers.getNewListId(editor) : null);
35553
- if (numId != null && ListHelpers.generateNewListDefinition) {
35550
+ const parentNumId = parentList.node?.attrs?.listId ?? null;
35551
+ let numId = parentNumId ?? attrs.numId ?? null;
35552
+ let createdNewId = false;
35553
+ if (numId == null && ListHelpers.getNewListId) {
35554
+ numId = ListHelpers.getNewListId(editor);
35555
+ createdNewId = true;
35556
+ }
35557
+ if (createdNewId && numId != null && ListHelpers.generateNewListDefinition) {
35554
35558
  ListHelpers.generateNewListDefinition({
35555
35559
  numId,
35556
35560
  listType: parentList.node.type,
35557
- // orderedList or bulletList NodeType
35558
35561
  editor
35559
35562
  });
35560
35563
  }
@@ -35837,7 +35840,7 @@ const handleBackspaceNextToList = () => ({ state: state2, dispatch, editor }) =>
35837
35840
  if ($from.parent.type.name !== "paragraph") return false;
35838
35841
  const ctx2 = getListContext(state2);
35839
35842
  if (ctx2) {
35840
- const { listDepth, listPos, listNode, liNode } = ctx2;
35843
+ const { listPos, listNode, liNode } = ctx2;
35841
35844
  const atStartOfParagraph = $from.parentOffset === 0;
35842
35845
  const itemIsEmpty = liNode.childCount > 0 ? liNode.firstChild?.content.size === 0 : true;
35843
35846
  if (!atStartOfParagraph && !itemIsEmpty) return false;
@@ -47270,7 +47273,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
47270
47273
  * @returns {Object | void} Migration results
47271
47274
  */
47272
47275
  processCollaborationMigrations() {
47273
- console.debug("[checkVersionMigrations] Current editor version", "0.16.0");
47276
+ console.debug("[checkVersionMigrations] Current editor version", "0.16.0-next.2");
47274
47277
  if (!this.options.ydoc) return;
47275
47278
  const metaMap = this.options.ydoc.getMap("meta");
47276
47279
  let docVersion = metaMap.get("version");
@@ -74239,7 +74242,7 @@ const NSkeleton = vue.defineComponent({
74239
74242
  return child;
74240
74243
  }
74241
74244
  });
74242
- const _hoisted_1$e = ["onKeydown", "tabindex"];
74245
+ const _hoisted_1$e = ["onKeydown", "tabindex", "data-item-id"];
74243
74246
  const _hoisted_2$b = { key: 0 };
74244
74247
  const _hoisted_3$9 = { key: 0 };
74245
74248
  const _hoisted_4$5 = { key: 0 };
@@ -74336,6 +74339,12 @@ const _sfc_main$1$1 = {
74336
74339
  };
74337
74340
  };
74338
74341
  const handleClickOutside2 = (e) => {
74342
+ const target = e.target;
74343
+ const itemCtn = target.closest(".toolbar-item-ctn");
74344
+ const targetItemId = itemCtn?.dataset.itemId;
74345
+ if (targetItemId === currentItem.value.id) {
74346
+ return;
74347
+ }
74339
74348
  closeDropdowns();
74340
74349
  };
74341
74350
  const moveToNextButton = (e) => {
@@ -74384,7 +74393,6 @@ const _sfc_main$1$1 = {
74384
74393
  e.preventDefault();
74385
74394
  switch (e.key) {
74386
74395
  case "Enter":
74387
- console.log("Enter");
74388
74396
  handleToolbarButtonClick(item, null);
74389
74397
  break;
74390
74398
  case "Escape":
@@ -74433,7 +74441,8 @@ const _sfc_main$1$1 = {
74433
74441
  ref_for: true,
74434
74442
  ref_key: "toolbarItemRefs",
74435
74443
  ref: toolbarItemRefs,
74436
- tabindex: index2 === 0 ? 0 : -1
74444
+ tabindex: index2 === 0 ? 0 : -1,
74445
+ "data-item-id": item.id.value
74437
74446
  }, [
74438
74447
  isSeparator(item) ? (vue.openBlock(), vue.createBlock(ToolbarSeparator, {
74439
74448
  key: 0,
@@ -74511,7 +74520,7 @@ const _sfc_main$1$1 = {
74511
74520
  };
74512
74521
  }
74513
74522
  };
74514
- const ButtonGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1$1, [["__scopeId", "data-v-4ccab1c9"]]);
74523
+ const ButtonGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1$1, [["__scopeId", "data-v-54680d22"]]);
74515
74524
  const _sfc_main$f = {
74516
74525
  __name: "Toolbar",
74517
74526
  emits: ["command", "toggle", "select"],
@@ -26412,7 +26412,7 @@ function translateImageNode(params2, imageSize) {
26412
26412
  let imageId = attrs.rId;
26413
26413
  const src = attrs.src || attrs.imageSrc;
26414
26414
  const { originalWidth, originalHeight } = getPngDimensions(src);
26415
- const imageName = params2.node.type === "image" ? src?.split("word/media/")[1] : attrs.fieldId?.replace("-", "_");
26415
+ const imageName = params2.node.type === "image" ? src.split("/").pop() : attrs.fieldId?.replace("-", "_");
26416
26416
  let size2 = attrs.size ? {
26417
26417
  w: pixelsToEmu(attrs.size.width),
26418
26418
  h: pixelsToEmu(attrs.size.height)
@@ -27673,7 +27673,9 @@ function handleImageImport(node2, currentFileName, params2) {
27673
27673
  const rel = elements.find((el) => el.attributes["Id"] === rEmbed);
27674
27674
  if (!rel) return null;
27675
27675
  const { attributes: relAttributes } = rel;
27676
- const path = `word/${relAttributes["Target"]}`;
27676
+ const targetPath = relAttributes["Target"];
27677
+ let path = `word/${targetPath}`;
27678
+ if (targetPath.startsWith("/word") || targetPath.startsWith("/media")) path = targetPath.substring(1);
27677
27679
  return {
27678
27680
  type: "image",
27679
27681
  attrs: {
@@ -30036,7 +30038,7 @@ const _SuperConverter = class _SuperConverter2 {
30036
30038
  return;
30037
30039
  }
30038
30040
  }
30039
- static updateDocumentVersion(docx = this.convertedXml, version2 = "0.16.0") {
30041
+ static updateDocumentVersion(docx = this.convertedXml, version2 = "0.16.0-next.2") {
30040
30042
  const customLocation = "docProps/custom.xml";
30041
30043
  if (!docx[customLocation]) {
30042
30044
  docx[customLocation] = generateCustomXml();
@@ -30434,8 +30436,7 @@ exportProcessMediaFiles_fn = async function(media, editor) {
30434
30436
  const processedData = {};
30435
30437
  for (const filePath in media) {
30436
30438
  if (typeof media[filePath] !== "string") continue;
30437
- const name = filePath.split("/").pop();
30438
- processedData[name] = await getArrayBufferFromUrl(media[filePath], editor.options.isHeadless);
30439
+ processedData[filePath] = await getArrayBufferFromUrl(media[filePath], editor.options.isHeadless);
30439
30440
  }
30440
30441
  this.convertedXml.media = {
30441
30442
  ...this.convertedXml.media,
@@ -30519,7 +30520,7 @@ function storeSuperdocVersion(docx) {
30519
30520
  function generateCustomXml() {
30520
30521
  return DEFAULT_CUSTOM_XML;
30521
30522
  }
30522
- function generateSuperdocVersion(pid = 2, version2 = "0.16.0") {
30523
+ function generateSuperdocVersion(pid = 2, version2 = "0.16.0-next.2") {
30523
30524
  return {
30524
30525
  type: "element",
30525
30526
  name: "property",
@@ -32888,7 +32889,6 @@ class DocxZipper {
32888
32889
  async getDocxData(file, isNode2 = false) {
32889
32890
  const extractedFiles = await this.unzip(file);
32890
32891
  const files = Object.entries(extractedFiles.files);
32891
- const mediaObjects = {};
32892
32892
  const validTypes = ["xml", "rels"];
32893
32893
  for (const file2 of files) {
32894
32894
  const [, zipEntry] = file2;
@@ -32898,11 +32898,11 @@ class DocxZipper {
32898
32898
  name: zipEntry.name,
32899
32899
  content
32900
32900
  });
32901
- } else if (zipEntry.name.startsWith("word/media") && zipEntry.name !== "word/media/") {
32901
+ } else if (zipEntry.name.startsWith("word/media") && zipEntry.name !== "word/media/" || zipEntry.name.startsWith("media") && zipEntry.name !== "media/") {
32902
32902
  if (isNode2) {
32903
32903
  const buffer2 = await zipEntry.async("nodebuffer");
32904
32904
  const fileBase64 = buffer2.toString("base64");
32905
- mediaObjects[zipEntry.name] = fileBase64;
32905
+ this.mediaFiles[zipEntry.name] = fileBase64;
32906
32906
  } else {
32907
32907
  const blob = await zipEntry.async("blob");
32908
32908
  const extension = this.getFileExtension(zipEntry.name);
@@ -33022,9 +33022,9 @@ class DocxZipper {
33022
33022
  const content = updatedDocs[key];
33023
33023
  zip.file(key, content);
33024
33024
  });
33025
- Object.keys(media).forEach((name) => {
33026
- const binaryData = Buffer2.from(media[name], "base64");
33027
- zip.file(`word/media/${name}`, binaryData);
33025
+ Object.keys(media).forEach((path) => {
33026
+ const binaryData = Buffer2.from(media[path], "base64");
33027
+ zip.file(path, binaryData);
33028
33028
  });
33029
33029
  for (const [fontName, fontUintArray] of Object.entries(fonts)) {
33030
33030
  zip.file(fontName, fontUintArray);
@@ -33052,8 +33052,8 @@ class DocxZipper {
33052
33052
  Object.keys(updatedDocs).forEach((key) => {
33053
33053
  unzippedOriginalDocx.file(key, updatedDocs[key]);
33054
33054
  });
33055
- Object.keys(media).forEach((name) => {
33056
- unzippedOriginalDocx.file(`word/media/${name}`, media[name]);
33055
+ Object.keys(media).forEach((path) => {
33056
+ unzippedOriginalDocx.file(path, media[path]);
33057
33057
  });
33058
33058
  await this.updateContentTypes(unzippedOriginalDocx, media);
33059
33059
  return unzippedOriginalDocx;
@@ -35528,16 +35528,19 @@ const decreaseListIndent = () => ({ editor, tr }) => {
35528
35528
  if (!parentList) return false;
35529
35529
  const attrs = currentItem.node.attrs || {};
35530
35530
  const currLevel = typeof attrs.level === "number" ? attrs.level : 0;
35531
- if (currLevel <= 0) {
35532
- return true;
35533
- }
35531
+ if (currLevel <= 0) return true;
35534
35532
  const newLevel = currLevel - 1;
35535
- let numId = attrs.numId ?? parentList.node?.attrs?.listId ?? (ListHelpers.getNewListId ? ListHelpers.getNewListId(editor) : null);
35536
- if (numId != null && ListHelpers.generateNewListDefinition) {
35533
+ const parentNumId = parentList.node?.attrs?.listId ?? null;
35534
+ let numId = parentNumId ?? attrs.numId ?? null;
35535
+ let createdNewId = false;
35536
+ if (numId == null && ListHelpers.getNewListId) {
35537
+ numId = ListHelpers.getNewListId(editor);
35538
+ createdNewId = true;
35539
+ }
35540
+ if (createdNewId && numId != null && ListHelpers.generateNewListDefinition) {
35537
35541
  ListHelpers.generateNewListDefinition({
35538
35542
  numId,
35539
35543
  listType: parentList.node.type,
35540
- // orderedList or bulletList NodeType
35541
35544
  editor
35542
35545
  });
35543
35546
  }
@@ -35820,7 +35823,7 @@ const handleBackspaceNextToList = () => ({ state: state2, dispatch, editor }) =>
35820
35823
  if ($from.parent.type.name !== "paragraph") return false;
35821
35824
  const ctx2 = getListContext(state2);
35822
35825
  if (ctx2) {
35823
- const { listDepth, listPos, listNode, liNode } = ctx2;
35826
+ const { listPos, listNode, liNode } = ctx2;
35824
35827
  const atStartOfParagraph = $from.parentOffset === 0;
35825
35828
  const itemIsEmpty = liNode.childCount > 0 ? liNode.firstChild?.content.size === 0 : true;
35826
35829
  if (!atStartOfParagraph && !itemIsEmpty) return false;
@@ -47253,7 +47256,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
47253
47256
  * @returns {Object | void} Migration results
47254
47257
  */
47255
47258
  processCollaborationMigrations() {
47256
- console.debug("[checkVersionMigrations] Current editor version", "0.16.0");
47259
+ console.debug("[checkVersionMigrations] Current editor version", "0.16.0-next.2");
47257
47260
  if (!this.options.ydoc) return;
47258
47261
  const metaMap = this.options.ydoc.getMap("meta");
47259
47262
  let docVersion = metaMap.get("version");
@@ -74222,7 +74225,7 @@ const NSkeleton = defineComponent({
74222
74225
  return child;
74223
74226
  }
74224
74227
  });
74225
- const _hoisted_1$e = ["onKeydown", "tabindex"];
74228
+ const _hoisted_1$e = ["onKeydown", "tabindex", "data-item-id"];
74226
74229
  const _hoisted_2$b = { key: 0 };
74227
74230
  const _hoisted_3$9 = { key: 0 };
74228
74231
  const _hoisted_4$5 = { key: 0 };
@@ -74319,6 +74322,12 @@ const _sfc_main$1$1 = {
74319
74322
  };
74320
74323
  };
74321
74324
  const handleClickOutside2 = (e) => {
74325
+ const target = e.target;
74326
+ const itemCtn = target.closest(".toolbar-item-ctn");
74327
+ const targetItemId = itemCtn?.dataset.itemId;
74328
+ if (targetItemId === currentItem.value.id) {
74329
+ return;
74330
+ }
74322
74331
  closeDropdowns();
74323
74332
  };
74324
74333
  const moveToNextButton = (e) => {
@@ -74367,7 +74376,6 @@ const _sfc_main$1$1 = {
74367
74376
  e.preventDefault();
74368
74377
  switch (e.key) {
74369
74378
  case "Enter":
74370
- console.log("Enter");
74371
74379
  handleToolbarButtonClick(item, null);
74372
74380
  break;
74373
74381
  case "Escape":
@@ -74416,7 +74424,8 @@ const _sfc_main$1$1 = {
74416
74424
  ref_for: true,
74417
74425
  ref_key: "toolbarItemRefs",
74418
74426
  ref: toolbarItemRefs,
74419
- tabindex: index2 === 0 ? 0 : -1
74427
+ tabindex: index2 === 0 ? 0 : -1,
74428
+ "data-item-id": item.id.value
74420
74429
  }, [
74421
74430
  isSeparator(item) ? (openBlock(), createBlock(ToolbarSeparator, {
74422
74431
  key: 0,
@@ -74494,7 +74503,7 @@ const _sfc_main$1$1 = {
74494
74503
  };
74495
74504
  }
74496
74505
  };
74497
- const ButtonGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1$1, [["__scopeId", "data-v-4ccab1c9"]]);
74506
+ const ButtonGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1$1, [["__scopeId", "data-v-54680d22"]]);
74498
74507
  const _sfc_main$f = {
74499
74508
  __name: "Toolbar",
74500
74509
  emits: ["command", "toggle", "select"],
@@ -1 +1 @@
1
- {"version":3,"file":"SuperD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;QAAE,OAAO,EAAE,QAAQ,CAAC;QAAC,MAAM,QAAO;KAAE,KAAK,IAAI;;;;eACtD,CAAC,MAAM,EAAE;QAAE,QAAQ,EAAE,OAAO,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE,KAAK,IAAI;;;;yBACvD,MAAM,IAAI;;;;sBACV,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI;;;;2BAC3B,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI;;;;qBACpC,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI;;;;kBACpC,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,KAAK,CAAA;KAAE,KAAK,IAAI;;;;2BAClC,CAAC,MAAM,EAAE;QAAE,UAAU,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI;;;;8BACzC,CAAC,MAAM,EAAE,EAAE,KAAC,GAAA;;;;aACZ,MAAM;;;;uBACN,KAAQ;;;;iBACR,OAAO;;;;YACP,MAAM;;;;oBACN,KAAQ;;;;eACR,OAAO;;;;;;;;wBAEP,CAAS,IAAI,EAAJ,IAAI,KAAG,OAAO,CAAC,MAAM,CAAC;;;;eAC/B,IAAI;;;;aACJ,OAAO;;;;gCACP,OAAO;;;;;;;;yBAEP,OAAO;;;;WACP,MAAM;;;;eACN,MAAM;;6BA5GS,eAAe;0BASlB,0CAA0C;6BAJ5B,mCAAmC;8BAC7C,iEAAiE"}
package/dist/style.css CHANGED
@@ -630,7 +630,7 @@ span[data-v-53e13009] {
630
630
  border-radius: 8px !important;
631
631
  }
632
632
 
633
- .button-group[data-v-4ccab1c9] {
633
+ .button-group[data-v-54680d22] {
634
634
  display: flex;
635
635
  }
636
636
 
@@ -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-fbIVVOqP.js";
3
- import { _ as _export_sfc } from "./chunks/editor-Djw1eU4w.js";
2
+ import { T as TextSelection } from "./chunks/converter-CqPmy5UJ.js";
3
+ import { _ as _export_sfc } from "./chunks/editor-D3CHN_mN.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 = {}) {
@@ -26410,7 +26410,7 @@ function translateImageNode(params, imageSize) {
26410
26410
  let imageId = attrs.rId;
26411
26411
  const src = attrs.src || attrs.imageSrc;
26412
26412
  const { originalWidth, originalHeight } = getPngDimensions(src);
26413
- const imageName = params.node.type === "image" ? src?.split("word/media/")[1] : attrs.fieldId?.replace("-", "_");
26413
+ const imageName = params.node.type === "image" ? src.split("/").pop() : attrs.fieldId?.replace("-", "_");
26414
26414
  let size = attrs.size ? {
26415
26415
  w: pixelsToEmu(attrs.size.width),
26416
26416
  h: pixelsToEmu(attrs.size.height)
@@ -27671,7 +27671,9 @@ function handleImageImport(node2, currentFileName, params) {
27671
27671
  const rel = elements.find((el) => el.attributes["Id"] === rEmbed);
27672
27672
  if (!rel) return null;
27673
27673
  const { attributes: relAttributes } = rel;
27674
- const path = `word/${relAttributes["Target"]}`;
27674
+ const targetPath = relAttributes["Target"];
27675
+ let path = `word/${targetPath}`;
27676
+ if (targetPath.startsWith("/word") || targetPath.startsWith("/media")) path = targetPath.substring(1);
27675
27677
  return {
27676
27678
  type: "image",
27677
27679
  attrs: {
@@ -30034,7 +30036,7 @@ const _SuperConverter = class _SuperConverter {
30034
30036
  return;
30035
30037
  }
30036
30038
  }
30037
- static updateDocumentVersion(docx = this.convertedXml, version = "0.16.0") {
30039
+ static updateDocumentVersion(docx = this.convertedXml, version = "0.16.0-next.2") {
30038
30040
  const customLocation = "docProps/custom.xml";
30039
30041
  if (!docx[customLocation]) {
30040
30042
  docx[customLocation] = generateCustomXml();
@@ -30435,8 +30437,7 @@ exportProcessMediaFiles_fn = async function(media, editor) {
30435
30437
  const processedData = {};
30436
30438
  for (const filePath in media) {
30437
30439
  if (typeof media[filePath] !== "string") continue;
30438
- const name = filePath.split("/").pop();
30439
- processedData[name] = await getArrayBufferFromUrl(media[filePath], editor.options.isHeadless);
30440
+ processedData[filePath] = await getArrayBufferFromUrl(media[filePath], editor.options.isHeadless);
30440
30441
  }
30441
30442
  this.convertedXml.media = {
30442
30443
  ...this.convertedXml.media,
@@ -30520,7 +30521,7 @@ function storeSuperdocVersion(docx) {
30520
30521
  function generateCustomXml() {
30521
30522
  return DEFAULT_CUSTOM_XML;
30522
30523
  }
30523
- function generateSuperdocVersion(pid = 2, version = "0.16.0") {
30524
+ function generateSuperdocVersion(pid = 2, version = "0.16.0-next.2") {
30524
30525
  return {
30525
30526
  type: "element",
30526
30527
  name: "property",
@@ -1,4 +1,4 @@
1
- import { H as process$1, av as commonjsGlobal, I as Buffer, aw as getDefaultExportFromCjs, ax as getContentTypesFromXml, ay as xmljs } from "./converter-fbIVVOqP.js";
1
+ import { H as process$1, av as commonjsGlobal, I as Buffer, aw as getDefaultExportFromCjs, ax as getContentTypesFromXml, ay as xmljs } from "./converter-CqPmy5UJ.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
  }
@@ -2345,7 +2345,6 @@ class DocxZipper {
2345
2345
  async getDocxData(file, isNode = false) {
2346
2346
  const extractedFiles = await this.unzip(file);
2347
2347
  const files = Object.entries(extractedFiles.files);
2348
- const mediaObjects = {};
2349
2348
  const validTypes = ["xml", "rels"];
2350
2349
  for (const file2 of files) {
2351
2350
  const [, zipEntry] = file2;
@@ -2355,11 +2354,11 @@ class DocxZipper {
2355
2354
  name: zipEntry.name,
2356
2355
  content
2357
2356
  });
2358
- } else if (zipEntry.name.startsWith("word/media") && zipEntry.name !== "word/media/") {
2357
+ } else if (zipEntry.name.startsWith("word/media") && zipEntry.name !== "word/media/" || zipEntry.name.startsWith("media") && zipEntry.name !== "media/") {
2359
2358
  if (isNode) {
2360
2359
  const buffer = await zipEntry.async("nodebuffer");
2361
2360
  const fileBase64 = buffer.toString("base64");
2362
- mediaObjects[zipEntry.name] = fileBase64;
2361
+ this.mediaFiles[zipEntry.name] = fileBase64;
2363
2362
  } else {
2364
2363
  const blob = await zipEntry.async("blob");
2365
2364
  const extension = this.getFileExtension(zipEntry.name);
@@ -2479,9 +2478,9 @@ class DocxZipper {
2479
2478
  const content = updatedDocs[key];
2480
2479
  zip.file(key, content);
2481
2480
  });
2482
- Object.keys(media).forEach((name) => {
2483
- const binaryData = Buffer.from(media[name], "base64");
2484
- zip.file(`word/media/${name}`, binaryData);
2481
+ Object.keys(media).forEach((path) => {
2482
+ const binaryData = Buffer.from(media[path], "base64");
2483
+ zip.file(path, binaryData);
2485
2484
  });
2486
2485
  for (const [fontName, fontUintArray] of Object.entries(fonts)) {
2487
2486
  zip.file(fontName, fontUintArray);
@@ -2509,8 +2508,8 @@ class DocxZipper {
2509
2508
  Object.keys(updatedDocs).forEach((key) => {
2510
2509
  unzippedOriginalDocx.file(key, updatedDocs[key]);
2511
2510
  });
2512
- Object.keys(media).forEach((name) => {
2513
- unzippedOriginalDocx.file(`word/media/${name}`, media[name]);
2511
+ Object.keys(media).forEach((path) => {
2512
+ unzippedOriginalDocx.file(path, media[path]);
2514
2513
  });
2515
2514
  await this.updateContentTypes(unzippedOriginalDocx, media);
2516
2515
  return unzippedOriginalDocx;
@@ -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, _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, insertNewFileData_fn, registerPluginByNameIfNotExists_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_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, _ListItemNodeView_instances, init_fn2, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn, _DocumentSectionView_instances, init_fn3, addToolTip_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, g as getExtensionConfigField, b as getMarkType, d as getMarksFromSelection, e as getNodeType, f as getSchemaTypeNameByName, S as Schema$1, h as cleanSchemaItem, T as TextSelection, N as NodeSelection, i as canSplit, j as defaultBlockAt$1, l as liftTarget, A as AllSelection, k as canJoin, m as joinPoint, n as Selection, r as replaceStep$1, F as Fragment, R as ReplaceAroundStep$1, o as Slice, p as isTextSelection, q as getMarkRange, s as isMarkActive, t as isNodeActive, u as deleteProps, D as DOMParser$1, v as ReplaceStep, w as NodeRange, x as findWrapping, L as ListHelpers, y as findParentNode, z as isMacOS, B as isIOS, C as DOMSerializer, E as Mark$1, G as dropPoint, H as process$1, I as Buffer2, J as getSchemaTypeByName, K as inputRulesPlugin, O as TrackDeleteMarkName, Q as TrackInsertMarkName, U as v4, V as TrackFormatMarkName, W as comments_module_events, X as findMark, Y as objectIncludes, Z as AddMarkStep, _ as RemoveMarkStep, $ as twipsToLines, a0 as pixelsToTwips, a1 as helpers, a2 as posToDOMRect, a3 as CommandService, a4 as SuperConverter, a5 as createDocument, a6 as createDocFromMarkdown, a7 as createDocFromHTML, a8 as EditorState, a9 as hasSomeParentWithClass, aa as isActive, ab as unflattenListsInHtml, ac as parseSizeUnit, ad as minMax, ae as getLineHeightValueString, af as InputRule, ag as kebabCase, ah as getListItemStyleDefinitions, ai as docxNumberigHelpers, aj as parseIndentElement, ak as combineIndents, al as StepMap, am as getColStyleDeclaration, an as SelectionRange, ao as Transform, ap as findParentNodeClosestToPos, aq as isInTable$1, ar as createColGroup, as as generateDocxRandomId, at as insertNewRelationship, au as htmlHandler } from "./converter-fbIVVOqP.js";
15
+ import { P as PluginKey, a as Plugin, M as Mapping, c as callOrGet, g as getExtensionConfigField, b as getMarkType, d as getMarksFromSelection, e as getNodeType, f as getSchemaTypeNameByName, S as Schema$1, h as cleanSchemaItem, T as TextSelection, N as NodeSelection, i as canSplit, j as defaultBlockAt$1, l as liftTarget, A as AllSelection, k as canJoin, m as joinPoint, n as Selection, r as replaceStep$1, F as Fragment, R as ReplaceAroundStep$1, o as Slice, p as isTextSelection, q as getMarkRange, s as isMarkActive, t as isNodeActive, u as deleteProps, D as DOMParser$1, v as ReplaceStep, w as NodeRange, x as findWrapping, L as ListHelpers, y as findParentNode, z as isMacOS, B as isIOS, C as DOMSerializer, E as Mark$1, G as dropPoint, H as process$1, I as Buffer2, J as getSchemaTypeByName, K as inputRulesPlugin, O as TrackDeleteMarkName, Q as TrackInsertMarkName, U as v4, V as TrackFormatMarkName, W as comments_module_events, X as findMark, Y as objectIncludes, Z as AddMarkStep, _ as RemoveMarkStep, $ as twipsToLines, a0 as pixelsToTwips, a1 as helpers, a2 as posToDOMRect, a3 as CommandService, a4 as SuperConverter, a5 as createDocument, a6 as createDocFromMarkdown, a7 as createDocFromHTML, a8 as EditorState, a9 as hasSomeParentWithClass, aa as isActive, ab as unflattenListsInHtml, ac as parseSizeUnit, ad as minMax, ae as getLineHeightValueString, af as InputRule, ag as kebabCase, ah as getListItemStyleDefinitions, ai as docxNumberigHelpers, aj as parseIndentElement, ak as combineIndents, al as StepMap, am as getColStyleDeclaration, an as SelectionRange, ao as Transform, ap as findParentNodeClosestToPos, aq as isInTable$1, ar as createColGroup, as as generateDocxRandomId, at as insertNewRelationship, au as htmlHandler } from "./converter-CqPmy5UJ.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-BtDLBZ6l.js";
17
+ import { D as DocxZipper } from "./docx-zipper-D_3vWdSa.js";
18
18
  var GOOD_LEAF_SIZE = 200;
19
19
  var RopeSequence = function RopeSequence2() {
20
20
  };
@@ -2472,16 +2472,19 @@ const decreaseListIndent = () => ({ editor, tr }) => {
2472
2472
  if (!parentList) return false;
2473
2473
  const attrs = currentItem.node.attrs || {};
2474
2474
  const currLevel = typeof attrs.level === "number" ? attrs.level : 0;
2475
- if (currLevel <= 0) {
2476
- return true;
2477
- }
2475
+ if (currLevel <= 0) return true;
2478
2476
  const newLevel = currLevel - 1;
2479
- let numId = attrs.numId ?? parentList.node?.attrs?.listId ?? (ListHelpers.getNewListId ? ListHelpers.getNewListId(editor) : null);
2480
- if (numId != null && ListHelpers.generateNewListDefinition) {
2477
+ const parentNumId = parentList.node?.attrs?.listId ?? null;
2478
+ let numId = parentNumId ?? attrs.numId ?? null;
2479
+ let createdNewId = false;
2480
+ if (numId == null && ListHelpers.getNewListId) {
2481
+ numId = ListHelpers.getNewListId(editor);
2482
+ createdNewId = true;
2483
+ }
2484
+ if (createdNewId && numId != null && ListHelpers.generateNewListDefinition) {
2481
2485
  ListHelpers.generateNewListDefinition({
2482
2486
  numId,
2483
2487
  listType: parentList.node.type,
2484
- // orderedList or bulletList NodeType
2485
2488
  editor
2486
2489
  });
2487
2490
  }
@@ -2764,7 +2767,7 @@ const handleBackspaceNextToList = () => ({ state, dispatch, editor }) => {
2764
2767
  if ($from.parent.type.name !== "paragraph") return false;
2765
2768
  const ctx = getListContext(state);
2766
2769
  if (ctx) {
2767
- const { listDepth, listPos, listNode, liNode } = ctx;
2770
+ const { listPos, listNode, liNode } = ctx;
2768
2771
  const atStartOfParagraph = $from.parentOffset === 0;
2769
2772
  const itemIsEmpty = liNode.childCount > 0 ? liNode.firstChild?.content.size === 0 : true;
2770
2773
  if (!atStartOfParagraph && !itemIsEmpty) return false;
@@ -14249,7 +14252,7 @@ const _Editor = class _Editor extends EventEmitter {
14249
14252
  * @returns {Object | void} Migration results
14250
14253
  */
14251
14254
  processCollaborationMigrations() {
14252
- console.debug("[checkVersionMigrations] Current editor version", "0.16.0");
14255
+ console.debug("[checkVersionMigrations] Current editor version", "0.16.0-next.2");
14253
14256
  if (!this.options.ydoc) return;
14254
14257
  const metaMap = this.options.ydoc.getMap("meta");
14255
14258
  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, 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 { H as process$1 } from "./converter-fbIVVOqP.js";
3
- import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-Djw1eU4w.js";
2
+ import { H as process$1 } from "./converter-CqPmy5UJ.js";
3
+ import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-D3CHN_mN.js";
4
4
  const sanitizeNumber = (value, defaultNumber) => {
5
5
  let sanitized = value.replace(/[^0-9.]/g, "");
6
6
  sanitized = parseFloat(sanitized);
@@ -9787,7 +9787,7 @@ const NSkeleton = defineComponent({
9787
9787
  return child;
9788
9788
  }
9789
9789
  });
9790
- const _hoisted_1 = ["onKeydown", "tabindex"];
9790
+ const _hoisted_1 = ["onKeydown", "tabindex", "data-item-id"];
9791
9791
  const _hoisted_2 = { key: 0 };
9792
9792
  const _hoisted_3 = { key: 0 };
9793
9793
  const _hoisted_4 = { key: 0 };
@@ -9884,6 +9884,12 @@ const _sfc_main$1 = {
9884
9884
  };
9885
9885
  };
9886
9886
  const handleClickOutside = (e) => {
9887
+ const target = e.target;
9888
+ const itemCtn = target.closest(".toolbar-item-ctn");
9889
+ const targetItemId = itemCtn?.dataset.itemId;
9890
+ if (targetItemId === currentItem.value.id) {
9891
+ return;
9892
+ }
9887
9893
  closeDropdowns();
9888
9894
  };
9889
9895
  const moveToNextButton = (e) => {
@@ -9932,7 +9938,6 @@ const _sfc_main$1 = {
9932
9938
  e.preventDefault();
9933
9939
  switch (e.key) {
9934
9940
  case "Enter":
9935
- console.log("Enter");
9936
9941
  handleToolbarButtonClick(item, null);
9937
9942
  break;
9938
9943
  case "Escape":
@@ -9981,7 +9986,8 @@ const _sfc_main$1 = {
9981
9986
  ref_for: true,
9982
9987
  ref_key: "toolbarItemRefs",
9983
9988
  ref: toolbarItemRefs,
9984
- tabindex: index === 0 ? 0 : -1
9989
+ tabindex: index === 0 ? 0 : -1,
9990
+ "data-item-id": item.id.value
9985
9991
  }, [
9986
9992
  isSeparator(item) ? (openBlock(), createBlock(ToolbarSeparator, {
9987
9993
  key: 0,
@@ -10059,7 +10065,7 @@ const _sfc_main$1 = {
10059
10065
  };
10060
10066
  }
10061
10067
  };
10062
- const ButtonGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-4ccab1c9"]]);
10068
+ const ButtonGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-54680d22"]]);
10063
10069
  const _sfc_main = {
10064
10070
  __name: "Toolbar",
10065
10071
  emits: ["command", "toggle", "select"],
@@ -1,4 +1,4 @@
1
- import { a4 } from "./chunks/converter-fbIVVOqP.js";
1
+ import { a4 } from "./chunks/converter-CqPmy5UJ.js";
2
2
  export {
3
3
  a4 as SuperConverter
4
4
  };
@@ -1,5 +1,5 @@
1
- import "./chunks/converter-fbIVVOqP.js";
2
- import { D } from "./chunks/docx-zipper-BtDLBZ6l.js";
1
+ import "./chunks/converter-CqPmy5UJ.js";
2
+ import { D } from "./chunks/docx-zipper-D_3vWdSa.js";
3
3
  export {
4
4
  D as default
5
5
  };