@harbour-enterprises/superdoc 0.6.112 → 0.6.113

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 (29) hide show
  1. package/dist/chunks/{super-editor.es-B8fXoY6P.js → super-editor.es-C3Y2h-1x.js} +27 -15
  2. package/dist/chunks/super-editor.es-C3Y2h-1x.js.map +1 -0
  3. package/dist/super-editor/chunks/{converter-s9yhBEHO.js → converter-DcfRQ1B4.js} +24 -13
  4. package/dist/super-editor/chunks/{converter-s9yhBEHO.js.map → converter-DcfRQ1B4.js.map} +1 -1
  5. package/dist/super-editor/chunks/{docx-zipper-DEE6oGA6.js → docx-zipper-DvBrpROR.js} +2 -2
  6. package/dist/super-editor/chunks/{docx-zipper-DEE6oGA6.js.map → docx-zipper-DvBrpROR.js.map} +1 -1
  7. package/dist/super-editor/chunks/{editor-BkJfSOly.js → editor-DDYTGfpP.js} +6 -5
  8. package/dist/super-editor/chunks/editor-DDYTGfpP.js.map +1 -0
  9. package/dist/super-editor/chunks/{toolbar-Ib-MW1xa.js → toolbar-D4zVdryy.js} +3 -3
  10. package/dist/super-editor/chunks/{toolbar-Ib-MW1xa.js.map → toolbar-D4zVdryy.js.map} +1 -1
  11. package/dist/super-editor/converter.es.js +1 -1
  12. package/dist/super-editor/core/super-converter/exporter.d.ts.map +1 -1
  13. package/dist/super-editor/core/super-converter/helpers.d.ts +1 -0
  14. package/dist/super-editor/core/super-converter/helpers.d.ts.map +1 -1
  15. package/dist/super-editor/core/super-converter/v2/exporter/commentsExporter.d.ts.map +1 -1
  16. package/dist/super-editor/core/super-converter/v2/importer/documentCommentsImporter.d.ts.map +1 -1
  17. package/dist/super-editor/docx-zipper.es.js +2 -2
  18. package/dist/super-editor/editor.es.js +3 -3
  19. package/dist/super-editor/extensions/comment/comments-helpers.d.ts.map +1 -1
  20. package/dist/super-editor/file-zipper.es.js +1 -1
  21. package/dist/super-editor/super-editor.es.js +6 -6
  22. package/dist/super-editor/toolbar.es.js +2 -2
  23. package/dist/super-editor.es.js +1 -1
  24. package/dist/superdoc.es.js +3 -3
  25. package/dist/superdoc.umd.js +27 -15
  26. package/dist/superdoc.umd.js.map +1 -1
  27. package/package.json +1 -1
  28. package/dist/chunks/super-editor.es-B8fXoY6P.js.map +0 -1
  29. package/dist/super-editor/chunks/editor-BkJfSOly.js.map +0 -1
@@ -15978,6 +15978,13 @@ function isValidHexColor(color) {
15978
15978
  return false;
15979
15979
  }
15980
15980
  }
15981
+ const componentToHex = (val) => {
15982
+ const a = Number(val).toString(16);
15983
+ return a.length === 1 ? "0" + a : a;
15984
+ };
15985
+ const rgbToHex = (rgb) => {
15986
+ return "#" + rgb.match(/\d+/g).map(componentToHex).join("");
15987
+ };
15981
15988
  function generateDocxRandomId(length = 8) {
15982
15989
  const characters = "0123456789abcdef";
15983
15990
  let id = [];
@@ -17270,7 +17277,8 @@ const getCommentDefinition = (comment, commentId, allComments) => {
17270
17277
  "w:date": toIsoNoFractional(comment.createdTime),
17271
17278
  "w:initials": getInitials(comment.creatorName),
17272
17279
  "w:done": comment.resolvedTime ? "1" : "0",
17273
- "w15:paraId": comment.commentParaId
17280
+ "w15:paraId": comment.commentParaId,
17281
+ "custom:internalId": comment.commentId || comment.internalId
17274
17282
  };
17275
17283
  if (comment?.parentCommentId) {
17276
17284
  const parentComment = allComments.find((c) => c.commentId === comment.parentCommentId);
@@ -17304,7 +17312,9 @@ const updateCommentsXml = (commentDefs = [], commentsXml) => {
17304
17312
  "w:id": commentDef.attributes["w:id"],
17305
17313
  "w:author": commentDef.attributes["w:author"],
17306
17314
  "w:date": commentDef.attributes["w:date"],
17307
- "w:initials": commentDef.attributes["w:initials"]
17315
+ "w:initials": commentDef.attributes["w:initials"],
17316
+ "custom:internalId": commentDef.attributes["custom:internalId"],
17317
+ "xmlns:custom": "http://schemas.openxmlformats.org/wordprocessingml/2006/main"
17308
17318
  };
17309
17319
  });
17310
17320
  newCommentsXml.elements[0].elements = commentDefs;
