@pixerate/editor 0.18.0 → 0.20.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/README.md +91 -2
- package/dist/agent/index.cjs +625 -2
- package/dist/agent/index.cjs.map +1 -1
- package/dist/agent/index.d.cts +286 -2
- package/dist/agent/index.d.ts +286 -2
- package/dist/agent/index.js +624 -1
- package/dist/agent/index.js.map +1 -1
- package/dist/canvas/index.cjs +1240 -22
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +515 -3
- package/dist/canvas/index.d.ts +515 -3
- package/dist/canvas/index.js +1219 -1
- package/dist/canvas/index.js.map +1 -1
- package/dist/chunk-3TYMNULT.js +1367 -0
- package/dist/chunk-3TYMNULT.js.map +1 -0
- package/dist/chunk-4QPLEUL2.cjs +4480 -0
- package/dist/chunk-4QPLEUL2.cjs.map +1 -0
- package/dist/chunk-4SUNJZWB.cjs +553 -0
- package/dist/chunk-4SUNJZWB.cjs.map +1 -0
- package/dist/chunk-A7DKIA72.js +2657 -0
- package/dist/chunk-A7DKIA72.js.map +1 -0
- package/dist/chunk-AXV2ZW34.cjs +118 -0
- package/dist/chunk-AXV2ZW34.cjs.map +1 -0
- package/dist/chunk-B2ZRLN4S.js +118 -0
- package/dist/chunk-B2ZRLN4S.js.map +1 -0
- package/dist/chunk-CYFJCKC4.js +4480 -0
- package/dist/chunk-CYFJCKC4.js.map +1 -0
- package/dist/chunk-GVW4P7BG.js +2706 -0
- package/dist/chunk-GVW4P7BG.js.map +1 -0
- package/dist/chunk-JACER6TE.cjs +1 -0
- package/dist/chunk-JACER6TE.cjs.map +1 -0
- package/dist/chunk-JYRIOFEN.cjs +2657 -0
- package/dist/chunk-JYRIOFEN.cjs.map +1 -0
- package/dist/chunk-KYRZDWM4.js +299 -0
- package/dist/chunk-KYRZDWM4.js.map +1 -0
- package/dist/chunk-LA7PEGU3.cjs +299 -0
- package/dist/chunk-LA7PEGU3.cjs.map +1 -0
- package/dist/chunk-N7FG6CBO.js +1 -0
- package/dist/chunk-N7FG6CBO.js.map +1 -0
- package/dist/chunk-OYXSKQFR.js +553 -0
- package/dist/chunk-OYXSKQFR.js.map +1 -0
- package/dist/chunk-TVRC4KVT.cjs +1367 -0
- package/dist/chunk-TVRC4KVT.cjs.map +1 -0
- package/dist/chunk-U6NDQFOK.cjs +2706 -0
- package/dist/chunk-U6NDQFOK.cjs.map +1 -0
- package/dist/controller-OUdxPY-X.d.cts +754 -0
- package/dist/controller-OUdxPY-X.d.ts +754 -0
- package/dist/extensions/index.cjs +144 -3
- package/dist/extensions/index.cjs.map +1 -1
- package/dist/extensions/index.d.cts +9 -144
- package/dist/extensions/index.d.ts +9 -144
- package/dist/extensions/index.js +145 -4
- package/dist/grammar/index.cjs +31 -3
- package/dist/grammar/index.cjs.map +1 -1
- package/dist/grammar/index.d.cts +239 -19
- package/dist/grammar/index.d.ts +239 -19
- package/dist/grammar/index.js +31 -3
- package/dist/history/index.d.cts +2 -41
- package/dist/history/index.d.ts +2 -41
- package/dist/image-editor/index.cjs +732 -497
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +105 -9
- package/dist/image-editor/index.d.ts +105 -9
- package/dist/image-editor/index.js +721 -486
- package/dist/image-editor/index.js.map +1 -1
- package/dist/index-Ng1pG7JE.d.ts +899 -0
- package/dist/index-k3mFbPx_.d.cts +899 -0
- package/dist/index.cjs +457 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +99 -12
- package/dist/index.d.ts +99 -12
- package/dist/index.js +457 -20
- package/dist/index.js.map +1 -1
- package/dist/registry-iAHbqkYt.d.cts +128 -0
- package/dist/registry-iAHbqkYt.d.ts +128 -0
- package/dist/serializers/index.cjs +26 -3
- package/dist/serializers/index.cjs.map +1 -1
- package/dist/serializers/index.d.cts +119 -6
- package/dist/serializers/index.d.ts +119 -6
- package/dist/serializers/index.js +24 -1
- package/dist/spreadsheet/index.cjs +122 -2
- package/dist/spreadsheet/index.cjs.map +1 -1
- package/dist/spreadsheet/index.d.cts +371 -313
- package/dist/spreadsheet/index.d.ts +371 -313
- package/dist/spreadsheet/index.js +127 -7
- package/dist/tokens-CyLZmIei.d.cts +76 -0
- package/dist/tokens-CyLZmIei.d.ts +76 -0
- package/dist/track-changes-G8JcWB8b.d.cts +306 -0
- package/dist/track-changes-G8JcWB8b.d.ts +306 -0
- package/dist/types-BZgcDsC5.d.cts +42 -0
- package/dist/types-BZgcDsC5.d.ts +42 -0
- package/dist/{types-JV3S8VeR.d.cts → types-DMe0vFB1.d.cts} +1 -1
- package/dist/{types-JV3S8VeR.d.ts → types-DMe0vFB1.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-7FWEWE6T.js +0 -1888
- package/dist/chunk-7FWEWE6T.js.map +0 -1
- package/dist/chunk-AIZUKWTL.js +0 -1715
- package/dist/chunk-AIZUKWTL.js.map +0 -1
- package/dist/chunk-GLSIZKOX.js +0 -17
- package/dist/chunk-GLSIZKOX.js.map +0 -1
- package/dist/chunk-LDES3EOS.cjs +0 -1888
- package/dist/chunk-LDES3EOS.cjs.map +0 -1
- package/dist/chunk-LLUAKTLW.cjs +0 -532
- package/dist/chunk-LLUAKTLW.cjs.map +0 -1
- package/dist/chunk-MPPXH7U5.cjs +0 -336
- package/dist/chunk-MPPXH7U5.cjs.map +0 -1
- package/dist/chunk-O7LOPQMH.js +0 -336
- package/dist/chunk-O7LOPQMH.js.map +0 -1
- package/dist/chunk-QGVMBCT5.js +0 -532
- package/dist/chunk-QGVMBCT5.js.map +0 -1
- package/dist/chunk-SEDR75VH.cjs +0 -17
- package/dist/chunk-SEDR75VH.cjs.map +0 -1
- package/dist/chunk-YQCI4CCN.cjs +0 -1715
- package/dist/chunk-YQCI4CCN.cjs.map +0 -1
- package/dist/mention-Dcevh3ff.d.cts +0 -32
- package/dist/mention-Dcevh3ff.d.ts +0 -32
- package/dist/tokens-7kRTEtPb.d.cts +0 -39
- package/dist/tokens-7kRTEtPb.d.ts +0 -39
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
import * as _tiptap_core from '@tiptap/core';
|
|
2
|
+
import { Extension, Mark, Editor } from '@tiptap/core';
|
|
3
|
+
import * as _tiptap_extension_mention from '@tiptap/extension-mention';
|
|
4
|
+
import { MentionOptions as MentionOptions$1 } from '@tiptap/extension-mention';
|
|
5
|
+
import { SuggestionOptions } from '@tiptap/suggestion';
|
|
6
|
+
import { EditorState, PluginKey } from '@tiptap/pm/state';
|
|
7
|
+
import { Node } from '@tiptap/pm/model';
|
|
8
|
+
|
|
9
|
+
interface MentionEntity {
|
|
10
|
+
id: string;
|
|
11
|
+
label: string;
|
|
12
|
+
type?: string;
|
|
13
|
+
avatarUrl?: string;
|
|
14
|
+
color?: string;
|
|
15
|
+
handle?: string;
|
|
16
|
+
name?: string;
|
|
17
|
+
hexColor?: string;
|
|
18
|
+
aliases?: string[];
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
}
|
|
21
|
+
interface MentionOptions extends Partial<MentionOptions$1> {
|
|
22
|
+
HTMLAttributes?: Record<string, any>;
|
|
23
|
+
suggestion?: Partial<SuggestionOptions<MentionEntity>>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* First-class native Mention extension for @pixerate/editor.
|
|
27
|
+
* Creates atomic inline <span data-type="mention"> nodes with full suggestion support.
|
|
28
|
+
*/
|
|
29
|
+
declare const Mention: _tiptap_core.Node<MentionOptions$1<any, _tiptap_extension_mention.MentionNodeAttrs>, any>;
|
|
30
|
+
/**
|
|
31
|
+
* Helper to configure the Mention extension with preset defaults.
|
|
32
|
+
*/
|
|
33
|
+
declare function createMentionExtension(options?: Partial<MentionOptions>): _tiptap_core.Node<MentionOptions$1<any, _tiptap_extension_mention.MentionNodeAttrs>, any>;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Who made a comment, reply or tracked change.
|
|
37
|
+
*/
|
|
38
|
+
interface ReviewAuthor {
|
|
39
|
+
id: string;
|
|
40
|
+
name: string;
|
|
41
|
+
color?: string;
|
|
42
|
+
avatarUrl?: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Where a comment thread is attached in the document. `from`/`to` are
|
|
46
|
+
* ProseMirror positions and `quote` is the commented text at the time the
|
|
47
|
+
* anchor was last synced. Positions are only meaningful for the current
|
|
48
|
+
* document; the `comment` mark in the document is the source of truth.
|
|
49
|
+
*/
|
|
50
|
+
interface CommentAnchor {
|
|
51
|
+
from: number;
|
|
52
|
+
to: number;
|
|
53
|
+
quote: string;
|
|
54
|
+
}
|
|
55
|
+
interface CommentReply {
|
|
56
|
+
id: string;
|
|
57
|
+
author: ReviewAuthor;
|
|
58
|
+
body: string;
|
|
59
|
+
createdAt: number;
|
|
60
|
+
editedAt?: number;
|
|
61
|
+
}
|
|
62
|
+
interface CommentThread {
|
|
63
|
+
id: string;
|
|
64
|
+
/** `null` while the thread has no text in the document (see `orphaned`). */
|
|
65
|
+
anchor: CommentAnchor | null;
|
|
66
|
+
author: ReviewAuthor;
|
|
67
|
+
createdAt: number;
|
|
68
|
+
/** An empty body marks a draft that has not been posted yet. */
|
|
69
|
+
body: string;
|
|
70
|
+
editedAt?: number;
|
|
71
|
+
replies: CommentReply[];
|
|
72
|
+
resolved: boolean;
|
|
73
|
+
resolvedAt?: number;
|
|
74
|
+
resolvedBy?: ReviewAuthor;
|
|
75
|
+
/**
|
|
76
|
+
* True when the commented text was deleted from the document. Undoing the
|
|
77
|
+
* deletion re-attaches the thread.
|
|
78
|
+
*/
|
|
79
|
+
orphaned: boolean;
|
|
80
|
+
/** The quote the thread had before it was orphaned. */
|
|
81
|
+
lastQuote?: string;
|
|
82
|
+
}
|
|
83
|
+
interface CommentStoreSnapshot {
|
|
84
|
+
/** Threads in document order (anchored first), then orphaned threads. */
|
|
85
|
+
threads: readonly CommentThread[];
|
|
86
|
+
activeThreadId: string | null;
|
|
87
|
+
}
|
|
88
|
+
/** JSON shape produced by `CommentStore.toJSON()`. */
|
|
89
|
+
interface SerializedComments {
|
|
90
|
+
version: 1;
|
|
91
|
+
threads: CommentThread[];
|
|
92
|
+
}
|
|
93
|
+
interface CommentStoreOptions {
|
|
94
|
+
threads?: CommentThread[] | SerializedComments;
|
|
95
|
+
generateId?: () => string;
|
|
96
|
+
now?: () => number;
|
|
97
|
+
}
|
|
98
|
+
interface CreateThreadInput {
|
|
99
|
+
id?: string;
|
|
100
|
+
body: string;
|
|
101
|
+
author: ReviewAuthor;
|
|
102
|
+
anchor?: CommentAnchor | null;
|
|
103
|
+
createdAt?: number;
|
|
104
|
+
}
|
|
105
|
+
type CommentStoreListener = (snapshot: CommentStoreSnapshot) => void;
|
|
106
|
+
/**
|
|
107
|
+
* Generates a reasonably unique id without depending on `crypto`.
|
|
108
|
+
*/
|
|
109
|
+
declare function createReviewId(prefix?: string): string;
|
|
110
|
+
/**
|
|
111
|
+
* Headless, framework-agnostic store of comment threads.
|
|
112
|
+
*
|
|
113
|
+
* The store never talks to a server: persist `toJSON()` yourself and pass it
|
|
114
|
+
* back via `new CommentStore({ threads })` or `load()`. Snapshots are
|
|
115
|
+
* immutable and only replaced when something changes, so `getSnapshot` is safe
|
|
116
|
+
* to use with React's `useSyncExternalStore`. `subscribe` calls the listener
|
|
117
|
+
* immediately (Svelte store contract).
|
|
118
|
+
*/
|
|
119
|
+
declare class CommentStore {
|
|
120
|
+
private threads;
|
|
121
|
+
private activeThreadId;
|
|
122
|
+
private snapshot;
|
|
123
|
+
private listeners;
|
|
124
|
+
/** Deleted threads, kept so undoing a "Delete Comment" can restore them. */
|
|
125
|
+
private deleted;
|
|
126
|
+
private generateId;
|
|
127
|
+
private now;
|
|
128
|
+
constructor(options?: CommentStoreOptions);
|
|
129
|
+
/** Parses `toJSON()` output (or a plain thread array). */
|
|
130
|
+
static parse(json: string | CommentThread[] | SerializedComments): CommentThread[];
|
|
131
|
+
subscribe: (listener: CommentStoreListener) => (() => void);
|
|
132
|
+
getSnapshot: () => CommentStoreSnapshot;
|
|
133
|
+
getThread(id: string): CommentThread | undefined;
|
|
134
|
+
createThread(input: CreateThreadInput): CommentThread;
|
|
135
|
+
/** Edits the thread's body, or one of its replies when `replyId` is given. */
|
|
136
|
+
editComment(threadId: string, body: string, replyId?: string): boolean;
|
|
137
|
+
addReply(threadId: string, input: {
|
|
138
|
+
body: string;
|
|
139
|
+
author: ReviewAuthor;
|
|
140
|
+
id?: string;
|
|
141
|
+
}): CommentReply | null;
|
|
142
|
+
deleteReply(threadId: string, replyId: string): boolean;
|
|
143
|
+
resolveThread(id: string, resolved?: boolean, by?: ReviewAuthor): boolean;
|
|
144
|
+
deleteThread(id: string): boolean;
|
|
145
|
+
/** Deletes every thread whose text is no longer in the document. */
|
|
146
|
+
removeOrphanedThreads(): string[];
|
|
147
|
+
setActiveThread(id: string | null): void;
|
|
148
|
+
/**
|
|
149
|
+
* Updates anchors from the document. Threads missing from `anchors` become
|
|
150
|
+
* orphaned. Threads that were deleted but whose mark re-appeared (e.g. after
|
|
151
|
+
* undoing "Delete Comment") are restored. Returns true if anything changed.
|
|
152
|
+
*/
|
|
153
|
+
syncAnchors(anchors: Map<string, CommentAnchor>): boolean;
|
|
154
|
+
/** Replaces all threads, e.g. with data loaded from a server. */
|
|
155
|
+
load(json: string | CommentThread[] | SerializedComments): void;
|
|
156
|
+
clear(): void;
|
|
157
|
+
toJSON(): SerializedComments;
|
|
158
|
+
private updateThread;
|
|
159
|
+
private computeSnapshot;
|
|
160
|
+
private emit;
|
|
161
|
+
}
|
|
162
|
+
declare function createCommentStore(options?: CommentStoreOptions): CommentStore;
|
|
163
|
+
/**
|
|
164
|
+
* Short, human-readable timestamp for review UIs ("just now", "5m ago",
|
|
165
|
+
* "3h ago", then a locale date). Shared by the React and Svelte components.
|
|
166
|
+
*/
|
|
167
|
+
declare function formatReviewTime(timestamp: number, now?: number): string;
|
|
168
|
+
|
|
169
|
+
declare const INSERTION_MARK_NAME = "insertion";
|
|
170
|
+
declare const DELETION_MARK_NAME = "deletion";
|
|
171
|
+
/**
|
|
172
|
+
* Set this transaction meta to `true` to apply a change without tracking it,
|
|
173
|
+
* e.g. `editor.chain().command(({ tr }) => { tr.setMeta(TRACK_CHANGES_SKIP_META, true); return true; }).setContent(…).run()`.
|
|
174
|
+
*/
|
|
175
|
+
declare const TRACK_CHANGES_SKIP_META = "trackChangesSkip";
|
|
176
|
+
type TrackedChangeType = "insertion" | "deletion";
|
|
177
|
+
/**
|
|
178
|
+
* How tracked content is rendered by serializers:
|
|
179
|
+
* - `accepted` (default): as if every change were accepted (deleted text is
|
|
180
|
+
* dropped, inserted text kept).
|
|
181
|
+
* - `original`: as if every change were rejected.
|
|
182
|
+
* - `all`: both inserted and deleted text.
|
|
183
|
+
*/
|
|
184
|
+
type TrackedChangesView = "accepted" | "original" | "all";
|
|
185
|
+
interface TrackedChangeAttributes {
|
|
186
|
+
changeId: string;
|
|
187
|
+
authorId: string;
|
|
188
|
+
authorName: string;
|
|
189
|
+
authorColor: string | null;
|
|
190
|
+
createdAt: number;
|
|
191
|
+
}
|
|
192
|
+
interface TrackedChange {
|
|
193
|
+
id: string;
|
|
194
|
+
type: TrackedChangeType;
|
|
195
|
+
author: ReviewAuthor;
|
|
196
|
+
createdAt: number;
|
|
197
|
+
/** Start of the first range. */
|
|
198
|
+
from: number;
|
|
199
|
+
/** End of the last range. */
|
|
200
|
+
to: number;
|
|
201
|
+
/** A change can be split into several ranges by other marks or blocks. */
|
|
202
|
+
ranges: {
|
|
203
|
+
from: number;
|
|
204
|
+
to: number;
|
|
205
|
+
}[];
|
|
206
|
+
text: string;
|
|
207
|
+
}
|
|
208
|
+
interface TrackChangesSnapshot {
|
|
209
|
+
enabled: boolean;
|
|
210
|
+
author: ReviewAuthor;
|
|
211
|
+
/** Changes in document order. */
|
|
212
|
+
changes: readonly TrackedChange[];
|
|
213
|
+
/** The change at the selection, if any. */
|
|
214
|
+
currentChangeId: string | null;
|
|
215
|
+
}
|
|
216
|
+
interface TrackChangesOptions {
|
|
217
|
+
/** Whether tracking is on when the editor is created. */
|
|
218
|
+
enabled: boolean;
|
|
219
|
+
author: ReviewAuthor;
|
|
220
|
+
now: () => number;
|
|
221
|
+
generateId: () => string;
|
|
222
|
+
insertionHTMLAttributes: Record<string, any>;
|
|
223
|
+
deletionHTMLAttributes: Record<string, any>;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* External store over the editor's tracked-change state. Snapshots only
|
|
227
|
+
* change when the document, selection or tracking state changes, so they can
|
|
228
|
+
* be used with `useSyncExternalStore`. `subscribe` calls the listener
|
|
229
|
+
* immediately (Svelte store contract).
|
|
230
|
+
*/
|
|
231
|
+
declare class TrackChangesStore {
|
|
232
|
+
private snapshot;
|
|
233
|
+
private listeners;
|
|
234
|
+
constructor(initial: TrackChangesSnapshot);
|
|
235
|
+
subscribe: (listener: (snapshot: TrackChangesSnapshot) => void) => (() => void);
|
|
236
|
+
getSnapshot: () => TrackChangesSnapshot;
|
|
237
|
+
/** @internal Called by the extension's plugin view. */
|
|
238
|
+
set(snapshot: TrackChangesSnapshot): void;
|
|
239
|
+
}
|
|
240
|
+
interface TrackChangesStorage {
|
|
241
|
+
store: TrackChangesStore;
|
|
242
|
+
}
|
|
243
|
+
interface TrackChangesPluginState {
|
|
244
|
+
enabled: boolean;
|
|
245
|
+
author: ReviewAuthor;
|
|
246
|
+
}
|
|
247
|
+
declare const trackChangesPluginKey: PluginKey<TrackChangesPluginState>;
|
|
248
|
+
declare module "@tiptap/core" {
|
|
249
|
+
interface Commands<ReturnType> {
|
|
250
|
+
trackChanges: {
|
|
251
|
+
setTrackChanges: (enabled: boolean) => ReturnType;
|
|
252
|
+
toggleTrackChanges: () => ReturnType;
|
|
253
|
+
setTrackChangesAuthor: (author: ReviewAuthor) => ReturnType;
|
|
254
|
+
/** Accepts one change (single undo step). */
|
|
255
|
+
acceptChange: (id: string) => ReturnType;
|
|
256
|
+
/** Rejects one change (single undo step). */
|
|
257
|
+
rejectChange: (id: string) => ReturnType;
|
|
258
|
+
acceptAllChanges: () => ReturnType;
|
|
259
|
+
rejectAllChanges: () => ReturnType;
|
|
260
|
+
/** Selects the next change after the selection, wrapping around. */
|
|
261
|
+
selectNextChange: () => ReturnType;
|
|
262
|
+
/** Selects the previous change before the selection, wrapping around. */
|
|
263
|
+
selectPreviousChange: () => ReturnType;
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Text inserted while tracking was on. Rendered as `<ins>`.
|
|
269
|
+
*/
|
|
270
|
+
declare const TrackedInsertion: Mark<{
|
|
271
|
+
HTMLAttributes: Record<string, any>;
|
|
272
|
+
}, any>;
|
|
273
|
+
/**
|
|
274
|
+
* Text deleted while tracking was on. The text stays in the document until
|
|
275
|
+
* the change is accepted. Rendered as `<del>` (struck through).
|
|
276
|
+
*/
|
|
277
|
+
declare const TrackedDeletion: Mark<{
|
|
278
|
+
HTMLAttributes: Record<string, any>;
|
|
279
|
+
}, any>;
|
|
280
|
+
/**
|
|
281
|
+
* Lists tracked changes in document order. Accepts an editor, an editor
|
|
282
|
+
* state or a ProseMirror document.
|
|
283
|
+
*/
|
|
284
|
+
declare function getTrackedChanges(source: Editor | EditorState | Node | null | undefined): TrackedChange[];
|
|
285
|
+
/** The change containing `pos` (defaults to the selection start). */
|
|
286
|
+
declare function getTrackedChangeAt(state: EditorState, pos?: number, changes?: readonly TrackedChange[]): TrackedChange | null;
|
|
287
|
+
declare function isTrackChangesEnabled(source: Editor | EditorState | null | undefined): boolean;
|
|
288
|
+
/** Returns the tracked-changes store of an editor using `TrackChanges`. */
|
|
289
|
+
declare function getTrackChangesStore(editor: Editor | null | undefined): TrackChangesStore | null;
|
|
290
|
+
/**
|
|
291
|
+
* Returns a copy of `doc` with tracked changes resolved for `view`
|
|
292
|
+
* (`accepted` by default). The input document is not modified.
|
|
293
|
+
*/
|
|
294
|
+
declare function resolveTrackedChanges(doc: Node, view?: TrackedChangesView): Node;
|
|
295
|
+
/**
|
|
296
|
+
* Suggestion mode / track changes. When enabled, typed and pasted content is
|
|
297
|
+
* marked as an insertion and deleted content is kept but marked as a
|
|
298
|
+
* deletion (struck through) until the change is accepted or rejected.
|
|
299
|
+
*
|
|
300
|
+
* Deleting your own insertion really deletes it. Formatting-only changes and
|
|
301
|
+
* block-structure changes (splitting/joining paragraphs, lists) are not
|
|
302
|
+
* tracked. IME composition is tracked once the composition ends.
|
|
303
|
+
*/
|
|
304
|
+
declare const TrackChanges: Extension<TrackChangesOptions, TrackChangesStorage>;
|
|
305
|
+
|
|
306
|
+
export { getTrackedChanges as A, isTrackChangesEnabled as B, type CommentAnchor as C, DELETION_MARK_NAME as D, resolveTrackedChanges as E, trackChangesPluginKey as F, INSERTION_MARK_NAME as I, Mention as M, type ReviewAuthor as R, type SerializedComments as S, TRACK_CHANGES_SKIP_META as T, type CommentReply as a, CommentStore as b, type CommentStoreListener as c, type CommentStoreOptions as d, type CommentStoreSnapshot as e, type CommentThread as f, type CreateThreadInput as g, type MentionEntity as h, type MentionOptions as i, TrackChanges as j, type TrackChangesOptions as k, type TrackChangesSnapshot as l, type TrackChangesStorage as m, TrackChangesStore as n, type TrackedChange as o, type TrackedChangeAttributes as p, type TrackedChangeType as q, type TrackedChangesView as r, TrackedDeletion as s, TrackedInsertion as t, createCommentStore as u, createMentionExtension as v, createReviewId as w, formatReviewTime as x, getTrackChangesStore as y, getTrackedChangeAt as z };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
interface Command {
|
|
2
|
+
execute: () => void;
|
|
3
|
+
undo: () => void;
|
|
4
|
+
redo?: () => void;
|
|
5
|
+
name: string;
|
|
6
|
+
tag?: string;
|
|
7
|
+
timestamp?: number;
|
|
8
|
+
}
|
|
9
|
+
interface HistoryState {
|
|
10
|
+
canUndo: boolean;
|
|
11
|
+
canRedo: boolean;
|
|
12
|
+
undoName: string;
|
|
13
|
+
redoName: string;
|
|
14
|
+
undoCount: number;
|
|
15
|
+
redoCount: number;
|
|
16
|
+
}
|
|
17
|
+
interface HistoryManagerOptions {
|
|
18
|
+
/**
|
|
19
|
+
* Maximum number of undo states to keep. Defaults to 50.
|
|
20
|
+
*/
|
|
21
|
+
maxDepth?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Optional callback fired whenever the history state changes.
|
|
24
|
+
*/
|
|
25
|
+
onStateChange?: (state: HistoryState) => void;
|
|
26
|
+
}
|
|
27
|
+
interface SnapshotCommandOptions<T> {
|
|
28
|
+
name: string;
|
|
29
|
+
before: T;
|
|
30
|
+
after: T;
|
|
31
|
+
apply: (state: T) => void;
|
|
32
|
+
tag?: string;
|
|
33
|
+
}
|
|
34
|
+
interface MergedExecutionOptions {
|
|
35
|
+
/**
|
|
36
|
+
* Window in milliseconds during which commands with the same tag will be coalesced.
|
|
37
|
+
* Defaults to 300ms.
|
|
38
|
+
*/
|
|
39
|
+
windowMs?: number;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export type { Command as C, HistoryManagerOptions as H, MergedExecutionOptions as M, SnapshotCommandOptions as S, HistoryState as a };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
interface Command {
|
|
2
|
+
execute: () => void;
|
|
3
|
+
undo: () => void;
|
|
4
|
+
redo?: () => void;
|
|
5
|
+
name: string;
|
|
6
|
+
tag?: string;
|
|
7
|
+
timestamp?: number;
|
|
8
|
+
}
|
|
9
|
+
interface HistoryState {
|
|
10
|
+
canUndo: boolean;
|
|
11
|
+
canRedo: boolean;
|
|
12
|
+
undoName: string;
|
|
13
|
+
redoName: string;
|
|
14
|
+
undoCount: number;
|
|
15
|
+
redoCount: number;
|
|
16
|
+
}
|
|
17
|
+
interface HistoryManagerOptions {
|
|
18
|
+
/**
|
|
19
|
+
* Maximum number of undo states to keep. Defaults to 50.
|
|
20
|
+
*/
|
|
21
|
+
maxDepth?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Optional callback fired whenever the history state changes.
|
|
24
|
+
*/
|
|
25
|
+
onStateChange?: (state: HistoryState) => void;
|
|
26
|
+
}
|
|
27
|
+
interface SnapshotCommandOptions<T> {
|
|
28
|
+
name: string;
|
|
29
|
+
before: T;
|
|
30
|
+
after: T;
|
|
31
|
+
apply: (state: T) => void;
|
|
32
|
+
tag?: string;
|
|
33
|
+
}
|
|
34
|
+
interface MergedExecutionOptions {
|
|
35
|
+
/**
|
|
36
|
+
* Window in milliseconds during which commands with the same tag will be coalesced.
|
|
37
|
+
* Defaults to 300ms.
|
|
38
|
+
*/
|
|
39
|
+
windowMs?: number;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export type { Command as C, HistoryManagerOptions as H, MergedExecutionOptions as M, SnapshotCommandOptions as S, HistoryState as a };
|
|
@@ -214,4 +214,4 @@ interface CanvasDockingCallbacks<TNode extends CanvasNode = CanvasNode> {
|
|
|
214
214
|
onDockDrop?: (dockTarget: TNode, draggedNode: TNode) => void;
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
-
export type { CanvasNode as C, DirectionalDisplacementOptions as D, ExplodeNodeOptions as E, FanOutTrajectoryOptions as F, GraphDifferences as G, IncrementalLayoutOptions as I, NodeTransition as N, PlaceBesideOptions as P, Rect as R, Side as S, TrajectoryFunction as T, XYPosition as X, CanvasEdge as a, CanvasLayoutOptions as b, CanvasNodeStyle as c, ReflowDisplacementOptions as d, CanvasClipboardPayload as e,
|
|
217
|
+
export type { CanvasNode as C, DirectionalDisplacementOptions as D, ExplodeNodeOptions as E, FanOutTrajectoryOptions as F, GraphDifferences as G, IncrementalLayoutOptions as I, NodeTransition as N, PlaceBesideOptions as P, Rect as R, Side as S, TrajectoryFunction as T, XYPosition as X, CanvasEdge as a, CanvasLayoutOptions as b, CanvasNodeStyle as c, ReflowDisplacementOptions as d, CanvasClipboardPayload as e, Position as f, CanvasDockingCallbacks as g, CollapseNodeOptions as h, DisplacementDirection as i, DockStrategy as j, ExplosionSnapshot as k, Point as l, TrajectoryPoint as m };
|
|
@@ -214,4 +214,4 @@ interface CanvasDockingCallbacks<TNode extends CanvasNode = CanvasNode> {
|
|
|
214
214
|
onDockDrop?: (dockTarget: TNode, draggedNode: TNode) => void;
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
-
export type { CanvasNode as C, DirectionalDisplacementOptions as D, ExplodeNodeOptions as E, FanOutTrajectoryOptions as F, GraphDifferences as G, IncrementalLayoutOptions as I, NodeTransition as N, PlaceBesideOptions as P, Rect as R, Side as S, TrajectoryFunction as T, XYPosition as X, CanvasEdge as a, CanvasLayoutOptions as b, CanvasNodeStyle as c, ReflowDisplacementOptions as d, CanvasClipboardPayload as e,
|
|
217
|
+
export type { CanvasNode as C, DirectionalDisplacementOptions as D, ExplodeNodeOptions as E, FanOutTrajectoryOptions as F, GraphDifferences as G, IncrementalLayoutOptions as I, NodeTransition as N, PlaceBesideOptions as P, Rect as R, Side as S, TrajectoryFunction as T, XYPosition as X, CanvasEdge as a, CanvasLayoutOptions as b, CanvasNodeStyle as c, ReflowDisplacementOptions as d, CanvasClipboardPayload as e, Position as f, CanvasDockingCallbacks as g, CollapseNodeOptions as h, DisplacementDirection as i, DockStrategy as j, ExplosionSnapshot as k, Point as l, TrajectoryPoint as m };
|