@harbour-enterprises/superdoc 0.12.31 → 0.12.33
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-CYH3KblY.es.js → super-editor.es-CBLVWdKq.es.js} +613 -283
- package/dist/chunks/{super-editor.es-BxaiA9ut.cjs → super-editor.es-CYLlFqVM.cjs} +599 -269
- package/dist/composables/use-high-contrast-mode.d.ts +5 -0
- package/dist/composables/use-high-contrast-mode.d.ts.map +1 -0
- package/dist/core/SuperDoc.d.ts +7 -0
- package/dist/core/SuperDoc.d.ts.map +1 -1
- package/dist/core/create-app.d.ts.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/style.css +299 -245
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-Dm2_Htrh.js → converter-Dy-BSTkN.js} +2 -2
- package/dist/super-editor/chunks/{docx-zipper-CU11jH41.js → docx-zipper-DU8JCtV_.js} +7 -3
- package/dist/super-editor/chunks/{editor-CISWiQkg.js → editor-WlPEO0Uc.js} +190 -67
- package/dist/super-editor/chunks/{toolbar-Dgo3wQvN.js → toolbar-DX8uzwtc.js} +80 -36
- package/dist/super-editor/components/toolbar/defaultItems.d.ts.map +1 -1
- package/dist/super-editor/composables/use-high-contrast-mode.d.ts +5 -0
- package/dist/super-editor/composables/use-high-contrast-mode.d.ts.map +1 -0
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/core/DocxZipper.d.ts +1 -1
- package/dist/super-editor/core/DocxZipper.d.ts.map +1 -1
- package/dist/super-editor/core/Editor.d.ts +2 -1
- package/dist/super-editor/core/Editor.d.ts.map +1 -1
- package/dist/super-editor/core/InputRule.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/ai/ai-nodes.d.ts.map +1 -1
- package/dist/super-editor/extensions/bookmarks/bookmarks.d.ts.map +1 -1
- package/dist/super-editor/extensions/bullet-list/bullet-list.d.ts.map +1 -1
- package/dist/super-editor/extensions/collaboration/collaboration-helpers.d.ts.map +1 -1
- package/dist/super-editor/extensions/comment/comment.d.ts.map +1 -1
- package/dist/super-editor/extensions/document/document.d.ts.map +1 -1
- package/dist/super-editor/extensions/field-annotation/field-annotation.d.ts.map +1 -1
- 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/extensions/heading/heading.d.ts.map +1 -1
- package/dist/super-editor/extensions/image/image.d.ts.map +1 -1
- package/dist/super-editor/extensions/line-break/line-break.d.ts.map +1 -1
- package/dist/super-editor/extensions/list-item/list-item.d.ts.map +1 -1
- package/dist/super-editor/extensions/mention/mention.d.ts.map +1 -1
- package/dist/super-editor/extensions/ordered-list/ordered-list.d.ts.map +1 -1
- package/dist/super-editor/extensions/page-number/page-number.d.ts.map +1 -1
- package/dist/super-editor/extensions/pagination/pagination-helpers.d.ts.map +1 -1
- package/dist/super-editor/extensions/run-item/run-item.d.ts.map +1 -1
- package/dist/super-editor/extensions/shape-container/shape-container.d.ts.map +1 -1
- package/dist/super-editor/extensions/shape-textbox/shape-textbox.d.ts.map +1 -1
- package/dist/super-editor/extensions/structured-content/structured-content.d.ts.map +1 -1
- package/dist/super-editor/extensions/table/table.d.ts.map +1 -1
- package/dist/super-editor/extensions/table-cell/table-cell.d.ts.map +1 -1
- package/dist/super-editor/extensions/table-header/table-header.d.ts.map +1 -1
- package/dist/super-editor/extensions/table-row/table-row.d.ts.map +1 -1
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/index.d.ts +1 -1
- package/dist/super-editor/style.css +243 -196
- package/dist/super-editor/super-editor.es.js +335 -174
- 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 +35 -9
- package/dist/superdoc.es.js +233 -207
- package/dist/superdoc.umd.js +636 -281
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +2 -2
|
@@ -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-Dy-BSTkN.js";
|
|
3
|
+
import { _ as _export_sfc } from "./chunks/editor-WlPEO0Uc.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.33") {
|
|
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.33") {
|
|
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-Dy-BSTkN.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
|
}
|
|
@@ -2376,12 +2376,15 @@ class DocxZipper {
|
|
|
2376
2376
|
/**
|
|
2377
2377
|
* Update [Content_Types].xml with extensions of new Image annotations
|
|
2378
2378
|
*/
|
|
2379
|
-
async updateContentTypes(docx, media) {
|
|
2379
|
+
async updateContentTypes(docx, media, fromJson) {
|
|
2380
2380
|
const newMediaTypes = Object.keys(media).map((name) => {
|
|
2381
2381
|
return this.getFileExtension(name);
|
|
2382
2382
|
});
|
|
2383
2383
|
const contentTypesPath = "[Content_Types].xml";
|
|
2384
|
-
|
|
2384
|
+
let contentTypesXml;
|
|
2385
|
+
if (fromJson) {
|
|
2386
|
+
contentTypesXml = docx.files.find((file) => file.name === contentTypesPath)?.content || "";
|
|
2387
|
+
} else contentTypesXml = await docx.file(contentTypesPath).async("string");
|
|
2385
2388
|
let typesString = "";
|
|
2386
2389
|
const defaultMediaTypes = getContentTypesFromXml(contentTypesXml);
|
|
2387
2390
|
const seenTypes = /* @__PURE__ */ new Set();
|
|
@@ -2425,6 +2428,7 @@ class DocxZipper {
|
|
|
2425
2428
|
});
|
|
2426
2429
|
const beginningString = '<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">';
|
|
2427
2430
|
const updatedContentTypesXml = contentTypesXml.replace(beginningString, `${beginningString}${typesString}`);
|
|
2431
|
+
if (fromJson) return updatedContentTypesXml;
|
|
2428
2432
|
docx.file(contentTypesPath, updatedContentTypesXml);
|
|
2429
2433
|
}
|
|
2430
2434
|
async unzip(file) {
|
|
@@ -12,9 +12,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
12
12
|
var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _commandService, _css, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, insertNewFileData_fn, registerPluginByNameIfNotExists_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, createSchema_fn, generatePmData_fn, createDocFromHTML_fn, createView_fn, onCollaborationReady_fn, initComments_fn, initPagination_fn, dispatchTransaction_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, _FieldAnnotationView_instances, createAnnotation_fn;
|
|
13
13
|
import * as Y from "yjs";
|
|
14
14
|
import { UndoManager, Item as Item$1, ContentType, Text as Text$1, XmlElement, encodeStateAsUpdate } from "yjs";
|
|
15
|
-
import { P as PluginKey, a as Plugin, M as Mapping, c as callOrGet, i as isEmptyObject, S as Schema$1, T as TextSelection, b as canSplit, l as liftTarget, A as AllSelection, d as canJoin, j as joinPoint, N as NodeSelection, r as replaceStep$1, e as Selection, F as Fragment, R as ReplaceAroundStep, f as Slice, o as objectIncludes, g as deleteProps, D as DOMParser$1, h as ReplaceStep, k as NodeRange, m as findWrapping, n as isMacOS, p as isIOS, q as generateDocxRandomId, s as minMax, t as generateRandom32BitHex, u as DOMSerializer, v as Mark$1, w as dropPoint, x as process$1, B as Buffer2, y as isRegExp, z as TrackDeleteMarkName, C as TrackInsertMarkName, E as v4, G as TrackFormatMarkName, H as comments_module_events, I as AddMarkStep, J as RemoveMarkStep, K as twipsToLines, L as pixelsToTwips, O as SuperConverter, Q as EditorState, U as hasSomeParentWithClass, V as parseSizeUnit, W as getLineHeightValueString, X as toKebabCase, Y as kebabCase, Z as getColStyleDeclaration, _ as SelectionRange, $ as Transform, a0 as createColGroup } from "./converter-
|
|
15
|
+
import { P as PluginKey, a as Plugin, M as Mapping, c as callOrGet, i as isEmptyObject, S as Schema$1, T as TextSelection, b as canSplit, l as liftTarget, A as AllSelection, d as canJoin, j as joinPoint, N as NodeSelection, r as replaceStep$1, e as Selection, F as Fragment, R as ReplaceAroundStep, f as Slice, o as objectIncludes, g as deleteProps, D as DOMParser$1, h as ReplaceStep, k as NodeRange, m as findWrapping, n as isMacOS, p as isIOS, q as generateDocxRandomId, s as minMax, t as generateRandom32BitHex, u as DOMSerializer, v as Mark$1, w as dropPoint, x as process$1, B as Buffer2, y as isRegExp, z as TrackDeleteMarkName, C as TrackInsertMarkName, E as v4, G as TrackFormatMarkName, H as comments_module_events, I as AddMarkStep, J as RemoveMarkStep, K as twipsToLines, L as pixelsToTwips, O as SuperConverter, Q as EditorState, U as hasSomeParentWithClass, V as parseSizeUnit, W as getLineHeightValueString, X as toKebabCase, Y as kebabCase, Z as getColStyleDeclaration, _ as SelectionRange, $ as Transform, a0 as createColGroup } from "./converter-Dy-BSTkN.js";
|
|
16
16
|
import { ref, computed, createElementBlock, openBlock, withModifiers, Fragment as Fragment$1, renderList, normalizeClass, createCommentVNode, toDisplayString, createElementVNode, createApp } from "vue";
|
|
17
|
-
import { D as DocxZipper } from "./docx-zipper-
|
|
17
|
+
import { D as DocxZipper } from "./docx-zipper-DU8JCtV_.js";
|
|
18
18
|
function getMarksFromSelection(state) {
|
|
19
19
|
const { from: from2, to, empty: empty2 } = state.selection;
|
|
20
20
|
const marks = [];
|
|
@@ -11933,6 +11933,10 @@ const inputRulesPlugin = ({ editor, rules }) => {
|
|
|
11933
11933
|
const clipboard = event.clipboardData;
|
|
11934
11934
|
const html = clipboard.getData("text/html");
|
|
11935
11935
|
clipboard.getData("text/plain");
|
|
11936
|
+
const fieldAnnotationContent = slice2.content.content.filter((item) => item.type.name === "fieldAnnotation");
|
|
11937
|
+
if (fieldAnnotationContent.length) {
|
|
11938
|
+
return false;
|
|
11939
|
+
}
|
|
11936
11940
|
let source;
|
|
11937
11941
|
if (!html) {
|
|
11938
11942
|
source = "plain-text";
|
|
@@ -12720,16 +12724,14 @@ const updateYdocDocxData = async (editor) => {
|
|
|
12720
12724
|
const docx = [...metaMap.get("docx")];
|
|
12721
12725
|
const newXml = await editor.exportDocx({ getUpdatedDocs: true });
|
|
12722
12726
|
Object.keys(newXml).forEach((key) => {
|
|
12723
|
-
|
|
12724
|
-
|
|
12725
|
-
|
|
12726
|
-
docx.splice(fileIndex, 1);
|
|
12727
|
-
}
|
|
12728
|
-
docx.push({
|
|
12729
|
-
name: key,
|
|
12730
|
-
content: newXml[key]
|
|
12731
|
-
});
|
|
12727
|
+
const fileIndex = docx.findIndex((item) => item.name === key);
|
|
12728
|
+
if (fileIndex > -1) {
|
|
12729
|
+
docx.splice(fileIndex, 1);
|
|
12732
12730
|
}
|
|
12731
|
+
docx.push({
|
|
12732
|
+
name: key,
|
|
12733
|
+
content: newXml[key]
|
|
12734
|
+
});
|
|
12733
12735
|
});
|
|
12734
12736
|
editor.options.ydoc.transact(() => {
|
|
12735
12737
|
metaMap.set("docx", docx);
|
|
@@ -12839,6 +12841,9 @@ const createHeaderFooterEditor = ({
|
|
|
12839
12841
|
pm.style.minHeight = "100%";
|
|
12840
12842
|
pm.style.outline = "none";
|
|
12841
12843
|
pm.style.border = "none";
|
|
12844
|
+
pm.setAttribute("role", "textbox");
|
|
12845
|
+
pm.setAttribute("aria-multiline", true);
|
|
12846
|
+
pm.setAttribute("aria-label", `${type} content area. Double click to start typing.`);
|
|
12842
12847
|
return headerFooterEditor;
|
|
12843
12848
|
};
|
|
12844
12849
|
const broadcastEditorEvents = (editor, sectionEditor) => {
|
|
@@ -12860,13 +12865,16 @@ const broadcastEditorEvents = (editor, sectionEditor) => {
|
|
|
12860
12865
|
const toggleHeaderFooterEditMode = (editor, focusedSectionEditor, isEditMode) => {
|
|
12861
12866
|
editor.converter.headerEditors.forEach((item) => {
|
|
12862
12867
|
item.editor.setEditable(isEditMode, false);
|
|
12868
|
+
item.editor.view.dom.setAttribute("aria-readonly", !isEditMode);
|
|
12863
12869
|
});
|
|
12864
12870
|
editor.converter.footerEditors.forEach((item) => {
|
|
12865
12871
|
item.editor.setEditable(isEditMode, false);
|
|
12872
|
+
item.editor.view.dom.setAttribute("aria-readonly", !isEditMode);
|
|
12866
12873
|
});
|
|
12867
12874
|
if (isEditMode) {
|
|
12868
12875
|
const pm = document.querySelector(".ProseMirror");
|
|
12869
12876
|
pm.classList.add("header-footer-edit");
|
|
12877
|
+
pm.setAttribute("aria-readonly", true);
|
|
12870
12878
|
}
|
|
12871
12879
|
if (focusedSectionEditor) {
|
|
12872
12880
|
focusedSectionEditor.view.focus();
|
|
@@ -13785,11 +13793,12 @@ const generateTableIfNecessary = ({ tableNode, annotationValues, tr, state }) =>
|
|
|
13785
13793
|
const getAnnotationValue = (id, annotationValues) => {
|
|
13786
13794
|
return annotationValues.find((value) => value.input_id === id)?.input_value || null;
|
|
13787
13795
|
};
|
|
13788
|
-
const
|
|
13796
|
+
const getAllHeaderFooterEditors = (editor) => {
|
|
13789
13797
|
const sections = {
|
|
13790
13798
|
header: editor.converter.headers || {},
|
|
13791
13799
|
footer: editor.converter.footers || {}
|
|
13792
13800
|
};
|
|
13801
|
+
const allEditors = [];
|
|
13793
13802
|
Object.entries(sections).forEach(([type, items]) => {
|
|
13794
13803
|
const editorsKey = `${type}Editors`;
|
|
13795
13804
|
Object.entries(items).forEach(([sectionId, data]) => {
|
|
@@ -13807,25 +13816,38 @@ const annotateHeadersAndFooters = ({ editor, annotationValues = [], hiddenFieldI
|
|
|
13807
13816
|
})
|
|
13808
13817
|
};
|
|
13809
13818
|
editor.converter[editorsKey].push(sectionEditor);
|
|
13819
|
+
allEditors.push({
|
|
13820
|
+
...sectionEditor,
|
|
13821
|
+
key: editorsKey,
|
|
13822
|
+
type,
|
|
13823
|
+
sectionId
|
|
13824
|
+
});
|
|
13810
13825
|
}
|
|
13811
|
-
sectionEditor.editor.annotate(annotationValues, hiddenFieldIds);
|
|
13812
|
-
onHeaderFooterDataUpdate(
|
|
13813
|
-
{ editor: sectionEditor.editor },
|
|
13814
|
-
editor,
|
|
13815
|
-
sectionId,
|
|
13816
|
-
type
|
|
13817
|
-
);
|
|
13818
13826
|
});
|
|
13819
13827
|
});
|
|
13828
|
+
return allEditors;
|
|
13829
|
+
};
|
|
13830
|
+
const annotateHeadersAndFooters = ({ editor, annotationValues = [], hiddenFieldIds = [], removeEmptyFields = false }) => {
|
|
13831
|
+
const allEditors = getAllHeaderFooterEditors(editor);
|
|
13832
|
+
allEditors.forEach(({ sectionId, editor: sectionEditor, type }) => {
|
|
13833
|
+
sectionEditor.annotate(annotationValues, hiddenFieldIds, removeEmptyFields);
|
|
13834
|
+
onHeaderFooterDataUpdate(
|
|
13835
|
+
{ editor: sectionEditor },
|
|
13836
|
+
editor,
|
|
13837
|
+
sectionId,
|
|
13838
|
+
type
|
|
13839
|
+
);
|
|
13840
|
+
});
|
|
13820
13841
|
};
|
|
13821
13842
|
const annotateDocument = ({
|
|
13822
13843
|
annotationValues = [],
|
|
13823
13844
|
hiddenFieldIds = [],
|
|
13845
|
+
removeEmptyFields = false,
|
|
13824
13846
|
schema,
|
|
13825
13847
|
tr,
|
|
13826
13848
|
editor
|
|
13827
13849
|
}) => {
|
|
13828
|
-
annotateHeadersAndFooters({ editor, annotationValues, hiddenFieldIds });
|
|
13850
|
+
annotateHeadersAndFooters({ editor, annotationValues, hiddenFieldIds, removeEmptyFields });
|
|
13829
13851
|
const annotations = [];
|
|
13830
13852
|
const FieldType = schema.nodes.fieldAnnotation;
|
|
13831
13853
|
tr.doc.descendants((node, pos) => {
|
|
@@ -13878,11 +13900,13 @@ const annotateDocument = ({
|
|
|
13878
13900
|
});
|
|
13879
13901
|
}
|
|
13880
13902
|
}
|
|
13881
|
-
|
|
13882
|
-
|
|
13883
|
-
|
|
13884
|
-
|
|
13885
|
-
|
|
13903
|
+
if (removeEmptyFields) {
|
|
13904
|
+
Array.from(toDelete).sort((a, b) => b - a).forEach((pos) => {
|
|
13905
|
+
const ann = annotations.find((a) => a.pos === pos);
|
|
13906
|
+
if (!ann) return;
|
|
13907
|
+
tr = tr.delete(pos, pos + ann.node.nodeSize);
|
|
13908
|
+
});
|
|
13909
|
+
}
|
|
13886
13910
|
return tr;
|
|
13887
13911
|
};
|
|
13888
13912
|
const getFormattedDate = (input = null, format = "") => {
|
|
@@ -13900,11 +13924,40 @@ const getFormattedDate = (input = null, format = "") => {
|
|
|
13900
13924
|
// e.g. “2025”
|
|
13901
13925
|
});
|
|
13902
13926
|
};
|
|
13903
|
-
const
|
|
13927
|
+
const updateHeaderFooterFieldAnnotations = ({ editor, fieldIdOrArray, attrs = {} }) => {
|
|
13928
|
+
if (!editor) return;
|
|
13929
|
+
const sectionEditors = getAllHeaderFooterEditors(editor);
|
|
13930
|
+
sectionEditors.forEach(({ editor: sectionEditor, sectionId, type }) => {
|
|
13931
|
+
sectionEditor.commands.updateFieldAnnotations(fieldIdOrArray, attrs);
|
|
13932
|
+
onHeaderFooterDataUpdate(
|
|
13933
|
+
{ editor: sectionEditor },
|
|
13934
|
+
editor,
|
|
13935
|
+
sectionId,
|
|
13936
|
+
type
|
|
13937
|
+
);
|
|
13938
|
+
});
|
|
13939
|
+
};
|
|
13940
|
+
const deleteHeaderFooterFieldAnnotations = ({ editor, fieldIdOrArray }) => {
|
|
13941
|
+
if (!editor) return;
|
|
13942
|
+
const sectionEditors = getAllHeaderFooterEditors(editor);
|
|
13943
|
+
sectionEditors.forEach(({ editor: sectionEditor, sectionId, type }) => {
|
|
13944
|
+
sectionEditor.commands.deleteFieldAnnotations(fieldIdOrArray);
|
|
13945
|
+
onHeaderFooterDataUpdate(
|
|
13946
|
+
{ editor: sectionEditor },
|
|
13947
|
+
editor,
|
|
13948
|
+
sectionId,
|
|
13949
|
+
type
|
|
13950
|
+
);
|
|
13951
|
+
});
|
|
13952
|
+
};
|
|
13953
|
+
const AnnotatorHelpers = {
|
|
13904
13954
|
getFieldAttrs,
|
|
13905
13955
|
processTables,
|
|
13906
13956
|
annotateDocument,
|
|
13907
|
-
annotateHeadersAndFooters
|
|
13957
|
+
annotateHeadersAndFooters,
|
|
13958
|
+
getAllHeaderFooterEditors,
|
|
13959
|
+
updateHeaderFooterFieldAnnotations,
|
|
13960
|
+
deleteHeaderFooterFieldAnnotations
|
|
13908
13961
|
};
|
|
13909
13962
|
const CollaborationPluginKey = new PluginKey("collaboration");
|
|
13910
13963
|
const Collaboration = Extension.create({
|
|
@@ -14054,6 +14107,16 @@ const generateCollaborationData = (editor) => {
|
|
|
14054
14107
|
initializeMetaMap(ydoc, editor);
|
|
14055
14108
|
return encodeStateAsUpdate(ydoc);
|
|
14056
14109
|
};
|
|
14110
|
+
const isHighContrastMode = ref(false);
|
|
14111
|
+
function useHighContrastMode() {
|
|
14112
|
+
const setHighContrastMode = (value) => {
|
|
14113
|
+
isHighContrastMode.value = value;
|
|
14114
|
+
};
|
|
14115
|
+
return {
|
|
14116
|
+
isHighContrastMode,
|
|
14117
|
+
setHighContrastMode
|
|
14118
|
+
};
|
|
14119
|
+
}
|
|
14057
14120
|
const _Editor = class _Editor extends EventEmitter {
|
|
14058
14121
|
/**
|
|
14059
14122
|
* Create a new Editor instance
|
|
@@ -14174,6 +14237,8 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14174
14237
|
}
|
|
14175
14238
|
};
|
|
14176
14239
|
let initMode = modes[this.options.mode] ?? modes.default;
|
|
14240
|
+
const { setHighContrastMode } = useHighContrastMode();
|
|
14241
|
+
this.setHighContrastMode = setHighContrastMode;
|
|
14177
14242
|
initMode();
|
|
14178
14243
|
}
|
|
14179
14244
|
/**
|
|
@@ -14470,6 +14535,10 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14470
14535
|
if (!proseMirror || !pageSize || !pageMargins) {
|
|
14471
14536
|
return;
|
|
14472
14537
|
}
|
|
14538
|
+
proseMirror.setAttribute("role", "document");
|
|
14539
|
+
proseMirror.setAttribute("aria-multiline", true);
|
|
14540
|
+
proseMirror.setAttribute("aria-label", "Main content area, start typing to enter text.");
|
|
14541
|
+
proseMirror.setAttribute("aria-description", "");
|
|
14473
14542
|
element.style.width = pageSize.width + "in";
|
|
14474
14543
|
element.style.minWidth = pageSize.width + "in";
|
|
14475
14544
|
element.style.minHeight = pageSize.height + "in";
|
|
@@ -14678,8 +14747,13 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14678
14747
|
updatedDocs["word/commentsExtensible.xml"] = String(commentsExtensibleXml);
|
|
14679
14748
|
updatedDocs["word/commentsIds.xml"] = String(commentsIdsXml);
|
|
14680
14749
|
}
|
|
14681
|
-
if (getUpdatedDocs) return updatedDocs;
|
|
14682
14750
|
const zipper = new DocxZipper();
|
|
14751
|
+
if (getUpdatedDocs) {
|
|
14752
|
+
updatedDocs["[Content_Types].xml"] = await zipper.updateContentTypes({
|
|
14753
|
+
files: this.options.content
|
|
14754
|
+
}, media, true);
|
|
14755
|
+
return updatedDocs;
|
|
14756
|
+
}
|
|
14683
14757
|
const result = await zipper.updateZip({
|
|
14684
14758
|
docx: this.options.content,
|
|
14685
14759
|
updatedDocs,
|
|
@@ -14721,7 +14795,7 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14721
14795
|
* @returns {Object | void} Migration results
|
|
14722
14796
|
*/
|
|
14723
14797
|
processCollaborationMigrations() {
|
|
14724
|
-
console.debug("[checkVersionMigrations] Current editor version", "0.12.
|
|
14798
|
+
console.debug("[checkVersionMigrations] Current editor version", "0.12.33");
|
|
14725
14799
|
if (!this.options.ydoc) return;
|
|
14726
14800
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
14727
14801
|
let docVersion = metaMap.get("version");
|
|
@@ -14810,10 +14884,8 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14810
14884
|
*/
|
|
14811
14885
|
prepareForAnnotations(annotationValues = []) {
|
|
14812
14886
|
const { tr } = this.state;
|
|
14813
|
-
const
|
|
14814
|
-
const newTr = AnnotatorServices.processTables({ state: this.state, tr, annotationValues });
|
|
14887
|
+
const newTr = AnnotatorHelpers.processTables({ state: this.state, tr, annotationValues });
|
|
14815
14888
|
this.view.dispatch(newTr);
|
|
14816
|
-
AnnotatorServices.annotateHeadersAndFooters({ editor: this, annotationValues });
|
|
14817
14889
|
}
|
|
14818
14890
|
/**
|
|
14819
14891
|
* Annotate the document with the given annotation values.
|
|
@@ -14822,15 +14894,16 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14822
14894
|
* @param {String[]} hiddenIds List of field ids to remove from the document.
|
|
14823
14895
|
* @returns {void}
|
|
14824
14896
|
*/
|
|
14825
|
-
annotate(annotationValues = [], hiddenIds = []) {
|
|
14897
|
+
annotate(annotationValues = [], hiddenIds = [], removeEmptyFields = false) {
|
|
14826
14898
|
const { state, view, schema } = this;
|
|
14827
14899
|
let tr = state.tr;
|
|
14828
|
-
tr =
|
|
14829
|
-
tr =
|
|
14900
|
+
tr = AnnotatorHelpers.processTables({ state: this.state, tr, annotationValues });
|
|
14901
|
+
tr = AnnotatorHelpers.annotateDocument({
|
|
14830
14902
|
tr,
|
|
14831
14903
|
schema,
|
|
14832
14904
|
annotationValues,
|
|
14833
14905
|
hiddenFieldIds: hiddenIds,
|
|
14906
|
+
removeEmptyFields,
|
|
14834
14907
|
editor: this
|
|
14835
14908
|
});
|
|
14836
14909
|
if (tr.docChanged) view.dispatch(tr.scrollIntoView());
|
|
@@ -15181,6 +15254,7 @@ createView_fn = function() {
|
|
|
15181
15254
|
toggleHeaderFooterEditMode(this, null, false);
|
|
15182
15255
|
const pm = document.querySelector(".ProseMirror");
|
|
15183
15256
|
pm.classList.remove("header-footer-edit");
|
|
15257
|
+
pm.setAttribute("aria-readonly", false);
|
|
15184
15258
|
}
|
|
15185
15259
|
}
|
|
15186
15260
|
});
|
|
@@ -16191,7 +16265,8 @@ const AiLoaderNode = Node$1.create({
|
|
|
16191
16265
|
return {
|
|
16192
16266
|
htmlAttributes: {
|
|
16193
16267
|
class: "sd-ai-loader",
|
|
16194
|
-
contentEditable: "false"
|
|
16268
|
+
contentEditable: "false",
|
|
16269
|
+
"aria-label": "AI loader node"
|
|
16195
16270
|
}
|
|
16196
16271
|
};
|
|
16197
16272
|
},
|
|
@@ -16387,7 +16462,8 @@ const Document = Node$1.create({
|
|
|
16387
16462
|
addAttributes() {
|
|
16388
16463
|
return {
|
|
16389
16464
|
attributes: {
|
|
16390
|
-
rendered: false
|
|
16465
|
+
rendered: false,
|
|
16466
|
+
"aria-label": "Document node"
|
|
16391
16467
|
}
|
|
16392
16468
|
};
|
|
16393
16469
|
}
|
|
@@ -16411,7 +16487,8 @@ const RunItem = Node$1.create({
|
|
|
16411
16487
|
addAttributes() {
|
|
16412
16488
|
return {
|
|
16413
16489
|
attributes: {
|
|
16414
|
-
rendered: false
|
|
16490
|
+
rendered: false,
|
|
16491
|
+
"aria-label": "Run node"
|
|
16415
16492
|
}
|
|
16416
16493
|
};
|
|
16417
16494
|
}
|
|
@@ -16464,7 +16541,9 @@ const BulletList = Node$1.create({
|
|
|
16464
16541
|
addOptions() {
|
|
16465
16542
|
return {
|
|
16466
16543
|
itemTypeName: "listItem",
|
|
16467
|
-
htmlAttributes: {
|
|
16544
|
+
htmlAttributes: {
|
|
16545
|
+
"aria-label": "Bullet list node"
|
|
16546
|
+
},
|
|
16468
16547
|
keepMarks: true,
|
|
16469
16548
|
keepAttributes: false
|
|
16470
16549
|
};
|
|
@@ -16755,7 +16834,9 @@ const OrderedList = Node$1.create({
|
|
|
16755
16834
|
addOptions() {
|
|
16756
16835
|
return {
|
|
16757
16836
|
itemTypeName: "listItem",
|
|
16758
|
-
htmlAttributes: {
|
|
16837
|
+
htmlAttributes: {
|
|
16838
|
+
"aria-label": "Ordered list node"
|
|
16839
|
+
},
|
|
16759
16840
|
keepMarks: true,
|
|
16760
16841
|
keepAttributes: false,
|
|
16761
16842
|
listStyleTypes: ["decimal", "lowerAlpha", "lowerRoman"]
|
|
@@ -17155,7 +17236,9 @@ const ListItem = Node$1.create({
|
|
|
17155
17236
|
// to run listItem commands first
|
|
17156
17237
|
addOptions() {
|
|
17157
17238
|
return {
|
|
17158
|
-
htmlAttributes: {
|
|
17239
|
+
htmlAttributes: {
|
|
17240
|
+
"aria-label": "List item node"
|
|
17241
|
+
},
|
|
17159
17242
|
bulletListTypeName: "bulletList",
|
|
17160
17243
|
orderedListTypeName: "orderedList"
|
|
17161
17244
|
};
|
|
@@ -17677,7 +17760,9 @@ const Heading = Node$1.create({
|
|
|
17677
17760
|
addOptions() {
|
|
17678
17761
|
return {
|
|
17679
17762
|
levels: [1, 2, 3, 4, 5, 6],
|
|
17680
|
-
htmlAttributes: {
|
|
17763
|
+
htmlAttributes: {
|
|
17764
|
+
"aria-label": "Heading node"
|
|
17765
|
+
}
|
|
17681
17766
|
};
|
|
17682
17767
|
},
|
|
17683
17768
|
addAttributes() {
|
|
@@ -17738,7 +17823,8 @@ const CommentRangeStart = Node$1.create({
|
|
|
17738
17823
|
addOptions() {
|
|
17739
17824
|
return {
|
|
17740
17825
|
htmlAttributes: {
|
|
17741
|
-
contentEditable: "false"
|
|
17826
|
+
contentEditable: "false",
|
|
17827
|
+
"aria-label": "Comment range start node"
|
|
17742
17828
|
}
|
|
17743
17829
|
};
|
|
17744
17830
|
},
|
|
@@ -17767,7 +17853,8 @@ const CommentRangeEnd = Node$1.create({
|
|
|
17767
17853
|
addOptions() {
|
|
17768
17854
|
return {
|
|
17769
17855
|
htmlAttributes: {
|
|
17770
|
-
contentEditable: "false"
|
|
17856
|
+
contentEditable: "false",
|
|
17857
|
+
"aria-label": "Comment range end node"
|
|
17771
17858
|
}
|
|
17772
17859
|
};
|
|
17773
17860
|
},
|
|
@@ -17795,7 +17882,8 @@ const CommentReference = Node$1.create({
|
|
|
17795
17882
|
addOptions() {
|
|
17796
17883
|
return {
|
|
17797
17884
|
htmlAttributes: {
|
|
17798
|
-
contentEditable: "false"
|
|
17885
|
+
contentEditable: "false",
|
|
17886
|
+
"aria-label": "Comment reference node"
|
|
17799
17887
|
}
|
|
17800
17888
|
};
|
|
17801
17889
|
},
|
|
@@ -17970,7 +18058,9 @@ const HardBreak = Node$1.create({
|
|
|
17970
18058
|
return {
|
|
17971
18059
|
htmlAttributes: {
|
|
17972
18060
|
contentEditable: "false",
|
|
17973
|
-
lineBreakType: "page"
|
|
18061
|
+
lineBreakType: "page",
|
|
18062
|
+
"aria-hidden": "true",
|
|
18063
|
+
"aria-label": "Hard break node"
|
|
17974
18064
|
}
|
|
17975
18065
|
};
|
|
17976
18066
|
},
|
|
@@ -20328,7 +20418,9 @@ const Table = Node$1.create({
|
|
|
20328
20418
|
tableRole: "table",
|
|
20329
20419
|
addOptions() {
|
|
20330
20420
|
return {
|
|
20331
|
-
htmlAttributes: {
|
|
20421
|
+
htmlAttributes: {
|
|
20422
|
+
"aria-label": "Table node"
|
|
20423
|
+
},
|
|
20332
20424
|
resizable: true,
|
|
20333
20425
|
handleWidth: 5,
|
|
20334
20426
|
cellMinWidth: 25,
|
|
@@ -20578,7 +20670,9 @@ const TableHeader = Node$1.create({
|
|
|
20578
20670
|
isolating: true,
|
|
20579
20671
|
addOptions() {
|
|
20580
20672
|
return {
|
|
20581
|
-
htmlAttributes: {
|
|
20673
|
+
htmlAttributes: {
|
|
20674
|
+
"aria-label": "Table head node"
|
|
20675
|
+
}
|
|
20582
20676
|
};
|
|
20583
20677
|
},
|
|
20584
20678
|
addAttributes() {
|
|
@@ -20618,7 +20712,9 @@ const TableRow = Node$1.create({
|
|
|
20618
20712
|
tableRole: "row",
|
|
20619
20713
|
addOptions() {
|
|
20620
20714
|
return {
|
|
20621
|
-
htmlAttributes: {
|
|
20715
|
+
htmlAttributes: {
|
|
20716
|
+
"aria-label": "Table row node"
|
|
20717
|
+
}
|
|
20622
20718
|
};
|
|
20623
20719
|
},
|
|
20624
20720
|
addAttributes() {
|
|
@@ -20646,7 +20742,9 @@ const TableCell = Node$1.create({
|
|
|
20646
20742
|
isolating: true,
|
|
20647
20743
|
addOptions() {
|
|
20648
20744
|
return {
|
|
20649
|
-
htmlAttributes: {
|
|
20745
|
+
htmlAttributes: {
|
|
20746
|
+
"aria-label": "Table cell node"
|
|
20747
|
+
}
|
|
20650
20748
|
};
|
|
20651
20749
|
},
|
|
20652
20750
|
addAttributes() {
|
|
@@ -21188,6 +21286,15 @@ function findFieldAnnotationsBetween(from2, to, doc2) {
|
|
|
21188
21286
|
});
|
|
21189
21287
|
return fieldAnnotations;
|
|
21190
21288
|
}
|
|
21289
|
+
const getHeaderFooterAnnotations = (editor) => {
|
|
21290
|
+
const editors = getAllHeaderFooterEditors(editor);
|
|
21291
|
+
const allAnnotations = [];
|
|
21292
|
+
editors.forEach(({ id, editor: editor2 }) => {
|
|
21293
|
+
const annotations = getAllFieldAnnotations(editor2.state);
|
|
21294
|
+
allAnnotations.push(...annotations);
|
|
21295
|
+
});
|
|
21296
|
+
return allAnnotations;
|
|
21297
|
+
};
|
|
21191
21298
|
const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
21192
21299
|
__proto__: null,
|
|
21193
21300
|
findFieldAnnotations,
|
|
@@ -21197,6 +21304,7 @@ const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
21197
21304
|
findRemovedFieldAnnotations,
|
|
21198
21305
|
getAllFieldAnnotations,
|
|
21199
21306
|
getAllFieldAnnotationsWithRect,
|
|
21307
|
+
getHeaderFooterAnnotations,
|
|
21200
21308
|
trackFieldAnnotationsDeletion
|
|
21201
21309
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
21202
21310
|
function guard(low, high, value) {
|
|
@@ -21327,7 +21435,8 @@ const FieldAnnotation = Node$1.create({
|
|
|
21327
21435
|
addOptions() {
|
|
21328
21436
|
return {
|
|
21329
21437
|
htmlAttributes: {
|
|
21330
|
-
class: annotationClass
|
|
21438
|
+
class: annotationClass,
|
|
21439
|
+
"aria-label": "Field annotation node"
|
|
21331
21440
|
},
|
|
21332
21441
|
annotationClass,
|
|
21333
21442
|
annotationContentClass,
|
|
@@ -22269,7 +22378,8 @@ const Image = Node$1.create({
|
|
|
22269
22378
|
return {
|
|
22270
22379
|
allowBase64: true,
|
|
22271
22380
|
htmlAttributes: {
|
|
22272
|
-
style: "display: inline-block;"
|
|
22381
|
+
style: "display: inline-block;",
|
|
22382
|
+
"aria-label": "Image node"
|
|
22273
22383
|
}
|
|
22274
22384
|
};
|
|
22275
22385
|
},
|
|
@@ -22385,7 +22495,11 @@ const BookmarkStart = Node$1.create({
|
|
|
22385
22495
|
inline: true,
|
|
22386
22496
|
addOptions() {
|
|
22387
22497
|
return {
|
|
22388
|
-
htmlAttributes: {
|
|
22498
|
+
htmlAttributes: {
|
|
22499
|
+
style: "height: 0; width: 0;",
|
|
22500
|
+
"aria-label": "Bookmark start node",
|
|
22501
|
+
role: "link"
|
|
22502
|
+
}
|
|
22389
22503
|
};
|
|
22390
22504
|
},
|
|
22391
22505
|
addAttributes() {
|
|
@@ -22419,7 +22533,8 @@ const Mention = Node$1.create({
|
|
|
22419
22533
|
addOptions() {
|
|
22420
22534
|
return {
|
|
22421
22535
|
htmlAttributes: {
|
|
22422
|
-
class: "sd-editor-mention"
|
|
22536
|
+
class: "sd-editor-mention",
|
|
22537
|
+
"aria-label": "Mention node"
|
|
22423
22538
|
}
|
|
22424
22539
|
};
|
|
22425
22540
|
},
|
|
@@ -22457,7 +22572,8 @@ const PageNumber = Node$1.create({
|
|
|
22457
22572
|
addOptions() {
|
|
22458
22573
|
return {
|
|
22459
22574
|
htmlAttributes: {
|
|
22460
|
-
"data-id": "auto-page-number"
|
|
22575
|
+
"data-id": "auto-page-number",
|
|
22576
|
+
"aria-label": "Page number node"
|
|
22461
22577
|
}
|
|
22462
22578
|
};
|
|
22463
22579
|
},
|
|
@@ -22476,7 +22592,8 @@ const TotalPageCount = Node$1.create({
|
|
|
22476
22592
|
addOptions() {
|
|
22477
22593
|
return {
|
|
22478
22594
|
htmlAttributes: {
|
|
22479
|
-
"data-id": "auto-total-pages"
|
|
22595
|
+
"data-id": "auto-total-pages",
|
|
22596
|
+
"aria-label": "Total page count node"
|
|
22480
22597
|
}
|
|
22481
22598
|
};
|
|
22482
22599
|
},
|
|
@@ -22495,7 +22612,8 @@ const ShapeContainer = Node$1.create({
|
|
|
22495
22612
|
addOptions() {
|
|
22496
22613
|
return {
|
|
22497
22614
|
htmlAttributes: {
|
|
22498
|
-
class: "sd-editor-shape-container"
|
|
22615
|
+
class: "sd-editor-shape-container",
|
|
22616
|
+
"aria-label": "Shape container node"
|
|
22499
22617
|
}
|
|
22500
22618
|
};
|
|
22501
22619
|
},
|
|
@@ -22548,7 +22666,8 @@ const ShapeTextbox = Node$1.create({
|
|
|
22548
22666
|
addOptions() {
|
|
22549
22667
|
return {
|
|
22550
22668
|
htmlAttributes: {
|
|
22551
|
-
class: "sd-editor-shape-textbox"
|
|
22669
|
+
class: "sd-editor-shape-textbox",
|
|
22670
|
+
"aria-label": "Shape textbox node"
|
|
22552
22671
|
}
|
|
22553
22672
|
};
|
|
22554
22673
|
},
|
|
@@ -22640,7 +22759,9 @@ const StructuredContent = Node$1.create({
|
|
|
22640
22759
|
addOptions() {
|
|
22641
22760
|
return {
|
|
22642
22761
|
annotationClass: "sd-structured-content-tag",
|
|
22643
|
-
htmlAttributes: {
|
|
22762
|
+
htmlAttributes: {
|
|
22763
|
+
"aria-label": "Structured content node"
|
|
22764
|
+
}
|
|
22644
22765
|
};
|
|
22645
22766
|
},
|
|
22646
22767
|
parseDOM() {
|
|
@@ -27312,16 +27433,18 @@ export {
|
|
|
27312
27433
|
generateLinkedStyleString as b,
|
|
27313
27434
|
findParentNode as c,
|
|
27314
27435
|
getActiveFormatting as d,
|
|
27315
|
-
|
|
27436
|
+
undoDepth as e,
|
|
27316
27437
|
findPlaceholder as f,
|
|
27317
27438
|
global as g,
|
|
27318
|
-
|
|
27439
|
+
getStarterExtensions as h,
|
|
27319
27440
|
isInTable$1 as i,
|
|
27320
|
-
|
|
27321
|
-
|
|
27322
|
-
|
|
27323
|
-
index as m,
|
|
27324
|
-
|
|
27441
|
+
getRichTextExtensions as j,
|
|
27442
|
+
Extension as k,
|
|
27443
|
+
helpers as l,
|
|
27444
|
+
index$1 as m,
|
|
27445
|
+
index as n,
|
|
27446
|
+
AnnotatorHelpers as o,
|
|
27447
|
+
getMarksFromSelection as p,
|
|
27325
27448
|
redoDepth as r,
|
|
27326
|
-
|
|
27449
|
+
useHighContrastMode as u
|
|
27327
27450
|
};
|