@portone/docx-editor 0.2.1 → 0.4.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/CHANGELOG.md +155 -0
- package/CONTRIBUTING.md +5 -1
- package/dist/DocxEditor.d.ts +6 -0
- package/dist/DocxEditor.js +13 -29
- package/dist/core.d.ts +23 -8
- package/dist/core.js +9 -4
- package/dist/docx/cloning.d.ts +38 -0
- package/dist/docx/cloning.js +74 -0
- package/dist/docx/commentOnlyChange.d.ts +12 -7
- package/dist/docx/commentOnlyChange.js +9 -156
- package/dist/docx/comments/constants.d.ts +0 -1
- package/dist/docx/comments/constants.js +0 -2
- package/dist/docx/comments/grammar.d.ts +10 -4
- package/dist/docx/comments/grammar.js +12 -2
- package/dist/docx/comments/{verifying.d.ts → parts.d.ts} +26 -18
- package/dist/docx/comments/parts.js +279 -0
- package/dist/docx/comments/people.d.ts +11 -2
- package/dist/docx/comments/people.js +16 -92
- package/dist/docx/comments/policy.d.ts +7 -0
- package/dist/docx/comments/policy.js +43 -0
- package/dist/docx/comments/reading.js +8 -10
- package/dist/docx/comments/writing.d.ts +19 -7
- package/dist/docx/comments/writing.js +59 -112
- package/dist/docx/documentSettings.d.ts +7 -0
- package/dist/docx/documentSettings.js +10 -2
- package/dist/docx/exportDocx.d.ts +40 -5
- package/dist/docx/exportDocx.js +88 -74
- package/dist/docx/exportRefs.d.ts +5 -2
- package/dist/docx/exportRefs.js +3 -1
- package/dist/docx/fidelity.d.ts +43 -0
- package/dist/docx/fidelity.js +64 -0
- package/dist/docx/formatting/attrs.d.ts +45 -0
- package/dist/docx/formatting/attrs.js +86 -0
- package/dist/docx/formatting/context.d.ts +39 -0
- package/dist/docx/formatting/context.js +60 -0
- package/dist/docx/formatting/direct.d.ts +6 -5
- package/dist/docx/formatting/direct.js +52 -78
- package/dist/docx/formatting/resolve.d.ts +51 -0
- package/dist/docx/formatting/resolve.js +160 -0
- package/dist/docx/formatting/runProperties.d.ts +93 -0
- package/dist/docx/formatting/runProperties.js +316 -0
- package/dist/docx/formatting/styles.d.ts +25 -2
- package/dist/docx/formatting/styles.js +87 -6
- package/dist/docx/formatting/tabStops.js +7 -22
- package/dist/docx/formatting.d.ts +4 -1
- package/dist/docx/formatting.js +4 -1
- package/dist/docx/headersFooters.js +6 -13
- package/dist/docx/hyperlink.d.ts +14 -4
- package/dist/docx/hyperlink.js +4 -1
- package/dist/docx/identities.d.ts +67 -0
- package/dist/docx/identities.js +174 -0
- package/dist/docx/importDocx.d.ts +12 -1
- package/dist/docx/importDocx.js +90 -88
- package/dist/docx/importParagraph.d.ts +1 -1
- package/dist/docx/importParagraph.js +4 -3
- package/dist/docx/importTable.d.ts +2 -2
- package/dist/docx/importTable.js +69 -56
- package/dist/docx/invariants.d.ts +33 -0
- package/dist/docx/invariants.js +269 -0
- package/dist/docx/media.d.ts +6 -4
- package/dist/docx/media.js +6 -37
- package/dist/docx/newLists.d.ts +50 -0
- package/dist/docx/newLists.js +59 -0
- package/dist/docx/notes.js +3 -7
- package/dist/docx/numberingPlanner.d.ts +11 -0
- package/dist/docx/numberingPlanner.js +50 -0
- package/dist/docx/packageParts.d.ts +42 -0
- package/dist/docx/packageParts.js +135 -0
- package/dist/docx/pageGeometry.d.ts +2 -0
- package/dist/docx/pageGeometry.js +18 -9
- package/dist/docx/paraProps.d.ts +10 -22
- package/dist/docx/paraProps.js +47 -76
- package/dist/docx/partPlan.d.ts +36 -0
- package/dist/docx/partPlan.js +59 -0
- package/dist/docx/protectionPolicy.d.ts +127 -0
- package/dist/docx/protectionPolicy.js +169 -0
- package/dist/docx/relationships.d.ts +1 -1
- package/dist/docx/relationships.js +8 -13
- package/dist/docx/runProps.d.ts +9 -22
- package/dist/docx/runProps.js +15 -168
- package/dist/docx/scan.js +20 -52
- package/dist/docx/sdt.js +9 -34
- package/dist/docx/sdtProps.d.ts +8 -1
- package/dist/docx/sdtProps.js +10 -0
- package/dist/docx/serializeBlock.d.ts +2 -0
- package/dist/docx/serializeBlock.js +8 -5
- package/dist/docx/serializeTable.js +32 -15
- package/dist/docx/session.d.ts +42 -14
- package/dist/docx/session.js +53 -17
- package/dist/docx/tableFormatting/conditions.d.ts +76 -0
- package/dist/docx/tableFormatting/conditions.js +196 -0
- package/dist/docx/tableFormatting/editing.d.ts +7 -3
- package/dist/docx/tableFormatting/editing.js +111 -143
- package/dist/docx/tableFormatting/reading.d.ts +63 -23
- package/dist/docx/tableFormatting/reading.js +132 -38
- package/dist/docx/tableFormatting.d.ts +1 -0
- package/dist/docx/tableFormatting.js +1 -0
- package/dist/docx/tableTemplate.js +30 -19
- package/dist/download.d.ts +8 -5
- package/dist/download.js +2 -0
- package/dist/editor/clipboard/inlineFormatting.js +19 -30
- package/dist/editor/commands/comments/editing.d.ts +6 -2
- package/dist/editor/commands/comments/editing.js +19 -31
- package/dist/editor/commands/exportQueries.d.ts +15 -0
- package/dist/editor/commands/exportQueries.js +14 -0
- package/dist/editor/commands/fidelityQueries.d.ts +12 -0
- package/dist/editor/commands/fidelityQueries.js +8 -0
- package/dist/editor/commands/formatting/editing.d.ts +2 -2
- package/dist/editor/commands/formatting/editing.js +26 -108
- package/dist/editor/commands/formatting/propertyCommands.d.ts +21 -0
- package/dist/editor/commands/formatting/propertyCommands.js +108 -0
- package/dist/editor/commands/formatting/shared.d.ts +3 -3
- package/dist/editor/commands/formatting/shared.js +5 -2
- package/dist/editor/commands/indentCommands.js +5 -4
- package/dist/editor/commands/index.d.ts +11 -0
- package/dist/editor/commands/index.js +5 -0
- package/dist/editor/commands/linkCommands.js +5 -6
- package/dist/editor/commands/listCommands.d.ts +6 -3
- package/dist/editor/commands/listCommands.js +73 -30
- package/dist/editor/commands/lockCommands.d.ts +7 -1
- package/dist/editor/commands/lockCommands.js +35 -46
- package/dist/editor/commands/paragraphCommands.js +33 -31
- package/dist/editor/commands/spacingCommands.js +1 -1
- package/dist/editor/createEditor.d.ts +17 -29
- package/dist/editor/createEditor.js +58 -58
- package/dist/editor/documentStyles.d.ts +11 -35
- package/dist/editor/documentStyles.js +9 -52
- package/dist/editor/editorDocument.d.ts +57 -0
- package/dist/editor/editorDocument.js +86 -0
- package/dist/editor/externalClipboard.d.ts +13 -2
- package/dist/editor/externalClipboard.js +76 -75
- package/dist/editor/insertTable.js +4 -3
- package/dist/editor/paragraphEdits.d.ts +27 -19
- package/dist/editor/paragraphEdits.js +18 -19
- package/dist/editor/paragraphPlacement.d.ts +11 -0
- package/dist/editor/paragraphPlacement.js +18 -0
- package/dist/editor/plugins/displayDerivation.d.ts +47 -0
- package/dist/editor/plugins/displayDerivation.js +78 -0
- package/dist/editor/plugins/imagePaste.js +11 -7
- package/dist/editor/plugins/keymap.js +18 -3
- package/dist/editor/plugins/numberingDecorations.d.ts +14 -14
- package/dist/editor/plugins/numberingDecorations.js +50 -19
- package/dist/editor/plugins/paragraphDisplay.d.ts +7 -0
- package/dist/editor/plugins/paragraphDisplay.js +57 -0
- package/dist/editor/plugins/tabLayout.js +1 -1
- package/dist/editor/plugins/tableDisplay.d.ts +6 -0
- package/dist/editor/plugins/tableDisplay.js +30 -0
- package/dist/index.d.ts +2 -0
- package/dist/model/format.d.ts +80 -8
- package/dist/model/format.js +100 -22
- package/dist/model/tabStops.d.ts +9 -0
- package/dist/model/tabStops.js +18 -0
- package/dist/numbering/listRegistry.d.ts +37 -0
- package/dist/numbering/listRegistry.js +112 -0
- package/dist/numbering/listTemplate.d.ts +26 -17
- package/dist/numbering/listTemplate.js +88 -25
- package/dist/numbering/markers.d.ts +15 -6
- package/dist/numbering/markers.js +26 -59
- package/dist/numbering/parseNumbering.d.ts +84 -6
- package/dist/numbering/parseNumbering.js +131 -44
- package/dist/numbering/spellers.d.ts +15 -0
- package/dist/numbering/spellers.js +96 -0
- package/dist/numbering/writeNumbering.d.ts +8 -7
- package/dist/numbering/writeNumbering.js +28 -39
- package/dist/ooxml/childOrder.d.ts +34 -0
- package/dist/ooxml/childOrder.js +496 -0
- package/dist/ooxml/conformance.d.ts +28 -0
- package/dist/ooxml/conformance.js +20 -0
- package/dist/ooxml/element.d.ts +24 -11
- package/dist/ooxml/element.js +31 -12
- package/dist/ooxml/errors.d.ts +6 -5
- package/dist/ooxml/image.d.ts +4 -0
- package/dist/ooxml/image.js +2 -5
- package/dist/ooxml/names.d.ts +9 -0
- package/dist/ooxml/names.js +8 -1
- package/dist/ooxml/partSplice.d.ts +67 -0
- package/dist/ooxml/partSplice.js +176 -0
- package/dist/ooxml/props.d.ts +112 -0
- package/dist/{docx/propsXml.js → ooxml/props.js} +72 -200
- package/dist/ooxml/simpleTypes.d.ts +103 -0
- package/dist/ooxml/simpleTypes.js +182 -0
- package/dist/ooxml/tabStops.js +8 -27
- package/dist/ooxml/tagScan.d.ts +34 -0
- package/dist/ooxml/tagScan.js +108 -0
- package/dist/ooxml/units.d.ts +25 -13
- package/dist/ooxml/units.js +65 -31
- package/dist/ooxml/xml.d.ts +35 -15
- package/dist/ooxml/xml.js +43 -11
- package/dist/page/PageGuides.d.ts +1 -1
- package/dist/page/PageGuides.js +0 -13
- package/dist/page/blockKinds.d.ts +61 -0
- package/dist/page/blockKinds.js +11 -0
- package/dist/page/kinds/index.d.ts +6 -0
- package/dist/page/kinds/index.js +10 -0
- package/dist/page/kinds/paragraphKind.d.ts +10 -0
- package/dist/page/kinds/paragraphKind.js +71 -0
- package/dist/page/kinds/tableKind.d.ts +10 -0
- package/dist/page/kinds/tableKind.js +178 -0
- package/dist/page/measureBlocks.d.ts +3 -14
- package/dist/page/measureBlocks.js +24 -45
- package/dist/page/pageDecorations.d.ts +27 -44
- package/dist/page/pageDecorations.js +70 -152
- package/dist/page/pageLayout.d.ts +2 -29
- package/dist/page/pageLayout.js +39 -16
- package/dist/page/usePageLayout.d.ts +2 -24
- package/dist/page/usePageLayout.js +5 -48
- package/dist/schema/attrRoles.d.ts +25 -18
- package/dist/schema/attrRoles.js +110 -68
- package/dist/schema/displayDerivation.d.ts +82 -0
- package/dist/schema/displayDerivation.js +130 -0
- package/dist/schema/docxSchema.d.ts +3 -0
- package/dist/schema/docxSchema.js +58 -17
- package/dist/schema/editGuard.d.ts +1 -1
- package/dist/schema/guards.d.ts +37 -14
- package/dist/schema/guards.js +29 -3
- package/dist/schema/index.d.ts +2 -0
- package/dist/schema/index.js +2 -0
- package/dist/schema/locks.d.ts +11 -44
- package/dist/schema/locks.js +0 -9
- package/dist/schema/preservedGuards.d.ts +26 -6
- package/dist/schema/preservedGuards.js +31 -1
- package/dist/schema/protection.d.ts +7 -1
- package/dist/schema/protection.js +2 -1
- package/dist/schema/sourceEquality.d.ts +1 -9
- package/dist/schema/sourceEquality.js +1 -27
- package/dist/styles/classNames.d.ts +13 -2
- package/dist/styles/classNames.js +13 -2
- package/dist/styles/inlineStyle.js +15 -6
- package/dist/styles.css +16 -18
- package/dist/table/cellFormatting.d.ts +8 -1
- package/dist/table/cellFormatting.js +11 -20
- package/dist/table/commands.js +20 -18
- package/dist/table/format.d.ts +3 -0
- package/dist/table/format.js +3 -9
- package/dist/table/gridBorders.d.ts +24 -30
- package/dist/table/gridBorders.js +35 -59
- package/dist/table/merge.d.ts +2 -6
- package/dist/table/merge.js +5 -5
- package/package.json +7 -3
- package/dist/docx/comments/contentTypes.d.ts +0 -7
- package/dist/docx/comments/contentTypes.js +0 -38
- package/dist/docx/comments/verifying.js +0 -206
- package/dist/docx/formatting/effectiveParagraph.d.ts +0 -15
- package/dist/docx/formatting/effectiveParagraph.js +0 -81
- package/dist/docx/propsXml.d.ts +0 -67
- package/dist/docx/uniqueControls.d.ts +0 -14
- package/dist/docx/uniqueControls.js +0 -62
- package/dist/editor/plugins/commentReservations.d.ts +0 -5
- package/dist/editor/plugins/commentReservations.js +0 -26
- package/dist/editor/plugins/styledParagraphs.d.ts +0 -15
- package/dist/editor/plugins/styledParagraphs.js +0 -65
- package/dist/page/tableMeasurements.d.ts +0 -18
- package/dist/page/tableMeasurements.js +0 -119
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** The character formatting commands the package exports, each built from the property it edits. */
|
|
2
2
|
import type { Command, EditorState } from "prosemirror-state";
|
|
3
|
-
export type { RunToggle } from "../../../docx/runProps";
|
|
4
3
|
/**
|
|
5
4
|
* Whether character formatting reaches anything where the selection stands, which is what a
|
|
6
5
|
* control offering it is drawn from.
|
|
@@ -13,6 +12,7 @@ export type { RunToggle } from "../../../docx/runProps";
|
|
|
13
12
|
export declare function canFormatText(state: EditorState): boolean;
|
|
14
13
|
export declare const toggleBold: Command;
|
|
15
14
|
export declare const toggleItalic: Command;
|
|
15
|
+
/** Switching the underline on writes a single one; a run already underlined keeps the kind it has */
|
|
16
16
|
export declare const toggleUnderline: Command;
|
|
17
17
|
export declare const toggleStrike: Command;
|
|
18
18
|
/** Sets the font size in points. Null withdraws the setting and falls back to the document default */
|
|
@@ -1,130 +1,48 @@
|
|
|
1
1
|
// src/editor/commands/formatting/editing.ts
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
matchesRunEdit
|
|
6
|
-
} from "../../../docx/runProps.js";
|
|
7
|
-
import { docxSchema } from "../../../schema/index.js";
|
|
8
|
-
import {
|
|
9
|
-
insertionInsideLocked,
|
|
10
|
-
rangeTouchesLocked
|
|
11
|
-
} from "../../../schema/locks.js";
|
|
12
|
-
import { editsShut } from "../../../schema/protectionState.js";
|
|
13
|
-
import {
|
|
14
|
-
activePieces,
|
|
15
|
-
caretPiece,
|
|
16
|
-
text,
|
|
17
|
-
textPieces
|
|
18
|
-
} from "./shared.js";
|
|
19
|
-
function editedMark(target, edit) {
|
|
20
|
-
const next = editRunProps(
|
|
21
|
-
{ rPr: text(target.mark?.attrs.rPr), format: target.format },
|
|
22
|
-
target.pPr,
|
|
23
|
-
edit
|
|
24
|
-
);
|
|
25
|
-
if (!next) return null;
|
|
26
|
-
return docxSchema.marks.run.create({
|
|
27
|
-
...target.mark?.attrs,
|
|
28
|
-
rPr: next.rPr,
|
|
29
|
-
format: next.format
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
function planChanges(pieces, edit) {
|
|
33
|
-
const changes = [];
|
|
34
|
-
for (const target of pieces) {
|
|
35
|
-
const mark = editedMark(target, edit);
|
|
36
|
-
if (!mark) return null;
|
|
37
|
-
changes.push({ from: target.from, to: target.to, mark });
|
|
38
|
-
}
|
|
39
|
-
return changes;
|
|
40
|
-
}
|
|
41
|
-
function applyToSelection(state, dispatch, edit) {
|
|
42
|
-
const pieces = textPieces(state).filter(
|
|
43
|
-
(target) => (
|
|
44
|
-
// Text already in the desired state is left untouched, so its original XML survives
|
|
45
|
-
!matchesRunEdit(target.format, edit) && // A locked stretch is left out rather than refused: the guard turns down the whole
|
|
46
|
-
// transaction, so asking for it would leave the rest of the selection unformatted too
|
|
47
|
-
!rangeTouchesLocked(state.doc, target.from, target.to)
|
|
48
|
-
)
|
|
49
|
-
);
|
|
50
|
-
const changes = pieces.length > 0 ? planChanges(pieces, edit) : null;
|
|
51
|
-
if (!changes) return false;
|
|
52
|
-
if (dispatch) {
|
|
53
|
-
const tr = state.tr;
|
|
54
|
-
for (const change of changes) {
|
|
55
|
-
tr.addMark(change.from, change.to, change.mark);
|
|
56
|
-
}
|
|
57
|
-
dispatch(tr);
|
|
58
|
-
}
|
|
59
|
-
return true;
|
|
60
|
-
}
|
|
61
|
-
function applyToCaret(state, dispatch, edit) {
|
|
62
|
-
const target = caretPiece(state);
|
|
63
|
-
if (matchesRunEdit(target.format, edit)) return false;
|
|
64
|
-
const mark = editedMark(target, edit);
|
|
65
|
-
if (!mark) return false;
|
|
66
|
-
if (dispatch) {
|
|
67
|
-
const marks = state.storedMarks ?? state.selection.$from.marks();
|
|
68
|
-
dispatch(state.tr.setStoredMarks(mark.addToSet(marks)));
|
|
69
|
-
}
|
|
70
|
-
return true;
|
|
71
|
-
}
|
|
72
|
-
function runEditCommand(edit) {
|
|
73
|
-
return (state, dispatch) => {
|
|
74
|
-
if (editsShut(state)) return false;
|
|
75
|
-
return state.selection.empty ? applyToCaret(state, dispatch, edit) : applyToSelection(state, dispatch, edit);
|
|
76
|
-
};
|
|
77
|
-
}
|
|
2
|
+
import { editShut, openStretches } from "../../../schema/guards.js";
|
|
3
|
+
import { runPropertyCommands } from "./propertyCommands.js";
|
|
4
|
+
import { textPieces } from "./shared.js";
|
|
78
5
|
function canFormatText(state) {
|
|
79
|
-
if (editsShut(state)) return false;
|
|
80
6
|
if (state.selection.empty) {
|
|
81
|
-
return !
|
|
7
|
+
return !editShut(state, { kind: "insert", at: state.selection.from });
|
|
82
8
|
}
|
|
83
|
-
return textPieces(state).
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
};
|
|
98
|
-
return runEditCommand(edit)(state, dispatch);
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
var toggleBold = toggleCommand("bold");
|
|
102
|
-
var toggleItalic = toggleCommand("italic");
|
|
103
|
-
var toggleUnderline = toggleCommand("underline");
|
|
104
|
-
var toggleStrike = toggleCommand("strike");
|
|
9
|
+
return openStretches(state, textPieces(state), "mark").length > 0;
|
|
10
|
+
}
|
|
11
|
+
var bold = runPropertyCommands("bold");
|
|
12
|
+
var italic = runPropertyCommands("italic");
|
|
13
|
+
var underline = runPropertyCommands("underline");
|
|
14
|
+
var strike = runPropertyCommands("strike");
|
|
15
|
+
var fontSize = runPropertyCommands("fontSizePt");
|
|
16
|
+
var fontFamily = runPropertyCommands("fontFamily");
|
|
17
|
+
var textColor = runPropertyCommands("color");
|
|
18
|
+
var textBackground = runPropertyCommands("background");
|
|
19
|
+
var toggleBold = bold.toggle(true);
|
|
20
|
+
var toggleItalic = italic.toggle(true);
|
|
21
|
+
var toggleUnderline = underline.toggle("single");
|
|
22
|
+
var toggleStrike = strike.toggle(true);
|
|
105
23
|
function setFontSize(pt) {
|
|
106
|
-
return
|
|
24
|
+
return fontSize.set(pt);
|
|
107
25
|
}
|
|
108
26
|
function setFontFamily(name) {
|
|
109
|
-
return
|
|
27
|
+
return fontFamily.set(name);
|
|
110
28
|
}
|
|
111
29
|
function setTextColor(hex) {
|
|
112
|
-
return
|
|
30
|
+
return textColor.set(hex);
|
|
113
31
|
}
|
|
114
32
|
function setTextBackground(hex) {
|
|
115
|
-
return
|
|
33
|
+
return textBackground.set(hex);
|
|
116
34
|
}
|
|
117
35
|
function isBoldActive(state) {
|
|
118
|
-
return
|
|
36
|
+
return bold.isActive(state);
|
|
119
37
|
}
|
|
120
38
|
function isItalicActive(state) {
|
|
121
|
-
return
|
|
39
|
+
return italic.isActive(state);
|
|
122
40
|
}
|
|
123
41
|
function isUnderlineActive(state) {
|
|
124
|
-
return
|
|
42
|
+
return underline.isActive(state);
|
|
125
43
|
}
|
|
126
44
|
function isStrikeActive(state) {
|
|
127
|
-
return
|
|
45
|
+
return strike.isActive(state);
|
|
128
46
|
}
|
|
129
47
|
export {
|
|
130
48
|
canFormatText,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The commands and the query one run property is edited and read through, built from the
|
|
3
|
+
* property's row in the run property table.
|
|
4
|
+
*
|
|
5
|
+
* Each edit preserves the run's untouched XML: the row says which children of the rPr change,
|
|
6
|
+
* and the mark keeps every other attr it wore.
|
|
7
|
+
*/
|
|
8
|
+
import type { Command, EditorState } from "prosemirror-state";
|
|
9
|
+
import { type EditableRunKey, type RunSetting } from "../../../docx/formatting";
|
|
10
|
+
export interface RunPropertyCommands<K extends EditableRunKey> {
|
|
11
|
+
/** Writes the value into the selection. Null withdraws the run's own setting, so the layers below decide again */
|
|
12
|
+
set(value: RunSetting<K> | null): Command;
|
|
13
|
+
/** Whether the property is on where the selection stands. It counts as on only when it is on everywhere */
|
|
14
|
+
isActive(state: EditorState): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* The same toggle convention as Word: if every character in the selection is already on, turn
|
|
17
|
+
* them all off; otherwise switch them all on as `on`.
|
|
18
|
+
*/
|
|
19
|
+
toggle(on: RunSetting<K>): Command;
|
|
20
|
+
}
|
|
21
|
+
export declare function runPropertyCommands<K extends EditableRunKey>(key: K): RunPropertyCommands<K>;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
// src/editor/commands/formatting/propertyCommands.ts
|
|
2
|
+
import {
|
|
3
|
+
inheritedRunFormat,
|
|
4
|
+
RUN_PROPERTIES,
|
|
5
|
+
resolveParagraph,
|
|
6
|
+
resolveRun
|
|
7
|
+
} from "../../../docx/formatting.js";
|
|
8
|
+
import {
|
|
9
|
+
editRunProps,
|
|
10
|
+
matchesRunEdit
|
|
11
|
+
} from "../../../docx/runProps.js";
|
|
12
|
+
import { docxSchema } from "../../../schema/index.js";
|
|
13
|
+
import { editShut, openStretches } from "../../../schema/guards.js";
|
|
14
|
+
import { documentFormatting } from "../../documentStyles.js";
|
|
15
|
+
import { paragraphPlacementAt } from "../../paragraphPlacement.js";
|
|
16
|
+
import {
|
|
17
|
+
activePieces,
|
|
18
|
+
caretPiece,
|
|
19
|
+
text,
|
|
20
|
+
textPieces
|
|
21
|
+
} from "./shared.js";
|
|
22
|
+
function editedMark(state, target, edit) {
|
|
23
|
+
const context = documentFormatting(state);
|
|
24
|
+
const rPr = text(target.mark?.attrs.rPr);
|
|
25
|
+
const paragraph = resolveParagraph(
|
|
26
|
+
target.pPr,
|
|
27
|
+
context,
|
|
28
|
+
paragraphPlacementAt(state.doc, target.from)
|
|
29
|
+
);
|
|
30
|
+
const next = editRunProps(
|
|
31
|
+
{ rPr, format: target.format },
|
|
32
|
+
inheritedRunFormat(rPr, paragraph, context),
|
|
33
|
+
edit
|
|
34
|
+
);
|
|
35
|
+
if (!next) return null;
|
|
36
|
+
return docxSchema.marks.run.create({
|
|
37
|
+
...target.mark?.attrs,
|
|
38
|
+
rPr: next.rPr,
|
|
39
|
+
format: resolveRun(next.rPr, paragraph, context)
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function planChanges(state, pieces, edit) {
|
|
43
|
+
const changes = [];
|
|
44
|
+
for (const target of pieces) {
|
|
45
|
+
const mark = editedMark(state, target, edit);
|
|
46
|
+
if (!mark) return null;
|
|
47
|
+
changes.push({ from: target.from, to: target.to, mark });
|
|
48
|
+
}
|
|
49
|
+
return changes;
|
|
50
|
+
}
|
|
51
|
+
function applyToSelection(state, dispatch, edit) {
|
|
52
|
+
const pieces = openStretches(
|
|
53
|
+
state,
|
|
54
|
+
// Text already in the desired state is left untouched, so its original XML survives
|
|
55
|
+
textPieces(state).filter((target) => !matchesRunEdit(target.format, edit)),
|
|
56
|
+
"mark"
|
|
57
|
+
);
|
|
58
|
+
const changes = pieces.length > 0 ? planChanges(state, pieces, edit) : null;
|
|
59
|
+
if (!changes) return false;
|
|
60
|
+
if (dispatch) {
|
|
61
|
+
const tr = state.tr;
|
|
62
|
+
for (const change of changes) {
|
|
63
|
+
tr.addMark(change.from, change.to, change.mark);
|
|
64
|
+
}
|
|
65
|
+
dispatch(tr);
|
|
66
|
+
}
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
function applyToCaret(state, dispatch, edit) {
|
|
70
|
+
if (editShut(state, { kind: "insert", at: state.selection.from })) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
const target = caretPiece(state);
|
|
74
|
+
if (matchesRunEdit(target.format, edit)) return false;
|
|
75
|
+
const mark = editedMark(state, target, edit);
|
|
76
|
+
if (!mark) return false;
|
|
77
|
+
if (dispatch) {
|
|
78
|
+
const marks = state.storedMarks ?? state.selection.$from.marks();
|
|
79
|
+
dispatch(state.tr.setStoredMarks(mark.addToSet(marks)));
|
|
80
|
+
}
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
function runEditCommand(edit) {
|
|
84
|
+
return (state, dispatch) => state.selection.empty ? applyToCaret(state, dispatch, edit) : applyToSelection(state, dispatch, edit);
|
|
85
|
+
}
|
|
86
|
+
function runPropertyCommands(key) {
|
|
87
|
+
const property = RUN_PROPERTIES[key];
|
|
88
|
+
const isOn = (target) => property.isOn(target.format ?? {});
|
|
89
|
+
const set = (value) => runEditCommand({ key, value });
|
|
90
|
+
return {
|
|
91
|
+
set,
|
|
92
|
+
isActive: (state) => {
|
|
93
|
+
const pieces = activePieces(state);
|
|
94
|
+
return pieces.length > 0 && pieces.every(isOn);
|
|
95
|
+
},
|
|
96
|
+
toggle: (on) => (state, dispatch) => {
|
|
97
|
+
const pieces = openStretches(
|
|
98
|
+
state,
|
|
99
|
+
state.selection.empty ? [caretPiece(state)] : textPieces(state),
|
|
100
|
+
"mark"
|
|
101
|
+
);
|
|
102
|
+
return set(pieces.every(isOn) ? null : on)(state, dispatch);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
export {
|
|
107
|
+
runPropertyCommands
|
|
108
|
+
};
|
|
@@ -25,8 +25,8 @@ export declare function textPieces(state: EditorState): TextPiece[];
|
|
|
25
25
|
/** When the selection is collapsed, the formatting that text typed next will follow */
|
|
26
26
|
export declare function caretPiece(state: EditorState): TextPiece;
|
|
27
27
|
/**
|
|
28
|
-
* The
|
|
29
|
-
*
|
|
30
|
-
*
|
|
28
|
+
* The formatting a toolbar reads, excluding locked text as it does during editing.
|
|
29
|
+
* Document protection prevents edits, but must not hide the selected text's actual formatting.
|
|
30
|
+
* Commands separately ask all guards before deciding what they can change.
|
|
31
31
|
*/
|
|
32
32
|
export declare function activePieces(state: EditorState): TextPiece[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/editor/commands/formatting/shared.ts
|
|
2
2
|
import { toRunFormat } from "../../../model/format.js";
|
|
3
3
|
import { docxSchema } from "../../../schema/index.js";
|
|
4
|
-
import {
|
|
4
|
+
import { lockGuard } from "../../../schema/locks.js";
|
|
5
5
|
function text(value) {
|
|
6
6
|
return typeof value === "string" ? value : null;
|
|
7
7
|
}
|
|
@@ -41,7 +41,10 @@ function caretPiece(state) {
|
|
|
41
41
|
function activePieces(state) {
|
|
42
42
|
if (state.selection.empty) return [caretPiece(state)];
|
|
43
43
|
return textPieces(state).filter(
|
|
44
|
-
(target) => !
|
|
44
|
+
(target) => !lockGuard.shuts(
|
|
45
|
+
{ kind: "mark", from: target.from, to: target.to },
|
|
46
|
+
state
|
|
47
|
+
)
|
|
45
48
|
);
|
|
46
49
|
}
|
|
47
50
|
export {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// src/editor/commands/indentCommands.ts
|
|
2
2
|
import { withLeftIndent, withListNumbering } from "../../docx/paraProps.js";
|
|
3
3
|
import { toParagraphFormat } from "../../model/format.js";
|
|
4
|
+
import { TWIPS_PER_PT } from "../../ooxml/simpleTypes.js";
|
|
4
5
|
import { editParagraphs, paragraphPPr } from "../paragraphEdits.js";
|
|
5
6
|
import { documentNumbering } from "../plugins/numberingDecorations.js";
|
|
6
7
|
import { listLevelChange, listRefOf } from "./listCommands.js";
|
|
@@ -8,7 +9,7 @@ var STEP_TWIPS = 720;
|
|
|
8
9
|
function leftIndentTwips(node) {
|
|
9
10
|
const format = toParagraphFormat(node.attrs.format);
|
|
10
11
|
const pt = format?.indentStartPt ?? format?.indentLeftPt ?? 0;
|
|
11
|
-
return Math.round(pt *
|
|
12
|
+
return Math.round(pt * TWIPS_PER_PT);
|
|
12
13
|
}
|
|
13
14
|
function steppedLeftTwips(node, delta) {
|
|
14
15
|
const left = leftIndentTwips(node);
|
|
@@ -18,13 +19,13 @@ function steppedLeftTwips(node, delta) {
|
|
|
18
19
|
function indentStep(delta) {
|
|
19
20
|
return (state, dispatch) => {
|
|
20
21
|
const numbering = documentNumbering(state);
|
|
21
|
-
return editParagraphs(state, dispatch, (node
|
|
22
|
+
return editParagraphs(state, dispatch, (node) => {
|
|
22
23
|
if (listRefOf(node)) {
|
|
23
24
|
const change = listLevelChange(numbering, node, delta);
|
|
24
|
-
return change && withListNumbering(paragraphPPr(node), change
|
|
25
|
+
return change && withListNumbering(paragraphPPr(node), change);
|
|
25
26
|
}
|
|
26
27
|
const left = steppedLeftTwips(node, delta);
|
|
27
|
-
return left === null ? null : withLeftIndent(paragraphPPr(node), left
|
|
28
|
+
return left === null ? null : withLeftIndent(paragraphPPr(node), left);
|
|
28
29
|
});
|
|
29
30
|
};
|
|
30
31
|
}
|
|
@@ -13,6 +13,8 @@ export type { ParagraphStyleOption } from "../../docx/formatting";
|
|
|
13
13
|
export type { RunToggle } from "../../docx/runProps";
|
|
14
14
|
export type { LineSpacing, ParagraphAlign } from "../../model/format";
|
|
15
15
|
export type { ListKind } from "../../numbering/listTemplate";
|
|
16
|
+
/** The codes a problem below is reported under, which are the ones `DocxExportError` is thrown with */
|
|
17
|
+
export type { DocxExportErrorCode } from "../../ooxml/errors";
|
|
16
18
|
/** The size an image is shown at, which the insert command asks for */
|
|
17
19
|
export type { ImageExtent } from "../../ooxml/image";
|
|
18
20
|
/**
|
|
@@ -56,6 +58,15 @@ export { insertLineBreak, insertPageBreak } from "./breakCommands";
|
|
|
56
58
|
export { canRunCommand } from "./canRunCommand";
|
|
57
59
|
export type { CommentAuthor, DocumentComment, DocumentCommentReply, NewComment, } from "./commentCommands";
|
|
58
60
|
export { addComment, addCommentReply, canAddComment, canEditComment, documentComments, removeComment, removeCommentReply, selectComment, setCommentResolved, updateComment, updateCommentReply, } from "./commentCommands";
|
|
61
|
+
/**
|
|
62
|
+
* Whether the document as it stands can be written back, and every reason it could not, each
|
|
63
|
+
* with the code `exportDocx` would throw it under. `canExport` is what an export control is
|
|
64
|
+
* drawn from, and `downloadDocx` answers `blocked` with the same list.
|
|
65
|
+
*/
|
|
66
|
+
export type { ExportProblem } from "./exportQueries";
|
|
67
|
+
export { canExport, documentExportProblems } from "./exportQueries";
|
|
68
|
+
export type { FidelityCode, FidelityNote, FidelitySeverity, } from "./fidelityQueries";
|
|
69
|
+
export { documentFidelity } from "./fidelityQueries";
|
|
59
70
|
export type { ActiveFontFamily, ActiveFontSize, } from "./formattingCommands";
|
|
60
71
|
export { activeFontFamily, activeFontSize, activeTextBackground, activeTextColor, canFormatText, documentFontNames, isBoldActive, isItalicActive, isStrikeActive, isUnderlineActive, setFontFamily, setFontSize, setTextBackground, setTextColor, toggleBold, toggleItalic, toggleStrike, toggleUnderline, } from "./formattingCommands";
|
|
61
72
|
/**
|
|
@@ -29,6 +29,8 @@ import {
|
|
|
29
29
|
updateComment,
|
|
30
30
|
updateCommentReply
|
|
31
31
|
} from "./commentCommands.js";
|
|
32
|
+
import { canExport, documentExportProblems } from "./exportQueries.js";
|
|
33
|
+
import { documentFidelity } from "./fidelityQueries.js";
|
|
32
34
|
import {
|
|
33
35
|
activeFontFamily,
|
|
34
36
|
activeFontSize,
|
|
@@ -111,6 +113,7 @@ export {
|
|
|
111
113
|
canAddComment,
|
|
112
114
|
canDecreaseIndent,
|
|
113
115
|
canEditComment,
|
|
116
|
+
canExport,
|
|
114
117
|
canFormatText,
|
|
115
118
|
canIncreaseIndent,
|
|
116
119
|
canInsertImage,
|
|
@@ -124,6 +127,8 @@ export {
|
|
|
124
127
|
documentBodyWidthPx,
|
|
125
128
|
documentComments,
|
|
126
129
|
documentDefaults,
|
|
130
|
+
documentExportProblems,
|
|
131
|
+
documentFidelity,
|
|
127
132
|
documentFontNames,
|
|
128
133
|
documentHasLocked,
|
|
129
134
|
documentNotes,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// src/editor/commands/linkCommands.ts
|
|
2
2
|
import { docxSchema } from "../../schema/index.js";
|
|
3
|
-
import {
|
|
4
|
-
import { editsShut } from "../../schema/protectionState.js";
|
|
3
|
+
import { openStretches } from "../../schema/guards.js";
|
|
5
4
|
var linkType = docxSchema.marks.link;
|
|
6
5
|
function text(value) {
|
|
7
6
|
return typeof value === "string" ? value : null;
|
|
@@ -75,10 +74,10 @@ function linkSpansTouching(doc, from, to) {
|
|
|
75
74
|
return spans;
|
|
76
75
|
}
|
|
77
76
|
function openPieces(state) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
77
|
+
return openStretches(
|
|
78
|
+
state,
|
|
79
|
+
state.selection.empty ? caretPieces(state) : selectionPieces(state),
|
|
80
|
+
"mark"
|
|
82
81
|
);
|
|
83
82
|
}
|
|
84
83
|
function caretPieces(state) {
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* All they do is change a paragraph's place in a list (its numbering id and level).
|
|
5
5
|
* Editing the formatting fragments belongs to `docx/paraProps`, and the list's appearance
|
|
6
6
|
* belongs to `numbering/`.
|
|
7
|
-
*
|
|
7
|
+
* Starting a list records its definition on the document node in the same transaction, and the
|
|
8
|
+
* export writes that definition into numbering.xml.
|
|
8
9
|
*/
|
|
9
10
|
import type { Node as PMNode } from "prosemirror-model";
|
|
10
11
|
import type { Command, EditorState } from "prosemirror-state";
|
|
@@ -24,6 +25,8 @@ export declare function listLevelChange(numbering: Numbering, node: PMNode, delt
|
|
|
24
25
|
export declare const increaseListLevel: Command;
|
|
25
26
|
/** Moves a list item one level back up, which is not the paragraph's own indent. What Shift+Tab does */
|
|
26
27
|
export declare const decreaseListLevel: Command;
|
|
28
|
+
/** Every numbering id a paragraph of this document wears */
|
|
29
|
+
export declare function numIdsIn(doc: PMNode): Set<number>;
|
|
27
30
|
/**
|
|
28
31
|
* Takes the selected paragraphs out of the list.
|
|
29
32
|
* Only the hanging indentation the marker sat in goes with it; an indentation the paragraph had
|
|
@@ -31,8 +34,8 @@ export declare const decreaseListLevel: Command;
|
|
|
31
34
|
*/
|
|
32
35
|
export declare const removeFromList: Command;
|
|
33
36
|
/**
|
|
34
|
-
* The kind of list the selected paragraphs belong to. Null when they are not a list
|
|
35
|
-
* are mixed.
|
|
37
|
+
* The kind of list the selected paragraphs belong to. Null when they are not a list, when nothing
|
|
38
|
+
* defines the list they are in, or when the kinds are mixed.
|
|
36
39
|
* It reads the paragraphs a lock leaves open, the same ones `editParagraphs` writes to: counting a
|
|
37
40
|
* locked paragraph that stays out of the list would keep the answer mixed, so the button would make
|
|
38
41
|
* a list a second time instead of taking it off.
|
|
@@ -5,12 +5,18 @@ import {
|
|
|
5
5
|
} from "../../docx/paraProps.js";
|
|
6
6
|
import { toParagraphFormat } from "../../model/format.js";
|
|
7
7
|
import {
|
|
8
|
+
listsWorn,
|
|
9
|
+
NEW_LISTS_ATTR,
|
|
10
|
+
newListsValue
|
|
11
|
+
} from "../../numbering/listRegistry.js";
|
|
12
|
+
import {
|
|
13
|
+
allocateList,
|
|
8
14
|
listFor,
|
|
9
|
-
listKindOf,
|
|
10
15
|
MAX_ILVL,
|
|
11
|
-
|
|
16
|
+
templateList
|
|
12
17
|
} from "../../numbering/listTemplate.js";
|
|
13
18
|
import { docxSchema } from "../../schema/index.js";
|
|
19
|
+
import { documentFormatting } from "../documentStyles.js";
|
|
14
20
|
import {
|
|
15
21
|
editableParagraphs,
|
|
16
22
|
editParagraphs,
|
|
@@ -24,18 +30,25 @@ import {
|
|
|
24
30
|
function listRefOf(node) {
|
|
25
31
|
return toParagraphFormat(node.attrs.format)?.numbering ?? null;
|
|
26
32
|
}
|
|
27
|
-
function changeParagraphs(state, dispatch, plan
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
function changeParagraphs(state, dispatch, plan, extras = {
|
|
34
|
+
alongside: pruneLists(documentNumbering(state).added)
|
|
35
|
+
}) {
|
|
36
|
+
return editParagraphs(
|
|
37
|
+
state,
|
|
38
|
+
dispatch,
|
|
39
|
+
(node) => {
|
|
40
|
+
const change = plan(node);
|
|
41
|
+
return change && withListNumbering(paragraphPPr(node), change);
|
|
42
|
+
},
|
|
43
|
+
extras
|
|
44
|
+
);
|
|
32
45
|
}
|
|
33
46
|
function indentForLevel(numbering, node, ref) {
|
|
34
47
|
const format = toParagraphFormat(node.attrs.format);
|
|
35
48
|
if (format?.indentStartPt === void 0 && format?.indentLeftPt === void 0) {
|
|
36
49
|
return { kind: "keep" };
|
|
37
50
|
}
|
|
38
|
-
const indent = listFor(numbering, ref.numId)
|
|
51
|
+
const indent = listFor(numbering, ref.numId)?.levels.get(ref.ilvl)?.indent;
|
|
39
52
|
return indent ? { kind: "level", indent } : { kind: "keep" };
|
|
40
53
|
}
|
|
41
54
|
function listLevelChange(numbering, node, delta) {
|
|
@@ -58,24 +71,50 @@ function levelShift(delta) {
|
|
|
58
71
|
}
|
|
59
72
|
var increaseListLevel = levelShift(1);
|
|
60
73
|
var decreaseListLevel = levelShift(-1);
|
|
61
|
-
function
|
|
62
|
-
const
|
|
63
|
-
|
|
74
|
+
function numIdsIn(doc) {
|
|
75
|
+
const worn = /* @__PURE__ */ new Set();
|
|
76
|
+
doc.descendants((node) => {
|
|
64
77
|
if (node.type !== docxSchema.nodes.paragraph) return true;
|
|
65
78
|
const ref = listRefOf(node);
|
|
66
|
-
if (ref)
|
|
79
|
+
if (ref) worn.add(ref.numId);
|
|
67
80
|
return false;
|
|
68
81
|
});
|
|
69
|
-
return
|
|
82
|
+
return worn;
|
|
83
|
+
}
|
|
84
|
+
function recordLists(tr, lists) {
|
|
85
|
+
tr.setDocAttribute(
|
|
86
|
+
NEW_LISTS_ATTR,
|
|
87
|
+
newListsValue(listsWorn(lists, numIdsIn(tr.doc)))
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
function pruneLists(lists) {
|
|
91
|
+
return (tr) => {
|
|
92
|
+
if (listsWorn(lists, numIdsIn(tr.doc)) !== lists) recordLists(tr, lists);
|
|
93
|
+
};
|
|
70
94
|
}
|
|
71
95
|
function startList(kind) {
|
|
72
96
|
return (state, dispatch) => {
|
|
73
97
|
if (!canStartNewList(state)) return false;
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
98
|
+
const started = allocateList(
|
|
99
|
+
documentNumbering(state),
|
|
100
|
+
numIdsIn(state.doc),
|
|
101
|
+
templateList(kind)
|
|
102
|
+
);
|
|
103
|
+
return changeParagraphs(
|
|
104
|
+
state,
|
|
105
|
+
dispatch,
|
|
106
|
+
(node) => ({
|
|
107
|
+
numbering: { numId: started.numId, ilvl: listRefOf(node)?.ilvl ?? 0 },
|
|
108
|
+
indent: { kind: "keep" }
|
|
109
|
+
}),
|
|
110
|
+
{
|
|
111
|
+
formatting: {
|
|
112
|
+
...documentFormatting(state),
|
|
113
|
+
numbering: started.numbering
|
|
114
|
+
},
|
|
115
|
+
alongside: (tr) => recordLists(tr, started.numbering.added)
|
|
116
|
+
}
|
|
117
|
+
);
|
|
79
118
|
};
|
|
80
119
|
}
|
|
81
120
|
var removeFromList = (state, dispatch) => changeParagraphs(
|
|
@@ -84,8 +123,8 @@ var removeFromList = (state, dispatch) => changeParagraphs(
|
|
|
84
123
|
(node) => listRefOf(node) ? { numbering: null, indent: { kind: "clearHanging" } } : null
|
|
85
124
|
);
|
|
86
125
|
function kindOf(numbering, ref) {
|
|
87
|
-
const level = listFor(numbering, ref.numId)
|
|
88
|
-
if (!level) return
|
|
126
|
+
const level = listFor(numbering, ref.numId)?.levels.get(ref.ilvl);
|
|
127
|
+
if (!level) return null;
|
|
89
128
|
return level.format === "bullet" ? "bullet" : "numbered";
|
|
90
129
|
}
|
|
91
130
|
function activeListKind(state) {
|
|
@@ -107,16 +146,19 @@ function isInList(state) {
|
|
|
107
146
|
(spot) => listRefOf(spot.node) !== null
|
|
108
147
|
);
|
|
109
148
|
}
|
|
110
|
-
var leaveListAtLineStart = (state, dispatch) => editParagraphs(
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
149
|
+
var leaveListAtLineStart = (state, dispatch) => editParagraphs(
|
|
150
|
+
state,
|
|
151
|
+
dispatch,
|
|
152
|
+
(node) => {
|
|
153
|
+
if (!listRefOf(node)) return null;
|
|
154
|
+
const unlisted = withListNumbering(paragraphPPr(node), {
|
|
155
|
+
numbering: null,
|
|
156
|
+
indent: { kind: "clearHanging" }
|
|
157
|
+
});
|
|
158
|
+
return unlisted && withLeftIndent(unlisted.pPr, 0);
|
|
159
|
+
},
|
|
160
|
+
{ alongside: pruneLists(documentNumbering(state).added) }
|
|
161
|
+
);
|
|
120
162
|
var leaveEmptyListItem = (state, dispatch) => {
|
|
121
163
|
const { empty, $from } = state.selection;
|
|
122
164
|
const paragraph = $from.parent;
|
|
@@ -134,6 +176,7 @@ export {
|
|
|
134
176
|
leaveEmptyListItem,
|
|
135
177
|
listLevelChange,
|
|
136
178
|
listRefOf,
|
|
179
|
+
numIdsIn,
|
|
137
180
|
removeFromList,
|
|
138
181
|
toggleBulletList,
|
|
139
182
|
toggleNumberedList
|
|
@@ -25,7 +25,13 @@ export declare function selectionLock(state: EditorState): SelectionLock;
|
|
|
25
25
|
* A selection that also reaches a lock still locks what that lock leaves open.
|
|
26
26
|
*/
|
|
27
27
|
export declare const lockSelection: Command;
|
|
28
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Lifts the lock off every control the selection reaches, over that control's whole stretch.
|
|
30
|
+
*
|
|
31
|
+
* The transaction carries the pass that lets it reach past the very locks it lifts, which is the
|
|
32
|
+
* one thing the pass is for; every other guard still has its say, so lifting a lock stays shut
|
|
33
|
+
* under a protection that shuts the body (`schema/guards`).
|
|
34
|
+
*/
|
|
29
35
|
export declare const unlockSelection: Command;
|
|
30
36
|
/**
|
|
31
37
|
* Whether editing where the selection stands is shut.
|