@stll/folio-core 0.22.3 → 0.23.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/ai-edits/apply.d.ts +1 -1
- package/dist/controller/layoutPipeline.js +7 -3
- package/dist/document-operations.d.ts +4 -4
- package/dist/document-operations.js +17 -1
- package/dist/docx/blockContentParser.js +2 -47
- package/dist/docx/fieldParser.d.ts +1 -1
- package/dist/docx/fieldParser.js +12 -4
- package/dist/docx/numberingParser.d.ts +2 -11
- package/dist/docx/numberingParser.js +3 -79
- package/dist/docx/ooxmlCounterFormatter.d.ts +8 -0
- package/dist/docx/ooxmlCounterFormatter.js +134 -0
- package/dist/docx/rezip.d.ts +1 -1
- package/dist/docx/rezip.js +12 -31
- package/dist/docx/serializer/tableSerializer.js +1 -1
- package/dist/docx/tableParser.js +2 -1
- package/dist/fields/bookmarkPages.js +1 -1
- package/dist/fields/evaluateField.js +1 -1
- package/dist/fields/fieldContext.d.ts +2 -0
- package/dist/fields/resolveFieldValues.js +5 -2
- package/dist/layout-bridge/convert/headerFooterLayout.js +6 -0
- package/dist/layout-bridge/convert/toFlowBlocks.js +51 -109
- package/dist/layout-engine/index.d.ts +3 -2
- package/dist/layout-engine/index.js +40 -16
- package/dist/layout-engine/measure/cache.js +1 -1
- package/dist/layout-engine/measure/complexScriptFormatting.d.ts +18 -0
- package/dist/layout-engine/measure/complexScriptFormatting.js +11 -0
- package/dist/layout-engine/measure/measureContainer.js +31 -16
- package/dist/layout-engine/measure/measureHelpers.js +4 -0
- package/dist/layout-engine/measure/measureParagraph.js +13 -3
- package/dist/layout-engine/measure/measureTypes.d.ts +4 -0
- package/dist/layout-engine/paginator.d.ts +5 -3
- package/dist/layout-engine/paginator.js +34 -13
- package/dist/layout-engine/types.d.ts +31 -4
- package/dist/layout-painter/imageLayout.d.ts +1 -1
- package/dist/layout-painter/index.js +2 -1
- package/dist/layout-painter/renderPage.js +9 -3
- package/dist/layout-painter/renderParagraph.js +42 -25
- package/dist/layout-painter/renderUtils.d.ts +2 -0
- package/dist/managers/AutoSaveManager.js +8 -40
- package/dist/managers/TableSelectionManager.d.ts +1 -1
- package/dist/managers/autoSaveCodec.d.ts +17 -0
- package/dist/managers/autoSaveCodec.js +109 -0
- package/dist/paged-layout/sectionGeometry.d.ts +3 -2
- package/dist/paged-layout/sectionGeometry.js +17 -1
- package/dist/prosemirror/attrs/index.js +278 -25
- package/dist/prosemirror/commands/comments.js +3 -3
- package/dist/prosemirror/commands/formatting.js +19 -19
- package/dist/prosemirror/commands/index.d.ts +2 -2
- package/dist/prosemirror/commands/paragraph.js +32 -32
- package/dist/prosemirror/commands/propertyChangeScope.d.ts +4 -2
- package/dist/prosemirror/commands/propertyChangeScope.js +8 -8
- package/dist/prosemirror/commands/table.d.ts +10 -52
- package/dist/prosemirror/commands/table.js +34 -34
- package/dist/prosemirror/conversion/fromProseDoc.js +24 -33
- package/dist/prosemirror/conversion/sdtAttrs.d.ts +2 -1
- package/dist/prosemirror/conversion/sdtAttrs.js +9 -4
- package/dist/prosemirror/conversion/toProseDoc.js +4 -1
- package/dist/prosemirror/extensions/ExtensionManager.d.ts +6 -3
- package/dist/prosemirror/extensions/ExtensionManager.js +5 -3
- package/dist/prosemirror/extensions/core/ParagraphExtension.d.ts +1 -1
- package/dist/prosemirror/extensions/features/ListExtension.js +4 -4
- package/dist/prosemirror/extensions/marks/RunFormattingOverrideExtension.d.ts +3 -2
- package/dist/prosemirror/extensions/marks/RunFormattingOverrideExtension.js +31 -17
- package/dist/prosemirror/extensions/nodes/ShapeExtension.d.ts +1 -1
- package/dist/prosemirror/extensions/nodes/TableExtension.js +1 -0
- package/dist/prosemirror/extensions/nodes/TextBoxExtension.d.ts +1 -1
- package/dist/prosemirror/extensions/types.d.ts +134 -1
- package/dist/prosemirror/index.d.ts +2 -2
- package/dist/prosemirror/plugins/selectionTracker.js +25 -99
- package/dist/prosemirror/revisionCarriers.js +3 -1
- package/dist/prosemirror/schema/index.d.ts +2 -2
- package/dist/prosemirror/schema/index.js +87 -0
- package/dist/prosemirror/schema/marks.d.ts +8 -0
- package/dist/prosemirror/schema/nodes.d.ts +15 -2
- package/dist/prosemirror/selectionState.d.ts +11 -5
- package/dist/prosemirror/selectionState.js +94 -57
- package/dist/utils/tableOperations.d.ts +7 -6
- package/package.json +3 -3
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { validateFolioDocumentModel } from "../docx/modelValidation.js";
|
|
2
|
+
//#region src/managers/autoSaveCodec.ts
|
|
3
|
+
const AUTOSAVE_FORMAT_VERSION = 2;
|
|
4
|
+
const BASE64_CHUNK_BYTES = 32768;
|
|
5
|
+
const encodeBase64 = (buffer) => {
|
|
6
|
+
const bytes = new Uint8Array(buffer);
|
|
7
|
+
const chunks = [];
|
|
8
|
+
for (let offset = 0; offset < bytes.length; offset += BASE64_CHUNK_BYTES) chunks.push(String.fromCharCode(...bytes.subarray(offset, offset + BASE64_CHUNK_BYTES)));
|
|
9
|
+
return btoa(chunks.join(""));
|
|
10
|
+
};
|
|
11
|
+
const decodeBase64 = (value) => {
|
|
12
|
+
const binary = atob(value);
|
|
13
|
+
const bytes = new Uint8Array(binary.length);
|
|
14
|
+
for (let index = 0; index < binary.length; index += 1) bytes[index] = binary.charCodeAt(index);
|
|
15
|
+
return bytes.buffer;
|
|
16
|
+
};
|
|
17
|
+
const encodeValue = (value) => {
|
|
18
|
+
if (value === void 0) return { type: "undefined" };
|
|
19
|
+
if (value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean") return value;
|
|
20
|
+
if (value instanceof Date) return {
|
|
21
|
+
type: "date",
|
|
22
|
+
value: value.toISOString()
|
|
23
|
+
};
|
|
24
|
+
if (value instanceof ArrayBuffer) return {
|
|
25
|
+
type: "arrayBuffer",
|
|
26
|
+
value: encodeBase64(value)
|
|
27
|
+
};
|
|
28
|
+
if (value instanceof Map) return {
|
|
29
|
+
type: "map",
|
|
30
|
+
value: [...value.entries()].map(([key, entry]) => [encodeValue(key), encodeValue(entry)])
|
|
31
|
+
};
|
|
32
|
+
if (Array.isArray(value)) return {
|
|
33
|
+
type: "array",
|
|
34
|
+
value: value.map(encodeValue)
|
|
35
|
+
};
|
|
36
|
+
if (typeof value === "object") {
|
|
37
|
+
const encoded = {};
|
|
38
|
+
for (const [key, entry] of Object.entries(value)) encoded[key] = encodeValue(entry);
|
|
39
|
+
return {
|
|
40
|
+
type: "object",
|
|
41
|
+
value: encoded
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
throw new TypeError(`Unsupported auto-save value: ${typeof value}`);
|
|
45
|
+
};
|
|
46
|
+
const decodeValue = (value) => {
|
|
47
|
+
if (value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean") return value;
|
|
48
|
+
if (typeof value !== "object" || !value || !("type" in value)) throw new TypeError("Invalid auto-save encoded value");
|
|
49
|
+
const type = value.type;
|
|
50
|
+
if (type === "undefined") return;
|
|
51
|
+
if (type === "date") {
|
|
52
|
+
if (!("value" in value) || typeof value.value !== "string" || !Number.isFinite(Date.parse(value.value))) throw new TypeError("Invalid auto-save date");
|
|
53
|
+
return new Date(value.value);
|
|
54
|
+
}
|
|
55
|
+
if (type === "arrayBuffer") {
|
|
56
|
+
if (!("value" in value) || typeof value.value !== "string") throw new TypeError("Invalid auto-save binary data");
|
|
57
|
+
return decodeBase64(value.value);
|
|
58
|
+
}
|
|
59
|
+
if (type === "array") {
|
|
60
|
+
if (!("value" in value) || !Array.isArray(value.value)) throw new TypeError("Invalid auto-save array");
|
|
61
|
+
return value.value.map(decodeValue);
|
|
62
|
+
}
|
|
63
|
+
if (type === "map") {
|
|
64
|
+
if (!("value" in value) || !Array.isArray(value.value)) throw new TypeError("Invalid auto-save map");
|
|
65
|
+
return new Map(value.value.map((entry) => {
|
|
66
|
+
if (!Array.isArray(entry) || entry.length !== 2) throw new TypeError("Invalid auto-save map entry");
|
|
67
|
+
return [decodeValue(entry[0]), decodeValue(entry[1])];
|
|
68
|
+
}));
|
|
69
|
+
}
|
|
70
|
+
if (type === "object") {
|
|
71
|
+
if (!("value" in value) || typeof value.value !== "object" || !value.value) throw new TypeError("Invalid auto-save object");
|
|
72
|
+
const decoded = Object.create(null);
|
|
73
|
+
for (const [key, entry] of Object.entries(value.value)) {
|
|
74
|
+
if (key === "__proto__" || key === "constructor" || key === "prototype") throw new TypeError("Invalid auto-save object key");
|
|
75
|
+
const decodedEntry = decodeValue(entry);
|
|
76
|
+
if (decodedEntry !== void 0) decoded[key] = decodedEntry;
|
|
77
|
+
}
|
|
78
|
+
return decoded;
|
|
79
|
+
}
|
|
80
|
+
throw new TypeError("Unknown auto-save encoded value");
|
|
81
|
+
};
|
|
82
|
+
const encodeAutoSaveDocument = (document) => {
|
|
83
|
+
const snapshot = {
|
|
84
|
+
...document,
|
|
85
|
+
originalBuffer: null
|
|
86
|
+
};
|
|
87
|
+
return { json: JSON.stringify(encodeValue(snapshot)) };
|
|
88
|
+
};
|
|
89
|
+
const encodeAutoSaveEnvelopeFromDocument = (document, savedAt) => `{"document":${document.json},"savedAt":${JSON.stringify(savedAt)},"version":2}`;
|
|
90
|
+
const encodeAutoSaveEnvelope = (document, savedAt) => encodeAutoSaveEnvelopeFromDocument(encodeAutoSaveDocument(document), savedAt);
|
|
91
|
+
const decodeAutoSaveEnvelope = (json) => {
|
|
92
|
+
try {
|
|
93
|
+
const parsed = JSON.parse(json);
|
|
94
|
+
if (typeof parsed !== "object" || !parsed || !("document" in parsed) || !("savedAt" in parsed) || !("version" in parsed)) return null;
|
|
95
|
+
if (parsed.version !== 2 || typeof parsed.savedAt !== "string" || !Number.isFinite(Date.parse(parsed.savedAt))) return null;
|
|
96
|
+
const document = decodeValue(parsed.document);
|
|
97
|
+
if (typeof document !== "object" || !document) return null;
|
|
98
|
+
if (!validateFolioDocumentModel(document).valid) return null;
|
|
99
|
+
return {
|
|
100
|
+
document,
|
|
101
|
+
savedAt: parsed.savedAt,
|
|
102
|
+
version: 2
|
|
103
|
+
};
|
|
104
|
+
} catch {
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
//#endregion
|
|
109
|
+
export { AUTOSAVE_FORMAT_VERSION, decodeAutoSaveEnvelope, encodeAutoSaveDocument, encodeAutoSaveEnvelope, encodeAutoSaveEnvelopeFromDocument };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { document_d_exports } from "../types/document.js";
|
|
2
|
-
import { PageMargins } from "../layout-engine/types.js";
|
|
2
|
+
import { PageMargins, SectionPageNumbering } from "../layout-engine/types.js";
|
|
3
3
|
//#region src/paged-layout/sectionGeometry.d.ts
|
|
4
4
|
declare const DEFAULT_PAGE_WIDTH_PX = 816;
|
|
5
5
|
declare const DEFAULT_PAGE_HEIGHT_PX = 1056;
|
|
@@ -16,5 +16,6 @@ declare const getPageSize: (sectionProps: document_d_exports.SectionProperties |
|
|
|
16
16
|
h: number;
|
|
17
17
|
};
|
|
18
18
|
declare const getMargins: (sectionProps: document_d_exports.SectionProperties | null | undefined) => PageMargins;
|
|
19
|
+
declare const getPageNumbering: (sectionProps: document_d_exports.SectionProperties | null | undefined) => SectionPageNumbering;
|
|
19
20
|
//#endregion
|
|
20
|
-
export { DEFAULT_BODY_MARGIN_PX, DEFAULT_HEADER_FOOTER_DISTANCE_PX, DEFAULT_PAGE_HEIGHT_PX, DEFAULT_PAGE_WIDTH_PX, getMargins, getPageSize, twipsToPixels, twipsToPxOr };
|
|
21
|
+
export { DEFAULT_BODY_MARGIN_PX, DEFAULT_HEADER_FOOTER_DISTANCE_PX, DEFAULT_PAGE_HEIGHT_PX, DEFAULT_PAGE_WIDTH_PX, getMargins, getPageNumbering, getPageSize, twipsToPixels, twipsToPxOr };
|
|
@@ -32,5 +32,21 @@ const getMargins = (sectionProps) => ({
|
|
|
32
32
|
header: twipsToPxOr(sectionProps?.headerDistance, 48),
|
|
33
33
|
footer: twipsToPxOr(sectionProps?.footerDistance, 48)
|
|
34
34
|
});
|
|
35
|
+
const getPageNumbering = (sectionProps) => {
|
|
36
|
+
const pageNumbering = sectionProps?.pageNumbering;
|
|
37
|
+
const format = pageNumbering?.format;
|
|
38
|
+
if (pageNumbering?.start === void 0) return format === void 0 ? { type: "continue" } : {
|
|
39
|
+
type: "continue",
|
|
40
|
+
format
|
|
41
|
+
};
|
|
42
|
+
return format === void 0 ? {
|
|
43
|
+
type: "restart",
|
|
44
|
+
start: pageNumbering.start
|
|
45
|
+
} : {
|
|
46
|
+
type: "restart",
|
|
47
|
+
start: pageNumbering.start,
|
|
48
|
+
format
|
|
49
|
+
};
|
|
50
|
+
};
|
|
35
51
|
//#endregion
|
|
36
|
-
export { DEFAULT_BODY_MARGIN_PX, DEFAULT_HEADER_FOOTER_DISTANCE_PX, DEFAULT_PAGE_HEIGHT_PX, DEFAULT_PAGE_WIDTH_PX, getMargins, getPageSize, twipsToPixels, twipsToPxOr };
|
|
52
|
+
export { DEFAULT_BODY_MARGIN_PX, DEFAULT_HEADER_FOOTER_DISTANCE_PX, DEFAULT_PAGE_HEIGHT_PX, DEFAULT_PAGE_WIDTH_PX, getMargins, getPageNumbering, getPageSize, twipsToPixels, twipsToPxOr };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FIELD_TYPE_VALUES, FONT_THEME_VALUES, HIGHLIGHT_COLOR_VALUES, IMAGE_HORIZONTAL_ALIGNMENT_VALUES, IMAGE_HORIZONTAL_RELATIVE_TO_VALUES, IMAGE_VERTICAL_ALIGNMENT_VALUES, IMAGE_VERTICAL_RELATIVE_TO_VALUES, IMAGE_WRAP_TEXT_VALUES, IMAGE_WRAP_TYPE_VALUES, LINE_SPACING_RULE_VALUES, OUTLINE_STYLE_ATTR_VALUES, PARAGRAPH_ALIGNMENT_VALUES, POSITIONAL_TAB_ALIGNMENT_VALUES, POSITIONAL_TAB_LEADER_VALUES, POSITIONAL_TAB_RELATIVE_TO_VALUES, SDT_LOCK_VALUES, SDT_TYPE_VALUES, SHADING_PATTERN_VALUES, TABLE_CELL_TEXT_DIRECTION_VALUES, TABLE_CELL_VERTICAL_ALIGNMENT_VALUES, TABLE_JUSTIFICATION_VALUES, TABLE_ROW_HEIGHT_RULE_VALUES, TABLE_WIDTH_TYPE_VALUES, TAB_LEADER_VALUES, TAB_STOP_ALIGNMENT_VALUES, TEXT_EFFECT_VALUES, THEME_COLOR_SLOT_VALUES, UNDERLINE_STYLE_VALUES } from "../../types/documentEnumValues.js";
|
|
1
|
+
import { EMPHASIS_MARK_VALUES, FIELD_TYPE_VALUES, FONT_HINT_VALUES, FONT_THEME_VALUES, HIGHLIGHT_COLOR_VALUES, IMAGE_HORIZONTAL_ALIGNMENT_VALUES, IMAGE_HORIZONTAL_RELATIVE_TO_VALUES, IMAGE_VERTICAL_ALIGNMENT_VALUES, IMAGE_VERTICAL_RELATIVE_TO_VALUES, IMAGE_WRAP_TEXT_VALUES, IMAGE_WRAP_TYPE_VALUES, LINE_SPACING_RULE_VALUES, NUMBER_FORMAT_VALUES, OUTLINE_STYLE_ATTR_VALUES, PARAGRAPH_ALIGNMENT_VALUES, POSITIONAL_TAB_ALIGNMENT_VALUES, POSITIONAL_TAB_LEADER_VALUES, POSITIONAL_TAB_RELATIVE_TO_VALUES, SDT_LOCK_VALUES, SDT_TYPE_VALUES, SHADING_PATTERN_VALUES, TABLE_CELL_TEXT_DIRECTION_VALUES, TABLE_CELL_VERTICAL_ALIGNMENT_VALUES, TABLE_JUSTIFICATION_VALUES, TABLE_ROW_HEIGHT_RULE_VALUES, TABLE_WIDTH_TYPE_VALUES, TAB_LEADER_VALUES, TAB_STOP_ALIGNMENT_VALUES, TEXT_EFFECT_VALUES, THEME_COLOR_SLOT_VALUES, UNDERLINE_STYLE_VALUES } from "../../types/documentEnumValues.js";
|
|
2
2
|
import { isParagraphDirection } from "../paragraphDirection.js";
|
|
3
3
|
import { TRACKED_CHANGE_PROVENANCE_VALUES } from "../schema/marks.js";
|
|
4
4
|
import { panic } from "better-result";
|
|
@@ -89,21 +89,6 @@ const RUN_FORMATTING_OVERRIDE_FALSE_KEYS = [
|
|
|
89
89
|
"shadow",
|
|
90
90
|
"outline"
|
|
91
91
|
];
|
|
92
|
-
const TEXT_FORMATTING_BOOLEAN_KEYS = [
|
|
93
|
-
"bold",
|
|
94
|
-
"boldCs",
|
|
95
|
-
"italic",
|
|
96
|
-
"italicCs",
|
|
97
|
-
"strike",
|
|
98
|
-
"doubleStrike",
|
|
99
|
-
"smallCaps",
|
|
100
|
-
"allCaps",
|
|
101
|
-
"hidden",
|
|
102
|
-
"emboss",
|
|
103
|
-
"imprint",
|
|
104
|
-
"shadow",
|
|
105
|
-
"outline"
|
|
106
|
-
];
|
|
107
92
|
const SECTION_ORIENTATIONS = ["portrait", "landscape"];
|
|
108
93
|
const SECTION_START_TYPES = [
|
|
109
94
|
"continuous",
|
|
@@ -160,6 +145,7 @@ const readParagraphAttrs = (node) => {
|
|
|
160
145
|
optionalBoolean(attrs, "kinsoku", "paragraph.attrs.kinsoku", issues);
|
|
161
146
|
optionalBoolean(attrs, "overflowPunctuation", "paragraph.attrs.overflowPunctuation", issues);
|
|
162
147
|
optionalBoolean(attrs, "suppressAutoHyphens", "paragraph.attrs.suppressAutoHyphens", issues);
|
|
148
|
+
optionalBoolean(attrs, "suppressLineNumbers", "paragraph.attrs.suppressLineNumbers", issues);
|
|
163
149
|
optionalNumber(attrs, "spaceBefore", "paragraph.attrs.spaceBefore", issues);
|
|
164
150
|
optionalNumber(attrs, "spaceAfter", "paragraph.attrs.spaceAfter", issues);
|
|
165
151
|
optionalNumber(attrs, "lineSpacing", "paragraph.attrs.lineSpacing", issues);
|
|
@@ -192,9 +178,11 @@ const readParagraphAttrs = (node) => {
|
|
|
192
178
|
optionalBoolean(attrs, "pageBreakBefore", "paragraph.attrs.pageBreakBefore", issues);
|
|
193
179
|
optionalBoolean(attrs, "renderedPageBreakBefore", "paragraph.attrs.renderedPageBreakBefore", issues);
|
|
194
180
|
optionalBoolean(attrs, "_trailingPageBreak", "paragraph.attrs._trailingPageBreak", issues);
|
|
181
|
+
optionalBoolean(attrs, "_pageBreakCarrier", "paragraph.attrs._pageBreakCarrier", issues);
|
|
195
182
|
optionalBoolean(attrs, "runInWithNext", "paragraph.attrs.runInWithNext", issues);
|
|
196
183
|
optionalBoolean(attrs, "keepNext", "paragraph.attrs.keepNext", issues);
|
|
197
184
|
optionalBoolean(attrs, "keepLines", "paragraph.attrs.keepLines", issues);
|
|
185
|
+
optionalBoolean(attrs, "widowControl", "paragraph.attrs.widowControl", issues);
|
|
198
186
|
optionalBoolean(attrs, "contextualSpacing", "paragraph.attrs.contextualSpacing", issues);
|
|
199
187
|
const direction = attrs["direction"];
|
|
200
188
|
if (direction !== void 0 && direction !== null && !isParagraphDirection(direction)) issues.push({
|
|
@@ -223,7 +211,7 @@ const readParagraphAttrs = (node) => {
|
|
|
223
211
|
validateNumPr(attrs["numPr"], issues);
|
|
224
212
|
optionalBookmarkArray(attrs["bookmarks"], issues);
|
|
225
213
|
optionalEmptyHyperlinkArray(attrs["_emptyHyperlinks"], issues);
|
|
226
|
-
optionalAutospacingBase(attrs, issues);
|
|
214
|
+
optionalAutospacingBase(attrs, "paragraph.attrs._autospacingBase", issues);
|
|
227
215
|
optionalSectionProperties(attrs, "_sectionProperties", "paragraph.attrs._sectionProperties", issues);
|
|
228
216
|
optionalPropertyChanges(attrs, "_propertyChanges", "paragraph.attrs._propertyChanges", issues, ["paragraphPropertyChange"]);
|
|
229
217
|
return attrsResult(attrs, issues);
|
|
@@ -288,6 +276,7 @@ const readTableAttrs = (node) => {
|
|
|
288
276
|
"insideH",
|
|
289
277
|
"insideV"
|
|
290
278
|
]);
|
|
279
|
+
optionalBoolean(attrs, "_resolvedBidi", "table.attrs._resolvedBidi", issues);
|
|
291
280
|
optionalRecord(attrs, "_originalFormatting", "table.attrs._originalFormatting", issues);
|
|
292
281
|
return attrsResult(attrs, issues);
|
|
293
282
|
};
|
|
@@ -663,6 +652,10 @@ const readRunFormattingOverrideMarkAttrs = (mark) => {
|
|
|
663
652
|
const issues = [];
|
|
664
653
|
expectMarkType(mark, "runFormattingOverride", issues);
|
|
665
654
|
for (const key of RUN_FORMATTING_OVERRIDE_FALSE_KEYS) optionalFalse(attrs, key, `runFormattingOverride.attrs.${key}`, issues);
|
|
655
|
+
optionalBoolean(attrs, "boldCs", "runFormattingOverride.attrs.boldCs", issues);
|
|
656
|
+
optionalBoolean(attrs, "italicCs", "runFormattingOverride.attrs.italicCs", issues);
|
|
657
|
+
optionalNumber(attrs, "fontSizeCs", "runFormattingOverride.attrs.fontSizeCs", issues);
|
|
658
|
+
optionalBoolean(attrs, "cs", "runFormattingOverride.attrs.cs", issues);
|
|
666
659
|
optionalOneOf(attrs, "underline", "runFormattingOverride.attrs.underline", issues, ["none"]);
|
|
667
660
|
return attrsResult(attrs, issues);
|
|
668
661
|
};
|
|
@@ -1089,18 +1082,18 @@ const validateSdtAttrsRecord = (attrs, path, issues) => {
|
|
|
1089
1082
|
optionalString(attrs, "rawPropertiesXml", `${path}.rawPropertiesXml`, issues);
|
|
1090
1083
|
optionalString(attrs, "rawEndPropertiesXml", `${path}.rawEndPropertiesXml`, issues);
|
|
1091
1084
|
};
|
|
1092
|
-
const optionalAutospacingBase = (attrs, issues) => {
|
|
1085
|
+
const optionalAutospacingBase = (attrs, path, issues) => {
|
|
1093
1086
|
const value = attrs["_autospacingBase"];
|
|
1094
1087
|
if (value === void 0 || value === null) return;
|
|
1095
1088
|
if (!isRecord(value)) {
|
|
1096
1089
|
issues.push({
|
|
1097
|
-
path
|
|
1090
|
+
path,
|
|
1098
1091
|
message: "Expected an object."
|
|
1099
1092
|
});
|
|
1100
1093
|
return;
|
|
1101
1094
|
}
|
|
1102
|
-
optionalNumber(value, "before",
|
|
1103
|
-
optionalNumber(value, "after",
|
|
1095
|
+
optionalNumber(value, "before", `${path}.before`, issues);
|
|
1096
|
+
optionalNumber(value, "after", `${path}.after`, issues);
|
|
1104
1097
|
};
|
|
1105
1098
|
const optionalArray = (attrs, key, path, issues) => {
|
|
1106
1099
|
const value = attrs[key];
|
|
@@ -1201,11 +1194,42 @@ const optionalTextFormatting = (attrs, key, path, issues) => {
|
|
|
1201
1194
|
});
|
|
1202
1195
|
return;
|
|
1203
1196
|
}
|
|
1204
|
-
|
|
1197
|
+
validateTextFormatting(value, path, issues);
|
|
1198
|
+
};
|
|
1199
|
+
const validateTextFormatting = (value, path, issues) => {
|
|
1200
|
+
for (const booleanKey of [
|
|
1201
|
+
"bold",
|
|
1202
|
+
"boldCs",
|
|
1203
|
+
"italic",
|
|
1204
|
+
"italicCs",
|
|
1205
|
+
"strike",
|
|
1206
|
+
"doubleStrike",
|
|
1207
|
+
"smallCaps",
|
|
1208
|
+
"allCaps",
|
|
1209
|
+
"hidden",
|
|
1210
|
+
"emboss",
|
|
1211
|
+
"imprint",
|
|
1212
|
+
"outline",
|
|
1213
|
+
"shadow",
|
|
1214
|
+
"rtl",
|
|
1215
|
+
"cs"
|
|
1216
|
+
]) optionalBoolean(value, booleanKey, `${path}.${booleanKey}`, issues);
|
|
1217
|
+
optionalOneOf(value, "vertAlign", `${path}.vertAlign`, issues, [
|
|
1218
|
+
"baseline",
|
|
1219
|
+
"superscript",
|
|
1220
|
+
"subscript"
|
|
1221
|
+
]);
|
|
1205
1222
|
optionalNumber(value, "fontSize", `${path}.fontSize`, issues);
|
|
1206
1223
|
optionalNumber(value, "fontSizeCs", `${path}.fontSizeCs`, issues);
|
|
1207
|
-
|
|
1224
|
+
optionalNumber(value, "spacing", `${path}.spacing`, issues);
|
|
1225
|
+
optionalNumber(value, "position", `${path}.position`, issues);
|
|
1226
|
+
optionalNumber(value, "scale", `${path}.scale`, issues);
|
|
1227
|
+
optionalNumber(value, "kerning", `${path}.kerning`, issues);
|
|
1228
|
+
optionalString(value, "styleId", `${path}.styleId`, issues);
|
|
1229
|
+
optionalOneOf(value, "effect", `${path}.effect`, issues, TEXT_EFFECT_VALUES);
|
|
1230
|
+
optionalOneOf(value, "emphasisMark", `${path}.emphasisMark`, issues, EMPHASIS_MARK_VALUES);
|
|
1208
1231
|
optionalColorValue(value, "color", `${path}.color`, issues);
|
|
1232
|
+
optionalOneOf(value, "highlight", `${path}.highlight`, issues, HIGHLIGHT_COLOR_VALUES);
|
|
1209
1233
|
optionalShading(value, "shading", `${path}.shading`, issues);
|
|
1210
1234
|
const underline = value["underline"];
|
|
1211
1235
|
if (underline !== void 0 && underline !== null) if (!isRecord(underline)) issues.push({
|
|
@@ -1216,6 +1240,36 @@ const optionalTextFormatting = (attrs, key, path, issues) => {
|
|
|
1216
1240
|
requiredOneOf(underline, "style", `${path}.underline.style`, issues, UNDERLINE_STYLE_VALUES);
|
|
1217
1241
|
optionalColorValue(underline, "color", `${path}.underline.color`, issues);
|
|
1218
1242
|
}
|
|
1243
|
+
const fontFamily = value["fontFamily"];
|
|
1244
|
+
if (fontFamily !== void 0 && fontFamily !== null) if (!isRecord(fontFamily)) issues.push({
|
|
1245
|
+
path: `${path}.fontFamily`,
|
|
1246
|
+
message: "Expected an object."
|
|
1247
|
+
});
|
|
1248
|
+
else {
|
|
1249
|
+
for (const key of [
|
|
1250
|
+
"ascii",
|
|
1251
|
+
"hAnsi",
|
|
1252
|
+
"eastAsia",
|
|
1253
|
+
"cs"
|
|
1254
|
+
]) optionalString(fontFamily, key, `${path}.fontFamily.${key}`, issues);
|
|
1255
|
+
optionalOneOf(fontFamily, "hint", `${path}.fontFamily.hint`, issues, FONT_HINT_VALUES);
|
|
1256
|
+
for (const key of [
|
|
1257
|
+
"asciiTheme",
|
|
1258
|
+
"hAnsiTheme",
|
|
1259
|
+
"eastAsiaTheme",
|
|
1260
|
+
"csTheme"
|
|
1261
|
+
]) optionalOneOf(fontFamily, key, `${path}.fontFamily.${key}`, issues, FONT_THEME_VALUES);
|
|
1262
|
+
}
|
|
1263
|
+
const language = value["language"];
|
|
1264
|
+
if (language !== void 0 && language !== null) if (!isRecord(language)) issues.push({
|
|
1265
|
+
path: `${path}.language`,
|
|
1266
|
+
message: "Expected an object."
|
|
1267
|
+
});
|
|
1268
|
+
else for (const key of [
|
|
1269
|
+
"val",
|
|
1270
|
+
"eastAsia",
|
|
1271
|
+
"bidi"
|
|
1272
|
+
]) optionalString(language, key, `${path}.language.${key}`, issues);
|
|
1219
1273
|
};
|
|
1220
1274
|
const optionalInsetMap = (attrs, key, path, issues) => {
|
|
1221
1275
|
const value = attrs[key];
|
|
@@ -1285,8 +1339,192 @@ const optionalPropertyChanges = (attrs, key, path, issues, allowedTypes) => {
|
|
|
1285
1339
|
}
|
|
1286
1340
|
requiredOneOf(item, "type", `${itemPath}.type`, issues, allowedTypes);
|
|
1287
1341
|
validatePropertyChangeInfo(item["info"], `${itemPath}.info`, issues);
|
|
1288
|
-
|
|
1289
|
-
|
|
1342
|
+
let validateFormatting;
|
|
1343
|
+
if (allowedTypes.includes("paragraphPropertyChange")) validateFormatting = validateParagraphFormatting;
|
|
1344
|
+
else if (allowedTypes.includes("runPropertyChange")) validateFormatting = validateTextFormatting;
|
|
1345
|
+
if (validateFormatting) {
|
|
1346
|
+
optionalNestedRecord(item, "previousFormatting", `${itemPath}.previousFormatting`, issues, validateFormatting);
|
|
1347
|
+
optionalNestedRecord(item, "currentFormatting", `${itemPath}.currentFormatting`, issues, validateFormatting);
|
|
1348
|
+
} else {
|
|
1349
|
+
optionalRecord(item, "previousFormatting", `${itemPath}.previousFormatting`, issues);
|
|
1350
|
+
optionalRecord(item, "currentFormatting", `${itemPath}.currentFormatting`, issues);
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1353
|
+
};
|
|
1354
|
+
const optionalNestedRecord = (attrs, key, path, issues, validate) => {
|
|
1355
|
+
const value = attrs[key];
|
|
1356
|
+
if (value === void 0 || value === null) return;
|
|
1357
|
+
if (!isRecord(value)) {
|
|
1358
|
+
issues.push({
|
|
1359
|
+
path,
|
|
1360
|
+
message: "Expected an object."
|
|
1361
|
+
});
|
|
1362
|
+
return;
|
|
1363
|
+
}
|
|
1364
|
+
validate(value, path, issues);
|
|
1365
|
+
};
|
|
1366
|
+
const PARAGRAPH_FORMATTING_BOOLEAN_KEYS = [
|
|
1367
|
+
"bidi",
|
|
1368
|
+
"kinsoku",
|
|
1369
|
+
"overflowPunctuation",
|
|
1370
|
+
"suppressAutoHyphens",
|
|
1371
|
+
"suppressLineNumbers",
|
|
1372
|
+
"snapToGrid",
|
|
1373
|
+
"beforeAutospacing",
|
|
1374
|
+
"afterAutospacing",
|
|
1375
|
+
"hangingIndent",
|
|
1376
|
+
"keepNext",
|
|
1377
|
+
"keepLines",
|
|
1378
|
+
"widowControl",
|
|
1379
|
+
"pageBreakBefore",
|
|
1380
|
+
"contextualSpacing",
|
|
1381
|
+
"runInWithNext"
|
|
1382
|
+
];
|
|
1383
|
+
const PARAGRAPH_FORMATTING_NUMBER_KEYS = [
|
|
1384
|
+
"spaceBefore",
|
|
1385
|
+
"spaceAfter",
|
|
1386
|
+
"lineSpacing",
|
|
1387
|
+
"indentLeft",
|
|
1388
|
+
"indentRight",
|
|
1389
|
+
"indentFirstLine",
|
|
1390
|
+
"outlineLevel"
|
|
1391
|
+
];
|
|
1392
|
+
const validateParagraphFormatting = (value, path, issues) => {
|
|
1393
|
+
optionalOneOf(value, "alignment", `${path}.alignment`, issues, PARAGRAPH_ALIGNMENT_VALUES);
|
|
1394
|
+
for (const key of PARAGRAPH_FORMATTING_BOOLEAN_KEYS) optionalBoolean(value, key, `${path}.${key}`, issues);
|
|
1395
|
+
for (const key of [
|
|
1396
|
+
"lineSpacingExplicit",
|
|
1397
|
+
"listIsBullet",
|
|
1398
|
+
"listIsLegal",
|
|
1399
|
+
"listMarkerHidden",
|
|
1400
|
+
"listMarkerBold",
|
|
1401
|
+
"listMarkerAllCaps"
|
|
1402
|
+
]) optionalBoolean(value, key, `${path}.${key}`, issues);
|
|
1403
|
+
for (const key of PARAGRAPH_FORMATTING_NUMBER_KEYS) optionalNumber(value, key, `${path}.${key}`, issues);
|
|
1404
|
+
for (const key of [
|
|
1405
|
+
"listMarkerFontSize",
|
|
1406
|
+
"listImplicitChildLevelAdvances",
|
|
1407
|
+
"listMarkerSecondSlotOffsetTwips",
|
|
1408
|
+
"listAbstractNumId",
|
|
1409
|
+
"listStartOverride"
|
|
1410
|
+
]) optionalNumber(value, key, `${path}.${key}`, issues);
|
|
1411
|
+
optionalOneOf(value, "lineSpacingRule", `${path}.lineSpacingRule`, issues, LINE_SPACING_RULE_VALUES);
|
|
1412
|
+
optionalString(value, "styleId", `${path}.styleId`, issues);
|
|
1413
|
+
optionalOneOf(value, "listNumFmt", `${path}.listNumFmt`, issues, NUMBER_FORMAT_VALUES);
|
|
1414
|
+
optionalString(value, "listMarker", `${path}.listMarker`, issues);
|
|
1415
|
+
optionalString(value, "listMarkerFontFamily", `${path}.listMarkerFontFamily`, issues);
|
|
1416
|
+
optionalOneOf(value, "listMarkerAlignment", `${path}.listMarkerAlignment`, issues, [
|
|
1417
|
+
"left",
|
|
1418
|
+
"center",
|
|
1419
|
+
"right"
|
|
1420
|
+
]);
|
|
1421
|
+
optionalOneOf(value, "listMarkerSuffix", `${path}.listMarkerSuffix`, issues, [
|
|
1422
|
+
"tab",
|
|
1423
|
+
"space",
|
|
1424
|
+
"nothing"
|
|
1425
|
+
]);
|
|
1426
|
+
optionalOneOfArray(value, "listLevelNumFmts", `${path}.listLevelNumFmts`, issues, NUMBER_FORMAT_VALUES);
|
|
1427
|
+
optionalNumberArray(value, "listLevelStarts", `${path}.listLevelStarts`, issues);
|
|
1428
|
+
optionalAutospacingBase(value, `${path}._autospacingBase`, issues);
|
|
1429
|
+
for (const key of ["numPr", "numPrFromStyle"]) {
|
|
1430
|
+
const nested = value[key];
|
|
1431
|
+
if (nested === void 0 || nested === null) continue;
|
|
1432
|
+
if (!isRecord(nested)) {
|
|
1433
|
+
issues.push({
|
|
1434
|
+
path: `${path}.${key}`,
|
|
1435
|
+
message: "Expected an object."
|
|
1436
|
+
});
|
|
1437
|
+
continue;
|
|
1438
|
+
}
|
|
1439
|
+
optionalNumber(nested, "numId", `${path}.${key}.numId`, issues);
|
|
1440
|
+
optionalNumber(nested, "ilvl", `${path}.${key}.ilvl`, issues);
|
|
1441
|
+
}
|
|
1442
|
+
const direction = value["direction"];
|
|
1443
|
+
if (direction !== void 0 && direction !== null && !isParagraphDirection(direction)) issues.push({
|
|
1444
|
+
path: `${path}.direction`,
|
|
1445
|
+
message: "Expected a ParagraphDirection."
|
|
1446
|
+
});
|
|
1447
|
+
for (const key of [
|
|
1448
|
+
"spacingExplicit",
|
|
1449
|
+
"spacingFromDocDefaults",
|
|
1450
|
+
"spacingFromImplicitDefaultStyle"
|
|
1451
|
+
]) {
|
|
1452
|
+
const nested = value[key];
|
|
1453
|
+
if (nested === void 0 || nested === null) continue;
|
|
1454
|
+
if (!isRecord(nested)) {
|
|
1455
|
+
issues.push({
|
|
1456
|
+
path: `${path}.${key}`,
|
|
1457
|
+
message: "Expected an object."
|
|
1458
|
+
});
|
|
1459
|
+
continue;
|
|
1460
|
+
}
|
|
1461
|
+
optionalBoolean(nested, "before", `${path}.${key}.before`, issues);
|
|
1462
|
+
optionalBoolean(nested, "after", `${path}.${key}.after`, issues);
|
|
1463
|
+
}
|
|
1464
|
+
optionalBorderMap(value, "borders", `${path}.borders`, issues, [
|
|
1465
|
+
"top",
|
|
1466
|
+
"bottom",
|
|
1467
|
+
"left",
|
|
1468
|
+
"right",
|
|
1469
|
+
"between",
|
|
1470
|
+
"bar"
|
|
1471
|
+
]);
|
|
1472
|
+
optionalShading(value, "shading", `${path}.shading`, issues);
|
|
1473
|
+
optionalTabStops(value, "tabs", `${path}.tabs`, issues);
|
|
1474
|
+
optionalNestedRecord(value, "runProperties", `${path}.runProperties`, issues, validateTextFormatting);
|
|
1475
|
+
const frame = value["frame"];
|
|
1476
|
+
if (frame !== void 0 && frame !== null) if (!isRecord(frame)) issues.push({
|
|
1477
|
+
path: `${path}.frame`,
|
|
1478
|
+
message: "Expected an object."
|
|
1479
|
+
});
|
|
1480
|
+
else {
|
|
1481
|
+
optionalOneOf(frame, "dropCap", `${path}.frame.dropCap`, issues, [
|
|
1482
|
+
"none",
|
|
1483
|
+
"drop",
|
|
1484
|
+
"margin"
|
|
1485
|
+
]);
|
|
1486
|
+
optionalOneOf(frame, "hAnchor", `${path}.frame.hAnchor`, issues, [
|
|
1487
|
+
"text",
|
|
1488
|
+
"margin",
|
|
1489
|
+
"page"
|
|
1490
|
+
]);
|
|
1491
|
+
optionalOneOf(frame, "vAnchor", `${path}.frame.vAnchor`, issues, [
|
|
1492
|
+
"text",
|
|
1493
|
+
"margin",
|
|
1494
|
+
"page"
|
|
1495
|
+
]);
|
|
1496
|
+
optionalOneOf(frame, "xAlign", `${path}.frame.xAlign`, issues, [
|
|
1497
|
+
"left",
|
|
1498
|
+
"center",
|
|
1499
|
+
"right",
|
|
1500
|
+
"inside",
|
|
1501
|
+
"outside"
|
|
1502
|
+
]);
|
|
1503
|
+
optionalOneOf(frame, "yAlign", `${path}.frame.yAlign`, issues, [
|
|
1504
|
+
"top",
|
|
1505
|
+
"center",
|
|
1506
|
+
"bottom",
|
|
1507
|
+
"inside",
|
|
1508
|
+
"outside",
|
|
1509
|
+
"inline"
|
|
1510
|
+
]);
|
|
1511
|
+
optionalOneOf(frame, "wrap", `${path}.frame.wrap`, issues, [
|
|
1512
|
+
"around",
|
|
1513
|
+
"auto",
|
|
1514
|
+
"none",
|
|
1515
|
+
"notBeside",
|
|
1516
|
+
"through",
|
|
1517
|
+
"tight"
|
|
1518
|
+
]);
|
|
1519
|
+
for (const key of [
|
|
1520
|
+
"lines",
|
|
1521
|
+
"width",
|
|
1522
|
+
"height",
|
|
1523
|
+
"hSpace",
|
|
1524
|
+
"vSpace",
|
|
1525
|
+
"x",
|
|
1526
|
+
"y"
|
|
1527
|
+
]) optionalNumber(frame, key, `${path}.frame.${key}`, issues);
|
|
1290
1528
|
}
|
|
1291
1529
|
};
|
|
1292
1530
|
const validatePropertyChangeInfo = (value, path, issues) => {
|
|
@@ -1373,6 +1611,21 @@ const optionalStringArray = (attrs, key, path, issues) => {
|
|
|
1373
1611
|
message: "Expected a string."
|
|
1374
1612
|
});
|
|
1375
1613
|
};
|
|
1614
|
+
const optionalOneOfArray = (attrs, key, path, issues, allowed) => {
|
|
1615
|
+
const value = attrs[key];
|
|
1616
|
+
if (value === void 0 || value === null) return;
|
|
1617
|
+
if (!Array.isArray(value)) {
|
|
1618
|
+
issues.push({
|
|
1619
|
+
path,
|
|
1620
|
+
message: "Expected an array."
|
|
1621
|
+
});
|
|
1622
|
+
return;
|
|
1623
|
+
}
|
|
1624
|
+
for (const [index, item] of value.entries()) if (typeof item !== "string" || !allowed.includes(item)) issues.push({
|
|
1625
|
+
path: `${path}[${index}]`,
|
|
1626
|
+
message: `Expected one of ${allowed.join(", ")}.`
|
|
1627
|
+
});
|
|
1628
|
+
};
|
|
1376
1629
|
const validateNumPr = (value, issues) => {
|
|
1377
1630
|
if (value === void 0 || value === null || !isRecord(value)) return;
|
|
1378
1631
|
validateNonNegativeInteger(value["numId"], "paragraph.attrs.numPr.numId", issues);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { expectRunPropertyChangeMarkAttrs } from "../attrs/index.js";
|
|
1
|
+
import { expectParagraphAttrs, expectRunPropertyChangeMarkAttrs } from "../attrs/index.js";
|
|
2
2
|
import { textFormattingToMarks } from "../conversion/toProseDoc.js";
|
|
3
3
|
import { markStructuralChange } from "../extensions/features/ParagraphChangeTrackerExtension.js";
|
|
4
4
|
import { getFolioNodeRevisionCarriers } from "../revisionCarriers.js";
|
|
@@ -72,7 +72,7 @@ function resolveChange(from, to, mode, revisionIds) {
|
|
|
72
72
|
if (op) pPrMarkOps.push(op);
|
|
73
73
|
const boundaryCovered = rangeCoversParagraphBoundary(from, to, pos, node);
|
|
74
74
|
let nextAttrs = null;
|
|
75
|
-
const propertyChanges = node.
|
|
75
|
+
const propertyChanges = expectParagraphAttrs(node)._propertyChanges;
|
|
76
76
|
if (Array.isArray(propertyChanges) && propertyChanges.length > 0 && boundaryCovered) {
|
|
77
77
|
const matches = propertyChanges.filter((c) => revisionSet === null || c.info && revisionSet.has(c.info.id));
|
|
78
78
|
if (matches.length > 0) {
|
|
@@ -418,7 +418,7 @@ function findParagraphBoundaryChangeAtPosition(state, pos) {
|
|
|
418
418
|
const paragraphPos = $pos.before($pos.depth);
|
|
419
419
|
const pPrMark = node.attrs["pPrMark"];
|
|
420
420
|
if (isPPrMarkAttr(pPrMark)) return toParagraphBoundaryChange(node, paragraphPos, pPrMark.kind === "ins" ? "insertion" : "deletion", pPrMark.info);
|
|
421
|
-
const propertyChanges = node.
|
|
421
|
+
const propertyChanges = expectParagraphAttrs(node)._propertyChanges;
|
|
422
422
|
if (!Array.isArray(propertyChanges)) return null;
|
|
423
423
|
for (const change of propertyChanges) {
|
|
424
424
|
const type = getListPropertyChangeType(node.attrs, change);
|
|
@@ -8,38 +8,38 @@ import { schema, singletonManager } from "../schema/index.js";
|
|
|
8
8
|
function textFormattingToMarks(formatting) {
|
|
9
9
|
return textFormattingToMarks$1(formatting, schema);
|
|
10
10
|
}
|
|
11
|
-
const cmds = singletonManager
|
|
12
|
-
const toggleBold = cmds
|
|
13
|
-
const toggleItalic = cmds
|
|
14
|
-
const toggleUnderline = cmds
|
|
15
|
-
const toggleStrike = cmds
|
|
16
|
-
const toggleSuperscript = cmds
|
|
17
|
-
const toggleSubscript = cmds
|
|
11
|
+
const cmds = singletonManager;
|
|
12
|
+
const toggleBold = cmds.requireCommand("toggleBold")();
|
|
13
|
+
const toggleItalic = cmds.requireCommand("toggleItalic")();
|
|
14
|
+
const toggleUnderline = cmds.requireCommand("toggleUnderline")();
|
|
15
|
+
const toggleStrike = cmds.requireCommand("toggleStrike")();
|
|
16
|
+
const toggleSuperscript = cmds.requireCommand("toggleSuperscript")();
|
|
17
|
+
const toggleSubscript = cmds.requireCommand("toggleSubscript")();
|
|
18
18
|
function setTextColor(attrs) {
|
|
19
|
-
return cmds
|
|
19
|
+
return cmds.requireCommand("setTextColor")(attrs);
|
|
20
20
|
}
|
|
21
|
-
const clearTextColor = cmds
|
|
21
|
+
const clearTextColor = cmds.requireCommand("clearTextColor")();
|
|
22
22
|
function setHighlight(color) {
|
|
23
|
-
return cmds
|
|
23
|
+
return cmds.requireCommand("setHighlight")(color);
|
|
24
24
|
}
|
|
25
|
-
const clearHighlight = cmds
|
|
25
|
+
const clearHighlight = cmds.requireCommand("clearHighlight")();
|
|
26
26
|
function setFontSize(size) {
|
|
27
|
-
return cmds
|
|
27
|
+
return cmds.requireCommand("setFontSize")(size);
|
|
28
28
|
}
|
|
29
|
-
const clearFontSize = cmds
|
|
29
|
+
const clearFontSize = cmds.requireCommand("clearFontSize")();
|
|
30
30
|
function setFontFamily(fontName) {
|
|
31
|
-
return cmds
|
|
31
|
+
return cmds.requireCommand("setFontFamily")(fontName);
|
|
32
32
|
}
|
|
33
|
-
const clearFontFamily = cmds
|
|
33
|
+
const clearFontFamily = cmds.requireCommand("clearFontFamily")();
|
|
34
34
|
function setUnderlineStyle(style, color) {
|
|
35
|
-
return cmds
|
|
35
|
+
return cmds.requireCommand("setUnderlineStyle")(style, color);
|
|
36
36
|
}
|
|
37
37
|
function setHyperlink(href, tooltip) {
|
|
38
|
-
return cmds
|
|
38
|
+
return cmds.requireCommand("setHyperlink")(href, tooltip);
|
|
39
39
|
}
|
|
40
|
-
const removeHyperlink = cmds
|
|
40
|
+
const removeHyperlink = cmds.requireCommand("removeHyperlink")();
|
|
41
41
|
function insertHyperlink(text, href, tooltip) {
|
|
42
|
-
return cmds
|
|
42
|
+
return cmds.requireCommand("insertHyperlink")(text, href, tooltip);
|
|
43
43
|
}
|
|
44
44
|
//#endregion
|
|
45
45
|
export { clearFontFamily, clearFontSize, clearFormatting, clearHighlight, clearTextColor, createRemoveMarkCommand, createSetMarkCommand, getHyperlinkAttrs, getMarkAttr, getSelectedText, insertHyperlink, isHyperlinkActive, isMarkActive, removeHyperlink, setFontFamily, setFontSize, setHighlight, setHyperlink, setTextColor, setUnderlineStyle, textFormattingToMarks, toggleBold, toggleItalic, toggleStrike, toggleSubscript, toggleSuperscript, toggleUnderline };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import { ResolvedStyleAttrs, getParagraphAlignment, getParagraphBidi, getStyleId } from "../extensions/core/ParagraphExtension.js";
|
|
2
|
+
import { BorderPreset, TableBorderPreset, TableContextInfo, getTableContext, isInTable as isInTableCell } from "../extensions/nodes/TableExtension.js";
|
|
1
3
|
import { AcceptSuggestionOptions, FolioSuggestion, SuggestionAppliedAs, SuggestionKind, acceptAIEditRevision, acceptAllChanges, acceptAllSuggestions, acceptChange, acceptSuggestion, addCommentMark, findAIEditRevisionRange, findNextChange, findPreviousChange, findSuggestionRange, getSuggestions, rejectAIEditRevision, rejectAllChanges, rejectAllSuggestions, rejectChange, rejectSuggestion, removeCommentMark } from "./comments.js";
|
|
2
4
|
import { PAINTABLE_MARK_NAMES, applyFormatMarks, captureFormatMarks } from "./formatPainter.js";
|
|
3
5
|
import { clearFormatting, createRemoveMarkCommand, createSetMarkCommand, getMarkAttr, isMarkActive } from "../extensions/marks/markUtils.js";
|
|
4
6
|
import { getHyperlinkAttrs, getSelectedText, isHyperlinkActive } from "../extensions/marks/HyperlinkExtension.js";
|
|
5
7
|
import { clearFontFamily, clearFontSize, clearHighlight, clearTextColor, insertHyperlink, removeHyperlink, setFontFamily, setFontSize, setHighlight, setHyperlink, setTextColor, setUnderlineStyle, toggleBold, toggleItalic, toggleStrike, toggleSubscript, toggleSuperscript, toggleUnderline } from "./formatting.js";
|
|
6
|
-
import { ResolvedStyleAttrs, getParagraphAlignment, getParagraphBidi, getStyleId } from "../extensions/core/ParagraphExtension.js";
|
|
7
8
|
import { getListInfo, isInList } from "../extensions/features/ListExtension.js";
|
|
8
9
|
import { addTabStop, alignCenter, alignJustify, alignLeft, alignRight, applyStyle, clearStyle, decreaseIndent, decreaseListLevel, doubleSpacing, generateTOC, increaseIndent, increaseListLevel, oneAndHalfSpacing, removeList, removeTabStop, setAlignment, setIndentFirstLine, setIndentLeft, setIndentRight, setLineSpacing, setLtr, setRtl, setSpaceAfter, setSpaceBefore, singleSpacing, toggleBidi, toggleBulletList, toggleNumberedList } from "./paragraph.js";
|
|
9
|
-
import { BorderPreset, TableBorderPreset, TableContextInfo, getTableContext, isInTable as isInTableCell } from "../extensions/nodes/TableExtension.js";
|
|
10
10
|
import { addColumnLeft, addColumnRight, addRowAbove, addRowBelow, applyTableStyle, autoFitContents, deleteColumn, deleteRow, deleteTable, distributeColumns, insertTable, mergeCells, removeTableBorders, selectColumn, selectRow, selectTable, setAllTableBorders, setCellBorder, setCellFillColor, setCellMargins, setCellTextDirection, setCellVerticalAlign, setInsideTableBorders, setOutsideTableBorders, setRowHeight, setTableBorderColor, setTableBorderPreset, setTableBorderWidth, setTableBorders, setTableProperties, splitCell, toggleHeaderRow, toggleNoWrap } from "./table.js";
|
|
11
11
|
import { insertPageBreak } from "./pageBreak.js";
|
|
12
12
|
import { CLIPBOARD_READ_ERROR_EVENT, buildPlainTextSlice, pasteWithoutFormatting } from "./pastePlainText.js";
|