@stll/folio-core 0.73.0 → 0.74.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/headless.js +2 -5
- package/dist/ai-edits/pendingJoin.js +6 -1
- package/dist/ai-edits/result-validation.js +1 -1
- package/dist/ai-edits/snapshot.js +1 -1
- package/dist/ai-edits/table-cell-mutations.js +1 -1
- package/dist/ai-edits/tracked-batch-fidelity.js +1 -1
- package/dist/canonical/canonicalInlineGaps.d.ts +56 -0
- package/dist/canonical/canonicalInlineGaps.js +118 -0
- package/dist/canonical/canonicalInlineProjection.d.ts +4 -13
- package/dist/canonical/canonicalInlineProjection.js +6 -28
- package/dist/canonical/canonicalProjectionBlocks.d.ts +4 -4
- package/dist/canonical/canonicalPublicOperations.js +70 -27
- package/dist/canonical/canonicalSelection.js +1 -1
- package/dist/canonical/canonicalSession.js +14 -21
- package/dist/controller/autocompleteSuggestion.js +1 -1
- package/dist/controller/canonicalClipboard.js +2 -2
- package/dist/controller/canonicalComposition.js +1 -1
- package/dist/controller/canonicalInput.js +1 -1
- package/dist/controller/canonicalPresence.js +1 -1
- package/dist/controller/canonicalRoomAuthority.js +1 -1
- package/dist/controller/canonicalRoomWire.js +1 -1
- package/dist/controller/canonicalStructure.js +1 -1
- package/dist/controller/canonicalTabRoom.js +1 -1
- package/dist/controller/canonicalYjsRoom.js +1 -1
- package/dist/controller/hiddenEditorApi.js +2 -17
- package/dist/controller/hiddenEditorManager.js +4 -8
- package/dist/document-operations.js +1 -1
- package/dist/docx/canonicalSave.d.ts +1 -1
- package/dist/docx/canonicalSave.js +1 -1
- package/dist/docx/canonicalSessionInput.js +1 -1
- package/dist/docx/containerChildren.js +1 -1
- package/dist/docx/createDocx.d.ts +4 -0
- package/dist/docx/createDocx.js +6 -0
- package/dist/docx/modelValidation.js +1 -1
- package/dist/docx/parser.js +1 -1
- package/dist/docx/reviewResolutionProvenance.js +1 -1
- package/dist/docx/rezip.d.ts +1 -1
- package/dist/docx/rezip.js +2 -2
- package/dist/docx/serializer/borderSerializer.js +1 -1
- package/dist/docx/serializer/commentSerializer.js +1 -1
- package/dist/docx/serializer/documentSerializer.js +1 -1
- package/dist/docx/serializer/paragraphSerializer.js +3 -3
- package/dist/docx/serializer/runSerializer.js +1 -1
- package/dist/docx/serializer/sectionPropertiesSerializer.js +1 -1
- package/dist/docx/serializer/tableSerializer.js +1 -1
- package/dist/docx/serializer/textFormattingSerializer.js +1 -1
- package/dist/docx/serializer/trackedChangeAttributes.js +1 -1
- package/dist/docx/server/templatePlan/apply.js +69 -11
- package/dist/docx/server/templatePlan/inspect.js +88 -35
- package/dist/docx/server/templatePlan/labels.d.ts +10 -1
- package/dist/docx/server/templatePlan/labels.js +31 -2
- package/dist/docx/server/templatePlan/plan.d.ts +2 -0
- package/dist/docx/server/templatePlan/plan.js +41 -7
- package/dist/docx/server/templatePlan/planShape.js +22 -3
- package/dist/docx/server/templatePlan/types.d.ts +38 -2
- package/dist/docx/server/templatePlan/types.js +1 -0
- package/dist/docx/server/templatePlan/verify.js +11 -3
- package/dist/docx/server/templatePlan/xml.d.ts +5 -0
- package/dist/docx/server/templatePlan/xml.js +7 -1
- package/dist/docx/storyBlockReplay.js +1 -1
- package/dist/docx/xmlParser.js +1 -1
- package/dist/i18n/loadMessages.d.ts +5 -0
- package/dist/i18n/loadMessages.js +46 -0
- package/dist/i18n/locales.d.ts +3 -0
- package/dist/i18n/locales.js +17 -0
- package/dist/i18n/messages.d.ts +3 -2
- package/dist/i18n/messages.js +4 -16
- package/dist/internal/clipboardTransformPlugin.d.ts +3 -0
- package/dist/internal/clipboardTransformPlugin.js +13 -0
- package/dist/internal/extensionRuntime.d.ts +7 -0
- package/dist/internal/extensionRuntime.js +28 -0
- package/dist/internal/paragraphFormattingSerialization.js +1 -1
- package/dist/internal/starterKitExtensions.d.ts +20 -0
- package/dist/internal/starterKitExtensions.js +123 -0
- package/dist/internal/wholeStoryRevisionResolution.js +2 -2
- package/dist/prosemirror/attrs/index.js +1 -1
- package/dist/prosemirror/canonicalSelectionRange.js +1 -1
- package/dist/prosemirror/canonicalTableCommands.js +1 -1
- package/dist/prosemirror/commands/comments.js +3 -3
- package/dist/prosemirror/commands/contentControls.js +1 -1
- package/dist/prosemirror/commands/pastePlainText.js +2 -3
- package/dist/prosemirror/commands/replaceRangeText.js +1 -1
- package/dist/prosemirror/commentRecords.js +2 -2
- package/dist/prosemirror/conversion/fromProseDoc.d.ts +0 -5
- package/dist/prosemirror/conversion/fromProseDoc.js +2 -9
- package/dist/prosemirror/conversion/index.d.ts +2 -2
- package/dist/prosemirror/conversion/index.js +2 -2
- package/dist/prosemirror/extensions/ExtensionManager.js +4 -22
- package/dist/prosemirror/extensions/StarterKit.d.ts +4 -27
- package/dist/prosemirror/extensions/StarterKit.js +29 -115
- package/dist/prosemirror/extensions/core/ParagraphExtension.js +2 -2
- package/dist/prosemirror/extensions/features/BaseKeymapExtension.js +1 -1
- package/dist/prosemirror/extensions/features/ListExtension.js +7 -2
- package/dist/prosemirror/extensions/features/pastedHeadingStyles.js +1 -1
- package/dist/prosemirror/extensions/index.d.ts +2 -1
- package/dist/prosemirror/extensions/marks/FootnoteRefExtension.js +8 -3
- package/dist/prosemirror/extensions/nodes/TableExtension.js +7 -40
- package/dist/prosemirror/hyperlinkRemoval.js +7 -2
- package/dist/prosemirror/index.d.ts +2 -2
- package/dist/prosemirror/index.js +2 -2
- package/dist/prosemirror/keptRangeBoundaries.js +1 -1
- package/dist/prosemirror/listNumbering.js +1 -1
- package/dist/prosemirror/noteReferenceOccurrences.js +1 -1
- package/dist/prosemirror/noteReferenceReview.d.ts +2 -56
- package/dist/prosemirror/noteReferenceReview.js +2 -243
- package/dist/prosemirror/pastedCommentCopies.js +1 -1
- package/dist/prosemirror/plugins/documentNumbering.js +1 -1
- package/dist/prosemirror/plugins/documentStyles.js +1 -1
- package/dist/prosemirror/replacedAnnotations.js +1 -1
- package/dist/prosemirror/suggestionCommands.d.ts +47 -0
- package/dist/prosemirror/suggestionCommands.js +31 -0
- package/dist/prosemirror/tableCellPaste.js +1 -1
- package/dist/prosemirror/tableRunIn.js +1 -1
- package/dist/prosemirror/textInput.js +1 -1
- package/dist/types/canonicalCapabilities.d.ts +6 -52
- package/dist/types/canonicalCapabilities.js +6 -52
- package/package.json +2 -2
- package/dist/ai-edits/apply.d.ts +0 -94
- package/dist/ai-edits/apply.js +0 -6637
- package/dist/ai-edits/note-story-inventory.d.ts +0 -5
- package/dist/ai-edits/note-story-inventory.js +0 -10
- package/dist/ai-edits/revisionStretches.d.ts +0 -32
- package/dist/ai-edits/revisionStretches.js +0 -147
- package/dist/document-operations-apply.d.ts +0 -15
- package/dist/document-operations-apply.js +0 -280
- package/dist/prosemirror/extensions/core/HistoryExtension.d.ts +0 -12
- package/dist/prosemirror/extensions/core/HistoryExtension.js +0 -114
- package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.d.ts +0 -23
- package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.js +0 -270
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.d.ts +0 -51
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.js +0 -411
- package/dist/prosemirror/plugins/suggestionMode.d.ts +0 -92
- package/dist/prosemirror/plugins/suggestionMode.js +0 -1515
- package/dist/prosemirror/tablePositionedBookmarks.d.ts +0 -8
- package/dist/prosemirror/tablePositionedBookmarks.js +0 -80
|
@@ -1,28 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
* StarterKit — bundles all extensions into a ready-to-use set
|
|
3
|
-
*
|
|
4
|
-
* Usage:
|
|
5
|
-
* const extensions = createStarterKit();
|
|
6
|
-
* const manager = new ExtensionManager(extensions);
|
|
7
|
-
* manager.buildSchema();
|
|
8
|
-
* manager.initializeRuntime();
|
|
9
|
-
*/
|
|
10
|
-
import { SelectionChangeCallback } from "../plugins/selectionTracker.js";
|
|
11
|
-
import { HistoryShortcutOwner } from "./core/historyCommands.js";
|
|
1
|
+
import { StarterKitOptions } from "../../internal/starterKitExtensions.js";
|
|
12
2
|
import { AnyExtension } from "./types.js";
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
/** History depth (default: 100) */
|
|
17
|
-
historyDepth?: number;
|
|
18
|
-
/** History new group delay (default: 500) */
|
|
19
|
-
historyNewGroupDelay?: number;
|
|
20
|
-
/** Who answers the undo and redo keys (default: `"editor"`). */
|
|
21
|
-
historyShortcuts?: HistoryShortcutOwner;
|
|
22
|
-
/** Selection change callback */
|
|
23
|
-
onSelectionChange?: SelectionChangeCallback;
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* Create the full set of extensions for the DOCX editor
|
|
27
|
-
*/
|
|
28
|
-
export declare function createStarterKit(options?: StarterKitOptions): AnyExtension[];
|
|
3
|
+
/** Create the schema, commands, keymaps and clipboard rules for the DOCX editor. */
|
|
4
|
+
export declare function createStarterKit(options?: StarterKitOptions): AnyExtension[];
|
|
5
|
+
export type { StarterKitOptions };
|
|
@@ -1,121 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { TextExtension } from "./core/TextExtension.js";
|
|
5
|
-
import { AutoBidiDetectionExtension } from "./features/AutoBidiDetectionExtension.js";
|
|
6
|
-
import { BaseKeymapExtension } from "./features/BaseKeymapExtension.js";
|
|
7
|
-
import { BidiShortcutExtension } from "./features/BidiShortcutExtension.js";
|
|
8
|
-
import { ContentControlWidgetsExtension } from "./features/ContentControlWidgetsExtension.js";
|
|
9
|
-
import { DropCursorExtension } from "./features/DropCursorExtension.js";
|
|
10
|
-
import { EmptyParagraphFormatExtension } from "./features/EmptyParagraphFormatExtension.js";
|
|
11
|
-
import { GapCursorExtension } from "./features/GapCursorExtension.js";
|
|
12
|
-
import { ImageDragExtension } from "./features/ImageDragExtension.js";
|
|
13
|
-
import { ImagePasteExtension } from "./features/ImagePasteExtension.js";
|
|
14
|
-
import { JoinedRunStyleExtension } from "./features/JoinedRunStyleExtension.js";
|
|
15
|
-
import { ListExtension } from "./features/ListExtension.js";
|
|
16
|
-
import { ParaIdAllocatorExtension } from "./features/ParaIdAllocatorExtension.js";
|
|
17
|
-
import { ParagraphChangeTrackerExtension } from "./features/ParagraphChangeTrackerExtension.js";
|
|
18
|
-
import { PasteCleanupExtension } from "./features/PasteCleanupExtension.js";
|
|
19
|
-
import { PasteStyleInlinerExtension } from "./features/PasteStyleInlinerExtension.js";
|
|
20
|
-
import { SelectionTrackerExtension } from "./features/SelectionTrackerExtension.js";
|
|
21
|
-
import { MARK_EXTENSIONS, MARK_NESTING_ORDER } from "./markRegistry.js";
|
|
22
|
-
import { BlockBookmarkBoundaryExtension } from "./nodes/BlockBookmarkBoundaryExtension.js";
|
|
23
|
-
import { BlockCommentRangeBoundaryExtension } from "./nodes/BlockCommentRangeBoundaryExtension.js";
|
|
24
|
-
import { BlockCustomXmlExtension } from "./nodes/BlockCustomXmlExtension.js";
|
|
25
|
-
import { BlockMoveRangeBoundaryExtension } from "./nodes/BlockMoveRangeBoundaryExtension.js";
|
|
26
|
-
import { BlockSdtExtension } from "./nodes/BlockSdtExtension.js";
|
|
27
|
-
import { BookmarkBoundaryExtension } from "./nodes/BookmarkBoundaryExtension.js";
|
|
28
|
-
import { CommentRangeBoundaryExtension } from "./nodes/CommentRangeBoundaryExtension.js";
|
|
29
|
-
import { CommentReferenceExtension } from "./nodes/CommentReferenceExtension.js";
|
|
30
|
-
import { FieldExtension, StructuredFieldExtension } from "./nodes/FieldExtension.js";
|
|
31
|
-
import { HardBreakExtension } from "./nodes/HardBreakExtension.js";
|
|
32
|
-
import { HorizontalRuleExtension } from "./nodes/HorizontalRuleExtension.js";
|
|
33
|
-
import { ImageExtension } from "./nodes/ImageExtension.js";
|
|
34
|
-
import { MathExtension } from "./nodes/MathExtension.js";
|
|
35
|
-
import { MoveRangeBoundaryExtension } from "./nodes/MoveRangeBoundaryExtension.js";
|
|
36
|
-
import { NoteMarkerExtension } from "./nodes/NoteMarkerExtension.js";
|
|
37
|
-
import { PageBreakExtension } from "./nodes/PageBreakExtension.js";
|
|
38
|
-
import { PageBreakRunExtension } from "./nodes/PageBreakRunExtension.js";
|
|
39
|
-
import { PreservedBlockExtension } from "./nodes/PreservedBlockExtension.js";
|
|
40
|
-
import { PreservedXmlExtension } from "./nodes/PreservedXmlExtension.js";
|
|
41
|
-
import { RangeAnchorExtension } from "./nodes/RangeAnchorExtension.js";
|
|
42
|
-
import { RenderedPageBreakExtension } from "./nodes/RenderedPageBreakExtension.js";
|
|
43
|
-
import { SdtExtension } from "./nodes/SdtExtension.js";
|
|
44
|
-
import { ShapeExtension } from "./nodes/ShapeExtension.js";
|
|
45
|
-
import { SymbolExtension } from "./nodes/SymbolExtension.js";
|
|
46
|
-
import { TabExtension } from "./nodes/TabExtension.js";
|
|
47
|
-
import { createTableExtensions } from "./nodes/TableExtension.js";
|
|
48
|
-
import { TextBoxAnchorExtension } from "./nodes/TextBoxAnchorExtension.js";
|
|
49
|
-
import { TextBoxExtension } from "./nodes/TextBoxExtension.js";
|
|
1
|
+
import { clipboardTransformPlugin } from "../../internal/clipboardTransformPlugin.js";
|
|
2
|
+
import { createStarterKitExtensions } from "../../internal/starterKitExtensions.js";
|
|
3
|
+
import { Plugin } from "prosemirror-state";
|
|
50
4
|
// src/prosemirror/extensions/StarterKit.ts
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
5
|
+
const starterKitClipboardPlugins = (props) => {
|
|
6
|
+
const plugins = clipboardTransformPlugin(props);
|
|
7
|
+
const { handlePaste, handleDOMEvents } = props;
|
|
8
|
+
const paste = handleDOMEvents?.paste;
|
|
9
|
+
if (handlePaste !== void 0 || paste !== void 0) plugins.push(new Plugin({ props: {
|
|
10
|
+
...handlePaste === void 0 ? {} : { handlePaste },
|
|
11
|
+
...paste === void 0 ? {} : { handleDOMEvents: { paste } }
|
|
12
|
+
} }));
|
|
13
|
+
return plugins;
|
|
14
|
+
};
|
|
15
|
+
/** Create the schema, commands, keymaps and clipboard rules for the DOCX editor. */
|
|
54
16
|
function createStarterKit(options = {}) {
|
|
55
|
-
const
|
|
56
|
-
const extensions
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
17
|
+
const extensions = createStarterKitExtensions(options);
|
|
18
|
+
for (const extension of extensions) {
|
|
19
|
+
const { onSchemaReady } = extension;
|
|
20
|
+
extension.onSchemaReady = (ctx) => {
|
|
21
|
+
const { plugins, ...runtime } = onSchemaReady(ctx);
|
|
22
|
+
if (plugins === void 0) return runtime;
|
|
23
|
+
if (extension.config.name === "selectionTracker" && options.onSelectionChange) return {
|
|
24
|
+
...runtime,
|
|
25
|
+
plugins
|
|
26
|
+
};
|
|
27
|
+
return {
|
|
28
|
+
...runtime,
|
|
29
|
+
plugins: plugins.flatMap(({ props }) => starterKitClipboardPlugins(props))
|
|
30
|
+
};
|
|
31
|
+
};
|
|
64
32
|
}
|
|
65
|
-
add("doc", DocExtension());
|
|
66
|
-
add("text", TextExtension());
|
|
67
|
-
add("paragraph", ParagraphExtension());
|
|
68
|
-
add("history", HistoryExtension({
|
|
69
|
-
...options.historyDepth !== void 0 ? { depth: options.historyDepth } : {},
|
|
70
|
-
...options.historyNewGroupDelay !== void 0 ? { newGroupDelay: options.historyNewGroupDelay } : {},
|
|
71
|
-
...options.historyShortcuts !== void 0 ? { shortcuts: options.historyShortcuts } : {}
|
|
72
|
-
}));
|
|
73
|
-
for (const name of MARK_NESTING_ORDER) add(name, MARK_EXTENSIONS[name]({ getInternalClipboardToken }));
|
|
74
|
-
add("bookmarkBoundary", BookmarkBoundaryExtension({ getInternalClipboardToken }));
|
|
75
|
-
add("blockBookmarkBoundary", BlockBookmarkBoundaryExtension({ getInternalClipboardToken }));
|
|
76
|
-
add("blockMoveRangeBoundary", BlockMoveRangeBoundaryExtension({ getInternalClipboardToken }));
|
|
77
|
-
add("blockCommentRangeBoundary", BlockCommentRangeBoundaryExtension());
|
|
78
|
-
add("commentReference", CommentReferenceExtension({ getInternalClipboardToken }));
|
|
79
|
-
add("commentRangeBoundary", CommentRangeBoundaryExtension({ getInternalClipboardToken }));
|
|
80
|
-
add("moveRangeBoundary", MoveRangeBoundaryExtension({ getInternalClipboardToken }));
|
|
81
|
-
add("rangeAnchor", RangeAnchorExtension({ getInternalClipboardToken }));
|
|
82
|
-
add("hardBreak", HardBreakExtension());
|
|
83
|
-
add("tab", TabExtension());
|
|
84
|
-
add("symbol", SymbolExtension());
|
|
85
|
-
add("preservedXml", PreservedXmlExtension());
|
|
86
|
-
add("noteMarker", NoteMarkerExtension());
|
|
87
|
-
add("image", ImageExtension());
|
|
88
|
-
add("textBox", TextBoxExtension());
|
|
89
|
-
add("textBoxAnchor", TextBoxAnchorExtension({ getInternalClipboardToken }));
|
|
90
|
-
add("shape", ShapeExtension());
|
|
91
|
-
add("imageDrag", ImageDragExtension());
|
|
92
|
-
add("imagePaste", ImagePasteExtension());
|
|
93
|
-
add("dropCursor", DropCursorExtension());
|
|
94
|
-
add("gapCursor", GapCursorExtension());
|
|
95
|
-
add("horizontalRule", HorizontalRuleExtension());
|
|
96
|
-
add("pageBreak", PageBreakExtension());
|
|
97
|
-
add("pageBreakRun", PageBreakRunExtension());
|
|
98
|
-
add("renderedPageBreak", RenderedPageBreakExtension());
|
|
99
|
-
add("field", FieldExtension({ getInternalClipboardToken }));
|
|
100
|
-
add("field", StructuredFieldExtension({ getInternalClipboardToken }));
|
|
101
|
-
add("sdt", SdtExtension());
|
|
102
|
-
add("blockSdt", BlockSdtExtension());
|
|
103
|
-
add("blockCustomXml", BlockCustomXmlExtension());
|
|
104
|
-
add("preservedBlock", PreservedBlockExtension());
|
|
105
|
-
add("math", MathExtension());
|
|
106
|
-
if (!disabled.has("table")) extensions.push(...createTableExtensions());
|
|
107
|
-
add("pasteCleanup", PasteCleanupExtension({ getInternalClipboardToken }));
|
|
108
|
-
add("pasteStyleInliner", PasteStyleInlinerExtension());
|
|
109
|
-
add("list", ListExtension());
|
|
110
|
-
add("baseKeymap", BaseKeymapExtension());
|
|
111
|
-
add("emptyParagraphFormat", EmptyParagraphFormatExtension());
|
|
112
|
-
add("joinedRunStyle", JoinedRunStyleExtension());
|
|
113
|
-
add("selectionTracker", options.onSelectionChange === void 0 ? SelectionTrackerExtension() : SelectionTrackerExtension({ onSelectionChange: options.onSelectionChange }));
|
|
114
|
-
add("paraIdAllocator", ParaIdAllocatorExtension());
|
|
115
|
-
add("paragraphChangeTracker", ParagraphChangeTrackerExtension());
|
|
116
|
-
add("bidiShortcut", BidiShortcutExtension());
|
|
117
|
-
add("autoBidiDetection", AutoBidiDetectionExtension());
|
|
118
|
-
add("contentControlWidgets", ContentControlWidgetsExtension());
|
|
119
33
|
return extensions;
|
|
120
34
|
}
|
|
121
35
|
export { createStarterKit };
|
|
@@ -20,13 +20,13 @@ import { recordReplacedParagraphProperties } from "../../paragraphPropertyCarry.
|
|
|
20
20
|
import { directParagraphSpacing, withDirectParagraphSpacing } from "../../paragraphSpacing.js";
|
|
21
21
|
import { getDocumentNumbering } from "../../plugins/documentNumbering.js";
|
|
22
22
|
import { getDocumentBuiltInStyles, getDocumentStyleResolver } from "../../plugins/documentStyleState.js";
|
|
23
|
-
import { SUGGESTION_META, makeRevisionInfo } from "../../plugins/suggestionMode.js";
|
|
24
23
|
import { rebaseParagraphRuns } from "../../rebaseParagraphRuns.js";
|
|
25
24
|
import { mintSectionProperties, parseSectionBreakType, sectionBreakTypeOf } from "../../sectionCarrier.js";
|
|
26
25
|
import { listAttrsFromResolvedStyle, listIndentationProvenancePatch, paragraphAttrsFromResolvedStyle } from "../../styles/resolvedStyleAttrs.js";
|
|
26
|
+
import { SUGGESTION_META, makeRevisionInfo } from "../../suggestionCommands.js";
|
|
27
27
|
import { createNodeExtension } from "../create.js";
|
|
28
|
-
import { Fragment } from "prosemirror-model";
|
|
29
28
|
import { headingOutlineLevel } from "@stll/docx-core/model";
|
|
29
|
+
import { Fragment } from "prosemirror-model";
|
|
30
30
|
// src/prosemirror/extensions/core/ParagraphExtension.ts
|
|
31
31
|
/**
|
|
32
32
|
* Paragraph Extension — paragraph node with alignment, spacing, indent, style commands
|
|
@@ -10,8 +10,8 @@ import { paragraphAttrsFromResolvedStyle } from "../../styles/resolvedStyleAttrs
|
|
|
10
10
|
import { createExtension } from "../create.js";
|
|
11
11
|
import { marksToTextFormatting, textFormattingToMarks } from "../marks/markUtils.js";
|
|
12
12
|
import { Priority } from "../types.js";
|
|
13
|
-
import { EditorState, TextSelection } from "prosemirror-state";
|
|
14
13
|
import { baseKeymap, deleteSelection, joinBackward, joinForward, selectAll, selectParentNode, splitBlock } from "prosemirror-commands";
|
|
14
|
+
import { EditorState, TextSelection } from "prosemirror-state";
|
|
15
15
|
// src/prosemirror/extensions/features/BaseKeymapExtension.ts
|
|
16
16
|
/**
|
|
17
17
|
* Base Keymap Extension — wraps prosemirror-commands baseKeymap
|
|
@@ -7,8 +7,8 @@ import { applyParagraphUpdates, continueNumbering, listItemAttrs, resolveListTar
|
|
|
7
7
|
import { resolveListState } from "../../listState.js";
|
|
8
8
|
import { effectiveParagraphNumberingReference, paragraphNumberingSourcesFromBoundary, removedNumberingAttr } from "../../numberingAttr.js";
|
|
9
9
|
import { getDocumentNumbering } from "../../plugins/documentNumbering.js";
|
|
10
|
-
import { SUGGESTION_META, makeRevisionInfo, suggestRangeDeletion } from "../../plugins/suggestionMode.js";
|
|
11
10
|
import { listLevelAttrPatch, listLevelIndentRemovalPatch } from "../../styles/resolvedStyleAttrs.js";
|
|
11
|
+
import { SUGGESTION_META, makeRevisionInfo, suggestRangeDeletion } from "../../suggestionCommands.js";
|
|
12
12
|
import { createExtension } from "../create.js";
|
|
13
13
|
import { goToNextCell, goToPrevCell } from "../nodes/TableExtension.js";
|
|
14
14
|
import { Priority } from "../types.js";
|
|
@@ -421,7 +421,12 @@ const suggestedListAutoformat = (autoformat) => new Plugin({ appendTransaction(t
|
|
|
421
421
|
if (!requests) return null;
|
|
422
422
|
const start = $head.start();
|
|
423
423
|
const tr = state.tr;
|
|
424
|
-
if (!suggestRangeDeletion(
|
|
424
|
+
if (!suggestRangeDeletion({
|
|
425
|
+
state,
|
|
426
|
+
tr,
|
|
427
|
+
from: start,
|
|
428
|
+
to: $head.pos
|
|
429
|
+
})) return null;
|
|
425
430
|
const from = tr.mapping.map(start);
|
|
426
431
|
if (!numberParagraphs({
|
|
427
432
|
state,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readOutlineLevelAttr } from "../../outlineLevelAttr.js";
|
|
2
2
|
import { getDocumentBuiltInStyles, getDocumentStyleResolver } from "../../plugins/documentStyleState.js";
|
|
3
|
-
import { Fragment, Slice } from "prosemirror-model";
|
|
4
3
|
import { headingLevelOf } from "@stll/docx-core/model";
|
|
4
|
+
import { Fragment, Slice } from "prosemirror-model";
|
|
5
5
|
// src/prosemirror/extensions/features/pastedHeadingStyles.ts
|
|
6
6
|
/**
|
|
7
7
|
* Retarget pasted heading paragraphs at the open document's own heading style.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { StarterKitOptions } from "../../internal/starterKitExtensions.js";
|
|
1
2
|
import { ExtensionManager } from "./ExtensionManager.js";
|
|
2
|
-
import {
|
|
3
|
+
import { createStarterKit } from "./StarterKit.js";
|
|
3
4
|
export { ExtensionManager, type StarterKitOptions, createStarterKit };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { expectFootnoteRefMarkAttrs } from "../../attrs/index.js";
|
|
2
2
|
import { withCanonicalCommand } from "../../canonicalCommands.js";
|
|
3
3
|
import { mintNoteReferenceOccurrenceId, noteReferenceOccurrencePlugin } from "../../noteReferenceOccurrences.js";
|
|
4
|
-
import {
|
|
4
|
+
import { isSuggestionModeActive, suggestRangeDeletion } from "../../suggestionCommands.js";
|
|
5
5
|
import { createMarkExtension } from "../create.js";
|
|
6
6
|
import { expandNoteReferenceDeletionRange, noteReferenceRanges } from "./noteReferenceDeletion.js";
|
|
7
7
|
import { panic } from "better-result";
|
|
@@ -72,7 +72,7 @@ const FootnoteRefExtension = createMarkExtension({
|
|
|
72
72
|
},
|
|
73
73
|
onSchemaReady() {
|
|
74
74
|
const deleteWholeNoteReference = (direction) => (state, dispatch) => {
|
|
75
|
-
if (
|
|
75
|
+
if (isSuggestionModeActive(state)) return false;
|
|
76
76
|
const { from, to, empty } = state.selection;
|
|
77
77
|
const range = expandNoteReferenceDeletionRange(state.doc, empty && direction === "backward" ? Math.max(0, from - 1) : from, empty && direction === "forward" ? Math.min(state.doc.content.size, to + 1) : to);
|
|
78
78
|
if (!range) return false;
|
|
@@ -110,7 +110,12 @@ const FootnoteRefExtension = createMarkExtension({
|
|
|
110
110
|
if (references.length === 0) return false;
|
|
111
111
|
if (!dispatch) return true;
|
|
112
112
|
const tr = state.tr;
|
|
113
|
-
for (const reference of references.toReversed()) if (!suggestRangeDeletion(
|
|
113
|
+
for (const reference of references.toReversed()) if (!suggestRangeDeletion({
|
|
114
|
+
state,
|
|
115
|
+
tr,
|
|
116
|
+
from: reference.from,
|
|
117
|
+
to: reference.to
|
|
118
|
+
})) tr.delete(reference.from, reference.to);
|
|
114
119
|
dispatch(tr.scrollIntoView());
|
|
115
120
|
return true;
|
|
116
121
|
};
|
|
@@ -8,16 +8,14 @@ import { textFlowCss } from "../../../utils/textDirectionFlow.js";
|
|
|
8
8
|
import { expectTableAttrs, expectTableCellAttrs, expectTableRowAttrs, mergeTableAttrs, mergeTableCellAttrs, mergeTableRowAttrs } from "../../attrs/index.js";
|
|
9
9
|
import { withCanonicalCellMerge, withCanonicalCellSplit, withCanonicalColumnDeletion, withCanonicalColumnInsertion, withCanonicalRowDeletion, withCanonicalRowInsertion, withCanonicalSelectionCommand, withCanonicalTableAttributeCommand, withCanonicalTableDeletion, withCanonicalTableInsertion } from "../../canonicalTableCommands.js";
|
|
10
10
|
import { mintRevisionId } from "../../plugins/revisionIds.js";
|
|
11
|
-
import { makeRevisionInfo } from "../../
|
|
11
|
+
import { makeRevisionInfo } from "../../suggestionCommands.js";
|
|
12
12
|
import { pasteTableCells, pastedSliceWithNewTableCells } from "../../tableCellPaste.js";
|
|
13
13
|
import { insertTableColumn, removeTableColumns, removeTableRow } from "../../tableGridMutation.js";
|
|
14
|
-
import { tablePositionedBookmarksPlugin } from "../../tablePositionedBookmarks.js";
|
|
15
14
|
import { createExtension, createNodeExtension } from "../create.js";
|
|
16
15
|
import { panic } from "better-result";
|
|
17
|
-
import { CellSelection, TableMap, columnResizing, mergeCells, selectedRect, splitCell, tableEditing, tableNodeTypes } from "prosemirror-tables";
|
|
18
16
|
import { statesNoBorder } from "@stll/docx-core/model";
|
|
19
|
-
import { Plugin,
|
|
20
|
-
import {
|
|
17
|
+
import { Plugin, Selection, TextSelection } from "prosemirror-state";
|
|
18
|
+
import { CellSelection, TableMap, mergeCells, selectedRect, splitCell, tableNodeTypes } from "prosemirror-tables";
|
|
21
19
|
// src/prosemirror/extensions/nodes/TableExtension.ts
|
|
22
20
|
/**
|
|
23
21
|
* Table Extension — 4 node specs + plugins + commands
|
|
@@ -1964,42 +1962,11 @@ const TablePluginExtension = createExtension({
|
|
|
1964
1962
|
return false;
|
|
1965
1963
|
};
|
|
1966
1964
|
}
|
|
1967
|
-
const activeCellKey = new PluginKey("activeCell");
|
|
1968
|
-
const activeCellPlugin = new Plugin({
|
|
1969
|
-
key: activeCellKey,
|
|
1970
|
-
props: { decorations(state) {
|
|
1971
|
-
const { selection } = state;
|
|
1972
|
-
if (selection instanceof CellSelection) return DecorationSet.empty;
|
|
1973
|
-
const { $from } = selection;
|
|
1974
|
-
for (let d = $from.depth; d > 0; d--) {
|
|
1975
|
-
const node = $from.node(d);
|
|
1976
|
-
if (node.type.name === "tableCell" || node.type.name === "tableHeader") {
|
|
1977
|
-
const pos = $from.before(d);
|
|
1978
|
-
return DecorationSet.create(state.doc, [Decoration.node(pos, pos + node.nodeSize, { class: "activeCell" })]);
|
|
1979
|
-
}
|
|
1980
|
-
}
|
|
1981
|
-
return DecorationSet.empty;
|
|
1982
|
-
} }
|
|
1983
|
-
});
|
|
1984
|
-
const tableCellPastePlugin = new Plugin({
|
|
1985
|
-
key: new PluginKey("tableCellPaste"),
|
|
1986
|
-
props: {
|
|
1987
|
-
transformPasted: (slice) => pastedSliceWithNewTableCells(slice),
|
|
1988
|
-
handlePaste: (view, _event, slice) => pasteTableCells(view.state, slice, view.dispatch)
|
|
1989
|
-
}
|
|
1990
|
-
});
|
|
1991
1965
|
return {
|
|
1992
|
-
plugins: [
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
lastColumnResizable: true
|
|
1997
|
-
}),
|
|
1998
|
-
tableCellPastePlugin,
|
|
1999
|
-
tableEditing(),
|
|
2000
|
-
tablePositionedBookmarksPlugin(),
|
|
2001
|
-
activeCellPlugin
|
|
2002
|
-
],
|
|
1966
|
+
plugins: [new Plugin({ props: {
|
|
1967
|
+
transformPasted: pastedSliceWithNewTableCells,
|
|
1968
|
+
handlePaste: (view, _event, slice) => pasteTableCells(view.state, slice, view.dispatch)
|
|
1969
|
+
} })],
|
|
2003
1970
|
keyboardShortcuts: {
|
|
2004
1971
|
Backspace: chainCommands(deleteTableIfSelected(), preventTableMergeAtGap()),
|
|
2005
1972
|
Delete: chainCommands(deleteTableIfSelected(), preventTableMergeAtGap())
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BUILT_IN_STYLE_NAME } from "../docx/builtInStyles.js";
|
|
2
2
|
import { getDocumentBuiltInStyles, getDocumentStyleResolver } from "./plugins/documentStyleState.js";
|
|
3
|
-
import { isSuggestionModeActive, makeRevisionInfo, suggestRangeDeletion } from "./plugins/suggestionMode.js";
|
|
4
3
|
import { readAuthoredRunFormatting, reconcileRunFormattingMarks } from "./runFormattingReconciliation.js";
|
|
5
4
|
import { paragraphRunStyleContextAt } from "./runStyleFormatting.js";
|
|
5
|
+
import { isSuggestionModeActive, makeRevisionInfo, suggestRangeDeletion } from "./suggestionCommands.js";
|
|
6
6
|
import { TaggedError } from "better-result";
|
|
7
7
|
// src/prosemirror/hyperlinkRemoval.ts
|
|
8
8
|
/**
|
|
@@ -153,7 +153,12 @@ const removeHyperlinkInRange = (state, tr, from, to) => {
|
|
|
153
153
|
const change = previousFormatting && !hasPendingPropertyChange(piece.node.marks) ? propertyChange(previousFormatting) : null;
|
|
154
154
|
setInlineMarks(tr, piece.from, piece.to, piece.node.marks, change ? change.addToSet(marks) : marks);
|
|
155
155
|
}
|
|
156
|
-
suggestRangeDeletion(
|
|
156
|
+
suggestRangeDeletion({
|
|
157
|
+
state,
|
|
158
|
+
tr,
|
|
159
|
+
from: range.from,
|
|
160
|
+
to: range.to
|
|
161
|
+
});
|
|
157
162
|
}
|
|
158
163
|
return tr;
|
|
159
164
|
};
|
|
@@ -15,7 +15,7 @@ import "./commands/index.js";
|
|
|
15
15
|
import { insertPageBreak } from "./commands/pageBreak.js";
|
|
16
16
|
import { addTabStop, alignCenter, alignJustify, alignLeft, alignRight, applyStyle, clearStyle, continueNumbering, decreaseIndent, decreaseListLevel, generateTableOfContents, increaseIndent, increaseListLevel, removeList, removeTabStop, restartNumbering, setAlignment, setIndentFirstLine, setIndentLeft, setIndentRight, setLineSpacing, setLtr, setNumberingValue, setRtl, toggleBidi, toggleBulletList, toggleNumberedList } from "./commands/paragraph.js";
|
|
17
17
|
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 "./commands/table.js";
|
|
18
|
-
import { FromProseDocOptions, ProjectionReuse, fromProseDoc
|
|
18
|
+
import { FromProseDocOptions, ProjectionReuse, fromProseDoc } from "./conversion/fromProseDoc.js";
|
|
19
19
|
import "./conversion/index.js";
|
|
20
20
|
import { ToProseDocOptions, createEmptyDoc, toProseDoc } from "./conversion/toProseDoc.js";
|
|
21
21
|
import { getParagraphAlignment, getParagraphBidi, getStyleId } from "./extensions/core/ParagraphExtension.js";
|
|
@@ -40,4 +40,4 @@ import "./styles/index.js";
|
|
|
40
40
|
import { ResolvedParagraphStyle, StyleResolver, createStyleResolver } from "./styles/styleResolver.js";
|
|
41
41
|
import { ProseMirrorDocumentValidationIssue, ValidateProseMirrorDocumentResult, assertValidProseMirrorDocument, formatProseMirrorDocumentIssues, validateProseMirrorDocument } from "./validation.js";
|
|
42
42
|
import { TextSelection } from "prosemirror-state";
|
|
43
|
-
export { type ActiveListState, type BorderPreset, type CapturedTextFormatting, type FontFamilyAttrs, type FontSizeAttrs, type FromProseDocOptions, type HyperlinkAttrs, type ImageAttrs, type ListNumberingMenuState, type ListState, type ListType, NO_LIST_NUMBERING_MENU, NO_LIST_STATE, PAINTABLE_MARK_NAMES, type ParagraphAttrs, type ProjectionReuse, type ProseMirrorDocumentValidationIssue, type ResolvedParagraphStyle, type SelectionChangeCallback, type SelectionContext, type SelectionState, StyleResolver, type TableBorderCommandSpec, type TableBorderPreset, type TableCellBorderCommandSpec, type TableContextInfo, type TextColorAttrs, TextSelection, type ToProseDocOptions, type UnderlineAttrs, type ValidateProseMirrorDocumentResult, addColumnLeft, addColumnRight, addRowAbove, addRowBelow, addTabStop, alignCenter, alignJustify, alignLeft, alignRight, applyFormatMarks, applyStyle, applyTableStyle, assertValidProseMirrorDocument, autoFitContents, captureFormatMarks, clearFontFamily, clearFontSize, clearFormatting, clearHighlight, clearStyle, clearTextColor, continueNumbering, createDocumentStylesPlugin, createEmptyDoc, createSelectionTrackerPlugin, createStyleResolver, decreaseIndent, decreaseListLevel, deleteColumn, deleteRow, deleteTable, distributeColumns, documentStylesKey, ensureParaIdsInState, extractSelectionContext, extractSelectionState, formatProseMirrorDocumentIssues, fromProseDoc, generateTableOfContents, getDocumentBuiltInStyles, getDocumentStyleResolver, getHyperlinkAttrs, getListInfo, getMarkAttr, getParagraphAlignment, getParagraphBidi, getSelectedText, getSelectionContext, getStyleId, getTableContext, increaseIndent, increaseListLevel, insertHyperlink, insertImageFromFile, insertPageBreak, insertPageBreakInView, insertTable, insertTableInView, insertTableOfContentsInView, isHyperlinkActive, isInList, isInListState, isInTableCell as isInTable, isMarkActive, listNumberingMenuState, listStateLevel, mergeCells, removeHyperlink, removeList, removeTabStop, removeTableBorders, resolveListState, restartNumbering, sameListState, schema, selectColumn, selectRow, selectTable, selectionTrackerKey, setAlignment, setAllTableBorders, setCellBorder, setCellFillColor, setCellMargins, setCellTextDirection, setCellVerticalAlign, setFontFamily, setFontSize, setHighlight, setHyperlink, setIndentFirstLine, setIndentLeft, setIndentRight, setInsideTableBorders, setLineSpacing, setLtr, setNumberingValue, setOutsideTableBorders, setRowHeight, setRtl, setTableBorderColor, setTableBorderPreset, setTableBorderWidth, setTableBorders, setTableProperties, setTextColor, singletonManager, splitCell, toProseDoc, toggleBidi, toggleBold, toggleBulletList, toggleHeaderRow, toggleItalic, toggleNoWrap, toggleNumberedList, toggleStrike, toggleSubscript, toggleSuperscript, toggleUnderline,
|
|
43
|
+
export { type ActiveListState, type BorderPreset, type CapturedTextFormatting, type FontFamilyAttrs, type FontSizeAttrs, type FromProseDocOptions, type HyperlinkAttrs, type ImageAttrs, type ListNumberingMenuState, type ListState, type ListType, NO_LIST_NUMBERING_MENU, NO_LIST_STATE, PAINTABLE_MARK_NAMES, type ParagraphAttrs, type ProjectionReuse, type ProseMirrorDocumentValidationIssue, type ResolvedParagraphStyle, type SelectionChangeCallback, type SelectionContext, type SelectionState, StyleResolver, type TableBorderCommandSpec, type TableBorderPreset, type TableCellBorderCommandSpec, type TableContextInfo, type TextColorAttrs, TextSelection, type ToProseDocOptions, type UnderlineAttrs, type ValidateProseMirrorDocumentResult, addColumnLeft, addColumnRight, addRowAbove, addRowBelow, addTabStop, alignCenter, alignJustify, alignLeft, alignRight, applyFormatMarks, applyStyle, applyTableStyle, assertValidProseMirrorDocument, autoFitContents, captureFormatMarks, clearFontFamily, clearFontSize, clearFormatting, clearHighlight, clearStyle, clearTextColor, continueNumbering, createDocumentStylesPlugin, createEmptyDoc, createSelectionTrackerPlugin, createStyleResolver, decreaseIndent, decreaseListLevel, deleteColumn, deleteRow, deleteTable, distributeColumns, documentStylesKey, ensureParaIdsInState, extractSelectionContext, extractSelectionState, formatProseMirrorDocumentIssues, fromProseDoc, generateTableOfContents, getDocumentBuiltInStyles, getDocumentStyleResolver, getHyperlinkAttrs, getListInfo, getMarkAttr, getParagraphAlignment, getParagraphBidi, getSelectedText, getSelectionContext, getStyleId, getTableContext, increaseIndent, increaseListLevel, insertHyperlink, insertImageFromFile, insertPageBreak, insertPageBreakInView, insertTable, insertTableInView, insertTableOfContentsInView, isHyperlinkActive, isInList, isInListState, isInTableCell as isInTable, isMarkActive, listNumberingMenuState, listStateLevel, mergeCells, removeHyperlink, removeList, removeTabStop, removeTableBorders, resolveListState, restartNumbering, sameListState, schema, selectColumn, selectRow, selectTable, selectionTrackerKey, setAlignment, setAllTableBorders, setCellBorder, setCellFillColor, setCellMargins, setCellTextDirection, setCellVerticalAlign, setFontFamily, setFontSize, setHighlight, setHyperlink, setIndentFirstLine, setIndentLeft, setIndentRight, setInsideTableBorders, setLineSpacing, setLtr, setNumberingValue, setOutsideTableBorders, setRowHeight, setRtl, setTableBorderColor, setTableBorderPreset, setTableBorderWidth, setTableBorders, setTableProperties, setTextColor, singletonManager, splitCell, toProseDoc, toggleBidi, toggleBold, toggleBulletList, toggleHeaderRow, toggleItalic, toggleNoWrap, toggleNumberedList, toggleStrike, toggleSubscript, toggleSuperscript, toggleUnderline, validateProseMirrorDocument };
|
|
@@ -4,7 +4,7 @@ import { insertImageFromFile } from "./commands/image.js";
|
|
|
4
4
|
import { insertPageBreak } from "./commands/pageBreak.js";
|
|
5
5
|
import { addTabStop, alignCenter, alignJustify, alignLeft, alignRight, applyStyle, clearStyle, continueNumbering, decreaseIndent, decreaseListLevel, generateTableOfContents, increaseIndent, increaseListLevel, removeList, removeTabStop, restartNumbering, setAlignment, setIndentFirstLine, setIndentLeft, setIndentRight, setLineSpacing, setLtr, setNumberingValue, setRtl, toggleBidi, toggleBulletList, toggleNumberedList } from "./commands/paragraph.js";
|
|
6
6
|
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 "./commands/table.js";
|
|
7
|
-
import { fromProseDoc
|
|
7
|
+
import { fromProseDoc } from "./conversion/fromProseDoc.js";
|
|
8
8
|
import { createEmptyDoc, toProseDoc } from "./conversion/toProseDoc.js";
|
|
9
9
|
import { getParagraphAlignment, getParagraphBidi, getStyleId } from "./extensions/core/ParagraphExtension.js";
|
|
10
10
|
import { getListInfo, isInList } from "./extensions/features/ListExtension.js";
|
|
@@ -23,4 +23,4 @@ import { extractSelectionState } from "./selectionState.js";
|
|
|
23
23
|
import { StyleResolver, createStyleResolver } from "./styles/styleResolver.js";
|
|
24
24
|
import { assertValidProseMirrorDocument, formatProseMirrorDocumentIssues, validateProseMirrorDocument } from "./validation.js";
|
|
25
25
|
import { TextSelection } from "prosemirror-state";
|
|
26
|
-
export { NO_LIST_NUMBERING_MENU, NO_LIST_STATE, PAINTABLE_MARK_NAMES, StyleResolver, TextSelection, addColumnLeft, addColumnRight, addRowAbove, addRowBelow, addTabStop, alignCenter, alignJustify, alignLeft, alignRight, applyFormatMarks, applyStyle, applyTableStyle, assertValidProseMirrorDocument, autoFitContents, captureFormatMarks, clearFontFamily, clearFontSize, clearFormatting, clearHighlight, clearStyle, clearTextColor, continueNumbering, createDocumentStylesPlugin, createEmptyDoc, createSelectionTrackerPlugin, createStyleResolver, decreaseIndent, decreaseListLevel, deleteColumn, deleteRow, deleteTable, distributeColumns, documentStylesKey, ensureParaIdsInState, extractSelectionContext, extractSelectionState, formatProseMirrorDocumentIssues, fromProseDoc, generateTableOfContents, getDocumentBuiltInStyles, getDocumentStyleResolver, getHyperlinkAttrs, getListInfo, getMarkAttr, getParagraphAlignment, getParagraphBidi, getSelectedText, getSelectionContext, getStyleId, getTableContext, increaseIndent, increaseListLevel, insertHyperlink, insertImageFromFile, insertPageBreak, insertPageBreakInView, insertTable, insertTableInView, insertTableOfContentsInView, isHyperlinkActive, isInList, isInListState, isInTableCell as isInTable, isMarkActive, listNumberingMenuState, listStateLevel, mergeCells, removeHyperlink, removeList, removeTabStop, removeTableBorders, resolveListState, restartNumbering, sameListState, schema, selectColumn, selectRow, selectTable, selectionTrackerKey, setAlignment, setAllTableBorders, setCellBorder, setCellFillColor, setCellMargins, setCellTextDirection, setCellVerticalAlign, setFontFamily, setFontSize, setHighlight, setHyperlink, setIndentFirstLine, setIndentLeft, setIndentRight, setInsideTableBorders, setLineSpacing, setLtr, setNumberingValue, setOutsideTableBorders, setRowHeight, setRtl, setTableBorderColor, setTableBorderPreset, setTableBorderWidth, setTableBorders, setTableProperties, setTextColor, singletonManager, splitCell, toProseDoc, toggleBidi, toggleBold, toggleBulletList, toggleHeaderRow, toggleItalic, toggleNoWrap, toggleNumberedList, toggleStrike, toggleSubscript, toggleSuperscript, toggleUnderline,
|
|
26
|
+
export { NO_LIST_NUMBERING_MENU, NO_LIST_STATE, PAINTABLE_MARK_NAMES, StyleResolver, TextSelection, addColumnLeft, addColumnRight, addRowAbove, addRowBelow, addTabStop, alignCenter, alignJustify, alignLeft, alignRight, applyFormatMarks, applyStyle, applyTableStyle, assertValidProseMirrorDocument, autoFitContents, captureFormatMarks, clearFontFamily, clearFontSize, clearFormatting, clearHighlight, clearStyle, clearTextColor, continueNumbering, createDocumentStylesPlugin, createEmptyDoc, createSelectionTrackerPlugin, createStyleResolver, decreaseIndent, decreaseListLevel, deleteColumn, deleteRow, deleteTable, distributeColumns, documentStylesKey, ensureParaIdsInState, extractSelectionContext, extractSelectionState, formatProseMirrorDocumentIssues, fromProseDoc, generateTableOfContents, getDocumentBuiltInStyles, getDocumentStyleResolver, getHyperlinkAttrs, getListInfo, getMarkAttr, getParagraphAlignment, getParagraphBidi, getSelectedText, getSelectionContext, getStyleId, getTableContext, increaseIndent, increaseListLevel, insertHyperlink, insertImageFromFile, insertPageBreak, insertPageBreakInView, insertTable, insertTableInView, insertTableOfContentsInView, isHyperlinkActive, isInList, isInListState, isInTableCell as isInTable, isMarkActive, listNumberingMenuState, listStateLevel, mergeCells, removeHyperlink, removeList, removeTabStop, removeTableBorders, resolveListState, restartNumbering, sameListState, schema, selectColumn, selectRow, selectTable, selectionTrackerKey, setAlignment, setAllTableBorders, setCellBorder, setCellFillColor, setCellMargins, setCellTextDirection, setCellVerticalAlign, setFontFamily, setFontSize, setHighlight, setHyperlink, setIndentFirstLine, setIndentLeft, setIndentRight, setInsideTableBorders, setLineSpacing, setLtr, setNumberingValue, setOutsideTableBorders, setRowHeight, setRtl, setTableBorderColor, setTableBorderPreset, setTableBorderWidth, setTableBorders, setTableProperties, setTextColor, singletonManager, splitCell, toProseDoc, toggleBidi, toggleBold, toggleBulletList, toggleHeaderRow, toggleItalic, toggleNoWrap, toggleNumberedList, toggleStrike, toggleSubscript, toggleSuperscript, toggleUnderline, validateProseMirrorDocument };
|
|
@@ -12,8 +12,8 @@ import { RANGE_ANCHOR_NODE_NAME } from "./extensions/nodes/RangeAnchorExtension.
|
|
|
12
12
|
import { expectMoveRangeBoundaryAttrs } from "./moveRangeBoundaryAttrs.js";
|
|
13
13
|
import { expectRangeAnchorAttrs } from "./rangeAnchorAttrs.js";
|
|
14
14
|
import { retainedTrackedRevisionMark, trackedRevisionPathOf } from "./trackedRevisionPath.js";
|
|
15
|
-
import { Mark } from "prosemirror-model";
|
|
16
15
|
import { planWellFormedRanges, recordsCopyOrigin } from "@stll/docx-core/ops";
|
|
16
|
+
import { Mark } from "prosemirror-model";
|
|
17
17
|
// src/prosemirror/keptRangeBoundaries.ts
|
|
18
18
|
/**
|
|
19
19
|
* Range boundaries rejecting a change keeps from the content it removes.
|
|
@@ -11,8 +11,8 @@ import { effectiveParagraphNumbering, effectiveParagraphNumberingReference, para
|
|
|
11
11
|
import { directParagraphIndentation } from "./paragraphIndentation.js";
|
|
12
12
|
import { getDocumentNumbering } from "./plugins/documentNumbering.js";
|
|
13
13
|
import { getDocumentStyleResolver } from "./plugins/documentStyleState.js";
|
|
14
|
-
import { SUGGESTION_META, makeRevisionInfo } from "./plugins/suggestionMode.js";
|
|
15
14
|
import { listAttrsFromNumbering, listIndentationProvenancePatch } from "./styles/resolvedStyleAttrs.js";
|
|
15
|
+
import { SUGGESTION_META, makeRevisionInfo } from "./suggestionCommands.js";
|
|
16
16
|
// src/prosemirror/listNumbering.ts
|
|
17
17
|
const PARAGRAPH_NODE = "paragraph";
|
|
18
18
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readFootnoteRefMarkAttrs } from "./attrs/index.js";
|
|
2
2
|
import { Result, TaggedError, panic } from "better-result";
|
|
3
|
-
import { Fragment, Mark, Slice } from "prosemirror-model";
|
|
4
3
|
import { Plugin } from "prosemirror-state";
|
|
4
|
+
import { Fragment, Mark, Slice } from "prosemirror-model";
|
|
5
5
|
import { isHistoryTransaction } from "prosemirror-history";
|
|
6
6
|
// src/prosemirror/noteReferenceOccurrences.ts
|
|
7
7
|
const NoteReferenceEditRefusalBase = TaggedError("NoteReferenceEditRefusal");
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A note goes with its reference. Deleting a note's reference while tracking
|
|
3
|
-
* changes deletes the note's text too, so rejecting that deletion must give
|
|
4
|
-
* the note its text back, whichever surface resolves it: the body editor
|
|
5
|
-
* resolves the reference, and this resolves the note's story to match.
|
|
6
|
-
*/
|
|
1
|
+
/** Read note references and retain the corresponding model stories. */
|
|
7
2
|
import { document_d_exports } from "../types/document.js";
|
|
8
|
-
import {
|
|
9
|
-
import { Transform } from "prosemirror-transform";
|
|
3
|
+
import { Node } from "prosemirror-model";
|
|
10
4
|
type NoteKind = "footnote" | "endnote";
|
|
11
5
|
/** `footnote:<id>` or `endnote:<id>`. */
|
|
12
6
|
export type NoteKey = `${NoteKind}:${number}`;
|
|
@@ -15,54 +9,6 @@ export type NoteKey = `${NoteKind}:${number}`;
|
|
|
15
9
|
* deletion: a reference is deleted when every character of it is.
|
|
16
10
|
*/
|
|
17
11
|
export declare const noteReferenceStates: (doc: Node) => Map<NoteKey, "live" | "deleted">;
|
|
18
|
-
/** The notes whose reference a change took from pending deletion back to live. */
|
|
19
|
-
export declare const noteReferencesRestored: (before: Node, after: Node) => NoteKey[];
|
|
20
|
-
/**
|
|
21
|
-
* The revisions that deleted a note along with its reference: its text and
|
|
22
|
-
* its paragraph marks, deleted by the reference deletion's author at its
|
|
23
|
-
* date. A deletion in the note made some other time is a change of its own,
|
|
24
|
-
* which resolving the reference leaves alone.
|
|
25
|
-
*/
|
|
26
|
-
export declare const noteDeletionRevisions: (doc: Node, reference: Mark) => number[];
|
|
27
|
-
/**
|
|
28
|
-
* The document with the named notes' deletions that went with their
|
|
29
|
-
* reference rejected: the notes whose reference's deletion was rejected get
|
|
30
|
-
* their text back. `before` is the body that still had those deletions.
|
|
31
|
-
*/
|
|
32
|
-
export declare const restoreNotes: (document: document_d_exports.Document, keys: Iterable<NoteKey>, before: Node) => document_d_exports.Document;
|
|
33
|
-
/** The deletion each pending-deleted note reference carries. */
|
|
34
|
-
export declare const referenceDeletions: (doc: Node) => Map<NoteKey, Mark>;
|
|
35
|
-
/**
|
|
36
|
-
* Delete a note's text and its paragraph marks along with its reference: by
|
|
37
|
-
* the reference deletion's author at its date, so resolving the reference
|
|
38
|
-
* resolves them too (see {@link noteDeletionRevisions}).
|
|
39
|
-
*/
|
|
40
|
-
export declare const deleteNoteWithReference: <T extends Transform>(transform: T, reference: Mark) => T;
|
|
41
|
-
/**
|
|
42
|
-
* Keeps an editor's notes following their references across body edits. The
|
|
43
|
-
* editor reports the body as it was before the edits it has not yet written
|
|
44
|
-
* back, and reconciles the document it writes back:
|
|
45
|
-
*
|
|
46
|
-
* - a reference whose deletion is rejected gives its note back its text;
|
|
47
|
-
* - a reference deleted again, as undoing that reject does, takes the note's
|
|
48
|
-
* text with it: the note returns to what it was, or, when the note changed
|
|
49
|
-
* since, its text is deleted along with the reference.
|
|
50
|
-
*/
|
|
51
|
-
export type NoteReferenceFollower = {
|
|
52
|
-
/** The body before the edits the next {@link reconcile} writes back. */
|
|
53
|
-
noteBase: (before: Node) => void;
|
|
54
|
-
/** The document to write back, its notes following the body's references. */
|
|
55
|
-
reconcile: (document: document_d_exports.Document, body: Node) => document_d_exports.Document;
|
|
56
|
-
/**
|
|
57
|
-
* `document` with the note changes an earlier {@link reconcile} wrote back
|
|
58
|
-
* and the editor's document has not taken in yet: a save reads the editor
|
|
59
|
-
* right after a write-back, before the host hands the result back.
|
|
60
|
-
*/
|
|
61
|
-
withPending: (document: document_d_exports.Document) => document_d_exports.Document;
|
|
62
|
-
/** Forget the pending base and what earlier restores replaced (a new document). */
|
|
63
|
-
reset: () => void;
|
|
64
|
-
};
|
|
65
|
-
export declare const createNoteReferenceFollower: () => NoteReferenceFollower;
|
|
66
12
|
/** The notes model content refers to, live or pending deletion. */
|
|
67
13
|
export declare const noteKeysReferencedIn: (content: unknown) => Set<NoteKey>;
|
|
68
14
|
/**
|