@harbour-enterprises/superdoc 0.12.31-next.1 → 0.12.31-next.3
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-CzfjXQ8V.cjs → super-editor.es-DyMHUKH-.cjs} +80 -25
- package/dist/chunks/{super-editor.es-Bt5pMkY-.es.js → super-editor.es-FB6IxNPq.es.js} +93 -38
- 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-LyqpytFD.js → converter-uEzXlNMY.js} +2 -2
- package/dist/super-editor/chunks/{docx-zipper-CSx2w--M.js → docx-zipper-K49xEYFp.js} +1 -1
- package/dist/super-editor/chunks/{editor-czvDp00c.js → editor-D9iCd6-F.js} +81 -26
- package/dist/super-editor/chunks/{toolbar-BnvzLMKn.js → toolbar-D-IyvvJz.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/helpers/annotator.d.ts +17 -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/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 +81 -26
- 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.31-next.
|
|
23310
|
+
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.12.31-next.3") {
|
|
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.31-next.
|
|
23776
|
+
function generateSuperdocVersion(pid = 2, version2 = "0.12.31-next.3") {
|
|
23777
23777
|
return {
|
|
23778
23778
|
type: "element",
|
|
23779
23779
|
name: "property",
|
|
@@ -40070,11 +40070,12 @@ const generateTableIfNecessary = ({ tableNode, annotationValues, tr, state: stat
|
|
|
40070
40070
|
const getAnnotationValue = (id, annotationValues) => {
|
|
40071
40071
|
return annotationValues.find((value) => value.input_id === id)?.input_value || null;
|
|
40072
40072
|
};
|
|
40073
|
-
const
|
|
40073
|
+
const getAllHeaderFooterEditors = (editor) => {
|
|
40074
40074
|
const sections = {
|
|
40075
40075
|
header: editor.converter.headers || {},
|
|
40076
40076
|
footer: editor.converter.footers || {}
|
|
40077
40077
|
};
|
|
40078
|
+
const allEditors = [];
|
|
40078
40079
|
Object.entries(sections).forEach(([type2, items]) => {
|
|
40079
40080
|
const editorsKey = `${type2}Editors`;
|
|
40080
40081
|
Object.entries(items).forEach(([sectionId, data]) => {
|
|
@@ -40092,25 +40093,38 @@ const annotateHeadersAndFooters = ({ editor, annotationValues = [], hiddenFieldI
|
|
|
40092
40093
|
})
|
|
40093
40094
|
};
|
|
40094
40095
|
editor.converter[editorsKey].push(sectionEditor);
|
|
40096
|
+
allEditors.push({
|
|
40097
|
+
...sectionEditor,
|
|
40098
|
+
key: editorsKey,
|
|
40099
|
+
type: type2,
|
|
40100
|
+
sectionId
|
|
40101
|
+
});
|
|
40095
40102
|
}
|
|
40096
|
-
sectionEditor.editor.annotate(annotationValues, hiddenFieldIds);
|
|
40097
|
-
onHeaderFooterDataUpdate(
|
|
40098
|
-
{ editor: sectionEditor.editor },
|
|
40099
|
-
editor,
|
|
40100
|
-
sectionId,
|
|
40101
|
-
type2
|
|
40102
|
-
);
|
|
40103
40103
|
});
|
|
40104
40104
|
});
|
|
40105
|
+
return allEditors;
|
|
40106
|
+
};
|
|
40107
|
+
const annotateHeadersAndFooters = ({ editor, annotationValues = [], hiddenFieldIds = [], removeEmptyFields = false }) => {
|
|
40108
|
+
const allEditors = getAllHeaderFooterEditors(editor);
|
|
40109
|
+
allEditors.forEach(({ sectionId, editor: sectionEditor, type: type2 }) => {
|
|
40110
|
+
sectionEditor.annotate(annotationValues, hiddenFieldIds, removeEmptyFields);
|
|
40111
|
+
onHeaderFooterDataUpdate(
|
|
40112
|
+
{ editor: sectionEditor },
|
|
40113
|
+
editor,
|
|
40114
|
+
sectionId,
|
|
40115
|
+
type2
|
|
40116
|
+
);
|
|
40117
|
+
});
|
|
40105
40118
|
};
|
|
40106
40119
|
const annotateDocument = ({
|
|
40107
40120
|
annotationValues = [],
|
|
40108
40121
|
hiddenFieldIds = [],
|
|
40122
|
+
removeEmptyFields = false,
|
|
40109
40123
|
schema,
|
|
40110
40124
|
tr,
|
|
40111
40125
|
editor
|
|
40112
40126
|
}) => {
|
|
40113
|
-
annotateHeadersAndFooters({ editor, annotationValues, hiddenFieldIds });
|
|
40127
|
+
annotateHeadersAndFooters({ editor, annotationValues, hiddenFieldIds, removeEmptyFields });
|
|
40114
40128
|
const annotations = [];
|
|
40115
40129
|
const FieldType = schema.nodes.fieldAnnotation;
|
|
40116
40130
|
tr.doc.descendants((node2, pos) => {
|
|
@@ -40163,11 +40177,13 @@ const annotateDocument = ({
|
|
|
40163
40177
|
});
|
|
40164
40178
|
}
|
|
40165
40179
|
}
|
|
40166
|
-
|
|
40167
|
-
|
|
40168
|
-
|
|
40169
|
-
|
|
40170
|
-
|
|
40180
|
+
if (removeEmptyFields) {
|
|
40181
|
+
Array.from(toDelete).sort((a, b) => b - a).forEach((pos) => {
|
|
40182
|
+
const ann = annotations.find((a) => a.pos === pos);
|
|
40183
|
+
if (!ann) return;
|
|
40184
|
+
tr = tr.delete(pos, pos + ann.node.nodeSize);
|
|
40185
|
+
});
|
|
40186
|
+
}
|
|
40171
40187
|
return tr;
|
|
40172
40188
|
};
|
|
40173
40189
|
const getFormattedDate = (input = null, format = "") => {
|
|
@@ -40185,11 +40201,40 @@ const getFormattedDate = (input = null, format = "") => {
|
|
|
40185
40201
|
// e.g. “2025”
|
|
40186
40202
|
});
|
|
40187
40203
|
};
|
|
40188
|
-
const
|
|
40204
|
+
const updateHeaderFooterFieldAnnotations = ({ editor, fieldIdOrArray, attrs = {} }) => {
|
|
40205
|
+
if (!editor) return;
|
|
40206
|
+
const sectionEditors = getAllHeaderFooterEditors(editor);
|
|
40207
|
+
sectionEditors.forEach(({ editor: sectionEditor, sectionId, type: type2 }) => {
|
|
40208
|
+
sectionEditor.commands.updateFieldAnnotations(fieldIdOrArray, attrs);
|
|
40209
|
+
onHeaderFooterDataUpdate(
|
|
40210
|
+
{ editor: sectionEditor },
|
|
40211
|
+
editor,
|
|
40212
|
+
sectionId,
|
|
40213
|
+
type2
|
|
40214
|
+
);
|
|
40215
|
+
});
|
|
40216
|
+
};
|
|
40217
|
+
const deleteHeaderFooterFieldAnnotations = ({ editor, fieldIdOrArray }) => {
|
|
40218
|
+
if (!editor) return;
|
|
40219
|
+
const sectionEditors = getAllHeaderFooterEditors(editor);
|
|
40220
|
+
sectionEditors.forEach(({ editor: sectionEditor, sectionId, type: type2 }) => {
|
|
40221
|
+
sectionEditor.commands.deleteFieldAnnotations(fieldIdOrArray);
|
|
40222
|
+
onHeaderFooterDataUpdate(
|
|
40223
|
+
{ editor: sectionEditor },
|
|
40224
|
+
editor,
|
|
40225
|
+
sectionId,
|
|
40226
|
+
type2
|
|
40227
|
+
);
|
|
40228
|
+
});
|
|
40229
|
+
};
|
|
40230
|
+
const AnnotatorHelpers = {
|
|
40189
40231
|
getFieldAttrs,
|
|
40190
40232
|
processTables,
|
|
40191
40233
|
annotateDocument,
|
|
40192
|
-
annotateHeadersAndFooters
|
|
40234
|
+
annotateHeadersAndFooters,
|
|
40235
|
+
getAllHeaderFooterEditors,
|
|
40236
|
+
updateHeaderFooterFieldAnnotations,
|
|
40237
|
+
deleteHeaderFooterFieldAnnotations
|
|
40193
40238
|
};
|
|
40194
40239
|
const CollaborationPluginKey = new PluginKey("collaboration");
|
|
40195
40240
|
const Collaboration = Extension.create({
|
|
@@ -40994,7 +41039,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
40994
41039
|
* @returns {Object | void} Migration results
|
|
40995
41040
|
*/
|
|
40996
41041
|
processCollaborationMigrations() {
|
|
40997
|
-
console.debug("[checkVersionMigrations] Current editor version", "0.12.31-next.
|
|
41042
|
+
console.debug("[checkVersionMigrations] Current editor version", "0.12.31-next.3");
|
|
40998
41043
|
if (!this.options.ydoc) return;
|
|
40999
41044
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
41000
41045
|
let docVersion = metaMap.get("version");
|
|
@@ -41083,10 +41128,8 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
41083
41128
|
*/
|
|
41084
41129
|
prepareForAnnotations(annotationValues = []) {
|
|
41085
41130
|
const { tr } = this.state;
|
|
41086
|
-
const
|
|
41087
|
-
const newTr = AnnotatorServices.processTables({ state: this.state, tr, annotationValues });
|
|
41131
|
+
const newTr = AnnotatorHelpers.processTables({ state: this.state, tr, annotationValues });
|
|
41088
41132
|
this.view.dispatch(newTr);
|
|
41089
|
-
AnnotatorServices.annotateHeadersAndFooters({ editor: this, annotationValues });
|
|
41090
41133
|
}
|
|
41091
41134
|
/**
|
|
41092
41135
|
* Annotate the document with the given annotation values.
|
|
@@ -41095,15 +41138,16 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
41095
41138
|
* @param {String[]} hiddenIds List of field ids to remove from the document.
|
|
41096
41139
|
* @returns {void}
|
|
41097
41140
|
*/
|
|
41098
|
-
annotate(annotationValues = [], hiddenIds = []) {
|
|
41141
|
+
annotate(annotationValues = [], hiddenIds = [], removeEmptyFields = false) {
|
|
41099
41142
|
const { state: state2, view, schema } = this;
|
|
41100
41143
|
let tr = state2.tr;
|
|
41101
|
-
tr =
|
|
41102
|
-
tr =
|
|
41144
|
+
tr = AnnotatorHelpers.processTables({ state: this.state, tr, annotationValues });
|
|
41145
|
+
tr = AnnotatorHelpers.annotateDocument({
|
|
41103
41146
|
tr,
|
|
41104
41147
|
schema,
|
|
41105
41148
|
annotationValues,
|
|
41106
41149
|
hiddenFieldIds: hiddenIds,
|
|
41150
|
+
removeEmptyFields,
|
|
41107
41151
|
editor: this
|
|
41108
41152
|
});
|
|
41109
41153
|
if (tr.docChanged) view.dispatch(tr.scrollIntoView());
|
|
@@ -47352,6 +47396,15 @@ function findFieldAnnotationsBetween(from2, to, doc2) {
|
|
|
47352
47396
|
});
|
|
47353
47397
|
return fieldAnnotations;
|
|
47354
47398
|
}
|
|
47399
|
+
const getHeaderFooterAnnotations = (editor) => {
|
|
47400
|
+
const editors = getAllHeaderFooterEditors(editor);
|
|
47401
|
+
const allAnnotations = [];
|
|
47402
|
+
editors.forEach(({ id, editor: editor2 }) => {
|
|
47403
|
+
const annotations = getAllFieldAnnotations(editor2.state);
|
|
47404
|
+
allAnnotations.push(...annotations);
|
|
47405
|
+
});
|
|
47406
|
+
return allAnnotations;
|
|
47407
|
+
};
|
|
47355
47408
|
const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
47356
47409
|
__proto__: null,
|
|
47357
47410
|
findFieldAnnotations,
|
|
@@ -47361,6 +47414,7 @@ const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
47361
47414
|
findRemovedFieldAnnotations,
|
|
47362
47415
|
getAllFieldAnnotations,
|
|
47363
47416
|
getAllFieldAnnotationsWithRect,
|
|
47417
|
+
getHeaderFooterAnnotations,
|
|
47364
47418
|
trackFieldAnnotationsDeletion
|
|
47365
47419
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
47366
47420
|
function guard(low, high, value) {
|
|
@@ -67470,6 +67524,7 @@ const Extensions = {
|
|
|
67470
67524
|
Mark: Mark2
|
|
67471
67525
|
};
|
|
67472
67526
|
exports.AIWriter = AIWriter;
|
|
67527
|
+
exports.AnnotatorHelpers = AnnotatorHelpers;
|
|
67473
67528
|
exports.CommentsPluginKey = CommentsPluginKey;
|
|
67474
67529
|
exports.DocxZipper = DocxZipper;
|
|
67475
67530
|
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.31-next.
|
|
23293
|
+
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.12.31-next.3") {
|
|
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.31-next.
|
|
23759
|
+
function generateSuperdocVersion(pid = 2, version2 = "0.12.31-next.3") {
|
|
23760
23760
|
return {
|
|
23761
23761
|
type: "element",
|
|
23762
23762
|
name: "property",
|
|
@@ -40053,11 +40053,12 @@ const generateTableIfNecessary = ({ tableNode, annotationValues, tr, state: stat
|
|
|
40053
40053
|
const getAnnotationValue = (id, annotationValues) => {
|
|
40054
40054
|
return annotationValues.find((value) => value.input_id === id)?.input_value || null;
|
|
40055
40055
|
};
|
|
40056
|
-
const
|
|
40056
|
+
const getAllHeaderFooterEditors = (editor) => {
|
|
40057
40057
|
const sections = {
|
|
40058
40058
|
header: editor.converter.headers || {},
|
|
40059
40059
|
footer: editor.converter.footers || {}
|
|
40060
40060
|
};
|
|
40061
|
+
const allEditors = [];
|
|
40061
40062
|
Object.entries(sections).forEach(([type2, items]) => {
|
|
40062
40063
|
const editorsKey = `${type2}Editors`;
|
|
40063
40064
|
Object.entries(items).forEach(([sectionId, data]) => {
|
|
@@ -40075,25 +40076,38 @@ const annotateHeadersAndFooters = ({ editor, annotationValues = [], hiddenFieldI
|
|
|
40075
40076
|
})
|
|
40076
40077
|
};
|
|
40077
40078
|
editor.converter[editorsKey].push(sectionEditor);
|
|
40079
|
+
allEditors.push({
|
|
40080
|
+
...sectionEditor,
|
|
40081
|
+
key: editorsKey,
|
|
40082
|
+
type: type2,
|
|
40083
|
+
sectionId
|
|
40084
|
+
});
|
|
40078
40085
|
}
|
|
40079
|
-
sectionEditor.editor.annotate(annotationValues, hiddenFieldIds);
|
|
40080
|
-
onHeaderFooterDataUpdate(
|
|
40081
|
-
{ editor: sectionEditor.editor },
|
|
40082
|
-
editor,
|
|
40083
|
-
sectionId,
|
|
40084
|
-
type2
|
|
40085
|
-
);
|
|
40086
40086
|
});
|
|
40087
40087
|
});
|
|
40088
|
+
return allEditors;
|
|
40089
|
+
};
|
|
40090
|
+
const annotateHeadersAndFooters = ({ editor, annotationValues = [], hiddenFieldIds = [], removeEmptyFields = false }) => {
|
|
40091
|
+
const allEditors = getAllHeaderFooterEditors(editor);
|
|
40092
|
+
allEditors.forEach(({ sectionId, editor: sectionEditor, type: type2 }) => {
|
|
40093
|
+
sectionEditor.annotate(annotationValues, hiddenFieldIds, removeEmptyFields);
|
|
40094
|
+
onHeaderFooterDataUpdate(
|
|
40095
|
+
{ editor: sectionEditor },
|
|
40096
|
+
editor,
|
|
40097
|
+
sectionId,
|
|
40098
|
+
type2
|
|
40099
|
+
);
|
|
40100
|
+
});
|
|
40088
40101
|
};
|
|
40089
40102
|
const annotateDocument = ({
|
|
40090
40103
|
annotationValues = [],
|
|
40091
40104
|
hiddenFieldIds = [],
|
|
40105
|
+
removeEmptyFields = false,
|
|
40092
40106
|
schema,
|
|
40093
40107
|
tr,
|
|
40094
40108
|
editor
|
|
40095
40109
|
}) => {
|
|
40096
|
-
annotateHeadersAndFooters({ editor, annotationValues, hiddenFieldIds });
|
|
40110
|
+
annotateHeadersAndFooters({ editor, annotationValues, hiddenFieldIds, removeEmptyFields });
|
|
40097
40111
|
const annotations = [];
|
|
40098
40112
|
const FieldType = schema.nodes.fieldAnnotation;
|
|
40099
40113
|
tr.doc.descendants((node2, pos) => {
|
|
@@ -40146,11 +40160,13 @@ const annotateDocument = ({
|
|
|
40146
40160
|
});
|
|
40147
40161
|
}
|
|
40148
40162
|
}
|
|
40149
|
-
|
|
40150
|
-
|
|
40151
|
-
|
|
40152
|
-
|
|
40153
|
-
|
|
40163
|
+
if (removeEmptyFields) {
|
|
40164
|
+
Array.from(toDelete).sort((a, b) => b - a).forEach((pos) => {
|
|
40165
|
+
const ann = annotations.find((a) => a.pos === pos);
|
|
40166
|
+
if (!ann) return;
|
|
40167
|
+
tr = tr.delete(pos, pos + ann.node.nodeSize);
|
|
40168
|
+
});
|
|
40169
|
+
}
|
|
40154
40170
|
return tr;
|
|
40155
40171
|
};
|
|
40156
40172
|
const getFormattedDate = (input = null, format = "") => {
|
|
@@ -40168,11 +40184,40 @@ const getFormattedDate = (input = null, format = "") => {
|
|
|
40168
40184
|
// e.g. “2025”
|
|
40169
40185
|
});
|
|
40170
40186
|
};
|
|
40171
|
-
const
|
|
40187
|
+
const updateHeaderFooterFieldAnnotations = ({ editor, fieldIdOrArray, attrs = {} }) => {
|
|
40188
|
+
if (!editor) return;
|
|
40189
|
+
const sectionEditors = getAllHeaderFooterEditors(editor);
|
|
40190
|
+
sectionEditors.forEach(({ editor: sectionEditor, sectionId, type: type2 }) => {
|
|
40191
|
+
sectionEditor.commands.updateFieldAnnotations(fieldIdOrArray, attrs);
|
|
40192
|
+
onHeaderFooterDataUpdate(
|
|
40193
|
+
{ editor: sectionEditor },
|
|
40194
|
+
editor,
|
|
40195
|
+
sectionId,
|
|
40196
|
+
type2
|
|
40197
|
+
);
|
|
40198
|
+
});
|
|
40199
|
+
};
|
|
40200
|
+
const deleteHeaderFooterFieldAnnotations = ({ editor, fieldIdOrArray }) => {
|
|
40201
|
+
if (!editor) return;
|
|
40202
|
+
const sectionEditors = getAllHeaderFooterEditors(editor);
|
|
40203
|
+
sectionEditors.forEach(({ editor: sectionEditor, sectionId, type: type2 }) => {
|
|
40204
|
+
sectionEditor.commands.deleteFieldAnnotations(fieldIdOrArray);
|
|
40205
|
+
onHeaderFooterDataUpdate(
|
|
40206
|
+
{ editor: sectionEditor },
|
|
40207
|
+
editor,
|
|
40208
|
+
sectionId,
|
|
40209
|
+
type2
|
|
40210
|
+
);
|
|
40211
|
+
});
|
|
40212
|
+
};
|
|
40213
|
+
const AnnotatorHelpers = {
|
|
40172
40214
|
getFieldAttrs,
|
|
40173
40215
|
processTables,
|
|
40174
40216
|
annotateDocument,
|
|
40175
|
-
annotateHeadersAndFooters
|
|
40217
|
+
annotateHeadersAndFooters,
|
|
40218
|
+
getAllHeaderFooterEditors,
|
|
40219
|
+
updateHeaderFooterFieldAnnotations,
|
|
40220
|
+
deleteHeaderFooterFieldAnnotations
|
|
40176
40221
|
};
|
|
40177
40222
|
const CollaborationPluginKey = new PluginKey("collaboration");
|
|
40178
40223
|
const Collaboration = Extension.create({
|
|
@@ -40977,7 +41022,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
40977
41022
|
* @returns {Object | void} Migration results
|
|
40978
41023
|
*/
|
|
40979
41024
|
processCollaborationMigrations() {
|
|
40980
|
-
console.debug("[checkVersionMigrations] Current editor version", "0.12.31-next.
|
|
41025
|
+
console.debug("[checkVersionMigrations] Current editor version", "0.12.31-next.3");
|
|
40981
41026
|
if (!this.options.ydoc) return;
|
|
40982
41027
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
40983
41028
|
let docVersion = metaMap.get("version");
|
|
@@ -41066,10 +41111,8 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
41066
41111
|
*/
|
|
41067
41112
|
prepareForAnnotations(annotationValues = []) {
|
|
41068
41113
|
const { tr } = this.state;
|
|
41069
|
-
const
|
|
41070
|
-
const newTr = AnnotatorServices.processTables({ state: this.state, tr, annotationValues });
|
|
41114
|
+
const newTr = AnnotatorHelpers.processTables({ state: this.state, tr, annotationValues });
|
|
41071
41115
|
this.view.dispatch(newTr);
|
|
41072
|
-
AnnotatorServices.annotateHeadersAndFooters({ editor: this, annotationValues });
|
|
41073
41116
|
}
|
|
41074
41117
|
/**
|
|
41075
41118
|
* Annotate the document with the given annotation values.
|
|
@@ -41078,15 +41121,16 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
41078
41121
|
* @param {String[]} hiddenIds List of field ids to remove from the document.
|
|
41079
41122
|
* @returns {void}
|
|
41080
41123
|
*/
|
|
41081
|
-
annotate(annotationValues = [], hiddenIds = []) {
|
|
41124
|
+
annotate(annotationValues = [], hiddenIds = [], removeEmptyFields = false) {
|
|
41082
41125
|
const { state: state2, view, schema } = this;
|
|
41083
41126
|
let tr = state2.tr;
|
|
41084
|
-
tr =
|
|
41085
|
-
tr =
|
|
41127
|
+
tr = AnnotatorHelpers.processTables({ state: this.state, tr, annotationValues });
|
|
41128
|
+
tr = AnnotatorHelpers.annotateDocument({
|
|
41086
41129
|
tr,
|
|
41087
41130
|
schema,
|
|
41088
41131
|
annotationValues,
|
|
41089
41132
|
hiddenFieldIds: hiddenIds,
|
|
41133
|
+
removeEmptyFields,
|
|
41090
41134
|
editor: this
|
|
41091
41135
|
});
|
|
41092
41136
|
if (tr.docChanged) view.dispatch(tr.scrollIntoView());
|
|
@@ -47335,6 +47379,15 @@ function findFieldAnnotationsBetween(from2, to, doc2) {
|
|
|
47335
47379
|
});
|
|
47336
47380
|
return fieldAnnotations;
|
|
47337
47381
|
}
|
|
47382
|
+
const getHeaderFooterAnnotations = (editor) => {
|
|
47383
|
+
const editors = getAllHeaderFooterEditors(editor);
|
|
47384
|
+
const allAnnotations = [];
|
|
47385
|
+
editors.forEach(({ id, editor: editor2 }) => {
|
|
47386
|
+
const annotations = getAllFieldAnnotations(editor2.state);
|
|
47387
|
+
allAnnotations.push(...annotations);
|
|
47388
|
+
});
|
|
47389
|
+
return allAnnotations;
|
|
47390
|
+
};
|
|
47338
47391
|
const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
47339
47392
|
__proto__: null,
|
|
47340
47393
|
findFieldAnnotations,
|
|
@@ -47344,6 +47397,7 @@ const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
47344
47397
|
findRemovedFieldAnnotations,
|
|
47345
47398
|
getAllFieldAnnotations,
|
|
47346
47399
|
getAllFieldAnnotationsWithRect,
|
|
47400
|
+
getHeaderFooterAnnotations,
|
|
47347
47401
|
trackFieldAnnotationsDeletion
|
|
47348
47402
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
47349
47403
|
function guard(low, high, value) {
|
|
@@ -67460,18 +67514,19 @@ export {
|
|
|
67460
67514
|
SuperConverter as S,
|
|
67461
67515
|
Toolbar as T,
|
|
67462
67516
|
_sfc_main$1 as _,
|
|
67463
|
-
|
|
67464
|
-
|
|
67465
|
-
|
|
67466
|
-
|
|
67467
|
-
|
|
67468
|
-
|
|
67469
|
-
|
|
67470
|
-
|
|
67517
|
+
AnnotatorHelpers as a,
|
|
67518
|
+
Extensions as b,
|
|
67519
|
+
SuperEditor as c,
|
|
67520
|
+
SuperInput as d,
|
|
67521
|
+
SuperToolbar as e,
|
|
67522
|
+
TrackChangesBasePluginKey as f,
|
|
67523
|
+
createZip as g,
|
|
67524
|
+
getActiveFormatting as h,
|
|
67471
67525
|
index$1 as i,
|
|
67472
|
-
|
|
67473
|
-
|
|
67474
|
-
|
|
67475
|
-
|
|
67476
|
-
|
|
67526
|
+
getAllowedImageDimensions as j,
|
|
67527
|
+
getMarksFromSelection as k,
|
|
67528
|
+
getRichTextExtensions as l,
|
|
67529
|
+
getStarterExtensions as m,
|
|
67530
|
+
helpers as n,
|
|
67531
|
+
index as o
|
|
67477
67532
|
};
|
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-uEzXlNMY.js";
|
|
3
|
+
import { _ as _export_sfc } from "./chunks/editor-D9iCd6-F.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.31-next.
|
|
23312
|
+
static updateDocumentVersion(docx = this.convertedXml, version = "0.12.31-next.3") {
|
|
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.31-next.
|
|
23781
|
+
function generateSuperdocVersion(pid = 2, version = "0.12.31-next.3") {
|
|
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-uEzXlNMY.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
|
}
|