@stll/folio-core 0.73.0 → 0.75.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/clean-text.d.ts +4 -1
- package/dist/ai-edits/clean-text.js +21 -7
- package/dist/ai-edits/headless.d.ts +5 -2
- package/dist/ai-edits/headless.js +20 -14
- package/dist/ai-edits/note-references.d.ts +1 -1
- package/dist/ai-edits/note-references.js +1 -1
- package/dist/ai-edits/pending-suggestions.d.ts +9 -7
- package/dist/ai-edits/pending-suggestions.js +134 -88
- package/dist/ai-edits/pendingJoin.d.ts +5 -1
- package/dist/ai-edits/pendingJoin.js +12 -3
- package/dist/ai-edits/result-validation.js +1 -1
- package/dist/ai-edits/retired-comment-receipts.d.ts +2 -2
- package/dist/ai-edits/retired-comment-receipts.js +3 -18
- 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.d.ts +6 -10
- package/dist/ai-edits/tracked-batch-fidelity.js +3 -182
- package/dist/canonical/canonicalBatchReview.d.ts +4 -1
- package/dist/canonical/canonicalBatchReview.js +32 -14
- package/dist/canonical/canonicalComments.d.ts +6 -2
- package/dist/canonical/canonicalComments.js +8 -4
- 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 +99 -36
- package/dist/canonical/canonicalRefusalGrounds.d.ts +4 -0
- package/dist/canonical/canonicalRefusalGrounds.js +56 -0
- package/dist/canonical/canonicalSelection.js +1 -1
- package/dist/canonical/canonicalSession.d.ts +12 -6
- package/dist/canonical/canonicalSession.js +129 -141
- package/dist/canonical/canonicalTrackedBatchFidelity.js +3 -3
- package/dist/compare/inline-atoms.d.ts +35 -41
- package/dist/compare/inline-atoms.js +2 -465
- package/dist/compare/section-boundary-properties.d.ts +3 -30
- package/dist/compare/section-boundary-properties.js +4 -72
- package/dist/controller/autocompleteSuggestion.js +1 -1
- package/dist/controller/canonicalClipboard.js +45 -44
- package/dist/controller/canonicalComposition.d.ts +1 -1
- package/dist/controller/canonicalComposition.js +6 -6
- package/dist/controller/canonicalInput.d.ts +4 -2
- package/dist/controller/canonicalInput.js +34 -17
- package/dist/controller/canonicalPresence.js +1 -1
- package/dist/controller/canonicalRoomAuthority.js +1 -1
- package/dist/controller/canonicalRoomWire.js +1 -1
- package/dist/controller/canonicalStoryEditor.d.ts +2 -3
- package/dist/controller/canonicalStoryEditor.js +43 -25
- package/dist/controller/canonicalStructure.d.ts +19 -2
- package/dist/controller/canonicalStructure.js +140 -43
- package/dist/controller/canonicalTabRoom.js +1 -1
- package/dist/controller/canonicalYjsRoom.js +1 -1
- package/dist/controller/deferredDisplayListPainter.d.ts +8 -0
- package/dist/controller/deferredDisplayListPainter.js +34 -0
- package/dist/controller/folioEditor.js +4 -2
- package/dist/controller/headerFooterEditorManager.js +3 -17
- package/dist/controller/hiddenEditorApi.d.ts +24 -3
- package/dist/controller/hiddenEditorApi.js +4 -17
- package/dist/controller/hiddenEditorManager.js +136 -197
- package/dist/controller/layoutPipeline.d.ts +4 -86
- package/dist/controller/layoutPipeline.js +8 -727
- package/dist/controller/layoutPipelineExecution.d.ts +94 -0
- package/dist/controller/layoutPipelineExecution.js +730 -0
- package/dist/controller/noteEditorManager.js +3 -16
- package/dist/document-operations.js +1 -1
- package/dist/docx/blockContentParser.d.ts +1 -3
- package/dist/docx/blockContentParser.js +3 -10
- package/dist/docx/canonicalSave.d.ts +4 -3
- package/dist/docx/canonicalSave.js +4 -3
- 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/listMarkerComputation.d.ts +24 -17
- package/dist/docx/listMarkerComputation.js +31 -60
- package/dist/docx/listModelNormalization.js +8 -15
- 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 +16 -3
- package/dist/docx/rezip.js +36 -10
- package/dist/docx/selectiveSave.js +13 -5
- 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 +107 -14
- package/dist/docx/server/templatePlan/blocks.d.ts +16 -1
- package/dist/docx/server/templatePlan/blocks.js +93 -7
- package/dist/docx/server/templatePlan/builders.d.ts +37 -2
- package/dist/docx/server/templatePlan/builders.js +196 -5
- package/dist/docx/server/templatePlan/emit.d.ts +2 -0
- package/dist/docx/server/templatePlan/emit.js +2 -0
- package/dist/docx/server/templatePlan/inspect.js +81 -61
- package/dist/docx/server/templatePlan/labels.d.ts +16 -2
- package/dist/docx/server/templatePlan/labels.js +131 -20
- package/dist/docx/server/templatePlan/plan.d.ts +15 -1
- package/dist/docx/server/templatePlan/plan.js +62 -13
- package/dist/docx/server/templatePlan/planShape.js +52 -4
- package/dist/docx/server/templatePlan/story.d.ts +8 -0
- package/dist/docx/server/templatePlan/story.js +11 -1
- package/dist/docx/server/templatePlan/types.d.ts +176 -18
- package/dist/docx/server/templatePlan/types.js +1 -0
- package/dist/docx/server/templatePlan/verify.js +60 -11
- 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/ar.gen.js +1 -0
- package/dist/i18n/messages/catalogs.gen.d.ts +17 -0
- package/dist/i18n/messages/catalogs.gen.js +17 -0
- package/dist/i18n/messages/cs.gen.js +1 -0
- package/dist/i18n/messages/de.gen.js +1 -0
- package/dist/i18n/messages/en.gen.js +1 -0
- package/dist/i18n/messages/es.gen.js +1 -0
- package/dist/i18n/messages/et.gen.js +1 -0
- package/dist/i18n/messages/fr.gen.js +1 -0
- package/dist/i18n/messages/he.gen.js +1 -0
- package/dist/i18n/messages/hi.gen.js +1 -0
- package/dist/i18n/messages/hu.gen.js +1 -0
- package/dist/i18n/messages/lt.gen.js +1 -0
- package/dist/i18n/messages/lv.gen.js +1 -0
- package/dist/i18n/messages/messages.gen.d.ts +1 -0
- package/dist/i18n/messages/pl.gen.js +1 -0
- package/dist/i18n/messages/pt-BR.gen.js +1 -0
- package/dist/i18n/messages/sk.gen.js +1 -0
- package/dist/i18n/messages/tr.gen.js +1 -0
- package/dist/i18n/messages/zh-CN.gen.js +1 -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/layout-bridge/convert/toFlowBlocks.js +0 -12
- package/dist/layout-bridge/convert/topLevelConversion.js +1 -10
- 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/ImagePasteExtension.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/listMarker.d.ts +1 -6
- package/dist/prosemirror/listMarker.js +4 -56
- 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/server.d.ts +2 -2
- package/dist/types/canonicalCapabilities.d.ts +42 -93
- package/dist/types/canonicalCapabilities.js +53 -91
- package/dist/types/canonicalComments.d.ts +2 -2
- package/dist/types/canonicalSections.d.ts +2 -2
- package/dist/utils/clipboard.d.ts +2 -28
- package/dist/utils/clipboard.js +1 -96
- package/dist/utils/clipboardFiles.d.ts +27 -0
- package/dist/utils/clipboardFiles.js +98 -0
- package/dist/utils/rulerControl.d.ts +1 -0
- package/dist/utils/rulerControl.js +2 -1
- 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
|
@@ -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.
|
|
@@ -5,13 +5,8 @@ import { ParagraphAttrs } from "./schema/nodes.js";
|
|
|
5
5
|
export type ListCounterState = {
|
|
6
6
|
counters: Map<number, number[]>;
|
|
7
7
|
abstractCounters: Map<number, number[]>;
|
|
8
|
+
/** The levels of list instances a paragraph has used, as `numId:level`. */
|
|
8
9
|
seenLevels: Set<string>;
|
|
9
|
-
restartedNumIds?: Set<number>;
|
|
10
|
-
previousList?: {
|
|
11
|
-
abstractNumId: number | null;
|
|
12
|
-
fromStyle: boolean;
|
|
13
|
-
numId: number | null;
|
|
14
|
-
};
|
|
15
10
|
lastAdvancedNumId?: number;
|
|
16
11
|
};
|
|
17
12
|
export type ListCounterStreams = {
|
|
@@ -30,13 +30,7 @@ function createListCounterState() {
|
|
|
30
30
|
return {
|
|
31
31
|
counters: /* @__PURE__ */ new Map(),
|
|
32
32
|
abstractCounters: /* @__PURE__ */ new Map(),
|
|
33
|
-
seenLevels: /* @__PURE__ */ new Set()
|
|
34
|
-
restartedNumIds: /* @__PURE__ */ new Set(),
|
|
35
|
-
previousList: {
|
|
36
|
-
abstractNumId: null,
|
|
37
|
-
fromStyle: false,
|
|
38
|
-
numId: null
|
|
39
|
-
}
|
|
33
|
+
seenLevels: /* @__PURE__ */ new Set()
|
|
40
34
|
};
|
|
41
35
|
}
|
|
42
36
|
function cloneListCounterState(state) {
|
|
@@ -56,12 +50,6 @@ function cloneListCounterState(state) {
|
|
|
56
50
|
counters,
|
|
57
51
|
abstractCounters,
|
|
58
52
|
seenLevels: new Set(state.seenLevels),
|
|
59
|
-
restartedNumIds: new Set(state.restartedNumIds ?? []),
|
|
60
|
-
previousList: { ...state.previousList ?? {
|
|
61
|
-
abstractNumId: null,
|
|
62
|
-
fromStyle: false,
|
|
63
|
-
numId: null
|
|
64
|
-
} },
|
|
65
53
|
...state.lastAdvancedNumId !== void 0 ? { lastAdvancedNumId: state.lastAdvancedNumId } : {}
|
|
66
54
|
};
|
|
67
55
|
}
|
|
@@ -142,14 +130,7 @@ function formatNumberedMarker(counters, level) {
|
|
|
142
130
|
return parts.length === 0 ? "1." : `${parts.join(".")}.`;
|
|
143
131
|
}
|
|
144
132
|
function advanceListMarker(attrs, state) {
|
|
145
|
-
if (!hasListRendering(attrs))
|
|
146
|
-
state.previousList = {
|
|
147
|
-
abstractNumId: null,
|
|
148
|
-
fromStyle: false,
|
|
149
|
-
numId: null
|
|
150
|
-
};
|
|
151
|
-
return null;
|
|
152
|
-
}
|
|
133
|
+
if (!hasListRendering(attrs)) return null;
|
|
153
134
|
const markerTemplate = attrs.listMarkerTemplate ?? attrs.listMarker;
|
|
154
135
|
const foldedMarkerSuffix = attrs.listFoldedMarkerSuffix ?? void 0;
|
|
155
136
|
const effectiveNumbering = effectiveParagraphNumbering(paragraphNumberingSourcesFromBoundary({
|
|
@@ -170,44 +151,16 @@ function advanceListMarker(attrs, state) {
|
|
|
170
151
|
forceDecimal: attrs.listIsLegal
|
|
171
152
|
});
|
|
172
153
|
}
|
|
173
|
-
state.previousList = {
|
|
174
|
-
abstractNumId: null,
|
|
175
|
-
fromStyle: false,
|
|
176
|
-
numId: null
|
|
177
|
-
};
|
|
178
154
|
return marker;
|
|
179
155
|
}
|
|
180
156
|
if (attrs.listIsBullet) {
|
|
181
|
-
state.previousList = {
|
|
182
|
-
abstractNumId: null,
|
|
183
|
-
fromStyle: false,
|
|
184
|
-
numId: null
|
|
185
|
-
};
|
|
186
157
|
if (foldedMarkerSuffix !== void 0 && attrs.listMarkerTemplate == null) return attrs.listMarker ?? null;
|
|
187
158
|
const marker = convertBulletToUnicode(attrs.listMarkerTemplate ?? attrs.listMarker ?? "", bulletMarkerFontName(attrs.listMarkerFormatting));
|
|
188
159
|
return foldedMarkerSuffix === void 0 ? marker : `${marker}\t${foldedMarkerSuffix}`;
|
|
189
160
|
}
|
|
190
|
-
const firstInstanceEncounter = !state.counters.has(numId);
|
|
191
|
-
let counters = state.counters.get(numId) ?? Array.from({ length: 9 }, () => NaN);
|
|
192
161
|
const abstractNumId = attrs.listAbstractNumId;
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
fromStyle: false,
|
|
196
|
-
numId: null
|
|
197
|
-
};
|
|
198
|
-
const restartedNumIds = state.restartedNumIds ??= /* @__PURE__ */ new Set();
|
|
199
|
-
const latestAbstractCounters = abstractNumId === void 0 ? void 0 : state.abstractCounters.get(abstractNumId);
|
|
200
|
-
const styleNumbering = attrs.numPr?.kind !== "reference" && attrs.numPrFromStyle?.kind === "reference";
|
|
201
|
-
const resumesRestartedInstance = firstInstanceEncounter && attrs.listStartOverride == null && abstractNumId !== void 0 && previousList.abstractNumId === abstractNumId && previousList.numId !== null && previousList.numId !== numId && restartedNumIds.has(previousList.numId);
|
|
202
|
-
const resumesStyleInstance = firstInstanceEncounter && !styleNumbering && attrs.listStartOverride == null && abstractNumId !== void 0 && previousList.abstractNumId === abstractNumId && previousList.fromStyle;
|
|
203
|
-
if (latestAbstractCounters && (styleNumbering || resumesRestartedInstance || resumesStyleInstance)) counters = latestAbstractCounters;
|
|
204
|
-
if (attrs.listStartOverride != null || resumesRestartedInstance || previousList.numId === numId && restartedNumIds.has(numId)) restartedNumIds.add(numId);
|
|
205
|
-
if (level > 0) {
|
|
206
|
-
if (counters.slice(0, level).every((counter) => !Number.isFinite(counter))) for (let index = 0; index < level; index += 1) {
|
|
207
|
-
const latestCounter = latestAbstractCounters?.[index];
|
|
208
|
-
counters[index] = latestCounter !== void 0 && Number.isFinite(latestCounter) ? latestCounter : attrs.listLevelStarts?.[index] ?? 1;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
162
|
+
const counters = (abstractNumId === void 0 ? void 0 : state.abstractCounters.get(abstractNumId)) ?? state.counters.get(numId) ?? Array.from({ length: 9 }, () => NaN);
|
|
163
|
+
for (let index = 0; index < level; index += 1) if (!Number.isFinite(counters[index])) counters[index] = attrs.listLevelStarts?.[index] ?? 1;
|
|
211
164
|
const seenKey = `${numId}:${level}`;
|
|
212
165
|
if (!state.seenLevels.has(seenKey)) {
|
|
213
166
|
state.seenLevels.add(seenKey);
|
|
@@ -224,11 +177,6 @@ function advanceListMarker(attrs, state) {
|
|
|
224
177
|
state.counters.set(numId, counters);
|
|
225
178
|
state.lastAdvancedNumId = numId;
|
|
226
179
|
if (abstractNumId !== void 0) state.abstractCounters.set(abstractNumId, counters);
|
|
227
|
-
state.previousList = {
|
|
228
|
-
abstractNumId: abstractNumId ?? null,
|
|
229
|
-
fromStyle: Boolean(styleNumbering),
|
|
230
|
-
numId
|
|
231
|
-
};
|
|
232
180
|
const levelFormats = attrs.listLevelNumFmts ?? (attrs.listNumFmt ? [attrs.listNumFmt] : void 0);
|
|
233
181
|
if (markerTemplate?.includes("%") && (foldedMarkerSuffix === void 0 || attrs.listMarkerTemplate != null)) {
|
|
234
182
|
const marker = resolveListTemplate({
|
|
@@ -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
|
/**
|