@harbour-enterprises/superdoc 0.12.28 → 0.12.30-rev.1
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-BqhRxvuD.cjs → super-editor.es-3Ibj8IyF.cjs} +90 -30
- package/dist/chunks/{super-editor.es-BHZKnNbD.es.js → super-editor.es-Cs2w1rLv.es.js} +103 -43
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/super-editor/ai-writer.es.js +20 -2
- package/dist/super-editor/chunks/{converter-Dw5A3iB_.js → converter-B3YG794p.js} +2 -2
- package/dist/super-editor/chunks/{docx-zipper-CmSD0g5u.js → docx-zipper-CjIsb1a6.js} +1 -1
- package/dist/super-editor/chunks/{editor-CgEJXwqo.js → editor-HCMuRikV.js} +73 -31
- package/dist/super-editor/chunks/{toolbar-DhjJ9zUU.js → toolbar-DNy-8F3W.js} +2 -2
- package/dist/super-editor/components/toolbar/ai-helpers.d.ts.map +1 -1
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/core/Editor.d.ts +1 -1
- package/dist/super-editor/core/Editor.d.ts.map +1 -1
- package/dist/super-editor/core/EventEmitter.d.ts +19 -9
- package/dist/super-editor/core/EventEmitter.d.ts.map +1 -1
- package/dist/super-editor/core/helpers/annotator.d.ts +5 -3
- package/dist/super-editor/core/helpers/annotator.d.ts.map +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/getHeaderFooterAnnotations.d.ts +2 -0
- package/dist/super-editor/extensions/field-annotation/fieldAnnotationHelpers/getHeaderFooterAnnotations.d.ts.map +1 -0
- package/dist/super-editor/extensions/field-annotation/fieldAnnotationHelpers/index.d.ts +1 -0
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/index.d.ts +1 -1
- package/dist/super-editor/super-editor.es.js +8 -7
- package/dist/super-editor/tests/e2e/test-app/dist/assets/index-BTMvkUyI.d.ts +3 -0
- package/dist/super-editor/tests/e2e/test-app/dist/assets/index-BTMvkUyI.d.ts.map +1 -0
- package/dist/super-editor/tests/e2e/test-app/vite.config.d.ts +1 -1
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +2 -1
- package/dist/super-editor.es.js +15 -14
- package/dist/superdoc.cjs +3 -2
- package/dist/superdoc.es.js +201 -200
- package/dist/superdoc.umd.js +91 -31
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/superdoc.umd.js
CHANGED
|
@@ -30667,7 +30667,7 @@
|
|
|
30667
30667
|
return;
|
|
30668
30668
|
}
|
|
30669
30669
|
}
|
|
30670
|
-
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.12.
|
|
30670
|
+
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.12.30-rev.1") {
|
|
30671
30671
|
const customLocation = "docProps/custom.xml";
|
|
30672
30672
|
if (!docx[customLocation]) {
|
|
30673
30673
|
docx[customLocation] = generateCustomXml();
|
|
@@ -31133,7 +31133,7 @@
|
|
|
31133
31133
|
function generateCustomXml() {
|
|
31134
31134
|
return DEFAULT_CUSTOM_XML;
|
|
31135
31135
|
}
|
|
31136
|
-
function generateSuperdocVersion(pid = 2, version2 = "0.12.
|
|
31136
|
+
function generateSuperdocVersion(pid = 2, version2 = "0.12.30-rev.1") {
|
|
31137
31137
|
return {
|
|
31138
31138
|
type: "element",
|
|
31139
31139
|
name: "property",
|
|
@@ -44987,8 +44987,9 @@
|
|
|
44987
44987
|
}
|
|
44988
44988
|
/**
|
|
44989
44989
|
* Subscribe to the event.
|
|
44990
|
-
* @param name Event name.
|
|
44991
|
-
* @param fn Callback.
|
|
44990
|
+
* @param {string} name Event name.
|
|
44991
|
+
* @param {(...args: any[]) => void} fn Callback.
|
|
44992
|
+
* @returns {void}
|
|
44992
44993
|
*/
|
|
44993
44994
|
on(name, fn2) {
|
|
44994
44995
|
const callbacks2 = __privateGet$1(this, _events).get(name);
|
|
@@ -44997,8 +44998,9 @@
|
|
|
44997
44998
|
}
|
|
44998
44999
|
/**
|
|
44999
45000
|
* Emit event.
|
|
45000
|
-
* @param name Event name.
|
|
45001
|
-
* @param args Arguments.
|
|
45001
|
+
* @param {string} name Event name.
|
|
45002
|
+
* @param {...any} args – Arguments to pass to each listener.
|
|
45003
|
+
* @returns {void}
|
|
45002
45004
|
*/
|
|
45003
45005
|
emit(name, ...args) {
|
|
45004
45006
|
const callbacks2 = __privateGet$1(this, _events).get(name);
|
|
@@ -45010,8 +45012,9 @@
|
|
|
45010
45012
|
/**
|
|
45011
45013
|
* Remove a specific callback from event
|
|
45012
45014
|
* or all event subscriptions.
|
|
45013
|
-
* @param name Event name.
|
|
45014
|
-
* @param fn Callback.
|
|
45015
|
+
* @param {string} name Event name.
|
|
45016
|
+
* @param {(...args: any[]) => void} fn Callback.
|
|
45017
|
+
* @returns {void}
|
|
45015
45018
|
*/
|
|
45016
45019
|
off(name, fn2) {
|
|
45017
45020
|
const callbacks2 = __privateGet$1(this, _events).get(name);
|
|
@@ -45025,6 +45028,19 @@
|
|
|
45025
45028
|
__privateGet$1(this, _events).delete(name);
|
|
45026
45029
|
}
|
|
45027
45030
|
}
|
|
45031
|
+
/**
|
|
45032
|
+
* Subscribe to an event that will be called only once.
|
|
45033
|
+
* @param {string} name Event name.
|
|
45034
|
+
* @param {(...args: any[]) => void} fn Callback.
|
|
45035
|
+
* @returns {void}
|
|
45036
|
+
*/
|
|
45037
|
+
once(name, fn2) {
|
|
45038
|
+
const wrapper = (...args) => {
|
|
45039
|
+
this.off(name, wrapper);
|
|
45040
|
+
fn2.apply(this, args);
|
|
45041
|
+
};
|
|
45042
|
+
this.on(name, wrapper);
|
|
45043
|
+
}
|
|
45028
45044
|
/**
|
|
45029
45045
|
* Remove all registered events and subscriptions.
|
|
45030
45046
|
*/
|
|
@@ -47408,11 +47424,12 @@
|
|
|
47408
47424
|
const getAnnotationValue = (id, annotationValues) => {
|
|
47409
47425
|
return annotationValues.find((value) => value.input_id === id)?.input_value || null;
|
|
47410
47426
|
};
|
|
47411
|
-
const
|
|
47427
|
+
const getAllHeaderFooterEditors = (editor) => {
|
|
47412
47428
|
const sections = {
|
|
47413
47429
|
header: editor.converter.headers || {},
|
|
47414
47430
|
footer: editor.converter.footers || {}
|
|
47415
47431
|
};
|
|
47432
|
+
const allEditors = [];
|
|
47416
47433
|
Object.entries(sections).forEach(([type2, items]) => {
|
|
47417
47434
|
const editorsKey = `${type2}Editors`;
|
|
47418
47435
|
Object.entries(items).forEach(([sectionId, data]) => {
|
|
@@ -47430,25 +47447,38 @@
|
|
|
47430
47447
|
})
|
|
47431
47448
|
};
|
|
47432
47449
|
editor.converter[editorsKey].push(sectionEditor);
|
|
47450
|
+
allEditors.push({
|
|
47451
|
+
...sectionEditor,
|
|
47452
|
+
key: editorsKey,
|
|
47453
|
+
type: type2,
|
|
47454
|
+
sectionId
|
|
47455
|
+
});
|
|
47433
47456
|
}
|
|
47434
|
-
sectionEditor.editor.annotate(annotationValues, hiddenFieldIds);
|
|
47435
|
-
onHeaderFooterDataUpdate(
|
|
47436
|
-
{ editor: sectionEditor.editor },
|
|
47437
|
-
editor,
|
|
47438
|
-
sectionId,
|
|
47439
|
-
type2
|
|
47440
|
-
);
|
|
47441
47457
|
});
|
|
47442
47458
|
});
|
|
47459
|
+
return allEditors;
|
|
47460
|
+
};
|
|
47461
|
+
const annotateHeadersAndFooters = ({ editor, annotationValues = [], hiddenFieldIds = [], removeEmptyFields = false }) => {
|
|
47462
|
+
const allEditors = getAllHeaderFooterEditors(editor);
|
|
47463
|
+
allEditors.forEach(({ sectionId, editor: sectionEditor, type: type2 }) => {
|
|
47464
|
+
sectionEditor.annotate(annotationValues, hiddenFieldIds, removeEmptyFields);
|
|
47465
|
+
onHeaderFooterDataUpdate(
|
|
47466
|
+
{ editor: sectionEditor },
|
|
47467
|
+
editor,
|
|
47468
|
+
sectionId,
|
|
47469
|
+
type2
|
|
47470
|
+
);
|
|
47471
|
+
});
|
|
47443
47472
|
};
|
|
47444
47473
|
const annotateDocument = ({
|
|
47445
47474
|
annotationValues = [],
|
|
47446
47475
|
hiddenFieldIds = [],
|
|
47476
|
+
removeEmptyFields = false,
|
|
47447
47477
|
schema,
|
|
47448
47478
|
tr,
|
|
47449
47479
|
editor
|
|
47450
47480
|
}) => {
|
|
47451
|
-
annotateHeadersAndFooters({ editor, annotationValues, hiddenFieldIds });
|
|
47481
|
+
annotateHeadersAndFooters({ editor, annotationValues, hiddenFieldIds, removeEmptyFields });
|
|
47452
47482
|
const annotations = [];
|
|
47453
47483
|
const FieldType = schema.nodes.fieldAnnotation;
|
|
47454
47484
|
tr.doc.descendants((node2, pos) => {
|
|
@@ -47501,11 +47531,13 @@
|
|
|
47501
47531
|
});
|
|
47502
47532
|
}
|
|
47503
47533
|
}
|
|
47504
|
-
|
|
47505
|
-
|
|
47506
|
-
|
|
47507
|
-
|
|
47508
|
-
|
|
47534
|
+
if (removeEmptyFields) {
|
|
47535
|
+
Array.from(toDelete).sort((a, b) => b - a).forEach((pos) => {
|
|
47536
|
+
const ann = annotations.find((a) => a.pos === pos);
|
|
47537
|
+
if (!ann) return;
|
|
47538
|
+
tr = tr.delete(pos, pos + ann.node.nodeSize);
|
|
47539
|
+
});
|
|
47540
|
+
}
|
|
47509
47541
|
return tr;
|
|
47510
47542
|
};
|
|
47511
47543
|
const getFormattedDate = (input = null, format = "") => {
|
|
@@ -47523,7 +47555,7 @@
|
|
|
47523
47555
|
// e.g. “2025”
|
|
47524
47556
|
});
|
|
47525
47557
|
};
|
|
47526
|
-
const
|
|
47558
|
+
const AnnotatorHelpers = {
|
|
47527
47559
|
getFieldAttrs,
|
|
47528
47560
|
processTables,
|
|
47529
47561
|
annotateDocument,
|
|
@@ -48316,7 +48348,7 @@
|
|
|
48316
48348
|
* @returns {Object | void} Migration results
|
|
48317
48349
|
*/
|
|
48318
48350
|
processCollaborationMigrations() {
|
|
48319
|
-
console.debug("[checkVersionMigrations] Current editor version", "0.12.
|
|
48351
|
+
console.debug("[checkVersionMigrations] Current editor version", "0.12.30-rev.1");
|
|
48320
48352
|
if (!this.options.ydoc) return;
|
|
48321
48353
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
48322
48354
|
let docVersion = metaMap.get("version");
|
|
@@ -48405,10 +48437,8 @@
|
|
|
48405
48437
|
*/
|
|
48406
48438
|
prepareForAnnotations(annotationValues = []) {
|
|
48407
48439
|
const { tr } = this.state;
|
|
48408
|
-
const
|
|
48409
|
-
const newTr = AnnotatorServices.processTables({ state: this.state, tr, annotationValues });
|
|
48440
|
+
const newTr = AnnotatorHelpers.processTables({ state: this.state, tr, annotationValues });
|
|
48410
48441
|
this.view.dispatch(newTr);
|
|
48411
|
-
AnnotatorServices.annotateHeadersAndFooters({ editor: this, annotationValues });
|
|
48412
48442
|
}
|
|
48413
48443
|
/**
|
|
48414
48444
|
* Annotate the document with the given annotation values.
|
|
@@ -48417,15 +48447,16 @@
|
|
|
48417
48447
|
* @param {String[]} hiddenIds List of field ids to remove from the document.
|
|
48418
48448
|
* @returns {void}
|
|
48419
48449
|
*/
|
|
48420
|
-
annotate(annotationValues = [], hiddenIds = []) {
|
|
48450
|
+
annotate(annotationValues = [], hiddenIds = [], removeEmptyFields = false) {
|
|
48421
48451
|
const { state: state2, view, schema } = this;
|
|
48422
48452
|
let tr = state2.tr;
|
|
48423
|
-
tr =
|
|
48424
|
-
tr =
|
|
48453
|
+
tr = AnnotatorHelpers.processTables({ state: this.state, tr, annotationValues });
|
|
48454
|
+
tr = AnnotatorHelpers.annotateDocument({
|
|
48425
48455
|
tr,
|
|
48426
48456
|
schema,
|
|
48427
48457
|
annotationValues,
|
|
48428
48458
|
hiddenFieldIds: hiddenIds,
|
|
48459
|
+
removeEmptyFields,
|
|
48429
48460
|
editor: this
|
|
48430
48461
|
});
|
|
48431
48462
|
if (tr.docChanged) view.dispatch(tr.scrollIntoView());
|
|
@@ -54649,6 +54680,15 @@
|
|
|
54649
54680
|
});
|
|
54650
54681
|
return fieldAnnotations;
|
|
54651
54682
|
}
|
|
54683
|
+
const getHeaderFooterAnnotations = (editor) => {
|
|
54684
|
+
const editors = getAllHeaderFooterEditors(editor);
|
|
54685
|
+
const allAnnotations = [];
|
|
54686
|
+
editors.forEach(({ id, editor: editor2 }) => {
|
|
54687
|
+
const annotations = getAllFieldAnnotations(editor2.state);
|
|
54688
|
+
allAnnotations.push(...annotations);
|
|
54689
|
+
});
|
|
54690
|
+
return allAnnotations;
|
|
54691
|
+
};
|
|
54652
54692
|
const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
54653
54693
|
__proto__: null,
|
|
54654
54694
|
findFieldAnnotations,
|
|
@@ -54658,6 +54698,7 @@
|
|
|
54658
54698
|
findRemovedFieldAnnotations,
|
|
54659
54699
|
getAllFieldAnnotations,
|
|
54660
54700
|
getAllFieldAnnotationsWithRect,
|
|
54701
|
+
getHeaderFooterAnnotations,
|
|
54661
54702
|
trackFieldAnnotationsDeletion
|
|
54662
54703
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
54663
54704
|
function guard(low, high, value) {
|
|
@@ -70856,6 +70897,24 @@ ${style2}
|
|
|
70856
70897
|
marks: [{ type: "bold" }],
|
|
70857
70898
|
text: content
|
|
70858
70899
|
})
|
|
70900
|
+
},
|
|
70901
|
+
{
|
|
70902
|
+
name: "italic",
|
|
70903
|
+
pattern: /\*(.*?)\*/g,
|
|
70904
|
+
transform: (_match, content, _editor) => ({
|
|
70905
|
+
type: "text",
|
|
70906
|
+
marks: [{ type: "italic" }],
|
|
70907
|
+
text: content
|
|
70908
|
+
})
|
|
70909
|
+
},
|
|
70910
|
+
{
|
|
70911
|
+
name: "underline",
|
|
70912
|
+
pattern: /<(?:u|ins)>(.*?)<\/(?:u|ins)>/g,
|
|
70913
|
+
transform: (_match, content, _editor) => ({
|
|
70914
|
+
type: "text",
|
|
70915
|
+
marks: [{ type: "underline" }],
|
|
70916
|
+
text: content
|
|
70917
|
+
})
|
|
70859
70918
|
}
|
|
70860
70919
|
]
|
|
70861
70920
|
};
|
|
@@ -89495,7 +89554,7 @@ ${style2}
|
|
|
89495
89554
|
this.config.colors = shuffleArray(this.config.colors);
|
|
89496
89555
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
89497
89556
|
this.colorIndex = 0;
|
|
89498
|
-
this.version = "0.12.
|
|
89557
|
+
this.version = "0.12.30-rev.1";
|
|
89499
89558
|
console.debug("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
89500
89559
|
this.superdocId = config.superdocId || v4();
|
|
89501
89560
|
this.colors = this.config.colors;
|
|
@@ -90052,6 +90111,7 @@ ${style2}
|
|
|
90052
90111
|
}
|
|
90053
90112
|
}
|
|
90054
90113
|
}
|
|
90114
|
+
exports2.AnnotatorHelpers = AnnotatorHelpers;
|
|
90055
90115
|
exports2.BlankDOCX = BlankDOCX;
|
|
90056
90116
|
exports2.DOCX = DOCX;
|
|
90057
90117
|
exports2.Editor = Editor;
|