@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
|
@@ -1,20 +1,9 @@
|
|
|
1
1
|
/** Remaining seams to retire before the canonical session becomes the only authority. */
|
|
2
2
|
export declare const CANONICAL_GAP: {
|
|
3
|
-
readonly authorityRouting: "authority-routing";
|
|
4
3
|
readonly commands: "command-descriptors";
|
|
5
4
|
readonly trackedTableStructure: "tracked-table-structure";
|
|
6
5
|
readonly storyContentProjection: "story-content-projection";
|
|
7
|
-
readonly
|
|
8
|
-
readonly modelEdits: "direct-model-edits";
|
|
9
|
-
readonly sectionProperties: "section-properties";
|
|
10
|
-
readonly dispatch: "unclassified-transactions";
|
|
11
|
-
readonly save: "pm-save-projection";
|
|
12
|
-
readonly history: "pm-history";
|
|
13
|
-
readonly suggestionPlugin: "pm-suggestion-plugin";
|
|
14
|
-
readonly paragraphTracker: "pm-paragraph-tracker";
|
|
15
|
-
readonly tableGeometry: "pm-table-geometry";
|
|
16
|
-
readonly paragraphIdentity: "pm-paragraph-identity";
|
|
17
|
-
readonly documentOperations: "pm-document-operations";
|
|
6
|
+
readonly trackedChangeRecords: "tracked-change-records";
|
|
18
7
|
readonly publicComments: "publicOps.comments";
|
|
19
8
|
readonly publicUnsupportedInline: "publicOps.unsupportedInline";
|
|
20
9
|
readonly commentReplacementAlignment: "comment-replacement-alignment";
|
|
@@ -35,39 +24,63 @@ export declare const CANONICAL_RULE_MESSAGE_KEYS: {
|
|
|
35
24
|
readonly contentControlLock: "editor.contentLocked";
|
|
36
25
|
readonly linkSuggestionShape: "editor.linkSuggestionUnavailable";
|
|
37
26
|
};
|
|
27
|
+
/**
|
|
28
|
+
* Conditions of the session or of the request, not of the document: the
|
|
29
|
+
* session holds the capability, but cannot make this change now or was not
|
|
30
|
+
* asked for one it can make. A refusal under one is correct and is never a gap
|
|
31
|
+
* to retire.
|
|
32
|
+
*/
|
|
33
|
+
export declare const CANONICAL_CONDITION: {
|
|
34
|
+
readonly notReady: "notReady";
|
|
35
|
+
readonly notEditable: "notEditable";
|
|
36
|
+
readonly composing: "composing";
|
|
37
|
+
readonly invalidRequest: "invalidRequest";
|
|
38
|
+
readonly idSpace: "idSpace";
|
|
39
|
+
readonly stale: "stale";
|
|
40
|
+
readonly hostTransaction: "hostTransaction";
|
|
41
|
+
readonly internal: "internal";
|
|
42
|
+
};
|
|
43
|
+
export type CanonicalCondition = (typeof CANONICAL_CONDITION)[keyof typeof CANONICAL_CONDITION];
|
|
38
44
|
/**
|
|
39
45
|
* The editor message, in the folio catalog, a host shows for a refusal under
|
|
40
46
|
* any gap: the change cannot be made here yet.
|
|
41
47
|
*/
|
|
42
48
|
export declare const CANONICAL_GAP_MESSAGE_KEY: "editor.changeUnavailable";
|
|
49
|
+
/**
|
|
50
|
+
* The editor message, in the folio catalog, a host shows for a refusal under
|
|
51
|
+
* any condition: the change was not made.
|
|
52
|
+
*/
|
|
53
|
+
export declare const CANONICAL_CONDITION_MESSAGE_KEY: "editor.changeNotApplied";
|
|
43
54
|
/** A catalog key a refusal notice reads. */
|
|
44
|
-
export type CanonicalRefusalMessageKey = (typeof CANONICAL_RULE_MESSAGE_KEYS)[CanonicalRule] | typeof CANONICAL_GAP_MESSAGE_KEY;
|
|
55
|
+
export type CanonicalRefusalMessageKey = (typeof CANONICAL_RULE_MESSAGE_KEYS)[CanonicalRule] | typeof CANONICAL_GAP_MESSAGE_KEY | typeof CANONICAL_CONDITION_MESSAGE_KEY;
|
|
45
56
|
/**
|
|
46
57
|
* What a host shows for a refusal, always from the folio catalog, which the
|
|
47
58
|
* host translates: the editor's own message for a rule the document states,
|
|
48
|
-
*
|
|
49
|
-
*
|
|
59
|
+
* that the change was not made for a condition, and that the change cannot be
|
|
60
|
+
* made here yet for a gap. The session's own message describes the refusal
|
|
61
|
+
* for logs and `onError`, never for the user.
|
|
50
62
|
*/
|
|
51
63
|
export declare const canonicalRefusalNotice: (ground: CanonicalRefusalGround, translate: (key: CanonicalRefusalMessageKey) => string) => string;
|
|
52
64
|
/**
|
|
53
|
-
* The ground for a refusal: a capability the session does not have yet,
|
|
54
|
-
* rule the document or its review records state
|
|
55
|
-
*
|
|
65
|
+
* The ground for a refusal: a capability the session does not have yet, a
|
|
66
|
+
* rule the document or its review records state, or a condition of the
|
|
67
|
+
* session or the request. A host tells "not supported yet" from "not allowed"
|
|
68
|
+
* from "not now" by which one is present.
|
|
56
69
|
*/
|
|
57
70
|
export type CanonicalRefusalGround = {
|
|
58
71
|
gap: CanonicalGap;
|
|
59
72
|
rule?: never;
|
|
73
|
+
condition?: never;
|
|
60
74
|
} | {
|
|
61
75
|
rule: CanonicalRule;
|
|
62
76
|
gap?: never;
|
|
77
|
+
condition?: never;
|
|
78
|
+
} | {
|
|
79
|
+
condition: CanonicalCondition;
|
|
80
|
+
gap?: never;
|
|
81
|
+
rule?: never;
|
|
63
82
|
};
|
|
64
83
|
export declare const CANONICAL_CAPABILITIES: {
|
|
65
|
-
readonly "authority-routing": {
|
|
66
|
-
readonly owner: "controller";
|
|
67
|
-
readonly kind: "routing";
|
|
68
|
-
readonly adapters: readonly ["react", "vue"];
|
|
69
|
-
readonly summary: "Explicit session selection and legacy authority routing.";
|
|
70
|
-
};
|
|
71
84
|
readonly "command-descriptors": {
|
|
72
85
|
readonly remainingCommands: {
|
|
73
86
|
readonly registry: "extension-commands";
|
|
@@ -89,83 +102,20 @@ export declare const CANONICAL_CAPABILITIES: {
|
|
|
89
102
|
readonly adapters: readonly ["react", "vue"];
|
|
90
103
|
readonly summary: "Unsupported inline, field and review content cannot be projected after canonical edits; pasted embedded blocks, comment and note references copied outside the editor, and compositions over such content refuse.";
|
|
91
104
|
};
|
|
92
|
-
readonly "
|
|
93
|
-
readonly owner: "adapters";
|
|
94
|
-
readonly kind: "routing";
|
|
95
|
-
readonly adapters: readonly ["react", "vue"];
|
|
96
|
-
readonly summary: "Legacy sessions retain comment model edits; canonical comments use semantic operations.";
|
|
97
|
-
};
|
|
98
|
-
readonly "direct-model-edits": {
|
|
99
|
-
readonly owner: "adapters";
|
|
100
|
-
readonly kind: "refusal";
|
|
101
|
-
readonly adapters: readonly ["react", "vue"];
|
|
102
|
-
readonly summary: "Direct model and pending-suggestion snapshots bypass the canonical journal.";
|
|
103
|
-
};
|
|
104
|
-
readonly "section-properties": {
|
|
105
|
-
readonly owner: "controller";
|
|
106
|
-
readonly kind: "routing";
|
|
107
|
-
readonly adapters: readonly ["react", "vue"];
|
|
108
|
-
readonly summary: "The shared controller journals section properties; legacy sessions keep model changes.";
|
|
109
|
-
};
|
|
110
|
-
readonly "unclassified-transactions": {
|
|
111
|
-
readonly owner: "controller";
|
|
112
|
-
readonly kind: "refusal";
|
|
113
|
-
readonly adapters: readonly ["react", "vue"];
|
|
114
|
-
readonly summary: "A host plugin or raw dispatch that changes the document is refused, naming the transaction's meta keys; hosts express edits as document operations (applyDocumentOperations).";
|
|
115
|
-
};
|
|
116
|
-
readonly "pm-save-projection": {
|
|
117
|
-
readonly owner: "controller";
|
|
118
|
-
readonly kind: "routing";
|
|
119
|
-
readonly adapters: readonly ["react", "vue"];
|
|
120
|
-
readonly summary: "Legacy save and read paths reconstruct documents from PM.";
|
|
121
|
-
};
|
|
122
|
-
readonly "pm-history": {
|
|
123
|
-
readonly owner: "prosemirror";
|
|
124
|
-
readonly kind: "mutation-source";
|
|
125
|
-
readonly adapters: readonly ["react", "vue"];
|
|
126
|
-
readonly summary: "PM history remains installed for legacy sessions.";
|
|
127
|
-
};
|
|
128
|
-
readonly "pm-suggestion-plugin": {
|
|
129
|
-
readonly owner: "prosemirror";
|
|
130
|
-
readonly kind: "mutation-source";
|
|
131
|
-
readonly adapters: readonly ["react", "vue"];
|
|
132
|
-
readonly summary: "The legacy suggestion plugin produces PM transactions.";
|
|
133
|
-
};
|
|
134
|
-
readonly "pm-paragraph-tracker": {
|
|
135
|
-
readonly owner: "prosemirror";
|
|
136
|
-
readonly kind: "mutation-source";
|
|
137
|
-
readonly adapters: readonly ["react", "vue"];
|
|
138
|
-
readonly summary: "Dirty tracking and section bookkeeping still observe PM transactions.";
|
|
139
|
-
};
|
|
140
|
-
readonly "pm-table-geometry": {
|
|
141
|
-
readonly owner: "prosemirror";
|
|
142
|
-
readonly kind: "mutation-source";
|
|
143
|
-
readonly adapters: readonly ["react", "vue"];
|
|
144
|
-
readonly summary: "Table geometry, resize and repair still produce PM transactions.";
|
|
145
|
-
};
|
|
146
|
-
readonly "pm-paragraph-identity": {
|
|
147
|
-
readonly owner: "prosemirror";
|
|
148
|
-
readonly kind: "mutation-source";
|
|
149
|
-
readonly adapters: readonly ["react", "vue"];
|
|
150
|
-
readonly summary: "Legacy paragraph identity repair remains a PM append transaction.";
|
|
151
|
-
};
|
|
152
|
-
readonly "pm-document-operations": {
|
|
105
|
+
readonly "tracked-change-records": {
|
|
153
106
|
readonly owner: "document-operations";
|
|
154
|
-
readonly
|
|
155
|
-
readonly kind: "mutation-source";
|
|
107
|
+
readonly kind: "refusal";
|
|
156
108
|
readonly adapters: readonly ["react", "vue"];
|
|
157
|
-
readonly summary: "
|
|
109
|
+
readonly summary: "A suggested change whose content the tracked-change records cannot express is refused: comment boundaries in a tracked range, paragraph-mark run properties, a join at a section break, a record inside a field.";
|
|
158
110
|
};
|
|
159
111
|
readonly "publicOps.comments": {
|
|
160
112
|
readonly owner: "document-operations";
|
|
161
|
-
readonly
|
|
162
|
-
readonly kind: "routing";
|
|
113
|
+
readonly kind: "refusal";
|
|
163
114
|
readonly adapters: readonly ["react", "vue"];
|
|
164
|
-
readonly summary: "
|
|
115
|
+
readonly summary: "Public comment edits refuse when their anchors or revision structure cannot be represented.";
|
|
165
116
|
};
|
|
166
117
|
readonly "publicOps.unsupportedInline": {
|
|
167
118
|
readonly owner: "document-operations";
|
|
168
|
-
readonly legacySessionMutation: "pm-public-operations";
|
|
169
119
|
readonly kind: "refusal";
|
|
170
120
|
readonly adapters: readonly ["react", "vue"];
|
|
171
121
|
readonly summary: "Unsupported public payloads refuse with a typed compiler capability gap.";
|
|
@@ -178,7 +128,6 @@ export declare const CANONICAL_CAPABILITIES: {
|
|
|
178
128
|
};
|
|
179
129
|
readonly "publicOps.headlessSession": {
|
|
180
130
|
readonly owner: "document-operations";
|
|
181
|
-
readonly legacySessionMutation: "canonical";
|
|
182
131
|
readonly kind: "refusal";
|
|
183
132
|
readonly adapters: readonly ["react", "vue"];
|
|
184
133
|
readonly summary: "A reviewer refuses to resolve one story of a suggestion that reaches several, which resolves only whole.";
|
|
@@ -1,21 +1,10 @@
|
|
|
1
1
|
// src/types/canonicalCapabilities.ts
|
|
2
2
|
/** Remaining seams to retire before the canonical session becomes the only authority. */
|
|
3
3
|
const CANONICAL_GAP = {
|
|
4
|
-
authorityRouting: "authority-routing",
|
|
5
4
|
commands: "command-descriptors",
|
|
6
5
|
trackedTableStructure: "tracked-table-structure",
|
|
7
6
|
storyContentProjection: "story-content-projection",
|
|
8
|
-
|
|
9
|
-
modelEdits: "direct-model-edits",
|
|
10
|
-
sectionProperties: "section-properties",
|
|
11
|
-
dispatch: "unclassified-transactions",
|
|
12
|
-
save: "pm-save-projection",
|
|
13
|
-
history: "pm-history",
|
|
14
|
-
suggestionPlugin: "pm-suggestion-plugin",
|
|
15
|
-
paragraphTracker: "pm-paragraph-tracker",
|
|
16
|
-
tableGeometry: "pm-table-geometry",
|
|
17
|
-
paragraphIdentity: "pm-paragraph-identity",
|
|
18
|
-
documentOperations: "pm-document-operations",
|
|
7
|
+
trackedChangeRecords: "tracked-change-records",
|
|
19
8
|
publicComments: "publicOps.comments",
|
|
20
9
|
publicUnsupportedInline: "publicOps.unsupportedInline",
|
|
21
10
|
commentReplacementAlignment: "comment-replacement-alignment",
|
|
@@ -42,24 +31,61 @@ const CANONICAL_RULE_MESSAGE_KEYS = {
|
|
|
42
31
|
linkSuggestionShape: "editor.linkSuggestionUnavailable"
|
|
43
32
|
};
|
|
44
33
|
/**
|
|
34
|
+
* Conditions of the session or of the request, not of the document: the
|
|
35
|
+
* session holds the capability, but cannot make this change now or was not
|
|
36
|
+
* asked for one it can make. A refusal under one is correct and is never a gap
|
|
37
|
+
* to retire.
|
|
38
|
+
*/
|
|
39
|
+
const CANONICAL_CONDITION = {
|
|
40
|
+
/** No session holds a document yet, or the editor showing it has closed. */
|
|
41
|
+
notReady: "notReady",
|
|
42
|
+
/** The editor is read-only. */
|
|
43
|
+
notEditable: "notEditable",
|
|
44
|
+
/** An input composition must finish first. */
|
|
45
|
+
composing: "composing",
|
|
46
|
+
/**
|
|
47
|
+
* The request names nothing in the document or describes no change the
|
|
48
|
+
* document allows, such as a reply to a missing comment.
|
|
49
|
+
*/
|
|
50
|
+
invalidRequest: "invalidRequest",
|
|
51
|
+
/** No id is left to mint, in the document or in this author's lease. */
|
|
52
|
+
idSpace: "idSpace",
|
|
53
|
+
/** The projection, version or lease the change was prepared against moved on. */
|
|
54
|
+
stale: "stale",
|
|
55
|
+
/**
|
|
56
|
+
* A plugin or raw dispatch changed the document outside document
|
|
57
|
+
* operations; hosts express edits through `applyDocumentOperations`.
|
|
58
|
+
*/
|
|
59
|
+
hostTransaction: "hostTransaction",
|
|
60
|
+
/**
|
|
61
|
+
* The session failed to project or stage the change: a defect to report,
|
|
62
|
+
* not a missing capability.
|
|
63
|
+
*/
|
|
64
|
+
internal: "internal"
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
45
67
|
* The editor message, in the folio catalog, a host shows for a refusal under
|
|
46
68
|
* any gap: the change cannot be made here yet.
|
|
47
69
|
*/
|
|
48
70
|
const CANONICAL_GAP_MESSAGE_KEY = "editor.changeUnavailable";
|
|
49
71
|
/**
|
|
72
|
+
* The editor message, in the folio catalog, a host shows for a refusal under
|
|
73
|
+
* any condition: the change was not made.
|
|
74
|
+
*/
|
|
75
|
+
const CANONICAL_CONDITION_MESSAGE_KEY = "editor.changeNotApplied";
|
|
76
|
+
/**
|
|
50
77
|
* What a host shows for a refusal, always from the folio catalog, which the
|
|
51
78
|
* host translates: the editor's own message for a rule the document states,
|
|
52
|
-
*
|
|
53
|
-
*
|
|
79
|
+
* that the change was not made for a condition, and that the change cannot be
|
|
80
|
+
* made here yet for a gap. The session's own message describes the refusal
|
|
81
|
+
* for logs and `onError`, never for the user.
|
|
54
82
|
*/
|
|
55
|
-
const canonicalRefusalNotice = (ground, translate) =>
|
|
83
|
+
const canonicalRefusalNotice = (ground, translate) => {
|
|
84
|
+
if (ground.rule !== void 0) return translate(CANONICAL_RULE_MESSAGE_KEYS[ground.rule]);
|
|
85
|
+
if (ground.condition !== void 0) return translate(CANONICAL_CONDITION_MESSAGE_KEY);
|
|
86
|
+
return translate(CANONICAL_GAP_MESSAGE_KEY);
|
|
87
|
+
};
|
|
56
88
|
const CANONICAL_CAPABILITIES = {
|
|
57
|
-
[CANONICAL_GAP.authorityRouting]: {
|
|
58
|
-
owner: "controller",
|
|
59
|
-
kind: "routing",
|
|
60
|
-
adapters: ["react", "vue"],
|
|
61
|
-
summary: "Explicit session selection and legacy authority routing."
|
|
62
|
-
},
|
|
63
89
|
[CANONICAL_GAP.commands]: {
|
|
64
90
|
remainingCommands: { registry: "extension-commands" },
|
|
65
91
|
owner: "controller",
|
|
@@ -79,83 +105,20 @@ const CANONICAL_CAPABILITIES = {
|
|
|
79
105
|
adapters: ["react", "vue"],
|
|
80
106
|
summary: "Unsupported inline, field and review content cannot be projected after canonical edits; pasted embedded blocks, comment and note references copied outside the editor, and compositions over such content refuse."
|
|
81
107
|
},
|
|
82
|
-
[CANONICAL_GAP.
|
|
83
|
-
owner: "adapters",
|
|
84
|
-
kind: "routing",
|
|
85
|
-
adapters: ["react", "vue"],
|
|
86
|
-
summary: "Legacy sessions retain comment model edits; canonical comments use semantic operations."
|
|
87
|
-
},
|
|
88
|
-
[CANONICAL_GAP.modelEdits]: {
|
|
89
|
-
owner: "adapters",
|
|
90
|
-
kind: "refusal",
|
|
91
|
-
adapters: ["react", "vue"],
|
|
92
|
-
summary: "Direct model and pending-suggestion snapshots bypass the canonical journal."
|
|
93
|
-
},
|
|
94
|
-
[CANONICAL_GAP.sectionProperties]: {
|
|
95
|
-
owner: "controller",
|
|
96
|
-
kind: "routing",
|
|
97
|
-
adapters: ["react", "vue"],
|
|
98
|
-
summary: "The shared controller journals section properties; legacy sessions keep model changes."
|
|
99
|
-
},
|
|
100
|
-
[CANONICAL_GAP.dispatch]: {
|
|
101
|
-
owner: "controller",
|
|
102
|
-
kind: "refusal",
|
|
103
|
-
adapters: ["react", "vue"],
|
|
104
|
-
summary: "A host plugin or raw dispatch that changes the document is refused, naming the transaction's meta keys; hosts express edits as document operations (applyDocumentOperations)."
|
|
105
|
-
},
|
|
106
|
-
[CANONICAL_GAP.save]: {
|
|
107
|
-
owner: "controller",
|
|
108
|
-
kind: "routing",
|
|
109
|
-
adapters: ["react", "vue"],
|
|
110
|
-
summary: "Legacy save and read paths reconstruct documents from PM."
|
|
111
|
-
},
|
|
112
|
-
[CANONICAL_GAP.history]: {
|
|
113
|
-
owner: "prosemirror",
|
|
114
|
-
kind: "mutation-source",
|
|
115
|
-
adapters: ["react", "vue"],
|
|
116
|
-
summary: "PM history remains installed for legacy sessions."
|
|
117
|
-
},
|
|
118
|
-
[CANONICAL_GAP.suggestionPlugin]: {
|
|
119
|
-
owner: "prosemirror",
|
|
120
|
-
kind: "mutation-source",
|
|
121
|
-
adapters: ["react", "vue"],
|
|
122
|
-
summary: "The legacy suggestion plugin produces PM transactions."
|
|
123
|
-
},
|
|
124
|
-
[CANONICAL_GAP.paragraphTracker]: {
|
|
125
|
-
owner: "prosemirror",
|
|
126
|
-
kind: "mutation-source",
|
|
127
|
-
adapters: ["react", "vue"],
|
|
128
|
-
summary: "Dirty tracking and section bookkeeping still observe PM transactions."
|
|
129
|
-
},
|
|
130
|
-
[CANONICAL_GAP.tableGeometry]: {
|
|
131
|
-
owner: "prosemirror",
|
|
132
|
-
kind: "mutation-source",
|
|
133
|
-
adapters: ["react", "vue"],
|
|
134
|
-
summary: "Table geometry, resize and repair still produce PM transactions."
|
|
135
|
-
},
|
|
136
|
-
[CANONICAL_GAP.paragraphIdentity]: {
|
|
137
|
-
owner: "prosemirror",
|
|
138
|
-
kind: "mutation-source",
|
|
139
|
-
adapters: ["react", "vue"],
|
|
140
|
-
summary: "Legacy paragraph identity repair remains a PM append transaction."
|
|
141
|
-
},
|
|
142
|
-
[CANONICAL_GAP.documentOperations]: {
|
|
108
|
+
[CANONICAL_GAP.trackedChangeRecords]: {
|
|
143
109
|
owner: "document-operations",
|
|
144
|
-
|
|
145
|
-
kind: "mutation-source",
|
|
110
|
+
kind: "refusal",
|
|
146
111
|
adapters: ["react", "vue"],
|
|
147
|
-
summary: "
|
|
112
|
+
summary: "A suggested change whose content the tracked-change records cannot express is refused: comment boundaries in a tracked range, paragraph-mark run properties, a join at a section break, a record inside a field."
|
|
148
113
|
},
|
|
149
114
|
[CANONICAL_GAP.publicComments]: {
|
|
150
115
|
owner: "document-operations",
|
|
151
|
-
|
|
152
|
-
kind: "routing",
|
|
116
|
+
kind: "refusal",
|
|
153
117
|
adapters: ["react", "vue"],
|
|
154
|
-
summary: "
|
|
118
|
+
summary: "Public comment edits refuse when their anchors or revision structure cannot be represented."
|
|
155
119
|
},
|
|
156
120
|
[CANONICAL_GAP.publicUnsupportedInline]: {
|
|
157
121
|
owner: "document-operations",
|
|
158
|
-
legacySessionMutation: "pm-public-operations",
|
|
159
122
|
kind: "refusal",
|
|
160
123
|
adapters: ["react", "vue"],
|
|
161
124
|
summary: "Unsupported public payloads refuse with a typed compiler capability gap."
|
|
@@ -168,11 +131,10 @@ const CANONICAL_CAPABILITIES = {
|
|
|
168
131
|
},
|
|
169
132
|
[CANONICAL_GAP.publicHeadlessSession]: {
|
|
170
133
|
owner: "document-operations",
|
|
171
|
-
legacySessionMutation: "canonical",
|
|
172
134
|
kind: "refusal",
|
|
173
135
|
adapters: ["react", "vue"],
|
|
174
136
|
summary: "A reviewer refuses to resolve one story of a suggestion that reaches several, which resolves only whole."
|
|
175
137
|
}
|
|
176
138
|
};
|
|
177
139
|
const canonicalRefusalMessage = (gap, message) => `[${gap}] ${message}`;
|
|
178
|
-
export { CANONICAL_CAPABILITIES, CANONICAL_GAP, CANONICAL_GAP_MESSAGE_KEY, CANONICAL_RULE, CANONICAL_RULE_MESSAGE_KEYS, canonicalRefusalMessage, canonicalRefusalNotice };
|
|
140
|
+
export { CANONICAL_CAPABILITIES, CANONICAL_CONDITION, CANONICAL_CONDITION_MESSAGE_KEY, CANONICAL_GAP, CANONICAL_GAP_MESSAGE_KEY, CANONICAL_RULE, CANONICAL_RULE_MESSAGE_KEYS, canonicalRefusalMessage, canonicalRefusalNotice };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CanonicalRefusalGround } from "./canonicalCapabilities.js";
|
|
2
2
|
import { Comment } from "./content.js";
|
|
3
3
|
import { OpStory } from "@stll/docx-core/ops";
|
|
4
4
|
/** Requests name their anchor; comment metadata never creates an unanchored root. */
|
|
@@ -41,7 +41,7 @@ export type CanonicalCommentResult = {
|
|
|
41
41
|
commentId?: number;
|
|
42
42
|
} | {
|
|
43
43
|
status: "refused";
|
|
44
|
-
|
|
44
|
+
ground: CanonicalRefusalGround;
|
|
45
45
|
message: string;
|
|
46
46
|
/** Whether the same request can succeed once a pending composition settles. */
|
|
47
47
|
retry: "afterComposition" | "never";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CanonicalRefusalGround } from "./canonicalCapabilities.js";
|
|
2
2
|
export type CanonicalSectionPropertiesResult = {
|
|
3
3
|
status: "applied";
|
|
4
4
|
version: number;
|
|
5
5
|
} | {
|
|
6
6
|
status: "refused";
|
|
7
|
-
|
|
7
|
+
ground: CanonicalRefusalGround;
|
|
8
8
|
message: string;
|
|
9
9
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { document_d_exports } from "../types/document.js";
|
|
2
|
+
import { CLIPBOARD_TYPES, INTERNAL_CLIPBOARD_TYPE, getClipboardImageFiles, getStandaloneClipboardImageFiles } from "./clipboardFiles.js";
|
|
2
3
|
/**
|
|
3
4
|
* Clipboard content format
|
|
4
5
|
*/
|
|
@@ -34,33 +35,6 @@ export type ClipboardOptions = {
|
|
|
34
35
|
/** Callback for handling errors */
|
|
35
36
|
onError?: (error: Error) => void;
|
|
36
37
|
};
|
|
37
|
-
/**
|
|
38
|
-
* Custom MIME type for internal clipboard format
|
|
39
|
-
*/
|
|
40
|
-
export declare const INTERNAL_CLIPBOARD_TYPE = "application/x-stella-folio";
|
|
41
|
-
/**
|
|
42
|
-
* Standard clipboard MIME types
|
|
43
|
-
*/
|
|
44
|
-
export declare const CLIPBOARD_TYPES: {
|
|
45
|
-
readonly HTML: "text/html";
|
|
46
|
-
readonly PLAIN: "text/plain";
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* Extract image files from clipboard data (if present).
|
|
50
|
-
*/
|
|
51
|
-
type ClipboardDataLike = {
|
|
52
|
-
files?: FileList | readonly File[] | undefined;
|
|
53
|
-
getData?: ((format: string) => string) | undefined;
|
|
54
|
-
items?: DataTransferItemList | readonly DataTransferItem[] | undefined;
|
|
55
|
-
types?: ArrayLike<string> | undefined;
|
|
56
|
-
};
|
|
57
|
-
export declare function getClipboardImageFiles(clipboardData: ClipboardDataLike | null): File[];
|
|
58
|
-
/**
|
|
59
|
-
* Return image files only when the clipboard has no readable editor content.
|
|
60
|
-
* Rich HTML, internal payloads, and plain text must stay on the normal paste
|
|
61
|
-
* path; some applications include a rendered image beside that content.
|
|
62
|
-
*/
|
|
63
|
-
export declare function getStandaloneClipboardImageFiles(clipboardData: ClipboardDataLike | null): File[];
|
|
64
38
|
/**
|
|
65
39
|
* Copy runs to clipboard with formatting
|
|
66
40
|
*/
|
|
@@ -147,4 +121,4 @@ declare const _default_1: {
|
|
|
147
121
|
isEditorHtml: typeof isEditorHtml;
|
|
148
122
|
createClipboardHandlers: typeof createClipboardHandlers;
|
|
149
123
|
};
|
|
150
|
-
export { _default_1 as default };
|
|
124
|
+
export { CLIPBOARD_TYPES, INTERNAL_CLIPBOARD_TYPE, _default_1 as default, getClipboardImageFiles, getStandaloneClipboardImageFiles };
|
package/dist/utils/clipboard.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CLIPBOARD_TYPES, INTERNAL_CLIPBOARD_TYPE, getClipboardImageFiles, getStandaloneClipboardImageFiles } from "./clipboardFiles.js";
|
|
1
2
|
import { htmlCommentEnd } from "./htmlComments.js";
|
|
2
3
|
import { stripXmlDeclarations } from "./stripXmlDeclarations.js";
|
|
3
4
|
import { encodeUtf8, readBlobText } from "./textEncoding.js";
|
|
@@ -15,17 +16,6 @@ import createDOMPurify from "dompurify";
|
|
|
15
16
|
*/
|
|
16
17
|
let domPurify;
|
|
17
18
|
const getDomPurify = () => domPurify ??= createDOMPurify(window);
|
|
18
|
-
/**
|
|
19
|
-
* Custom MIME type for internal clipboard format
|
|
20
|
-
*/
|
|
21
|
-
const INTERNAL_CLIPBOARD_TYPE = "application/x-stella-folio";
|
|
22
|
-
/**
|
|
23
|
-
* Standard clipboard MIME types
|
|
24
|
-
*/
|
|
25
|
-
const CLIPBOARD_TYPES = {
|
|
26
|
-
HTML: "text/html",
|
|
27
|
-
PLAIN: "text/plain"
|
|
28
|
-
};
|
|
29
19
|
const SKIPPED_CLIPBOARD_ELEMENTS = /* @__PURE__ */ new Set([
|
|
30
20
|
"script",
|
|
31
21
|
"style",
|
|
@@ -35,91 +25,6 @@ const SKIPPED_CLIPBOARD_ELEMENTS = /* @__PURE__ */ new Set([
|
|
|
35
25
|
"svg",
|
|
36
26
|
"math"
|
|
37
27
|
]);
|
|
38
|
-
function getClipboardImageFiles(clipboardData) {
|
|
39
|
-
if (!clipboardData) return [];
|
|
40
|
-
const collectFromItems = () => {
|
|
41
|
-
const items = clipboardData.items;
|
|
42
|
-
if (!items || items.length === 0) return [];
|
|
43
|
-
const files = [];
|
|
44
|
-
for (const item of Array.from(items)) {
|
|
45
|
-
if (item.kind !== "file") continue;
|
|
46
|
-
if (!item.type.startsWith("image/")) continue;
|
|
47
|
-
const file = item.getAsFile();
|
|
48
|
-
if (file) files.push(file);
|
|
49
|
-
}
|
|
50
|
-
return files;
|
|
51
|
-
};
|
|
52
|
-
const collectFromFiles = () => {
|
|
53
|
-
const clipboardFiles = clipboardData.files;
|
|
54
|
-
if (!clipboardFiles || clipboardFiles.length === 0) return [];
|
|
55
|
-
return Array.from(clipboardFiles).filter((file) => file.type.startsWith("image/"));
|
|
56
|
-
};
|
|
57
|
-
const candidates = collectFromItems();
|
|
58
|
-
const files = candidates.length ? candidates : collectFromFiles();
|
|
59
|
-
if (files.length <= 1) return files;
|
|
60
|
-
const preferredTypes = [
|
|
61
|
-
"image/png",
|
|
62
|
-
"image/jpeg",
|
|
63
|
-
"image/webp",
|
|
64
|
-
"image/gif",
|
|
65
|
-
"image/svg+xml",
|
|
66
|
-
"image/bmp",
|
|
67
|
-
"image/tiff"
|
|
68
|
-
];
|
|
69
|
-
const pickBest = (group) => {
|
|
70
|
-
let best = group[0];
|
|
71
|
-
let bestRank = preferredTypes.indexOf(best.type);
|
|
72
|
-
if (bestRank < 0) bestRank = Number.MAX_SAFE_INTEGER;
|
|
73
|
-
for (const file of group.slice(1)) {
|
|
74
|
-
let rank = preferredTypes.indexOf(file.type);
|
|
75
|
-
if (rank < 0) rank = Number.MAX_SAFE_INTEGER;
|
|
76
|
-
if (rank < bestRank) {
|
|
77
|
-
best = file;
|
|
78
|
-
bestRank = rank;
|
|
79
|
-
continue;
|
|
80
|
-
}
|
|
81
|
-
if (rank === bestRank && file.size > best.size) best = file;
|
|
82
|
-
}
|
|
83
|
-
return best;
|
|
84
|
-
};
|
|
85
|
-
const groups = /* @__PURE__ */ new Map();
|
|
86
|
-
for (const file of files) {
|
|
87
|
-
const rawName = file.name.trim();
|
|
88
|
-
const key = (rawName ? rawName.replace(/\.[^/.]+$/, "").toLowerCase() : "") || `size:${file.size}`;
|
|
89
|
-
const bucket = groups.get(key);
|
|
90
|
-
if (bucket) bucket.push(file);
|
|
91
|
-
else groups.set(key, [file]);
|
|
92
|
-
}
|
|
93
|
-
const deduped = [];
|
|
94
|
-
for (const group of groups.values()) deduped.push(pickBest(group));
|
|
95
|
-
return deduped;
|
|
96
|
-
}
|
|
97
|
-
const ENGINE_CLIPBOARD_TYPES = [
|
|
98
|
-
INTERNAL_CLIPBOARD_TYPE,
|
|
99
|
-
CLIPBOARD_TYPES.HTML,
|
|
100
|
-
CLIPBOARD_TYPES.PLAIN
|
|
101
|
-
];
|
|
102
|
-
const hasEngineClipboardContent = (clipboardData) => {
|
|
103
|
-
if (!clipboardData.types || !clipboardData.getData) return false;
|
|
104
|
-
const availableTypes = new Set(Array.from(clipboardData.types));
|
|
105
|
-
for (const type of ENGINE_CLIPBOARD_TYPES) {
|
|
106
|
-
if (!availableTypes.has(type)) continue;
|
|
107
|
-
try {
|
|
108
|
-
if (clipboardData.getData(type) !== "") return true;
|
|
109
|
-
} catch {}
|
|
110
|
-
}
|
|
111
|
-
return false;
|
|
112
|
-
};
|
|
113
|
-
/**
|
|
114
|
-
* Return image files only when the clipboard has no readable editor content.
|
|
115
|
-
* Rich HTML, internal payloads, and plain text must stay on the normal paste
|
|
116
|
-
* path; some applications include a rendered image beside that content.
|
|
117
|
-
*/
|
|
118
|
-
function getStandaloneClipboardImageFiles(clipboardData) {
|
|
119
|
-
const imageFiles = getClipboardImageFiles(clipboardData);
|
|
120
|
-
if (imageFiles.length === 0 || !clipboardData) return imageFiles;
|
|
121
|
-
return hasEngineClipboardContent(clipboardData) ? [] : imageFiles;
|
|
122
|
-
}
|
|
123
28
|
/**
|
|
124
29
|
* Copy runs to clipboard with formatting
|
|
125
30
|
*/
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom MIME type for internal clipboard format
|
|
3
|
+
*/
|
|
4
|
+
export declare const INTERNAL_CLIPBOARD_TYPE = "application/x-stella-folio";
|
|
5
|
+
/**
|
|
6
|
+
* Standard clipboard MIME types
|
|
7
|
+
*/
|
|
8
|
+
export declare const CLIPBOARD_TYPES: {
|
|
9
|
+
readonly HTML: "text/html";
|
|
10
|
+
readonly PLAIN: "text/plain";
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Extract image files from clipboard data (if present).
|
|
14
|
+
*/
|
|
15
|
+
export type ClipboardDataLike = {
|
|
16
|
+
files?: FileList | readonly File[] | undefined;
|
|
17
|
+
getData?: ((format: string) => string) | undefined;
|
|
18
|
+
items?: DataTransferItemList | readonly DataTransferItem[] | undefined;
|
|
19
|
+
types?: ArrayLike<string> | undefined;
|
|
20
|
+
};
|
|
21
|
+
export declare function getClipboardImageFiles(clipboardData: ClipboardDataLike | null): File[];
|
|
22
|
+
/**
|
|
23
|
+
* Return image files only when the clipboard has no readable editor content.
|
|
24
|
+
* Rich HTML, internal payloads, and plain text must stay on the normal paste
|
|
25
|
+
* path; some applications include a rendered image beside that content.
|
|
26
|
+
*/
|
|
27
|
+
export declare function getStandaloneClipboardImageFiles(clipboardData: ClipboardDataLike | null): File[];
|