@harbour-enterprises/superdoc 0.13.0-next.2 → 0.13.0-next.4
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.
- package/dist/chunks/{super-editor.es-DL2IwegA.es.js → super-editor.es-BLihY9I3.es.js} +62 -20
- package/dist/chunks/{super-editor.es-BB_X_LWr.cjs → super-editor.es-C8bnXrNN.cjs} +62 -20
- package/dist/stores/comments-store.d.ts.map +1 -1
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-DW8-tb6t.js → converter-IP9PazoB.js} +2 -2
- package/dist/super-editor/chunks/{docx-zipper-D4HYgwV0.js → docx-zipper-CesiGAcg.js} +1 -1
- package/dist/super-editor/chunks/{editor-C_lmahhU.js → editor-2jdmUJVn.js} +62 -20
- package/dist/super-editor/chunks/{toolbar-DeqcMi3l.js → toolbar-BwVRLL78.js} +2 -2
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/docx-zipper.es.js +2 -2
- package/dist/super-editor/editor.es.js +3 -3
- package/dist/super-editor/extensions/field-annotation/fieldAnnotationHelpers/findHeaderFooterAnnotationsByFieldId.d.ts +8 -0
- package/dist/super-editor/extensions/field-annotation/fieldAnnotationHelpers/findHeaderFooterAnnotationsByFieldId.d.ts.map +1 -0
- package/dist/super-editor/extensions/field-annotation/fieldAnnotationHelpers/index.d.ts +1 -0
- package/dist/super-editor/extensions/image/imageHelpers/imagePositionPlugin.d.ts.map +1 -1
- package/dist/super-editor/extensions/ordered-list/helpers/orderedListSyncPlugin.d.ts.map +1 -1
- package/dist/super-editor/extensions/paragraph/paragraph.d.ts.map +1 -1
- package/dist/super-editor/extensions/tab/tab.d.ts.map +1 -1
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/super-editor.es.js +6 -6
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +1 -1
- package/dist/super-editor.es.js +1 -1
- package/dist/superdoc.cjs +23 -7
- package/dist/superdoc.es.js +24 -8
- package/dist/superdoc.umd.js +84 -26
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/superdoc.umd.js
CHANGED
|
@@ -30770,7 +30770,7 @@
|
|
|
30770
30770
|
return;
|
|
30771
30771
|
}
|
|
30772
30772
|
}
|
|
30773
|
-
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.13.0-next.
|
|
30773
|
+
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.13.0-next.4") {
|
|
30774
30774
|
const customLocation = "docProps/custom.xml";
|
|
30775
30775
|
if (!docx[customLocation]) {
|
|
30776
30776
|
docx[customLocation] = generateCustomXml();
|
|
@@ -31237,7 +31237,7 @@
|
|
|
31237
31237
|
function generateCustomXml() {
|
|
31238
31238
|
return DEFAULT_CUSTOM_XML;
|
|
31239
31239
|
}
|
|
31240
|
-
function generateSuperdocVersion(pid = 2, version2 = "0.13.0-next.
|
|
31240
|
+
function generateSuperdocVersion(pid = 2, version2 = "0.13.0-next.4") {
|
|
31241
31241
|
return {
|
|
31242
31242
|
type: "element",
|
|
31243
31243
|
name: "property",
|
|
@@ -37929,7 +37929,7 @@
|
|
|
37929
37929
|
}
|
|
37930
37930
|
return false;
|
|
37931
37931
|
}
|
|
37932
|
-
function findChildren$
|
|
37932
|
+
function findChildren$4(node2, predicate) {
|
|
37933
37933
|
const nodesWithPos = [];
|
|
37934
37934
|
node2.descendants((child, pos) => {
|
|
37935
37935
|
if (predicate(child)) {
|
|
@@ -37986,7 +37986,7 @@
|
|
|
37986
37986
|
cleanSchemaItem,
|
|
37987
37987
|
createDocument,
|
|
37988
37988
|
defaultBlockAt,
|
|
37989
|
-
findChildren: findChildren$
|
|
37989
|
+
findChildren: findChildren$4,
|
|
37990
37990
|
findMark,
|
|
37991
37991
|
findParentNode,
|
|
37992
37992
|
findParentNodeClosestToPos,
|
|
@@ -46113,7 +46113,7 @@
|
|
|
46113
46113
|
});
|
|
46114
46114
|
return result;
|
|
46115
46115
|
};
|
|
46116
|
-
const findChildren$
|
|
46116
|
+
const findChildren$3 = (node2, predicate, descend) => {
|
|
46117
46117
|
if (!node2) {
|
|
46118
46118
|
throw new Error('Invalid "node" parameter');
|
|
46119
46119
|
} else if (!predicate) {
|
|
@@ -46122,11 +46122,11 @@
|
|
|
46122
46122
|
return flatten$4(node2, descend).filter((child) => predicate(child.node));
|
|
46123
46123
|
};
|
|
46124
46124
|
const findInlineNodes = (node2, descend) => {
|
|
46125
|
-
return findChildren$
|
|
46125
|
+
return findChildren$3(node2, (child) => child.isInline, descend);
|
|
46126
46126
|
};
|
|
46127
46127
|
const documentHelpers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
46128
46128
|
__proto__: null,
|
|
46129
|
-
findChildren: findChildren$
|
|
46129
|
+
findChildren: findChildren$3,
|
|
46130
46130
|
findInlineNodes,
|
|
46131
46131
|
findMarkPosition,
|
|
46132
46132
|
flatten: flatten$4
|
|
@@ -46759,7 +46759,7 @@
|
|
|
46759
46759
|
if (isPaginationInit) shouldUpdate = true;
|
|
46760
46760
|
const meta = tr.getMeta(CommentsPluginKey);
|
|
46761
46761
|
const { type: type2 } = meta || {};
|
|
46762
|
-
if (type2 === "force") shouldUpdate = true;
|
|
46762
|
+
if (type2 === "force" || type2 === "forceTrackChanges") shouldUpdate = true;
|
|
46763
46763
|
if (!isPaginationInit && !shouldUpdate && meta && meta.decorations) {
|
|
46764
46764
|
return {
|
|
46765
46765
|
...pluginState,
|
|
@@ -48614,7 +48614,7 @@
|
|
|
48614
48614
|
* @returns {Object | void} Migration results
|
|
48615
48615
|
*/
|
|
48616
48616
|
processCollaborationMigrations() {
|
|
48617
|
-
console.debug("[checkVersionMigrations] Current editor version", "0.13.0-next.
|
|
48617
|
+
console.debug("[checkVersionMigrations] Current editor version", "0.13.0-next.4");
|
|
48618
48618
|
if (!this.options.ydoc) return;
|
|
48619
48619
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
48620
48620
|
let docVersion = metaMap.get("version");
|
|
@@ -50313,6 +50313,9 @@
|
|
|
50313
50313
|
let { doc: doc2, tr } = newState;
|
|
50314
50314
|
let listsBySyncId = {};
|
|
50315
50315
|
doc2.descendants((node2, pos) => {
|
|
50316
|
+
if (node2.type.name === "paragraph") {
|
|
50317
|
+
return false;
|
|
50318
|
+
}
|
|
50316
50319
|
if (node2.type.name === "orderedList" && !!node2.attrs.syncId) {
|
|
50317
50320
|
let syncId = node2.attrs.syncId;
|
|
50318
50321
|
if (!listsBySyncId[syncId]) listsBySyncId[syncId] = [];
|
|
@@ -50442,6 +50445,9 @@
|
|
|
50442
50445
|
let { doc: doc2 } = state2;
|
|
50443
50446
|
let map2 = /* @__PURE__ */ new Map();
|
|
50444
50447
|
doc2.descendants((node2, pos) => {
|
|
50448
|
+
if (node2.type.name === "paragraph") {
|
|
50449
|
+
return false;
|
|
50450
|
+
}
|
|
50445
50451
|
let { attrs } = node2;
|
|
50446
50452
|
let isListItem = node2.type.name === "listItem";
|
|
50447
50453
|
let hasListLevel = !!attrs.listLevel?.length;
|
|
@@ -50462,6 +50468,9 @@
|
|
|
50462
50468
|
let { doc: doc2 } = state2;
|
|
50463
50469
|
let allItems = [];
|
|
50464
50470
|
doc2.descendants((node2, pos) => {
|
|
50471
|
+
if (node2.type.name === "paragraph") {
|
|
50472
|
+
return false;
|
|
50473
|
+
}
|
|
50465
50474
|
let isListItem = node2.type.name === "listItem";
|
|
50466
50475
|
let $pos = doc2.resolve(pos);
|
|
50467
50476
|
if (isListItem && $pos.parent === list) {
|
|
@@ -50837,7 +50846,15 @@
|
|
|
50837
50846
|
let { doc: doc2, storedMarks } = state2;
|
|
50838
50847
|
let decorations = [];
|
|
50839
50848
|
if (Array.isArray(storedMarks)) marks.push(...storedMarks);
|
|
50840
|
-
let listItems =
|
|
50849
|
+
let listItems = [];
|
|
50850
|
+
doc2.descendants((node2, pos) => {
|
|
50851
|
+
if (node2.type.name === "paragraph") {
|
|
50852
|
+
return false;
|
|
50853
|
+
}
|
|
50854
|
+
if (node2.type.name === "listItem") {
|
|
50855
|
+
listItems.push({ node: node2, pos });
|
|
50856
|
+
}
|
|
50857
|
+
});
|
|
50841
50858
|
if (!listItems.length) {
|
|
50842
50859
|
return decorations;
|
|
50843
50860
|
}
|
|
@@ -50882,7 +50899,7 @@
|
|
|
50882
50899
|
function getListItemStylingFromParagraphProps(state2) {
|
|
50883
50900
|
let { doc: doc2 } = state2;
|
|
50884
50901
|
let decorations = [];
|
|
50885
|
-
let listItems = findChildren$
|
|
50902
|
+
let listItems = findChildren$4(doc2, (node2) => node2.type.name === "listItem");
|
|
50886
50903
|
if (!listItems.length) {
|
|
50887
50904
|
return decorations;
|
|
50888
50905
|
}
|
|
@@ -51414,6 +51431,7 @@
|
|
|
51414
51431
|
return DecorationSet.create(state2.doc, decorations);
|
|
51415
51432
|
},
|
|
51416
51433
|
apply(tr, oldDecorationSet, oldState, newState) {
|
|
51434
|
+
if (!tr.docChanged) return oldDecorationSet;
|
|
51417
51435
|
const decorations = getDropcapDecorations(newState, view);
|
|
51418
51436
|
return DecorationSet.create(newState.doc, decorations);
|
|
51419
51437
|
}
|
|
@@ -51430,11 +51448,14 @@
|
|
|
51430
51448
|
const getDropcapDecorations = (state2, view) => {
|
|
51431
51449
|
let decorations = [];
|
|
51432
51450
|
state2.doc.descendants((node2, pos) => {
|
|
51433
|
-
if (node2.
|
|
51434
|
-
|
|
51435
|
-
|
|
51436
|
-
|
|
51437
|
-
|
|
51451
|
+
if (node2.type.name === "paragraph") {
|
|
51452
|
+
if (node2.attrs.dropcap?.type === "margin") {
|
|
51453
|
+
const width = getDropcapWidth(view, pos);
|
|
51454
|
+
decorations.push(
|
|
51455
|
+
Decoration.inline(pos, pos + node2.nodeSize, { style: `margin-left: -${width}px;` })
|
|
51456
|
+
);
|
|
51457
|
+
}
|
|
51458
|
+
return false;
|
|
51438
51459
|
}
|
|
51439
51460
|
});
|
|
51440
51461
|
return decorations;
|
|
@@ -51670,6 +51691,7 @@
|
|
|
51670
51691
|
return DecorationSet.create(state2.doc, decorations);
|
|
51671
51692
|
},
|
|
51672
51693
|
apply(tr, oldDecorationSet, oldState, newState) {
|
|
51694
|
+
if (!tr.docChanged) return oldDecorationSet;
|
|
51673
51695
|
const decorations = getTabDecorations(newState, view);
|
|
51674
51696
|
return DecorationSet.create(newState.doc, decorations);
|
|
51675
51697
|
}
|
|
@@ -54801,9 +54823,9 @@
|
|
|
54801
54823
|
}, 0);
|
|
54802
54824
|
}
|
|
54803
54825
|
}
|
|
54804
|
-
const { findChildren: findChildren$
|
|
54826
|
+
const { findChildren: findChildren$2 } = helpers;
|
|
54805
54827
|
function getAllFieldAnnotations(state2) {
|
|
54806
|
-
let fieldAnnotations = findChildren$
|
|
54828
|
+
let fieldAnnotations = findChildren$2(state2.doc, (node2) => node2.type.name === "fieldAnnotation");
|
|
54807
54829
|
return fieldAnnotations;
|
|
54808
54830
|
}
|
|
54809
54831
|
const FieldAnnotationPlugin = (options2 = {}) => {
|
|
@@ -54945,9 +54967,9 @@
|
|
|
54945
54967
|
});
|
|
54946
54968
|
return fieldAnnotations;
|
|
54947
54969
|
}
|
|
54948
|
-
const { findChildren } = helpers;
|
|
54970
|
+
const { findChildren: findChildren$1 } = helpers;
|
|
54949
54971
|
function findFieldAnnotationsByFieldId(fieldIdOrArray, state2) {
|
|
54950
|
-
let fieldAnnotations = findChildren(state2.doc, (node2) => {
|
|
54972
|
+
let fieldAnnotations = findChildren$1(state2.doc, (node2) => {
|
|
54951
54973
|
let isFieldAnnotation = node2.type.name === "fieldAnnotation";
|
|
54952
54974
|
if (Array.isArray(fieldIdOrArray)) {
|
|
54953
54975
|
return isFieldAnnotation && fieldIdOrArray.includes(node2.attrs.fieldId);
|
|
@@ -54995,12 +55017,31 @@
|
|
|
54995
55017
|
});
|
|
54996
55018
|
return allAnnotations;
|
|
54997
55019
|
};
|
|
55020
|
+
const { findChildren } = helpers;
|
|
55021
|
+
function findHeaderFooterAnnotationsByFieldId(fieldIdOrArray, editor, activeSectionEditor) {
|
|
55022
|
+
const sectionEditors = getAllHeaderFooterEditors(editor);
|
|
55023
|
+
const annotations = [];
|
|
55024
|
+
sectionEditors.forEach(({ editor: sectionEditor }) => {
|
|
55025
|
+
const state2 = activeSectionEditor.options.documentId === sectionEditor.options.documentId ? activeSectionEditor.state : sectionEditor.state;
|
|
55026
|
+
const fieldAnnotations = findChildren(state2.doc, (node2) => {
|
|
55027
|
+
let isFieldAnnotation = node2.type.name === "fieldAnnotation";
|
|
55028
|
+
if (Array.isArray(fieldIdOrArray)) {
|
|
55029
|
+
return isFieldAnnotation && fieldIdOrArray.includes(node2.attrs.fieldId);
|
|
55030
|
+
} else {
|
|
55031
|
+
return isFieldAnnotation && node2.attrs.fieldId === fieldIdOrArray;
|
|
55032
|
+
}
|
|
55033
|
+
});
|
|
55034
|
+
annotations.push(...fieldAnnotations);
|
|
55035
|
+
});
|
|
55036
|
+
return annotations;
|
|
55037
|
+
}
|
|
54998
55038
|
const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
54999
55039
|
__proto__: null,
|
|
55000
55040
|
findFieldAnnotations,
|
|
55001
55041
|
findFieldAnnotationsBetween,
|
|
55002
55042
|
findFieldAnnotationsByFieldId,
|
|
55003
55043
|
findFirstFieldAnnotationByFieldId,
|
|
55044
|
+
findHeaderFooterAnnotationsByFieldId,
|
|
55004
55045
|
findRemovedFieldAnnotations,
|
|
55005
55046
|
getAllFieldAnnotations,
|
|
55006
55047
|
getAllFieldAnnotationsWithRect,
|
|
@@ -55986,6 +56027,7 @@
|
|
|
55986
56027
|
return DecorationSet.empty;
|
|
55987
56028
|
},
|
|
55988
56029
|
apply(tr, oldDecorationSet, oldState, newState) {
|
|
56030
|
+
if (!tr.docChanged) return oldDecorationSet;
|
|
55989
56031
|
const decorations = getImagePositionDecorations(newState, view);
|
|
55990
56032
|
return DecorationSet.create(newState.doc, decorations);
|
|
55991
56033
|
}
|
|
@@ -80429,14 +80471,29 @@ ${reason}`);
|
|
|
80429
80471
|
});
|
|
80430
80472
|
addComment({ superdoc: superdoc2, comment: newComment });
|
|
80431
80473
|
});
|
|
80432
|
-
|
|
80433
|
-
|
|
80474
|
+
setTimeout(() => {
|
|
80475
|
+
createCommentForTrackChanges(editor);
|
|
80476
|
+
}, 0);
|
|
80477
|
+
};
|
|
80478
|
+
const createCommentForTrackChanges = (editor) => {
|
|
80479
|
+
let trackedChanges = index$2.getTrackChanges(editor.state);
|
|
80480
|
+
let isLargeDoc = editor.state.doc.nodeSize >= 1e5;
|
|
80481
|
+
if (isLargeDoc && trackedChanges.length) {
|
|
80482
|
+
trackedChanges = trackedChanges.slice(0, 100);
|
|
80483
|
+
}
|
|
80484
|
+
trackedChanges.forEach(({ mark }, index2) => {
|
|
80485
|
+
console.debug(`Create comment for track change: ${index2}`);
|
|
80486
|
+
const { dispatch } = editor.view;
|
|
80487
|
+
const { tr } = editor.view.state;
|
|
80434
80488
|
const foundComment = commentsList.value.find((i2) => i2.commentId === mark.attrs.id);
|
|
80489
|
+
const isLastIteration = trackedChanges.length === index2 + 1;
|
|
80435
80490
|
if (foundComment) {
|
|
80491
|
+
if (isLastIteration) {
|
|
80492
|
+
tr.setMeta(CommentsPluginKey, { type: "force" });
|
|
80493
|
+
dispatch(tr);
|
|
80494
|
+
}
|
|
80436
80495
|
return;
|
|
80437
80496
|
}
|
|
80438
|
-
const { dispatch } = editor.view;
|
|
80439
|
-
const { tr } = editor.view.state;
|
|
80440
80497
|
const markMetaKeys = {
|
|
80441
80498
|
trackInsert: "insertedMark",
|
|
80442
80499
|
trackDelete: "deletionMark",
|
|
@@ -80444,7 +80501,8 @@ ${reason}`);
|
|
|
80444
80501
|
};
|
|
80445
80502
|
const markKeyName = markMetaKeys[mark.type.name];
|
|
80446
80503
|
if (markKeyName) {
|
|
80447
|
-
tr.setMeta(CommentsPluginKey, { type: "force" });
|
|
80504
|
+
if (isLastIteration) tr.setMeta(CommentsPluginKey, { type: "force" });
|
|
80505
|
+
tr.setMeta(CommentsPluginKey, { type: "forceTrackChanges" });
|
|
80448
80506
|
tr.setMeta(TrackChangesBasePluginKey, { [markKeyName]: mark });
|
|
80449
80507
|
dispatch(tr);
|
|
80450
80508
|
}
|
|
@@ -93219,7 +93277,7 @@ ${style2}
|
|
|
93219
93277
|
this.config.colors = shuffleArray(this.config.colors);
|
|
93220
93278
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
93221
93279
|
this.colorIndex = 0;
|
|
93222
|
-
this.version = "0.13.0-next.
|
|
93280
|
+
this.version = "0.13.0-next.4";
|
|
93223
93281
|
console.debug("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
93224
93282
|
this.superdocId = config.superdocId || v4();
|
|
93225
93283
|
this.colors = this.config.colors;
|