@stll/folio-core 0.22.2 → 0.23.0
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 +28 -0
- package/dist/document-operations.d.ts +4 -4
- package/dist/document-operations.js +17 -1
- package/dist/docx/imageParser.js +6 -9
- package/dist/docx/rezip.d.ts +1 -1
- package/dist/docx/rezip.js +12 -31
- package/dist/docx/server/inspectDocxPackage.js +8 -7
- package/dist/docx/styleParser.js +16 -16
- package/dist/docx/xmlParser.d.ts +7 -3
- package/dist/docx/xmlParser.js +20 -7
- package/dist/layout-bridge/convert/toFlowBlocks.js +35 -61
- package/dist/layout-engine/measure/measureHelpers.d.ts +2 -1
- package/dist/layout-engine/measure/measureHelpers.js +5 -2
- package/dist/layout-engine/types.d.ts +6 -0
- package/dist/layout-painter/anchoredImagePosition.d.ts +2 -1
- package/dist/layout-painter/anchoredImagePosition.js +14 -6
- package/dist/layout-painter/imageLayout.d.ts +1 -1
- package/dist/layout-painter/renderPage.js +11 -1
- package/dist/layout-painter/renderParagraph.js +3 -4
- 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/prosemirror/attrs/index.js +278 -29
- 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 +5 -3
- package/dist/prosemirror/commands/propertyChangeScope.js +9 -8
- package/dist/prosemirror/commands/table.d.ts +10 -52
- package/dist/prosemirror/commands/table.js +34 -34
- package/dist/prosemirror/conversion/fromProseDoc.js +33 -20
- package/dist/prosemirror/conversion/sdtAttrs.d.ts +2 -1
- package/dist/prosemirror/conversion/sdtAttrs.js +9 -4
- package/dist/prosemirror/conversion/toProseDoc.js +1 -0
- 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/core/ParagraphExtension.js +30 -3
- package/dist/prosemirror/extensions/features/ListExtension.js +4 -4
- package/dist/prosemirror/extensions/marks/UnderlineExtension.js +9 -7
- package/dist/prosemirror/extensions/marks/markUtils.d.ts +2 -1
- package/dist/prosemirror/extensions/marks/markUtils.js +92 -16
- package/dist/prosemirror/extensions/nodes/ShapeExtension.d.ts +1 -1
- 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 -94
- 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/nodes.d.ts +14 -2
- package/dist/prosemirror/selectionMarks.d.ts +11 -0
- package/dist/prosemirror/selectionMarks.js +19 -0
- package/dist/prosemirror/selectionState.d.ts +11 -5
- package/dist/prosemirror/selectionState.js +99 -74
- package/dist/prosemirror/styles/resolvedStyleAttrs.js +1 -0
- package/dist/utils/formatToStyle.js +1 -1
- package/dist/utils/tableOperations.d.ts +7 -6
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FIELD_TYPE_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,9 +145,11 @@ 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);
|
|
152
|
+
optionalBoolean(attrs, "lineSpacingExplicit", "paragraph.attrs.lineSpacingExplicit", issues);
|
|
166
153
|
optionalBoolean(attrs, "snapToGrid", "paragraph.attrs.snapToGrid", issues);
|
|
167
154
|
optionalOneOf(attrs, "lineSpacingRule", "paragraph.attrs.lineSpacingRule", issues, LINE_SPACING_RULE_VALUES);
|
|
168
155
|
optionalNumber(attrs, "indentLeft", "paragraph.attrs.indentLeft", issues);
|
|
@@ -191,9 +178,11 @@ const readParagraphAttrs = (node) => {
|
|
|
191
178
|
optionalBoolean(attrs, "pageBreakBefore", "paragraph.attrs.pageBreakBefore", issues);
|
|
192
179
|
optionalBoolean(attrs, "renderedPageBreakBefore", "paragraph.attrs.renderedPageBreakBefore", issues);
|
|
193
180
|
optionalBoolean(attrs, "_trailingPageBreak", "paragraph.attrs._trailingPageBreak", issues);
|
|
181
|
+
optionalBoolean(attrs, "_pageBreakCarrier", "paragraph.attrs._pageBreakCarrier", issues);
|
|
194
182
|
optionalBoolean(attrs, "runInWithNext", "paragraph.attrs.runInWithNext", issues);
|
|
195
183
|
optionalBoolean(attrs, "keepNext", "paragraph.attrs.keepNext", issues);
|
|
196
184
|
optionalBoolean(attrs, "keepLines", "paragraph.attrs.keepLines", issues);
|
|
185
|
+
optionalBoolean(attrs, "widowControl", "paragraph.attrs.widowControl", issues);
|
|
197
186
|
optionalBoolean(attrs, "contextualSpacing", "paragraph.attrs.contextualSpacing", issues);
|
|
198
187
|
const direction = attrs["direction"];
|
|
199
188
|
if (direction !== void 0 && direction !== null && !isParagraphDirection(direction)) issues.push({
|
|
@@ -222,7 +211,7 @@ const readParagraphAttrs = (node) => {
|
|
|
222
211
|
validateNumPr(attrs["numPr"], issues);
|
|
223
212
|
optionalBookmarkArray(attrs["bookmarks"], issues);
|
|
224
213
|
optionalEmptyHyperlinkArray(attrs["_emptyHyperlinks"], issues);
|
|
225
|
-
optionalAutospacingBase(attrs, issues);
|
|
214
|
+
optionalAutospacingBase(attrs, "paragraph.attrs._autospacingBase", issues);
|
|
226
215
|
optionalSectionProperties(attrs, "_sectionProperties", "paragraph.attrs._sectionProperties", issues);
|
|
227
216
|
optionalPropertyChanges(attrs, "_propertyChanges", "paragraph.attrs._propertyChanges", issues, ["paragraphPropertyChange"]);
|
|
228
217
|
return attrsResult(attrs, issues);
|
|
@@ -571,10 +560,10 @@ const readFontFamilyMarkAttrs = (mark) => {
|
|
|
571
560
|
optionalString(attrs, "eastAsia", "fontFamily.attrs.eastAsia", issues);
|
|
572
561
|
optionalString(attrs, "cs", "fontFamily.attrs.cs", issues);
|
|
573
562
|
optionalString(attrs, "hint", "fontFamily.attrs.hint", issues);
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
563
|
+
optionalOneOf(attrs, "asciiTheme", "fontFamily.attrs.asciiTheme", issues, FONT_THEME_VALUES);
|
|
564
|
+
optionalOneOf(attrs, "hAnsiTheme", "fontFamily.attrs.hAnsiTheme", issues, FONT_THEME_VALUES);
|
|
565
|
+
optionalOneOf(attrs, "eastAsiaTheme", "fontFamily.attrs.eastAsiaTheme", issues, FONT_THEME_VALUES);
|
|
566
|
+
optionalOneOf(attrs, "csTheme", "fontFamily.attrs.csTheme", issues, FONT_THEME_VALUES);
|
|
578
567
|
return attrsResult(attrs, issues);
|
|
579
568
|
};
|
|
580
569
|
const expectFontFamilyMarkAttrs = (mark) => expectCachedMarkAttrs(mark, fontFamilyAttrsCache, readFontFamilyMarkAttrs, "font family attrs");
|
|
@@ -1088,18 +1077,18 @@ const validateSdtAttrsRecord = (attrs, path, issues) => {
|
|
|
1088
1077
|
optionalString(attrs, "rawPropertiesXml", `${path}.rawPropertiesXml`, issues);
|
|
1089
1078
|
optionalString(attrs, "rawEndPropertiesXml", `${path}.rawEndPropertiesXml`, issues);
|
|
1090
1079
|
};
|
|
1091
|
-
const optionalAutospacingBase = (attrs, issues) => {
|
|
1080
|
+
const optionalAutospacingBase = (attrs, path, issues) => {
|
|
1092
1081
|
const value = attrs["_autospacingBase"];
|
|
1093
1082
|
if (value === void 0 || value === null) return;
|
|
1094
1083
|
if (!isRecord(value)) {
|
|
1095
1084
|
issues.push({
|
|
1096
|
-
path
|
|
1085
|
+
path,
|
|
1097
1086
|
message: "Expected an object."
|
|
1098
1087
|
});
|
|
1099
1088
|
return;
|
|
1100
1089
|
}
|
|
1101
|
-
optionalNumber(value, "before",
|
|
1102
|
-
optionalNumber(value, "after",
|
|
1090
|
+
optionalNumber(value, "before", `${path}.before`, issues);
|
|
1091
|
+
optionalNumber(value, "after", `${path}.after`, issues);
|
|
1103
1092
|
};
|
|
1104
1093
|
const optionalArray = (attrs, key, path, issues) => {
|
|
1105
1094
|
const value = attrs[key];
|
|
@@ -1200,11 +1189,42 @@ const optionalTextFormatting = (attrs, key, path, issues) => {
|
|
|
1200
1189
|
});
|
|
1201
1190
|
return;
|
|
1202
1191
|
}
|
|
1203
|
-
|
|
1192
|
+
validateTextFormatting(value, path, issues);
|
|
1193
|
+
};
|
|
1194
|
+
const validateTextFormatting = (value, path, issues) => {
|
|
1195
|
+
for (const booleanKey of [
|
|
1196
|
+
"bold",
|
|
1197
|
+
"boldCs",
|
|
1198
|
+
"italic",
|
|
1199
|
+
"italicCs",
|
|
1200
|
+
"strike",
|
|
1201
|
+
"doubleStrike",
|
|
1202
|
+
"smallCaps",
|
|
1203
|
+
"allCaps",
|
|
1204
|
+
"hidden",
|
|
1205
|
+
"emboss",
|
|
1206
|
+
"imprint",
|
|
1207
|
+
"outline",
|
|
1208
|
+
"shadow",
|
|
1209
|
+
"rtl",
|
|
1210
|
+
"cs"
|
|
1211
|
+
]) optionalBoolean(value, booleanKey, `${path}.${booleanKey}`, issues);
|
|
1212
|
+
optionalOneOf(value, "vertAlign", `${path}.vertAlign`, issues, [
|
|
1213
|
+
"baseline",
|
|
1214
|
+
"superscript",
|
|
1215
|
+
"subscript"
|
|
1216
|
+
]);
|
|
1204
1217
|
optionalNumber(value, "fontSize", `${path}.fontSize`, issues);
|
|
1205
1218
|
optionalNumber(value, "fontSizeCs", `${path}.fontSizeCs`, issues);
|
|
1206
|
-
|
|
1219
|
+
optionalNumber(value, "spacing", `${path}.spacing`, issues);
|
|
1220
|
+
optionalNumber(value, "position", `${path}.position`, issues);
|
|
1221
|
+
optionalNumber(value, "scale", `${path}.scale`, issues);
|
|
1222
|
+
optionalNumber(value, "kerning", `${path}.kerning`, issues);
|
|
1223
|
+
optionalString(value, "styleId", `${path}.styleId`, issues);
|
|
1224
|
+
optionalOneOf(value, "effect", `${path}.effect`, issues, TEXT_EFFECT_VALUES);
|
|
1225
|
+
optionalOneOf(value, "emphasisMark", `${path}.emphasisMark`, issues, EMPHASIS_MARK_VALUES);
|
|
1207
1226
|
optionalColorValue(value, "color", `${path}.color`, issues);
|
|
1227
|
+
optionalOneOf(value, "highlight", `${path}.highlight`, issues, HIGHLIGHT_COLOR_VALUES);
|
|
1208
1228
|
optionalShading(value, "shading", `${path}.shading`, issues);
|
|
1209
1229
|
const underline = value["underline"];
|
|
1210
1230
|
if (underline !== void 0 && underline !== null) if (!isRecord(underline)) issues.push({
|
|
@@ -1215,6 +1235,36 @@ const optionalTextFormatting = (attrs, key, path, issues) => {
|
|
|
1215
1235
|
requiredOneOf(underline, "style", `${path}.underline.style`, issues, UNDERLINE_STYLE_VALUES);
|
|
1216
1236
|
optionalColorValue(underline, "color", `${path}.underline.color`, issues);
|
|
1217
1237
|
}
|
|
1238
|
+
const fontFamily = value["fontFamily"];
|
|
1239
|
+
if (fontFamily !== void 0 && fontFamily !== null) if (!isRecord(fontFamily)) issues.push({
|
|
1240
|
+
path: `${path}.fontFamily`,
|
|
1241
|
+
message: "Expected an object."
|
|
1242
|
+
});
|
|
1243
|
+
else {
|
|
1244
|
+
for (const key of [
|
|
1245
|
+
"ascii",
|
|
1246
|
+
"hAnsi",
|
|
1247
|
+
"eastAsia",
|
|
1248
|
+
"cs"
|
|
1249
|
+
]) optionalString(fontFamily, key, `${path}.fontFamily.${key}`, issues);
|
|
1250
|
+
optionalOneOf(fontFamily, "hint", `${path}.fontFamily.hint`, issues, FONT_HINT_VALUES);
|
|
1251
|
+
for (const key of [
|
|
1252
|
+
"asciiTheme",
|
|
1253
|
+
"hAnsiTheme",
|
|
1254
|
+
"eastAsiaTheme",
|
|
1255
|
+
"csTheme"
|
|
1256
|
+
]) optionalOneOf(fontFamily, key, `${path}.fontFamily.${key}`, issues, FONT_THEME_VALUES);
|
|
1257
|
+
}
|
|
1258
|
+
const language = value["language"];
|
|
1259
|
+
if (language !== void 0 && language !== null) if (!isRecord(language)) issues.push({
|
|
1260
|
+
path: `${path}.language`,
|
|
1261
|
+
message: "Expected an object."
|
|
1262
|
+
});
|
|
1263
|
+
else for (const key of [
|
|
1264
|
+
"val",
|
|
1265
|
+
"eastAsia",
|
|
1266
|
+
"bidi"
|
|
1267
|
+
]) optionalString(language, key, `${path}.language.${key}`, issues);
|
|
1218
1268
|
};
|
|
1219
1269
|
const optionalInsetMap = (attrs, key, path, issues) => {
|
|
1220
1270
|
const value = attrs[key];
|
|
@@ -1284,8 +1334,192 @@ const optionalPropertyChanges = (attrs, key, path, issues, allowedTypes) => {
|
|
|
1284
1334
|
}
|
|
1285
1335
|
requiredOneOf(item, "type", `${itemPath}.type`, issues, allowedTypes);
|
|
1286
1336
|
validatePropertyChangeInfo(item["info"], `${itemPath}.info`, issues);
|
|
1287
|
-
|
|
1288
|
-
|
|
1337
|
+
let validateFormatting;
|
|
1338
|
+
if (allowedTypes.includes("paragraphPropertyChange")) validateFormatting = validateParagraphFormatting;
|
|
1339
|
+
else if (allowedTypes.includes("runPropertyChange")) validateFormatting = validateTextFormatting;
|
|
1340
|
+
if (validateFormatting) {
|
|
1341
|
+
optionalNestedRecord(item, "previousFormatting", `${itemPath}.previousFormatting`, issues, validateFormatting);
|
|
1342
|
+
optionalNestedRecord(item, "currentFormatting", `${itemPath}.currentFormatting`, issues, validateFormatting);
|
|
1343
|
+
} else {
|
|
1344
|
+
optionalRecord(item, "previousFormatting", `${itemPath}.previousFormatting`, issues);
|
|
1345
|
+
optionalRecord(item, "currentFormatting", `${itemPath}.currentFormatting`, issues);
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1348
|
+
};
|
|
1349
|
+
const optionalNestedRecord = (attrs, key, path, issues, validate) => {
|
|
1350
|
+
const value = attrs[key];
|
|
1351
|
+
if (value === void 0 || value === null) return;
|
|
1352
|
+
if (!isRecord(value)) {
|
|
1353
|
+
issues.push({
|
|
1354
|
+
path,
|
|
1355
|
+
message: "Expected an object."
|
|
1356
|
+
});
|
|
1357
|
+
return;
|
|
1358
|
+
}
|
|
1359
|
+
validate(value, path, issues);
|
|
1360
|
+
};
|
|
1361
|
+
const PARAGRAPH_FORMATTING_BOOLEAN_KEYS = [
|
|
1362
|
+
"bidi",
|
|
1363
|
+
"kinsoku",
|
|
1364
|
+
"overflowPunctuation",
|
|
1365
|
+
"suppressAutoHyphens",
|
|
1366
|
+
"suppressLineNumbers",
|
|
1367
|
+
"snapToGrid",
|
|
1368
|
+
"beforeAutospacing",
|
|
1369
|
+
"afterAutospacing",
|
|
1370
|
+
"hangingIndent",
|
|
1371
|
+
"keepNext",
|
|
1372
|
+
"keepLines",
|
|
1373
|
+
"widowControl",
|
|
1374
|
+
"pageBreakBefore",
|
|
1375
|
+
"contextualSpacing",
|
|
1376
|
+
"runInWithNext"
|
|
1377
|
+
];
|
|
1378
|
+
const PARAGRAPH_FORMATTING_NUMBER_KEYS = [
|
|
1379
|
+
"spaceBefore",
|
|
1380
|
+
"spaceAfter",
|
|
1381
|
+
"lineSpacing",
|
|
1382
|
+
"indentLeft",
|
|
1383
|
+
"indentRight",
|
|
1384
|
+
"indentFirstLine",
|
|
1385
|
+
"outlineLevel"
|
|
1386
|
+
];
|
|
1387
|
+
const validateParagraphFormatting = (value, path, issues) => {
|
|
1388
|
+
optionalOneOf(value, "alignment", `${path}.alignment`, issues, PARAGRAPH_ALIGNMENT_VALUES);
|
|
1389
|
+
for (const key of PARAGRAPH_FORMATTING_BOOLEAN_KEYS) optionalBoolean(value, key, `${path}.${key}`, issues);
|
|
1390
|
+
for (const key of [
|
|
1391
|
+
"lineSpacingExplicit",
|
|
1392
|
+
"listIsBullet",
|
|
1393
|
+
"listIsLegal",
|
|
1394
|
+
"listMarkerHidden",
|
|
1395
|
+
"listMarkerBold",
|
|
1396
|
+
"listMarkerAllCaps"
|
|
1397
|
+
]) optionalBoolean(value, key, `${path}.${key}`, issues);
|
|
1398
|
+
for (const key of PARAGRAPH_FORMATTING_NUMBER_KEYS) optionalNumber(value, key, `${path}.${key}`, issues);
|
|
1399
|
+
for (const key of [
|
|
1400
|
+
"listMarkerFontSize",
|
|
1401
|
+
"listImplicitChildLevelAdvances",
|
|
1402
|
+
"listMarkerSecondSlotOffsetTwips",
|
|
1403
|
+
"listAbstractNumId",
|
|
1404
|
+
"listStartOverride"
|
|
1405
|
+
]) optionalNumber(value, key, `${path}.${key}`, issues);
|
|
1406
|
+
optionalOneOf(value, "lineSpacingRule", `${path}.lineSpacingRule`, issues, LINE_SPACING_RULE_VALUES);
|
|
1407
|
+
optionalString(value, "styleId", `${path}.styleId`, issues);
|
|
1408
|
+
optionalOneOf(value, "listNumFmt", `${path}.listNumFmt`, issues, NUMBER_FORMAT_VALUES);
|
|
1409
|
+
optionalString(value, "listMarker", `${path}.listMarker`, issues);
|
|
1410
|
+
optionalString(value, "listMarkerFontFamily", `${path}.listMarkerFontFamily`, issues);
|
|
1411
|
+
optionalOneOf(value, "listMarkerAlignment", `${path}.listMarkerAlignment`, issues, [
|
|
1412
|
+
"left",
|
|
1413
|
+
"center",
|
|
1414
|
+
"right"
|
|
1415
|
+
]);
|
|
1416
|
+
optionalOneOf(value, "listMarkerSuffix", `${path}.listMarkerSuffix`, issues, [
|
|
1417
|
+
"tab",
|
|
1418
|
+
"space",
|
|
1419
|
+
"nothing"
|
|
1420
|
+
]);
|
|
1421
|
+
optionalOneOfArray(value, "listLevelNumFmts", `${path}.listLevelNumFmts`, issues, NUMBER_FORMAT_VALUES);
|
|
1422
|
+
optionalNumberArray(value, "listLevelStarts", `${path}.listLevelStarts`, issues);
|
|
1423
|
+
optionalAutospacingBase(value, `${path}._autospacingBase`, issues);
|
|
1424
|
+
for (const key of ["numPr", "numPrFromStyle"]) {
|
|
1425
|
+
const nested = value[key];
|
|
1426
|
+
if (nested === void 0 || nested === null) continue;
|
|
1427
|
+
if (!isRecord(nested)) {
|
|
1428
|
+
issues.push({
|
|
1429
|
+
path: `${path}.${key}`,
|
|
1430
|
+
message: "Expected an object."
|
|
1431
|
+
});
|
|
1432
|
+
continue;
|
|
1433
|
+
}
|
|
1434
|
+
optionalNumber(nested, "numId", `${path}.${key}.numId`, issues);
|
|
1435
|
+
optionalNumber(nested, "ilvl", `${path}.${key}.ilvl`, issues);
|
|
1436
|
+
}
|
|
1437
|
+
const direction = value["direction"];
|
|
1438
|
+
if (direction !== void 0 && direction !== null && !isParagraphDirection(direction)) issues.push({
|
|
1439
|
+
path: `${path}.direction`,
|
|
1440
|
+
message: "Expected a ParagraphDirection."
|
|
1441
|
+
});
|
|
1442
|
+
for (const key of [
|
|
1443
|
+
"spacingExplicit",
|
|
1444
|
+
"spacingFromDocDefaults",
|
|
1445
|
+
"spacingFromImplicitDefaultStyle"
|
|
1446
|
+
]) {
|
|
1447
|
+
const nested = value[key];
|
|
1448
|
+
if (nested === void 0 || nested === null) continue;
|
|
1449
|
+
if (!isRecord(nested)) {
|
|
1450
|
+
issues.push({
|
|
1451
|
+
path: `${path}.${key}`,
|
|
1452
|
+
message: "Expected an object."
|
|
1453
|
+
});
|
|
1454
|
+
continue;
|
|
1455
|
+
}
|
|
1456
|
+
optionalBoolean(nested, "before", `${path}.${key}.before`, issues);
|
|
1457
|
+
optionalBoolean(nested, "after", `${path}.${key}.after`, issues);
|
|
1458
|
+
}
|
|
1459
|
+
optionalBorderMap(value, "borders", `${path}.borders`, issues, [
|
|
1460
|
+
"top",
|
|
1461
|
+
"bottom",
|
|
1462
|
+
"left",
|
|
1463
|
+
"right",
|
|
1464
|
+
"between",
|
|
1465
|
+
"bar"
|
|
1466
|
+
]);
|
|
1467
|
+
optionalShading(value, "shading", `${path}.shading`, issues);
|
|
1468
|
+
optionalTabStops(value, "tabs", `${path}.tabs`, issues);
|
|
1469
|
+
optionalNestedRecord(value, "runProperties", `${path}.runProperties`, issues, validateTextFormatting);
|
|
1470
|
+
const frame = value["frame"];
|
|
1471
|
+
if (frame !== void 0 && frame !== null) if (!isRecord(frame)) issues.push({
|
|
1472
|
+
path: `${path}.frame`,
|
|
1473
|
+
message: "Expected an object."
|
|
1474
|
+
});
|
|
1475
|
+
else {
|
|
1476
|
+
optionalOneOf(frame, "dropCap", `${path}.frame.dropCap`, issues, [
|
|
1477
|
+
"none",
|
|
1478
|
+
"drop",
|
|
1479
|
+
"margin"
|
|
1480
|
+
]);
|
|
1481
|
+
optionalOneOf(frame, "hAnchor", `${path}.frame.hAnchor`, issues, [
|
|
1482
|
+
"text",
|
|
1483
|
+
"margin",
|
|
1484
|
+
"page"
|
|
1485
|
+
]);
|
|
1486
|
+
optionalOneOf(frame, "vAnchor", `${path}.frame.vAnchor`, issues, [
|
|
1487
|
+
"text",
|
|
1488
|
+
"margin",
|
|
1489
|
+
"page"
|
|
1490
|
+
]);
|
|
1491
|
+
optionalOneOf(frame, "xAlign", `${path}.frame.xAlign`, issues, [
|
|
1492
|
+
"left",
|
|
1493
|
+
"center",
|
|
1494
|
+
"right",
|
|
1495
|
+
"inside",
|
|
1496
|
+
"outside"
|
|
1497
|
+
]);
|
|
1498
|
+
optionalOneOf(frame, "yAlign", `${path}.frame.yAlign`, issues, [
|
|
1499
|
+
"top",
|
|
1500
|
+
"center",
|
|
1501
|
+
"bottom",
|
|
1502
|
+
"inside",
|
|
1503
|
+
"outside",
|
|
1504
|
+
"inline"
|
|
1505
|
+
]);
|
|
1506
|
+
optionalOneOf(frame, "wrap", `${path}.frame.wrap`, issues, [
|
|
1507
|
+
"around",
|
|
1508
|
+
"auto",
|
|
1509
|
+
"none",
|
|
1510
|
+
"notBeside",
|
|
1511
|
+
"through",
|
|
1512
|
+
"tight"
|
|
1513
|
+
]);
|
|
1514
|
+
for (const key of [
|
|
1515
|
+
"lines",
|
|
1516
|
+
"width",
|
|
1517
|
+
"height",
|
|
1518
|
+
"hSpace",
|
|
1519
|
+
"vSpace",
|
|
1520
|
+
"x",
|
|
1521
|
+
"y"
|
|
1522
|
+
]) optionalNumber(frame, key, `${path}.frame.${key}`, issues);
|
|
1289
1523
|
}
|
|
1290
1524
|
};
|
|
1291
1525
|
const validatePropertyChangeInfo = (value, path, issues) => {
|
|
@@ -1372,6 +1606,21 @@ const optionalStringArray = (attrs, key, path, issues) => {
|
|
|
1372
1606
|
message: "Expected a string."
|
|
1373
1607
|
});
|
|
1374
1608
|
};
|
|
1609
|
+
const optionalOneOfArray = (attrs, key, path, issues, allowed) => {
|
|
1610
|
+
const value = attrs[key];
|
|
1611
|
+
if (value === void 0 || value === null) return;
|
|
1612
|
+
if (!Array.isArray(value)) {
|
|
1613
|
+
issues.push({
|
|
1614
|
+
path,
|
|
1615
|
+
message: "Expected an array."
|
|
1616
|
+
});
|
|
1617
|
+
return;
|
|
1618
|
+
}
|
|
1619
|
+
for (const [index, item] of value.entries()) if (typeof item !== "string" || !allowed.includes(item)) issues.push({
|
|
1620
|
+
path: `${path}[${index}]`,
|
|
1621
|
+
message: `Expected one of ${allowed.join(", ")}.`
|
|
1622
|
+
});
|
|
1623
|
+
};
|
|
1375
1624
|
const validateNumPr = (value, issues) => {
|
|
1376
1625
|
if (value === void 0 || value === null || !isRecord(value)) return;
|
|
1377
1626
|
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";
|
|
@@ -2,63 +2,63 @@ import { getParagraphAlignment, getParagraphBidi, getParagraphTabs, getStyleId }
|
|
|
2
2
|
import { getListInfo, isInList } from "../extensions/features/ListExtension.js";
|
|
3
3
|
import { singletonManager } from "../schema/index.js";
|
|
4
4
|
//#region src/prosemirror/commands/paragraph.ts
|
|
5
|
-
const cmds = singletonManager
|
|
5
|
+
const cmds = singletonManager;
|
|
6
6
|
function setAlignment(alignment) {
|
|
7
|
-
return cmds
|
|
7
|
+
return cmds.requireCommand("setAlignment")(alignment);
|
|
8
8
|
}
|
|
9
|
-
const alignLeft = cmds
|
|
10
|
-
const alignCenter = cmds
|
|
11
|
-
const alignRight = cmds
|
|
12
|
-
const alignJustify = cmds
|
|
9
|
+
const alignLeft = cmds.requireCommand("alignLeft")();
|
|
10
|
+
const alignCenter = cmds.requireCommand("alignCenter")();
|
|
11
|
+
const alignRight = cmds.requireCommand("alignRight")();
|
|
12
|
+
const alignJustify = cmds.requireCommand("alignJustify")();
|
|
13
13
|
function setLineSpacing(value, rule = "auto") {
|
|
14
|
-
return cmds
|
|
14
|
+
return cmds.requireCommand("setLineSpacing")(value, rule);
|
|
15
15
|
}
|
|
16
|
-
const singleSpacing = cmds
|
|
17
|
-
const oneAndHalfSpacing = cmds
|
|
18
|
-
const doubleSpacing = cmds
|
|
16
|
+
const singleSpacing = cmds.requireCommand("singleSpacing")();
|
|
17
|
+
const oneAndHalfSpacing = cmds.requireCommand("oneAndHalfSpacing")();
|
|
18
|
+
const doubleSpacing = cmds.requireCommand("doubleSpacing")();
|
|
19
19
|
function increaseIndent(amount = 720) {
|
|
20
|
-
return cmds
|
|
20
|
+
return cmds.requireCommand("increaseIndent")(amount);
|
|
21
21
|
}
|
|
22
22
|
function decreaseIndent(amount = 720) {
|
|
23
|
-
return cmds
|
|
23
|
+
return cmds.requireCommand("decreaseIndent")(amount);
|
|
24
24
|
}
|
|
25
25
|
function setIndentLeft(twips) {
|
|
26
|
-
return cmds
|
|
26
|
+
return cmds.requireCommand("setIndentLeft")(twips);
|
|
27
27
|
}
|
|
28
28
|
function setIndentRight(twips) {
|
|
29
|
-
return cmds
|
|
29
|
+
return cmds.requireCommand("setIndentRight")(twips);
|
|
30
30
|
}
|
|
31
31
|
function setIndentFirstLine(twips, hanging) {
|
|
32
|
-
return cmds
|
|
32
|
+
return cmds.requireCommand("setIndentFirstLine")(twips, hanging);
|
|
33
33
|
}
|
|
34
|
-
const toggleBulletList = cmds
|
|
35
|
-
const toggleNumberedList = cmds
|
|
36
|
-
const increaseListLevel = cmds
|
|
37
|
-
const decreaseListLevel = cmds
|
|
38
|
-
const removeList = cmds
|
|
34
|
+
const toggleBulletList = cmds.requireCommand("toggleBulletList")();
|
|
35
|
+
const toggleNumberedList = cmds.requireCommand("toggleNumberedList")();
|
|
36
|
+
const increaseListLevel = cmds.requireCommand("increaseListLevel")();
|
|
37
|
+
const decreaseListLevel = cmds.requireCommand("decreaseListLevel")();
|
|
38
|
+
const removeList = cmds.requireCommand("removeList")();
|
|
39
39
|
function setSpaceBefore(twips) {
|
|
40
|
-
return cmds
|
|
40
|
+
return cmds.requireCommand("setSpaceBefore")(twips);
|
|
41
41
|
}
|
|
42
42
|
function setSpaceAfter(twips) {
|
|
43
|
-
return cmds
|
|
43
|
+
return cmds.requireCommand("setSpaceAfter")(twips);
|
|
44
44
|
}
|
|
45
45
|
function applyStyle(styleId, resolvedAttrs) {
|
|
46
|
-
return cmds
|
|
46
|
+
return cmds.requireCommand("applyStyle")(styleId, resolvedAttrs);
|
|
47
47
|
}
|
|
48
|
-
const clearStyle = cmds
|
|
48
|
+
const clearStyle = cmds.requireCommand("clearStyle")();
|
|
49
49
|
function insertSectionBreak(breakType) {
|
|
50
|
-
return cmds
|
|
50
|
+
return cmds.requireCommand("insertSectionBreak")(breakType);
|
|
51
51
|
}
|
|
52
|
-
const removeSectionBreak = cmds
|
|
52
|
+
const removeSectionBreak = cmds.requireCommand("removeSectionBreak")();
|
|
53
53
|
function addTabStop(position, alignment = "left", leader = "none") {
|
|
54
|
-
return cmds
|
|
54
|
+
return cmds.requireCommand("addTabStop")(position, alignment, leader);
|
|
55
55
|
}
|
|
56
56
|
function removeTabStop(position) {
|
|
57
|
-
return cmds
|
|
57
|
+
return cmds.requireCommand("removeTabStop")(position);
|
|
58
58
|
}
|
|
59
|
-
const toggleBidi = cmds
|
|
60
|
-
const setRtl = cmds
|
|
61
|
-
const setLtr = cmds
|
|
62
|
-
const generateTOC = cmds
|
|
59
|
+
const toggleBidi = cmds.requireCommand("toggleBidi")();
|
|
60
|
+
const setRtl = cmds.requireCommand("setRtl")();
|
|
61
|
+
const setLtr = cmds.requireCommand("setLtr")();
|
|
62
|
+
const generateTOC = cmds.requireCommand("generateTOC")();
|
|
63
63
|
//#endregion
|
|
64
64
|
export { addTabStop, alignCenter, alignJustify, alignLeft, alignRight, applyStyle, clearStyle, decreaseIndent, decreaseListLevel, doubleSpacing, generateTOC, getListInfo, getParagraphAlignment, getParagraphBidi, getParagraphTabs, getStyleId, increaseIndent, increaseListLevel, insertSectionBreak, isInList, oneAndHalfSpacing, removeList, removeSectionBreak, removeTabStop, setAlignment, setIndentFirstLine, setIndentLeft, setIndentRight, setLineSpacing, setLtr, setRtl, setSpaceAfter, setSpaceBefore, singleSpacing, toggleBidi, toggleBulletList, toggleNumberedList };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { document_d_exports } from "../../types/document.js";
|
|
2
|
+
import { ParagraphPropertyChangeAttrs } from "../schema/nodes.js";
|
|
2
3
|
//#region src/prosemirror/commands/propertyChangeScope.d.ts
|
|
3
4
|
type AttrPatch = Record<string, unknown>;
|
|
5
|
+
type ParagraphPropertySnapshot = NonNullable<ParagraphPropertyChangeAttrs["previousFormatting"]>;
|
|
4
6
|
/**
|
|
5
7
|
* Paragraph attrs governed by a `w:pPrChange` — the attrs
|
|
6
8
|
* `paragraphFormattingToAttrs` (conversion/toProseDoc.ts) can produce from a
|
|
@@ -19,7 +21,7 @@ type AttrPatch = Record<string, unknown>;
|
|
|
19
21
|
* without a style resolver: `numPrFromStyle`, the `list*` rendering attrs,
|
|
20
22
|
* `spacingFromDocDefaults`, `spacingFromImplicitDefaultStyle`
|
|
21
23
|
*/
|
|
22
|
-
declare const PPR_CHANGE_SCOPED_ATTR_KEYS: readonly ["styleId", "numPr", "alignment", "spaceBefore", "spaceAfter", "lineSpacing", "lineSpacingRule", "snapToGrid", "spacingExplicit", "indentLeft", "indentRight", "indentFirstLine", "hangingIndent", "borders", "shading", "tabs", "pageBreakBefore", "keepNext", "keepLines", "widowControl", "contextualSpacing", "outlineLevel", "direction", "_autospacingBase"];
|
|
24
|
+
declare const PPR_CHANGE_SCOPED_ATTR_KEYS: readonly ["styleId", "numPr", "alignment", "spaceBefore", "spaceAfter", "lineSpacing", "lineSpacingRule", "lineSpacingExplicit", "snapToGrid", "spacingExplicit", "indentLeft", "indentRight", "indentFirstLine", "hangingIndent", "borders", "shading", "tabs", "pageBreakBefore", "keepNext", "keepLines", "widowControl", "contextualSpacing", "outlineLevel", "direction", "_autospacingBase"];
|
|
23
25
|
/**
|
|
24
26
|
* Build the attr patch that rejecting one pPrChange applies to a paragraph:
|
|
25
27
|
* every in-scope key set to the stored previous value, or reset to `null`
|
|
@@ -27,7 +29,7 @@ declare const PPR_CHANGE_SCOPED_ATTR_KEYS: readonly ["styleId", "numPr", "alignm
|
|
|
27
29
|
* the scoped set (editor-created list suggestions snapshot list-rendering
|
|
28
30
|
* bookkeeping attrs) merge through 1:1 so their pre-change values restore too.
|
|
29
31
|
*/
|
|
30
|
-
declare function paragraphRejectAttrPatch(previousFormatting:
|
|
32
|
+
declare function paragraphRejectAttrPatch(previousFormatting: ParagraphPropertySnapshot | null | undefined): AttrPatch;
|
|
31
33
|
/**
|
|
32
34
|
* Rebuild the paragraph's `_originalFormatting` (the serializer's pPr source)
|
|
33
35
|
* after a reject: the stored old pPr wholesale within CT_PPrBase scope, with
|
|
@@ -35,7 +37,7 @@ declare function paragraphRejectAttrPatch(previousFormatting: Record<string, unk
|
|
|
35
37
|
* from the live original — a pPrChange cannot store them, so a reject must
|
|
36
38
|
* not drop them.
|
|
37
39
|
*/
|
|
38
|
-
declare function paragraphRejectOriginalFormatting(previousFormatting:
|
|
40
|
+
declare function paragraphRejectOriginalFormatting(previousFormatting: ParagraphPropertySnapshot | null | undefined, liveOriginal: unknown): document_d_exports.ParagraphFormatting | null;
|
|
39
41
|
/**
|
|
40
42
|
* Rejected section properties: the stored old sectPr wholesale, preserving
|
|
41
43
|
* the live header/footer references — `EG_HdrFtrReferences` is not part of
|