@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
@@ -15959,6 +15959,13 @@ function isValidHexColor(color) {
15959
15959
  return false;
15960
15960
  }
15961
15961
  }
15962
+ const componentToHex = (val) => {
15963
+ const a = Number(val).toString(16);
15964
+ return a.length === 1 ? "0" + a : a;
15965
+ };
15966
+ const rgbToHex = (rgb) => {
15967
+ return "#" + rgb.match(/\d+/g).map(componentToHex).join("");
15968
+ };
15962
15969
  function generateDocxRandomId(length = 8) {
15963
15970
  const characters = "0123456789abcdef";
15964
15971
  let id = [];
@@ -17251,7 +17258,8 @@ const getCommentDefinition = (comment, commentId, allComments) => {
17251
17258
  "w:date": toIsoNoFractional(comment.createdTime),
17252
17259
  "w:initials": getInitials(comment.creatorName),
17253
17260
  "w:done": comment.resolvedTime ? "1" : "0",
17254
- "w15:paraId": comment.commentParaId
17261
+ "w15:paraId": comment.commentParaId,
17262
+ "custom:internalId": comment.commentId || comment.internalId
17255
17263
  };
17256
17264
  if (comment?.parentCommentId) {
17257
17265
  const parentComment = allComments.find((c2) => c2.commentId === comment.parentCommentId);
@@ -17285,7 +17293,9 @@ const updateCommentsXml = (commentDefs = [], commentsXml) => {
17285
17293
  "w:id": commentDef.attributes["w:id"],
17286
17294
  "w:author": commentDef.attributes["w:author"],
17287
17295
  "w:date": commentDef.attributes["w:date"],
17288
- "w:initials": commentDef.attributes["w:initials"]
17296
+ "w:initials": commentDef.attributes["w:initials"],
17297
+ "custom:internalId": commentDef.attributes["custom:internalId"],
17298
+ "xmlns:custom": "http://schemas.openxmlformats.org/wordprocessingml/2006/main"
17289
17299
  };
17290
17300
  });
17291
17301
  newCommentsXml.elements[0].elements = commentDefs;
