@fileverse-dev/ddoc 3.2.6-sg-1 → 3.2.6-sg-3
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/index.es.js +16026 -15853
- package/dist/package/components/inline-comment/context/types.d.ts +2 -0
- package/dist/package/extensions/comment/comment-decoration-plugin.d.ts +8 -7
- package/dist/package/extensions/suggestion/suggestion-tracking-extension.d.ts +2 -0
- package/dist/package/stores/comment-store.d.ts +12 -3
- package/dist/package/types.d.ts +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -31,6 +31,8 @@ export interface SuggestionFloatingDraftCard extends CommentFloatingBaseCard {
|
|
|
31
31
|
suggestionId: string;
|
|
32
32
|
/** Accumulated inserted text from the live suggestion context. */
|
|
33
33
|
insertedText: string;
|
|
34
|
+
/** Pasted link href for link suggestions. */
|
|
35
|
+
linkHref?: string;
|
|
34
36
|
}
|
|
35
37
|
export type CommentFloatingCard = CommentFloatingDraftCard | CommentFloatingThreadCard | SuggestionFloatingDraftCard;
|
|
36
38
|
export interface InlineCommentData {
|
|
@@ -54,15 +54,16 @@ export declare function resolveCommentAnchorRangeForAnalysis(anchor: Pick<Commen
|
|
|
54
54
|
* whether each anchor remains unchanged, gets edited, or is deleted.
|
|
55
55
|
*
|
|
56
56
|
* Classification rules (in order):
|
|
57
|
-
* 1.
|
|
58
|
-
* 2.
|
|
59
|
-
* 3. If
|
|
60
|
-
* 4. If
|
|
61
|
-
* 5. If
|
|
62
|
-
* 6. If
|
|
57
|
+
* 1. If the transform preserves positions → 'unchanged'
|
|
58
|
+
* 2. Skip deleted or resolved anchors → 'unchanged'
|
|
59
|
+
* 3. If anchor has no old position → 'unchanged'
|
|
60
|
+
* 4. If no changed ranges touch the anchor → 'unchanged'
|
|
61
|
+
* 5. If any changed range fully covers the anchor → 'deleted' (full-span replacement)
|
|
62
|
+
* 6. If combined changed ranges fully cover the anchor → 'deleted' (multi-step removal)
|
|
63
|
+
* 7. If anchor maps through transform → check if position or content changed:
|
|
63
64
|
* a. If both unchanged → 'unchanged'
|
|
64
65
|
* b. Otherwise → 'edited' (return new position and relative anchor)
|
|
65
|
-
*
|
|
66
|
+
* 8. If mapping fails → 'deleted'
|
|
66
67
|
*/
|
|
67
68
|
export declare function analyzeCommentAnchorTransactionChanges(anchors: CommentAnchor[], oldState: EditorState, newState: EditorState, transform: Transform): CommentAnchorTransactionChange[];
|
|
68
69
|
export interface CommentDecorationOptions {
|
|
@@ -21,6 +21,8 @@ export interface SuggestionTrackingOptions {
|
|
|
21
21
|
onReplaceTyping: (from: number, to: number, text: string) => void;
|
|
22
22
|
/** Viewer presses Backspace/Delete with a non-empty selection. */
|
|
23
23
|
onDeleteSelection: (from: number, to: number) => void;
|
|
24
|
+
/** Viewer pastes a link over selected text. */
|
|
25
|
+
onPasteLink: (from: number, to: number, href: string) => void;
|
|
24
26
|
/**
|
|
25
27
|
* Viewer presses Backspace/Delete with a collapsed cursor.
|
|
26
28
|
* The consumer decides whether this should shrink an active draft or create
|
|
@@ -41,9 +41,9 @@ export interface CommentExternalDeps {
|
|
|
41
41
|
/**
|
|
42
42
|
* A suggestion draft is the viewer's in-progress proposed edit — kept local
|
|
43
43
|
* until Submit. Drafts live in memory only (lost on refresh). Derived into
|
|
44
|
-
* a CommentAnchor for decoration rendering via deriveDraftAnchor().
|
|
45
|
-
* suggestion
|
|
46
|
-
*
|
|
44
|
+
* a CommentAnchor for decoration rendering via deriveDraftAnchor(). Most
|
|
45
|
+
* suggestion types are derived at use time from hadDeletion + insertedText;
|
|
46
|
+
* linkHref marks a link suggestion over the original selected text.
|
|
47
47
|
*/
|
|
48
48
|
export interface DraftSuggestion {
|
|
49
49
|
id: string;
|
|
@@ -57,8 +57,11 @@ export interface DraftSuggestion {
|
|
|
57
57
|
keystrokes: string[];
|
|
58
58
|
/** True when the draft was created via select+delete or select+type. */
|
|
59
59
|
hadDeletion: boolean;
|
|
60
|
+
/** Pasted link href for a link suggestion. */
|
|
61
|
+
linkHref?: string;
|
|
60
62
|
}
|
|
61
63
|
type SuggestionDeleteDirection = 'backward' | 'forward';
|
|
64
|
+
export declare function isRangeDraft(draft: DraftSuggestion): boolean;
|
|
62
65
|
type FloatingCardsUpdater = React.SetStateAction<CommentFloatingCard[]>;
|
|
63
66
|
type InlineCommentDataUpdater = Partial<InlineCommentData> | ((prev: InlineCommentData) => Partial<InlineCommentData> | InlineCommentData);
|
|
64
67
|
type InlineDraftRecordMap = Record<string, InlineCommentDraft>;
|
|
@@ -186,6 +189,7 @@ export interface CommentStoreState {
|
|
|
186
189
|
cancelFloatingDraft: (draftId: string) => void;
|
|
187
190
|
submitFloatingDraft: (draftId: string) => void;
|
|
188
191
|
openFloatingThread: (commentId: string) => void;
|
|
192
|
+
focusSubmittedSuggestionFromEditor: (commentId: string) => boolean;
|
|
189
193
|
closeFloatingCard: (floatingCardId: string) => void;
|
|
190
194
|
blurFloatingCard: (floatingCardId: string) => void;
|
|
191
195
|
focusFloatingCard: (floatingCardId: string) => void;
|
|
@@ -220,6 +224,11 @@ export interface CommentStoreState {
|
|
|
220
224
|
* as soon as the viewer types.
|
|
221
225
|
*/
|
|
222
226
|
startDeleteDraft: (from: number, to: number, collapseTo?: number) => void;
|
|
227
|
+
/**
|
|
228
|
+
* Create a link suggestion from a selected range and pasted href.
|
|
229
|
+
* The document stays unchanged until the owner accepts the suggestion.
|
|
230
|
+
*/
|
|
231
|
+
startLinkDraft: (from: number, to: number, href: string) => void;
|
|
223
232
|
/**
|
|
224
233
|
* Convert a collapsed-caret Backspace/Delete into a delete draft when the
|
|
225
234
|
* caret is adjacent to text, or shrink the active draft if the caret is
|
package/dist/package/types.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export type InlineCommentData = {
|
|
|
20
20
|
handleClick: boolean;
|
|
21
21
|
};
|
|
22
22
|
export type CommentMutationType = 'create' | 'edit' | 'resolve' | 'unresolve' | 'delete';
|
|
23
|
-
export type SuggestionType = 'add' | 'replace' | 'delete';
|
|
23
|
+
export type SuggestionType = 'add' | 'replace' | 'delete' | 'link';
|
|
24
24
|
export interface CommentMutationMeta {
|
|
25
25
|
type: CommentMutationType;
|
|
26
26
|
updateChunk?: string;
|