@@ -17320,8 +17330,7 @@ const updateCommentsExtendedXml = (comments = [], commentsExtendedXml) => {
17320
17330
  const parentId = comment.parentCommentId;
17321
17331
  if (parentId) {
17322
17332
  const parentComment = comments.find((c) => c.commentId === parentId);
17323
- const parentParaId = parentComment.commentParaId;
17324
- attributes["w15:paraIdParent"] = parentParaId;
17333
+ attributes["w15:paraIdParent"] = parentComment.commentParaId;
17325
17334
  }
17326
17335
  return {
17327
17336
  type: "element",
@@ -18132,6 +18141,9 @@ function translateMark(mark) {
18132
18141
  break;
18133
18142
  case "color":
18134
18143
  let processedColor = attrs.color.replace(/^#/, "").replace(/;$/, "");
18144
+ if (processedColor.startsWith("rgb")) {
18145
+ processedColor = rgbToHex(processedColor);
18146
+ }
18135
18147
  markElement.attributes["w:val"] = processedColor;
18136
18148
  break;
18137
18149
  case "textAlign":
@@ -20222,6 +20234,7 @@ function importCommentData({ docx }) {
20222
20234
  const authorEmail = attributes["w:email"];
20223
20235
  const initials = attributes["w:initials"];
20224
20236
  const createdDate = attributes["w:date"];
20237
+ const internalId = attributes["custom:internalId"];
20225
20238
  const date = new Date(createdDate);
20226
20239
  const unixTimestampMs = date.getTime();
20227
20240
  const { elements: elements2 } = el;
@@ -20235,7 +20248,7 @@ function importCommentData({ docx }) {
20235
20248
  const { attrs } = parsedComment[0];
20236
20249
  const paraId = attrs["w14:paraId"];
20237
20250
  return {
20238
- commentId: v4(),
20251
+ commentId: internalId || v4(),
20239
20252
  importedId,
20240
20253
  creatorName: authorName,
20241
20254
  creatorEmail: authorEmail,
@@ -20257,14 +20270,13 @@ const generateCommentsWithExtendedData = ({ docx, comments }) => {
20257
20270
  return comments.map((comment) => {
20258
20271
  const extendedDef = commentEx.find((ce) => ce.attributes["w15:paraId"] === comment.paraId);
20259
20272
  if (!extendedDef) return { ...comment };
20260
- const { isDone, paraIdParent, superdocCommentId } = getExtendedDetails(extendedDef);
20273
+ const { isDone, paraIdParent } = getExtendedDetails(extendedDef);
20261
20274
  let parentComment;
20262
20275
  if (paraIdParent) parentComment = comments.find((c) => c.paraId === paraIdParent);
20263
20276
  const newComment = {
20264
20277
  ...comment,
20265
- commentId: superdocCommentId || v4(),
20266
20278
  isDone,
20267
- parentCommentId: parentComment?.id
20279
+ parentCommentId: parentComment?.commentId
20268
20280
  };
20269
20281
  return newComment;
20270
20282
  });
@@ -20274,8 +20286,7 @@ const getExtendedDetails = (commentEx) => {
20274
20286
  const paraId = attributes["w15:paraId"];
20275
20287
  const isDone = attributes["w15:done"] === "1" ? true : false;
20276
20288
  const paraIdParent = attributes["w15:paraIdParent"];
20277
- const superdocCommentId = attributes["w:rsid"];
20278
- return { paraId, isDone, paraIdParent, superdocCommentId };
20289
+ return { paraId, isDone, paraIdParent };
20279
20290
  };
20280
20291
  const createDocumentJson = (docx, converter, editor) => {
20281
20292
  const json = carbonCopy(getInitialJSON(docx));
@@ -20649,7 +20660,7 @@ const _SuperConverter = class _SuperConverter {
20649
20660
  return;
20650
20661
  }
20651
20662
  }
20652
- static updateDocumentVersion(docx = this.convertedXml, version = "0.6.112") {
20663
+ static updateDocumentVersion(docx = this.convertedXml, version = "0.6.113") {
20653
20664
  const customLocation = "docProps/custom.xml";
20654
20665
  if (!docx[customLocation]) {
20655
20666
  docx[customLocation] = generateCustomXml();
@@ -20925,7 +20936,7 @@ function storeSuperdocVersion(docx) {
20925
20936
  function generateCustomXml() {
20926
20937
  return DEFAULT_CUSTOM_XML;
20927
20938
  }
20928
- function generateSuperdocVersion(pid = 2, version = "0.6.112") {
20939
+ function generateSuperdocVersion(pid = 2, version = "0.6.113") {
20929
20940
  return {
20930
20941
  type: "element",
20931
20942
  name: "property",
@@ -20997,4 +21008,4 @@ export {
20997
21008
  RemoveMarkStep as y,
20998
21009
  twipsToLines as z
20999
21010
  };
21000
- //# sourceMappingURL=converter-s9yhBEHO.js.map
21011
+ //# sourceMappingURL=converter-DcfRQ1B4.js.map