@@ -17301,8 +17311,7 @@ const updateCommentsExtendedXml = (comments = [], commentsExtendedXml) => {
17301
17311
  const parentId = comment.parentCommentId;
17302
17312
  if (parentId) {
17303
17313
  const parentComment = comments.find((c2) => c2.commentId === parentId);
17304
- const parentParaId = parentComment.commentParaId;
17305
- attributes["w15:paraIdParent"] = parentParaId;
17314
+ attributes["w15:paraIdParent"] = parentComment.commentParaId;
17306
17315
  }
17307
17316
  return {
17308
17317
  type: "element",
@@ -18113,6 +18122,9 @@ function translateMark(mark) {
18113
18122
  break;
18114
18123
  case "color":
18115
18124
  let processedColor = attrs.color.replace(/^#/, "").replace(/;$/, "");
18125
+ if (processedColor.startsWith("rgb")) {
18126
+ processedColor = rgbToHex(processedColor);
18127
+ }
18116
18128
  markElement.attributes["w:val"] = processedColor;
18117
18129
  break;
18118
18130
  case "textAlign":
@@ -20203,6 +20215,7 @@ function importCommentData({ docx }) {
20203
20215
  const authorEmail = attributes["w:email"];
20204
20216
  const initials = attributes["w:initials"];
20205
20217
  const createdDate = attributes["w:date"];
20218
+ const internalId = attributes["custom:internalId"];
20206
20219
  const date = new Date(createdDate);
20207
20220
  const unixTimestampMs = date.getTime();
20208
20221
  const { elements: elements2 } = el;
@@ -20216,7 +20229,7 @@ function importCommentData({ docx }) {
20216
20229
  const { attrs } = parsedComment[0];
20217
20230
  const paraId = attrs["w14:paraId"];
20218
20231
  return {
20219
- commentId: v4(),
20232
+ commentId: internalId || v4(),
20220
20233
  importedId,
20221
20234
  creatorName: authorName,
20222
20235
  creatorEmail: authorEmail,
@@ -20238,14 +20251,13 @@ const generateCommentsWithExtendedData = ({ docx, comments }) => {
20238
20251
  return comments.map((comment) => {
20239
20252
  const extendedDef = commentEx.find((ce) => ce.attributes["w15:paraId"] === comment.paraId);
20240
20253
  if (!extendedDef) return { ...comment };
20241
- const { isDone, paraIdParent, superdocCommentId } = getExtendedDetails(extendedDef);
20254
+ const { isDone, paraIdParent } = getExtendedDetails(extendedDef);
20242
20255
  let parentComment;
20243
20256
  if (paraIdParent) parentComment = comments.find((c2) => c2.paraId === paraIdParent);
20244
20257
  const newComment = {
20245
20258
  ...comment,
20246
- commentId: superdocCommentId || v4(),
20247
20259
  isDone,
20248
- parentCommentId: parentComment?.id
20260
+ parentCommentId: parentComment?.commentId
20249
20261
  };
20250
20262
  return newComment;
20251
20263
  });
@@ -20255,8 +20267,7 @@ const getExtendedDetails = (commentEx) => {
20255
20267
  const paraId = attributes["w15:paraId"];
20256
20268
  const isDone = attributes["w15:done"] === "1" ? true : false;
20257
20269
  const paraIdParent = attributes["w15:paraIdParent"];
20258
- const superdocCommentId = attributes["w:rsid"];
20259
- return { paraId, isDone, paraIdParent, superdocCommentId };
20270
+ return { paraId, isDone, paraIdParent };
20260
20271
  };
20261
20272
  const createDocumentJson = (docx, converter, editor) => {
20262
20273
  const json = carbonCopy(getInitialJSON(docx));
@@ -20630,7 +20641,7 @@ const _SuperConverter = class _SuperConverter2 {
20630
20641
  return;
20631
20642
  }
20632
20643
  }
20633
- static updateDocumentVersion(docx = this.convertedXml, version = "0.6.112") {
20644
+ static updateDocumentVersion(docx = this.convertedXml, version = "0.6.113") {
20634
20645
  const customLocation = "docProps/custom.xml";
20635
20646
  if (!docx[customLocation]) {
20636
20647
  docx[customLocation] = generateCustomXml();
@@ -20903,7 +20914,7 @@ function storeSuperdocVersion(docx) {
20903
20914
  function generateCustomXml() {
20904
20915
  return DEFAULT_CUSTOM_XML;
20905
20916
  }
20906
- function generateSuperdocVersion(pid = 2, version = "0.6.112") {
20917
+ function generateSuperdocVersion(pid = 2, version = "0.6.113") {
20907
20918
  return {
20908
20919
  type: "element",
20909
20920
  name: "property",
@@ -33951,10 +33962,11 @@ const prepareCommentsForExport = (doc2, tr, schema, comments = []) => {
33951
33962
  });
33952
33963
  const parentId = commentId;
33953
33964
  if (parentId) {
33954
- const childComments = comments.filter((c2) => c2.parentCommentId == parentId || c2.parentCommentId == parentId).sort((a, b) => a.createdTime - b.createdTime);
33965
+ const childComments = comments.filter((c2) => c2.parentCommentId === parentId).sort((a, b) => a.createdTime - b.createdTime);
33955
33966
  childComments.forEach((c2) => {
33956
33967
  const childMark = getPreparedComment(c2);
33957
33968
  const childStartNode = schema.nodes.commentRangeStart.create(childMark);
33969
+ seen.add(c2.commentId);
33958
33970
  startNodes.push({
33959
33971
  pos,
33960
33972
  node: childStartNode
@@ -35130,7 +35142,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
35130
35142
  * @returns {Y.Doc | undefined} Updated Y.Doc if any, otherwise undefined
35131
35143
  */
35132
35144
  processCollaborationMigrations() {
35133
- console.debug("[checkVersionMigrations] Current editor version", "0.6.112");
35145
+ console.debug("[checkVersionMigrations] Current editor version", "0.6.113");
35134
35146
  if (!this.options.ydoc) return;
35135
35147
  const metaMap = this.options.ydoc.getMap("meta");
35136
35148
  let docVersion = metaMap.get("version");
@@ -58634,4 +58646,4 @@ export {
58634
58646
  helpers as k,
58635
58647
  index as l
58636
58648
  };
58637
- //# sourceMappingURL=super-editor.es-B8fXoY6P.js.map
58649
+ //# sourceMappingURL=super-editor.es-C3Y2h-1x.js.map