@harbour-enterprises/superdoc 0.12.29 → 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-DnY3YVQy.cjs → super-editor.es-3Ibj8IyF.cjs} +72 -30
- package/dist/chunks/{super-editor.es-DiznnaH9.es.js → super-editor.es-Cs2w1rLv.es.js} +85 -43
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-C3avHVhj.js → converter-B3YG794p.js} +2 -2
- package/dist/super-editor/chunks/{docx-zipper-CmhOMHgz.js → docx-zipper-CjIsb1a6.js} +1 -1
- package/dist/super-editor/chunks/{editor-BXIiZe6R.js → editor-HCMuRikV.js} +73 -31
- package/dist/super-editor/chunks/{toolbar-D53fQfyS.js → toolbar-DNy-8F3W.js} +2 -2
- 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 +73 -31
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -23307,7 +23307,7 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
23307
23307
|
return;
|
|
23308
23308
|
}
|
|
23309
23309
|
}
|
|
23310
|
-
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.12.
|
|
23310
|
+
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.12.30-rev.1") {
|
|
23311
23311
|
const customLocation = "docProps/custom.xml";
|
|
23312
23312
|
if (!docx[customLocation]) {
|
|
23313
23313
|
docx[customLocation] = generateCustomXml();
|
|
@@ -23773,7 +23773,7 @@ function storeSuperdocVersion(docx) {
|
|
|
23773
23773
|
function generateCustomXml() {
|
|
23774
23774
|
return DEFAULT_CUSTOM_XML;
|
|
23775
23775
|
}
|
|
23776
|
-
function generateSuperdocVersion(pid = 2, version2 = "0.12.
|
|
23776
|
+
function generateSuperdocVersion(pid = 2, version2 = "0.12.30-rev.1") {
|
|
23777
23777
|
return {
|
|
23778
23778
|
type: "element",
|
|
23779
23779
|
name: "property",
|
|
@@ -37627,8 +37627,9 @@ let EventEmitter$1 = class EventEmitter {
|
|
|
37627
37627
|
}
|
|
37628
37628
|
/**
|
|
37629
37629
|
* Subscribe to the event.
|
|
37630
|
-
* @param name Event name.
|
|
37631
|
-
* @param fn Callback.
|
|
37630
|
+
* @param {string} name Event name.
|
|
37631
|
+
* @param {(...args: any[]) => void} fn Callback.
|
|
37632
|
+
* @returns {void}
|
|
37632
37633
|
*/
|
|
37633
37634
|
on(name, fn2) {
|
|
37634
37635
|
const callbacks2 = __privateGet$1(this, _events).get(name);
|
|
@@ -37637,8 +37638,9 @@ let EventEmitter$1 = class EventEmitter {
|
|
|
37637
37638
|
}
|
|
37638
37639
|
/**
|
|
37639
37640
|
* Emit event.
|
|
37640
|
-
* @param name Event name.
|
|
37641
|
-
* @param args Arguments.
|
|
37641
|
+
* @param {string} name Event name.
|
|
37642
|
+
* @param {...any} args – Arguments to pass to each listener.
|
|
37643
|
+
* @returns {void}
|
|
37642
37644
|
*/
|
|
37643
37645
|
emit(name, ...args) {
|
|
37644
37646
|
const callbacks2 = __privateGet$1(this, _events).get(name);
|
|
@@ -37650,8 +37652,9 @@ let EventEmitter$1 = class EventEmitter {
|
|
|
37650
37652
|
/**
|
|
37651
37653
|
* Remove a specific callback from event
|
|
37652
37654
|
* or all event subscriptions.
|
|
37653
|
-
* @param name Event name.
|
|
37654
|
-
* @param fn Callback.
|
|
37655
|
+
* @param {string} name Event name.
|
|
37656
|
+
* @param {(...args: any[]) => void} fn Callback.
|
|
37657
|
+
* @returns {void}
|
|
37655
37658
|
*/
|
|
37656
37659
|
off(name, fn2) {
|
|
37657
37660
|
const callbacks2 = __privateGet$1(this, _events).get(name);
|
|
@@ -37665,6 +37668,19 @@ let EventEmitter$1 = class EventEmitter {
|
|
|
37665
37668
|
__privateGet$1(this, _events).delete(name);
|
|
37666
37669
|
}
|
|
37667
37670
|
}
|
|
37671
|
+
/**
|
|
37672
|
+
* Subscribe to an event that will be called only once.
|
|
37673
|
+
* @param {string} name Event name.
|
|
37674
|
+
* @param {(...args: any[]) => void} fn Callback.
|
|
37675
|
+
* @returns {void}
|
|
37676
|
+
*/
|
|
37677
|
+
once(name, fn2) {
|
|
37678
|
+
const wrapper = (...args) => {
|
|
37679
|
+
this.off(name, wrapper);
|
|
37680
|
+
fn2.apply(this, args);
|
|
37681
|
+
};
|
|
37682
|
+
this.on(name, wrapper);
|
|
37683
|
+
}
|
|
37668
37684
|
/**
|
|
37669
37685
|
* Remove all registered events and subscriptions.
|
|
37670
37686
|
*/
|
|
@@ -40048,11 +40064,12 @@ const generateTableIfNecessary = ({ tableNode, annotationValues, tr, state: stat
|
|
|
40048
40064
|
const getAnnotationValue = (id, annotationValues) => {
|
|
40049
40065
|
return annotationValues.find((value) => value.input_id === id)?.input_value || null;
|
|
40050
40066
|
};
|
|
40051
|
-
const
|
|
40067
|
+
const getAllHeaderFooterEditors = (editor) => {
|
|
40052
40068
|
const sections = {
|
|
40053
40069
|
header: editor.converter.headers || {},
|
|
40054
40070
|
footer: editor.converter.footers || {}
|
|
40055
40071
|
};
|
|
40072
|
+
const allEditors = [];
|
|
40056
40073
|
Object.entries(sections).forEach(([type2, items]) => {
|
|
40057
40074
|
const editorsKey = `${type2}Editors`;
|
|
40058
40075
|
Object.entries(items).forEach(([sectionId, data]) => {
|
|
@@ -40070,25 +40087,38 @@ const annotateHeadersAndFooters = ({ editor, annotationValues = [], hiddenFieldI
|
|
|
40070
40087
|
})
|
|
40071
40088
|
};
|
|
40072
40089
|
editor.converter[editorsKey].push(sectionEditor);
|
|
40090
|
+
allEditors.push({
|
|
40091
|
+
...sectionEditor,
|
|
40092
|
+
key: editorsKey,
|
|
40093
|
+
type: type2,
|
|
40094
|
+
sectionId
|
|
40095
|
+
});
|
|
40073
40096
|
}
|
|
40074
|
-
sectionEditor.editor.annotate(annotationValues, hiddenFieldIds);
|
|
40075
|
-
onHeaderFooterDataUpdate(
|
|
40076
|
-
{ editor: sectionEditor.editor },
|
|
40077
|
-
editor,
|
|
40078
|
-
sectionId,
|
|
40079
|
-
type2
|
|
40080
|
-
);
|
|
40081
40097
|
});
|
|
40082
40098
|
});
|
|
40099
|
+
return allEditors;
|
|
40100
|
+
};
|
|
40101
|
+
const annotateHeadersAndFooters = ({ editor, annotationValues = [], hiddenFieldIds = [], removeEmptyFields = false }) => {
|
|
40102
|
+
const allEditors = getAllHeaderFooterEditors(editor);
|
|
40103
|
+
allEditors.forEach(({ sectionId, editor: sectionEditor, type: type2 }) => {
|
|
40104
|
+
sectionEditor.annotate(annotationValues, hiddenFieldIds, removeEmptyFields);
|
|
40105
|
+
onHeaderFooterDataUpdate(
|
|
40106
|
+
{ editor: sectionEditor },
|
|
40107
|
+
editor,
|
|
40108
|
+
sectionId,
|
|
40109
|
+
type2
|
|
40110
|
+
);
|
|
40111
|
+
});
|
|
40083
40112
|
};
|
|
40084
40113
|
const annotateDocument = ({
|
|
40085
40114
|
annotationValues = [],
|
|
40086
40115
|
hiddenFieldIds = [],
|
|
40116
|
+
removeEmptyFields = false,
|
|
40087
40117
|
schema,
|
|
40088
40118
|
tr,
|
|
40089
40119
|
editor
|
|
40090
40120
|
}) => {
|
|
40091
|
-
annotateHeadersAndFooters({ editor, annotationValues, hiddenFieldIds });
|
|
40121
|
+
annotateHeadersAndFooters({ editor, annotationValues, hiddenFieldIds, removeEmptyFields });
|
|
40092
40122
|
const annotations = [];
|
|
40093
40123
|
const FieldType = schema.nodes.fieldAnnotation;
|
|
40094
40124
|
tr.doc.descendants((node2, pos) => {
|
|
@@ -40141,11 +40171,13 @@ const annotateDocument = ({
|
|
|
40141
40171
|
});
|
|
40142
40172
|
}
|
|
40143
40173
|
}
|
|
40144
|
-
|
|
40145
|
-
|
|
40146
|
-
|
|
40147
|
-
|
|
40148
|
-
|
|
40174
|
+
if (removeEmptyFields) {
|
|
40175
|
+
Array.from(toDelete).sort((a, b) => b - a).forEach((pos) => {
|
|
40176
|
+
const ann = annotations.find((a) => a.pos === pos);
|
|
40177
|
+
if (!ann) return;
|
|
40178
|
+
tr = tr.delete(pos, pos + ann.node.nodeSize);
|
|
40179
|
+
});
|
|
40180
|
+
}
|
|
40149
40181
|
return tr;
|
|
40150
40182
|
};
|
|
40151
40183
|
const getFormattedDate = (input = null, format = "") => {
|
|
@@ -40163,7 +40195,7 @@ const getFormattedDate = (input = null, format = "") => {
|
|
|
40163
40195
|
// e.g. “2025”
|
|
40164
40196
|
});
|
|
40165
40197
|
};
|
|
40166
|
-
const
|
|
40198
|
+
const AnnotatorHelpers = {
|
|
40167
40199
|
getFieldAttrs,
|
|
40168
40200
|
processTables,
|
|
40169
40201
|
annotateDocument,
|
|
@@ -40956,7 +40988,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
40956
40988
|
* @returns {Object | void} Migration results
|
|
40957
40989
|
*/
|
|
40958
40990
|
processCollaborationMigrations() {
|
|
40959
|
-
console.debug("[checkVersionMigrations] Current editor version", "0.12.
|
|
40991
|
+
console.debug("[checkVersionMigrations] Current editor version", "0.12.30-rev.1");
|
|
40960
40992
|
if (!this.options.ydoc) return;
|
|
40961
40993
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
40962
40994
|
let docVersion = metaMap.get("version");
|
|
@@ -41045,10 +41077,8 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
41045
41077
|
*/
|
|
41046
41078
|
prepareForAnnotations(annotationValues = []) {
|
|
41047
41079
|
const { tr } = this.state;
|
|
41048
|
-
const
|
|
41049
|
-
const newTr = AnnotatorServices.processTables({ state: this.state, tr, annotationValues });
|
|
41080
|
+
const newTr = AnnotatorHelpers.processTables({ state: this.state, tr, annotationValues });
|
|
41050
41081
|
this.view.dispatch(newTr);
|
|
41051
|
-
AnnotatorServices.annotateHeadersAndFooters({ editor: this, annotationValues });
|
|
41052
41082
|
}
|
|
41053
41083
|
/**
|
|
41054
41084
|
* Annotate the document with the given annotation values.
|
|
@@ -41057,15 +41087,16 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
41057
41087
|
* @param {String[]} hiddenIds List of field ids to remove from the document.
|
|
41058
41088
|
* @returns {void}
|
|
41059
41089
|
*/
|
|
41060
|
-
annotate(annotationValues = [], hiddenIds = []) {
|
|
41090
|
+
annotate(annotationValues = [], hiddenIds = [], removeEmptyFields = false) {
|
|
41061
41091
|
const { state: state2, view, schema } = this;
|
|
41062
41092
|
let tr = state2.tr;
|
|
41063
|
-
tr =
|
|
41064
|
-
tr =
|
|
41093
|
+
tr = AnnotatorHelpers.processTables({ state: this.state, tr, annotationValues });
|
|
41094
|
+
tr = AnnotatorHelpers.annotateDocument({
|
|
41065
41095
|
tr,
|
|
41066
41096
|
schema,
|
|
41067
41097
|
annotationValues,
|
|
41068
41098
|
hiddenFieldIds: hiddenIds,
|
|
41099
|
+
removeEmptyFields,
|
|
41069
41100
|
editor: this
|
|
41070
41101
|
});
|
|
41071
41102
|
if (tr.docChanged) view.dispatch(tr.scrollIntoView());
|
|
@@ -47289,6 +47320,15 @@ function findFieldAnnotationsBetween(from2, to, doc2) {
|
|
|
47289
47320
|
});
|
|
47290
47321
|
return fieldAnnotations;
|
|
47291
47322
|
}
|
|
47323
|
+
const getHeaderFooterAnnotations = (editor) => {
|
|
47324
|
+
const editors = getAllHeaderFooterEditors(editor);
|
|
47325
|
+
const allAnnotations = [];
|
|
47326
|
+
editors.forEach(({ id, editor: editor2 }) => {
|
|
47327
|
+
const annotations = getAllFieldAnnotations(editor2.state);
|
|
47328
|
+
allAnnotations.push(...annotations);
|
|
47329
|
+
});
|
|
47330
|
+
return allAnnotations;
|
|
47331
|
+
};
|
|
47292
47332
|
const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
47293
47333
|
__proto__: null,
|
|
47294
47334
|
findFieldAnnotations,
|
|
@@ -47298,6 +47338,7 @@ const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
47298
47338
|
findRemovedFieldAnnotations,
|
|
47299
47339
|
getAllFieldAnnotations,
|
|
47300
47340
|
getAllFieldAnnotationsWithRect,
|
|
47341
|
+
getHeaderFooterAnnotations,
|
|
47301
47342
|
trackFieldAnnotationsDeletion
|
|
47302
47343
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
47303
47344
|
function guard(low, high, value) {
|
|
@@ -67190,6 +67231,7 @@ const Extensions = {
|
|
|
67190
67231
|
Mark: Mark2
|
|
67191
67232
|
};
|
|
67192
67233
|
exports.AIWriter = AIWriter;
|
|
67234
|
+
exports.AnnotatorHelpers = AnnotatorHelpers;
|
|
67193
67235
|
exports.CommentsPluginKey = CommentsPluginKey;
|
|
67194
67236
|
exports.DocxZipper = DocxZipper;
|
|
67195
67237
|
exports.Editor = Editor;
|
|
@@ -23290,7 +23290,7 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
23290
23290
|
return;
|
|
23291
23291
|
}
|
|
23292
23292
|
}
|
|
23293
|
-
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.12.
|
|
23293
|
+
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.12.30-rev.1") {
|
|
23294
23294
|
const customLocation = "docProps/custom.xml";
|
|
23295
23295
|
if (!docx[customLocation]) {
|
|
23296
23296
|
docx[customLocation] = generateCustomXml();
|
|
@@ -23756,7 +23756,7 @@ function storeSuperdocVersion(docx) {
|
|
|
23756
23756
|
function generateCustomXml() {
|
|
23757
23757
|
return DEFAULT_CUSTOM_XML;
|
|
23758
23758
|
}
|
|
23759
|
-
function generateSuperdocVersion(pid = 2, version2 = "0.12.
|
|
23759
|
+
function generateSuperdocVersion(pid = 2, version2 = "0.12.30-rev.1") {
|
|
23760
23760
|
return {
|
|
23761
23761
|
type: "element",
|
|
23762
23762
|
name: "property",
|
|
@@ -37610,8 +37610,9 @@ let EventEmitter$1 = class EventEmitter {
|
|
|
37610
37610
|
}
|
|
37611
37611
|
/**
|
|
37612
37612
|
* Subscribe to the event.
|
|
37613
|
-
* @param name Event name.
|
|
37614
|
-
* @param fn Callback.
|
|
37613
|
+
* @param {string} name Event name.
|
|
37614
|
+
* @param {(...args: any[]) => void} fn Callback.
|
|
37615
|
+
* @returns {void}
|
|
37615
37616
|
*/
|
|
37616
37617
|
on(name, fn2) {
|
|
37617
37618
|
const callbacks2 = __privateGet$1(this, _events).get(name);
|
|
@@ -37620,8 +37621,9 @@ let EventEmitter$1 = class EventEmitter {
|
|
|
37620
37621
|
}
|
|
37621
37622
|
/**
|
|
37622
37623
|
* Emit event.
|
|
37623
|
-
* @param name Event name.
|
|
37624
|
-
* @param args Arguments.
|
|
37624
|
+
* @param {string} name Event name.
|
|
37625
|
+
* @param {...any} args – Arguments to pass to each listener.
|
|
37626
|
+
* @returns {void}
|
|
37625
37627
|
*/
|
|
37626
37628
|
emit(name, ...args) {
|
|
37627
37629
|
const callbacks2 = __privateGet$1(this, _events).get(name);
|
|
@@ -37633,8 +37635,9 @@ let EventEmitter$1 = class EventEmitter {
|
|
|
37633
37635
|
/**
|
|
37634
37636
|
* Remove a specific callback from event
|
|
37635
37637
|
* or all event subscriptions.
|
|
37636
|
-
* @param name Event name.
|
|
37637
|
-
* @param fn Callback.
|
|
37638
|
+
* @param {string} name Event name.
|
|
37639
|
+
* @param {(...args: any[]) => void} fn Callback.
|
|
37640
|
+
* @returns {void}
|
|
37638
37641
|
*/
|
|
37639
37642
|
off(name, fn2) {
|
|
37640
37643
|
const callbacks2 = __privateGet$1(this, _events).get(name);
|
|
@@ -37648,6 +37651,19 @@ let EventEmitter$1 = class EventEmitter {
|
|
|
37648
37651
|
__privateGet$1(this, _events).delete(name);
|
|
37649
37652
|
}
|
|
37650
37653
|
}
|
|
37654
|
+
/**
|
|
37655
|
+
* Subscribe to an event that will be called only once.
|
|
37656
|
+
* @param {string} name Event name.
|
|
37657
|
+
* @param {(...args: any[]) => void} fn Callback.
|
|
37658
|
+
* @returns {void}
|
|
37659
|
+
*/
|
|
37660
|
+
once(name, fn2) {
|
|
37661
|
+
const wrapper = (...args) => {
|
|
37662
|
+
this.off(name, wrapper);
|
|
37663
|
+
fn2.apply(this, args);
|
|
37664
|
+
};
|
|
37665
|
+
this.on(name, wrapper);
|
|
37666
|
+
}
|
|
37651
37667
|
/**
|
|
37652
37668
|
* Remove all registered events and subscriptions.
|
|
37653
37669
|
*/
|
|
@@ -40031,11 +40047,12 @@ const generateTableIfNecessary = ({ tableNode, annotationValues, tr, state: stat
|
|
|
40031
40047
|
const getAnnotationValue = (id, annotationValues) => {
|
|
40032
40048
|
return annotationValues.find((value) => value.input_id === id)?.input_value || null;
|
|
40033
40049
|
};
|
|
40034
|
-
const
|
|
40050
|
+
const getAllHeaderFooterEditors = (editor) => {
|
|
40035
40051
|
const sections = {
|
|
40036
40052
|
header: editor.converter.headers || {},
|
|
40037
40053
|
footer: editor.converter.footers || {}
|
|
40038
40054
|
};
|
|
40055
|
+
const allEditors = [];
|
|
40039
40056
|
Object.entries(sections).forEach(([type2, items]) => {
|
|
40040
40057
|
const editorsKey = `${type2}Editors`;
|
|
40041
40058
|
Object.entries(items).forEach(([sectionId, data]) => {
|
|
@@ -40053,25 +40070,38 @@ const annotateHeadersAndFooters = ({ editor, annotationValues = [], hiddenFieldI
|
|
|
40053
40070
|
})
|
|
40054
40071
|
};
|
|
40055
40072
|
editor.converter[editorsKey].push(sectionEditor);
|
|
40073
|
+
allEditors.push({
|
|
40074
|
+
...sectionEditor,
|
|
40075
|
+
key: editorsKey,
|
|
40076
|
+
type: type2,
|
|
40077
|
+
sectionId
|
|
40078
|
+
});
|
|
40056
40079
|
}
|
|
40057
|
-
sectionEditor.editor.annotate(annotationValues, hiddenFieldIds);
|
|
40058
|
-
onHeaderFooterDataUpdate(
|
|
40059
|
-
{ editor: sectionEditor.editor },
|
|
40060
|
-
editor,
|
|
40061
|
-
sectionId,
|
|
40062
|
-
type2
|
|
40063
|
-
);
|
|
40064
40080
|
});
|
|
40065
40081
|
});
|
|
40082
|
+
return allEditors;
|
|
40083
|
+
};
|
|
40084
|
+
const annotateHeadersAndFooters = ({ editor, annotationValues = [], hiddenFieldIds = [], removeEmptyFields = false }) => {
|
|
40085
|
+
const allEditors = getAllHeaderFooterEditors(editor);
|
|
40086
|
+
allEditors.forEach(({ sectionId, editor: sectionEditor, type: type2 }) => {
|
|
40087
|
+
sectionEditor.annotate(annotationValues, hiddenFieldIds, removeEmptyFields);
|
|
40088
|
+
onHeaderFooterDataUpdate(
|
|
40089
|
+
{ editor: sectionEditor },
|
|
40090
|
+
editor,
|
|
40091
|
+
sectionId,
|
|
40092
|
+
type2
|
|
40093
|
+
);
|
|
40094
|
+
});
|
|
40066
40095
|
};
|
|
40067
40096
|
const annotateDocument = ({
|
|
40068
40097
|
annotationValues = [],
|
|
40069
40098
|
hiddenFieldIds = [],
|
|
40099
|
+
removeEmptyFields = false,
|
|
40070
40100
|
schema,
|
|
40071
40101
|
tr,
|
|
40072
40102
|
editor
|
|
40073
40103
|
}) => {
|
|
40074
|
-
annotateHeadersAndFooters({ editor, annotationValues, hiddenFieldIds });
|
|
40104
|
+
annotateHeadersAndFooters({ editor, annotationValues, hiddenFieldIds, removeEmptyFields });
|
|
40075
40105
|
const annotations = [];
|
|
40076
40106
|
const FieldType = schema.nodes.fieldAnnotation;
|
|
40077
40107
|
tr.doc.descendants((node2, pos) => {
|
|
@@ -40124,11 +40154,13 @@ const annotateDocument = ({
|
|
|
40124
40154
|
});
|
|
40125
40155
|
}
|
|
40126
40156
|
}
|
|
40127
|
-
|
|
40128
|
-
|
|
40129
|
-
|
|
40130
|
-
|
|
40131
|
-
|
|
40157
|
+
if (removeEmptyFields) {
|
|
40158
|
+
Array.from(toDelete).sort((a, b) => b - a).forEach((pos) => {
|
|
40159
|
+
const ann = annotations.find((a) => a.pos === pos);
|
|
40160
|
+
if (!ann) return;
|
|
40161
|
+
tr = tr.delete(pos, pos + ann.node.nodeSize);
|
|
40162
|
+
});
|
|
40163
|
+
}
|
|
40132
40164
|
return tr;
|
|
40133
40165
|
};
|
|
40134
40166
|
const getFormattedDate = (input = null, format = "") => {
|
|
@@ -40146,7 +40178,7 @@ const getFormattedDate = (input = null, format = "") => {
|
|
|
40146
40178
|
// e.g. “2025”
|
|
40147
40179
|
});
|
|
40148
40180
|
};
|
|
40149
|
-
const
|
|
40181
|
+
const AnnotatorHelpers = {
|
|
40150
40182
|
getFieldAttrs,
|
|
40151
40183
|
processTables,
|
|
40152
40184
|
annotateDocument,
|
|
@@ -40939,7 +40971,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
40939
40971
|
* @returns {Object | void} Migration results
|
|
40940
40972
|
*/
|
|
40941
40973
|
processCollaborationMigrations() {
|
|
40942
|
-
console.debug("[checkVersionMigrations] Current editor version", "0.12.
|
|
40974
|
+
console.debug("[checkVersionMigrations] Current editor version", "0.12.30-rev.1");
|
|
40943
40975
|
if (!this.options.ydoc) return;
|
|
40944
40976
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
40945
40977
|
let docVersion = metaMap.get("version");
|
|
@@ -41028,10 +41060,8 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
41028
41060
|
*/
|
|
41029
41061
|
prepareForAnnotations(annotationValues = []) {
|
|
41030
41062
|
const { tr } = this.state;
|
|
41031
|
-
const
|
|
41032
|
-
const newTr = AnnotatorServices.processTables({ state: this.state, tr, annotationValues });
|
|
41063
|
+
const newTr = AnnotatorHelpers.processTables({ state: this.state, tr, annotationValues });
|
|
41033
41064
|
this.view.dispatch(newTr);
|
|
41034
|
-
AnnotatorServices.annotateHeadersAndFooters({ editor: this, annotationValues });
|
|
41035
41065
|
}
|
|
41036
41066
|
/**
|
|
41037
41067
|
* Annotate the document with the given annotation values.
|
|
@@ -41040,15 +41070,16 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
41040
41070
|
* @param {String[]} hiddenIds List of field ids to remove from the document.
|
|
41041
41071
|
* @returns {void}
|
|
41042
41072
|
*/
|
|
41043
|
-
annotate(annotationValues = [], hiddenIds = []) {
|
|
41073
|
+
annotate(annotationValues = [], hiddenIds = [], removeEmptyFields = false) {
|
|
41044
41074
|
const { state: state2, view, schema } = this;
|
|
41045
41075
|
let tr = state2.tr;
|
|
41046
|
-
tr =
|
|
41047
|
-
tr =
|
|
41076
|
+
tr = AnnotatorHelpers.processTables({ state: this.state, tr, annotationValues });
|
|
41077
|
+
tr = AnnotatorHelpers.annotateDocument({
|
|
41048
41078
|
tr,
|
|
41049
41079
|
schema,
|
|
41050
41080
|
annotationValues,
|
|
41051
41081
|
hiddenFieldIds: hiddenIds,
|
|
41082
|
+
removeEmptyFields,
|
|
41052
41083
|
editor: this
|
|
41053
41084
|
});
|
|
41054
41085
|
if (tr.docChanged) view.dispatch(tr.scrollIntoView());
|
|
@@ -47272,6 +47303,15 @@ function findFieldAnnotationsBetween(from2, to, doc2) {
|
|
|
47272
47303
|
});
|
|
47273
47304
|
return fieldAnnotations;
|
|
47274
47305
|
}
|
|
47306
|
+
const getHeaderFooterAnnotations = (editor) => {
|
|
47307
|
+
const editors = getAllHeaderFooterEditors(editor);
|
|
47308
|
+
const allAnnotations = [];
|
|
47309
|
+
editors.forEach(({ id, editor: editor2 }) => {
|
|
47310
|
+
const annotations = getAllFieldAnnotations(editor2.state);
|
|
47311
|
+
allAnnotations.push(...annotations);
|
|
47312
|
+
});
|
|
47313
|
+
return allAnnotations;
|
|
47314
|
+
};
|
|
47275
47315
|
const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
47276
47316
|
__proto__: null,
|
|
47277
47317
|
findFieldAnnotations,
|
|
@@ -47281,6 +47321,7 @@ const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
47281
47321
|
findRemovedFieldAnnotations,
|
|
47282
47322
|
getAllFieldAnnotations,
|
|
47283
47323
|
getAllFieldAnnotationsWithRect,
|
|
47324
|
+
getHeaderFooterAnnotations,
|
|
47284
47325
|
trackFieldAnnotationsDeletion
|
|
47285
47326
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
47286
47327
|
function guard(low, high, value) {
|
|
@@ -67180,18 +67221,19 @@ export {
|
|
|
67180
67221
|
SuperConverter as S,
|
|
67181
67222
|
Toolbar as T,
|
|
67182
67223
|
_sfc_main$1 as _,
|
|
67183
|
-
|
|
67184
|
-
|
|
67185
|
-
|
|
67186
|
-
|
|
67187
|
-
|
|
67188
|
-
|
|
67189
|
-
|
|
67190
|
-
|
|
67224
|
+
AnnotatorHelpers as a,
|
|
67225
|
+
Extensions as b,
|
|
67226
|
+
SuperEditor as c,
|
|
67227
|
+
SuperInput as d,
|
|
67228
|
+
SuperToolbar as e,
|
|
67229
|
+
TrackChangesBasePluginKey as f,
|
|
67230
|
+
createZip as g,
|
|
67231
|
+
getActiveFormatting as h,
|
|
67191
67232
|
index$1 as i,
|
|
67192
|
-
|
|
67193
|
-
|
|
67194
|
-
|
|
67195
|
-
|
|
67196
|
-
|
|
67233
|
+
getAllowedImageDimensions as j,
|
|
67234
|
+
getMarksFromSelection as k,
|
|
67235
|
+
getRichTextExtensions as l,
|
|
67236
|
+
getStarterExtensions as m,
|
|
67237
|
+
helpers as n,
|
|
67238
|
+
index as o
|
|
67197
67239
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,8 @@ import { HTML } from '@harbour-enterprises/common';
|
|
|
9
9
|
import { helpers as superEditorHelpers } from '@harbour-enterprises/super-editor';
|
|
10
10
|
import { fieldAnnotationHelpers } from '@harbour-enterprises/super-editor';
|
|
11
11
|
import { trackChangesHelpers } from '@harbour-enterprises/super-editor';
|
|
12
|
+
import { AnnotatorHelpers } from '@harbour-enterprises/super-editor';
|
|
12
13
|
import { SuperConverter } from '@harbour-enterprises/super-editor';
|
|
13
14
|
import { createZip } from '@harbour-enterprises/super-editor';
|
|
14
|
-
export { BlankDOCX, getFileObject, compareVersions, Editor, getRichTextExtensions, DOCX, PDF, HTML, superEditorHelpers, fieldAnnotationHelpers, trackChangesHelpers, SuperConverter, createZip };
|
|
15
|
+
export { BlankDOCX, getFileObject, compareVersions, Editor, getRichTextExtensions, DOCX, PDF, HTML, superEditorHelpers, fieldAnnotationHelpers, trackChangesHelpers, AnnotatorHelpers, SuperConverter, createZip };
|
|
15
16
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":";8BAOgE,6BAA6B;gCAA7B,6BAA6B;uBAPpB,mCAAmC;sCAAnC,mCAAmC;qBAO5C,6BAA6B;oBAA7B,6BAA6B;qBAA7B,6BAA6B;8CADtF,mCAAmC;uCAAnC,mCAAmC;oCAAnC,mCAAmC;iCAAnC,mCAAmC;+BAN+B,mCAAmC;0BAAnC,mCAAmC"}
|
|
@@ -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-
|
|
3
|
-
import { _ as _export_sfc } from "./chunks/editor-
|
|
2
|
+
import { T as TextSelection } from "./chunks/converter-B3YG794p.js";
|
|
3
|
+
import { _ as _export_sfc } from "./chunks/editor-HCMuRikV.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 = {}) {
|
|
@@ -23309,7 +23309,7 @@ const _SuperConverter = class _SuperConverter {
|
|
|
23309
23309
|
return;
|
|
23310
23310
|
}
|
|
23311
23311
|
}
|
|
23312
|
-
static updateDocumentVersion(docx = this.convertedXml, version = "0.12.
|
|
23312
|
+
static updateDocumentVersion(docx = this.convertedXml, version = "0.12.30-rev.1") {
|
|
23313
23313
|
const customLocation = "docProps/custom.xml";
|
|
23314
23314
|
if (!docx[customLocation]) {
|
|
23315
23315
|
docx[customLocation] = generateCustomXml();
|
|
@@ -23778,7 +23778,7 @@ function storeSuperdocVersion(docx) {
|
|
|
23778
23778
|
function generateCustomXml() {
|
|
23779
23779
|
return DEFAULT_CUSTOM_XML;
|
|
23780
23780
|
}
|
|
23781
|
-
function generateSuperdocVersion(pid = 2, version = "0.12.
|
|
23781
|
+
function generateSuperdocVersion(pid = 2, version = "0.12.30-rev.1") {
|
|
23782
23782
|
return {
|
|
23783
23783
|
type: "element",
|
|
23784
23784
|
name: "property",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { x as process$1, a1 as commonjsGlobal, B as Buffer, a2 as getDefaultExportFromCjs, a3 as getContentTypesFromXml, a4 as xmljs } from "./converter-
|
|
1
|
+
import { x as process$1, a1 as commonjsGlobal, B as Buffer, a2 as getDefaultExportFromCjs, a3 as getContentTypesFromXml, a4 as xmljs } from "./converter-B3YG794p.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
|
}
|