rte-builder 1.0.0 → 2.0.2
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 +219 -132
- package/dist/index.css +997 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +538 -2
- package/dist/index.d.ts +538 -2
- package/dist/index.js +1453 -2196
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1433 -2189
- package/dist/index.mjs.map +1 -1
- package/package.json +21 -10
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import react__default from 'react';
|
|
2
|
+
import react__default, { ReactNode } from 'react';
|
|
3
3
|
import { Editor } from '@tiptap/react';
|
|
4
4
|
import { Extension, Node } from '@tiptap/core';
|
|
5
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Core types for the RTE Builder - Editor Agnostic
|
|
@@ -687,4 +688,539 @@ declare module '@tiptap/core' {
|
|
|
687
688
|
}
|
|
688
689
|
declare const Indent: Extension<IndentOptions, any>;
|
|
689
690
|
|
|
690
|
-
|
|
691
|
+
/**
|
|
692
|
+
* Collaboration Types
|
|
693
|
+
* Types for real-time collaborative editing features
|
|
694
|
+
*/
|
|
695
|
+
/** User presence information */
|
|
696
|
+
interface CollaborationUser {
|
|
697
|
+
/** Unique user identifier */
|
|
698
|
+
id: string;
|
|
699
|
+
/** Display name */
|
|
700
|
+
name: string;
|
|
701
|
+
/** Avatar URL (optional) */
|
|
702
|
+
avatar?: string;
|
|
703
|
+
/** User color for cursor/selection */
|
|
704
|
+
color: string;
|
|
705
|
+
/** Current cursor position (optional) */
|
|
706
|
+
cursor?: CursorPosition;
|
|
707
|
+
/** Whether user is currently active */
|
|
708
|
+
isActive: boolean;
|
|
709
|
+
/** Last activity timestamp */
|
|
710
|
+
lastActive: number;
|
|
711
|
+
}
|
|
712
|
+
/** Cursor position in the document */
|
|
713
|
+
interface CursorPosition {
|
|
714
|
+
/** Position index in the document */
|
|
715
|
+
index: number;
|
|
716
|
+
/** Length of selection (0 if just cursor) */
|
|
717
|
+
length: number;
|
|
718
|
+
}
|
|
719
|
+
/** Collaboration provider configuration */
|
|
720
|
+
interface CollaborationConfig {
|
|
721
|
+
/** Provider type */
|
|
722
|
+
provider: 'websocket' | 'webrtc' | 'custom';
|
|
723
|
+
/** Server URL for websocket/webrtc */
|
|
724
|
+
serverUrl?: string;
|
|
725
|
+
/** Room/document identifier */
|
|
726
|
+
roomId: string;
|
|
727
|
+
/** Current user information */
|
|
728
|
+
user: Omit<CollaborationUser, 'cursor' | 'isActive' | 'lastActive'>;
|
|
729
|
+
/** Authentication token (optional) */
|
|
730
|
+
token?: string;
|
|
731
|
+
/** Auto-reconnect on disconnect */
|
|
732
|
+
autoReconnect?: boolean;
|
|
733
|
+
/** Reconnect interval in ms */
|
|
734
|
+
reconnectInterval?: number;
|
|
735
|
+
/** Maximum reconnect attempts */
|
|
736
|
+
maxReconnectAttempts?: number;
|
|
737
|
+
}
|
|
738
|
+
/** Collaboration connection status */
|
|
739
|
+
type CollaborationStatus = 'disconnected' | 'connecting' | 'connected' | 'reconnecting' | 'error';
|
|
740
|
+
/** Collaboration state */
|
|
741
|
+
interface CollaborationState {
|
|
742
|
+
/** Connection status */
|
|
743
|
+
status: CollaborationStatus;
|
|
744
|
+
/** Connected users */
|
|
745
|
+
users: CollaborationUser[];
|
|
746
|
+
/** Error message if status is 'error' */
|
|
747
|
+
error?: string;
|
|
748
|
+
/** Is current user the host/owner */
|
|
749
|
+
isHost: boolean;
|
|
750
|
+
}
|
|
751
|
+
/** Collaboration event types */
|
|
752
|
+
type CollaborationEvent = {
|
|
753
|
+
type: 'user-joined';
|
|
754
|
+
user: CollaborationUser;
|
|
755
|
+
} | {
|
|
756
|
+
type: 'user-left';
|
|
757
|
+
userId: string;
|
|
758
|
+
} | {
|
|
759
|
+
type: 'cursor-moved';
|
|
760
|
+
userId: string;
|
|
761
|
+
cursor: CursorPosition;
|
|
762
|
+
} | {
|
|
763
|
+
type: 'content-changed';
|
|
764
|
+
origin: string;
|
|
765
|
+
} | {
|
|
766
|
+
type: 'status-changed';
|
|
767
|
+
status: CollaborationStatus;
|
|
768
|
+
} | {
|
|
769
|
+
type: 'error';
|
|
770
|
+
message: string;
|
|
771
|
+
};
|
|
772
|
+
/** Props for collaboration-enabled editor */
|
|
773
|
+
interface CollaborationProps {
|
|
774
|
+
/** Enable collaboration features */
|
|
775
|
+
collaboration?: CollaborationConfig;
|
|
776
|
+
/** Callback when collaboration status changes */
|
|
777
|
+
onCollaborationStatusChange?: (status: CollaborationStatus) => void;
|
|
778
|
+
/** Callback when users join/leave */
|
|
779
|
+
onUsersChange?: (users: CollaborationUser[]) => void;
|
|
780
|
+
/** Show user cursors */
|
|
781
|
+
showCursors?: boolean;
|
|
782
|
+
/** Show user avatars in presence list */
|
|
783
|
+
showPresence?: boolean;
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
/** Context value type */
|
|
787
|
+
interface CollaborationContextValue {
|
|
788
|
+
state: CollaborationState;
|
|
789
|
+
config: CollaborationConfig | null;
|
|
790
|
+
connect: () => Promise<void>;
|
|
791
|
+
disconnect: () => void;
|
|
792
|
+
updateCursor: (cursor: CursorPosition) => void;
|
|
793
|
+
isEnabled: boolean;
|
|
794
|
+
}
|
|
795
|
+
/** Provider props */
|
|
796
|
+
interface CollaborationProviderProps {
|
|
797
|
+
children: ReactNode;
|
|
798
|
+
config?: CollaborationConfig;
|
|
799
|
+
onStatusChange?: (status: CollaborationStatus) => void;
|
|
800
|
+
onUsersChange?: (users: CollaborationUser[]) => void;
|
|
801
|
+
}
|
|
802
|
+
/** Collaboration Provider Component */
|
|
803
|
+
declare function CollaborationProvider({ children, config, onStatusChange, onUsersChange, }: CollaborationProviderProps): react_jsx_runtime.JSX.Element;
|
|
804
|
+
/** Hook to use collaboration context */
|
|
805
|
+
declare function useCollaboration(): CollaborationContextValue;
|
|
806
|
+
/** Hook to check if collaboration is available (doesn't throw) */
|
|
807
|
+
declare function useCollaborationOptional(): CollaborationContextValue | null;
|
|
808
|
+
|
|
809
|
+
/**
|
|
810
|
+
* Presence Indicator Component
|
|
811
|
+
* Shows connected users with avatars and status
|
|
812
|
+
*/
|
|
813
|
+
interface PresenceIndicatorProps {
|
|
814
|
+
/** Maximum avatars to show before "+N" */
|
|
815
|
+
maxAvatars?: number;
|
|
816
|
+
/** Show user names on hover */
|
|
817
|
+
showNames?: boolean;
|
|
818
|
+
/** Custom class name */
|
|
819
|
+
className?: string;
|
|
820
|
+
}
|
|
821
|
+
/** Presence Indicator Component */
|
|
822
|
+
declare function PresenceIndicator({ maxAvatars, showNames, className, }: PresenceIndicatorProps): react_jsx_runtime.JSX.Element | null;
|
|
823
|
+
|
|
824
|
+
/**
|
|
825
|
+
* Comments & Annotations Types
|
|
826
|
+
* Types for inline comments and annotation features
|
|
827
|
+
*/
|
|
828
|
+
/** Comment author information */
|
|
829
|
+
interface CommentAuthor {
|
|
830
|
+
/** Unique user identifier */
|
|
831
|
+
id: string;
|
|
832
|
+
/** Display name */
|
|
833
|
+
name: string;
|
|
834
|
+
/** Avatar URL (optional) */
|
|
835
|
+
avatar?: string;
|
|
836
|
+
}
|
|
837
|
+
/** Text range for comment anchor */
|
|
838
|
+
interface CommentRange {
|
|
839
|
+
/** Start position in document */
|
|
840
|
+
from: number;
|
|
841
|
+
/** End position in document */
|
|
842
|
+
to: number;
|
|
843
|
+
/** Selected text content */
|
|
844
|
+
text: string;
|
|
845
|
+
}
|
|
846
|
+
/** Single comment in a thread */
|
|
847
|
+
interface Comment {
|
|
848
|
+
/** Unique comment identifier */
|
|
849
|
+
id: string;
|
|
850
|
+
/** Thread this comment belongs to */
|
|
851
|
+
threadId: string;
|
|
852
|
+
/** Comment content (can be HTML) */
|
|
853
|
+
content: string;
|
|
854
|
+
/** Comment author */
|
|
855
|
+
author: CommentAuthor;
|
|
856
|
+
/** Creation timestamp */
|
|
857
|
+
createdAt: number;
|
|
858
|
+
/** Last update timestamp */
|
|
859
|
+
updatedAt?: number;
|
|
860
|
+
/** Is this comment edited */
|
|
861
|
+
isEdited: boolean;
|
|
862
|
+
/** Reactions on this comment */
|
|
863
|
+
reactions?: CommentReaction[];
|
|
864
|
+
}
|
|
865
|
+
/** Reaction on a comment */
|
|
866
|
+
interface CommentReaction {
|
|
867
|
+
/** Emoji reaction */
|
|
868
|
+
emoji: string;
|
|
869
|
+
/** Users who reacted */
|
|
870
|
+
users: CommentAuthor[];
|
|
871
|
+
}
|
|
872
|
+
/** Comment thread (group of comments on a text range) */
|
|
873
|
+
interface CommentThread {
|
|
874
|
+
/** Unique thread identifier */
|
|
875
|
+
id: string;
|
|
876
|
+
/** Text range this thread is attached to */
|
|
877
|
+
range: CommentRange;
|
|
878
|
+
/** Comments in this thread */
|
|
879
|
+
comments: Comment[];
|
|
880
|
+
/** Thread status */
|
|
881
|
+
status: 'open' | 'resolved';
|
|
882
|
+
/** Thread creation timestamp */
|
|
883
|
+
createdAt: number;
|
|
884
|
+
/** Thread resolution timestamp */
|
|
885
|
+
resolvedAt?: number;
|
|
886
|
+
/** User who resolved the thread */
|
|
887
|
+
resolvedBy?: CommentAuthor;
|
|
888
|
+
}
|
|
889
|
+
/** Comments state */
|
|
890
|
+
interface CommentsState {
|
|
891
|
+
/** All comment threads */
|
|
892
|
+
threads: CommentThread[];
|
|
893
|
+
/** Currently active/selected thread ID */
|
|
894
|
+
activeThreadId: string | null;
|
|
895
|
+
/** Is comment panel open */
|
|
896
|
+
isPanelOpen: boolean;
|
|
897
|
+
/** Filter for threads */
|
|
898
|
+
filter: 'all' | 'open' | 'resolved';
|
|
899
|
+
/** Current user (for adding comments) */
|
|
900
|
+
currentUser: CommentAuthor | null;
|
|
901
|
+
}
|
|
902
|
+
/** Comment event types */
|
|
903
|
+
type CommentEvent = {
|
|
904
|
+
type: 'thread-created';
|
|
905
|
+
thread: CommentThread;
|
|
906
|
+
} | {
|
|
907
|
+
type: 'thread-deleted';
|
|
908
|
+
threadId: string;
|
|
909
|
+
} | {
|
|
910
|
+
type: 'thread-resolved';
|
|
911
|
+
threadId: string;
|
|
912
|
+
resolvedBy: CommentAuthor;
|
|
913
|
+
} | {
|
|
914
|
+
type: 'thread-reopened';
|
|
915
|
+
threadId: string;
|
|
916
|
+
} | {
|
|
917
|
+
type: 'comment-added';
|
|
918
|
+
threadId: string;
|
|
919
|
+
comment: Comment;
|
|
920
|
+
} | {
|
|
921
|
+
type: 'comment-updated';
|
|
922
|
+
threadId: string;
|
|
923
|
+
comment: Comment;
|
|
924
|
+
} | {
|
|
925
|
+
type: 'comment-deleted';
|
|
926
|
+
threadId: string;
|
|
927
|
+
commentId: string;
|
|
928
|
+
} | {
|
|
929
|
+
type: 'reaction-added';
|
|
930
|
+
threadId: string;
|
|
931
|
+
commentId: string;
|
|
932
|
+
emoji: string;
|
|
933
|
+
user: CommentAuthor;
|
|
934
|
+
} | {
|
|
935
|
+
type: 'reaction-removed';
|
|
936
|
+
threadId: string;
|
|
937
|
+
commentId: string;
|
|
938
|
+
emoji: string;
|
|
939
|
+
userId: string;
|
|
940
|
+
};
|
|
941
|
+
/** Comments configuration */
|
|
942
|
+
interface CommentsConfig {
|
|
943
|
+
/** Current user for adding comments */
|
|
944
|
+
currentUser: CommentAuthor;
|
|
945
|
+
/** Allow resolving threads */
|
|
946
|
+
allowResolve?: boolean;
|
|
947
|
+
/** Allow deleting comments */
|
|
948
|
+
allowDelete?: boolean;
|
|
949
|
+
/** Allow editing comments */
|
|
950
|
+
allowEdit?: boolean;
|
|
951
|
+
/** Allow reactions */
|
|
952
|
+
allowReactions?: boolean;
|
|
953
|
+
/** Available reaction emojis */
|
|
954
|
+
reactionEmojis?: string[];
|
|
955
|
+
/** Callback to persist comments */
|
|
956
|
+
onSave?: (threads: CommentThread[]) => Promise<void>;
|
|
957
|
+
/** Callback to load comments */
|
|
958
|
+
onLoad?: () => Promise<CommentThread[]>;
|
|
959
|
+
}
|
|
960
|
+
/** Props for comments-enabled editor */
|
|
961
|
+
interface CommentsProps {
|
|
962
|
+
/** Enable comments features */
|
|
963
|
+
comments?: CommentsConfig;
|
|
964
|
+
/** Initial comment threads */
|
|
965
|
+
initialThreads?: CommentThread[];
|
|
966
|
+
/** Callback when threads change */
|
|
967
|
+
onThreadsChange?: (threads: CommentThread[]) => void;
|
|
968
|
+
/** Show comment highlights in editor */
|
|
969
|
+
showCommentHighlights?: boolean;
|
|
970
|
+
/** Show comment panel */
|
|
971
|
+
showCommentPanel?: boolean;
|
|
972
|
+
/** Comment panel position */
|
|
973
|
+
commentPanelPosition?: 'left' | 'right';
|
|
974
|
+
}
|
|
975
|
+
/** Default reaction emojis */
|
|
976
|
+
declare const DEFAULT_REACTION_EMOJIS: string[];
|
|
977
|
+
|
|
978
|
+
/** Context value type */
|
|
979
|
+
interface CommentsContextValue {
|
|
980
|
+
state: CommentsState;
|
|
981
|
+
config: CommentsConfig | null;
|
|
982
|
+
createThread: (range: CommentRange, initialComment: string) => CommentThread | null;
|
|
983
|
+
deleteThread: (threadId: string) => void;
|
|
984
|
+
resolveThread: (threadId: string) => void;
|
|
985
|
+
reopenThread: (threadId: string) => void;
|
|
986
|
+
addComment: (threadId: string, content: string) => Comment | null;
|
|
987
|
+
updateComment: (threadId: string, commentId: string, content: string) => void;
|
|
988
|
+
deleteComment: (threadId: string, commentId: string) => void;
|
|
989
|
+
addReaction: (threadId: string, commentId: string, emoji: string) => void;
|
|
990
|
+
removeReaction: (threadId: string, commentId: string, emoji: string) => void;
|
|
991
|
+
setActiveThread: (threadId: string | null) => void;
|
|
992
|
+
togglePanel: (isOpen?: boolean) => void;
|
|
993
|
+
setFilter: (filter: 'all' | 'open' | 'resolved') => void;
|
|
994
|
+
getThreadByRange: (from: number, to: number) => CommentThread | undefined;
|
|
995
|
+
getFilteredThreads: () => CommentThread[];
|
|
996
|
+
subscribe: (callback: (event: CommentEvent) => void) => () => void;
|
|
997
|
+
isEnabled: boolean;
|
|
998
|
+
}
|
|
999
|
+
/** Provider props */
|
|
1000
|
+
interface CommentsProviderProps {
|
|
1001
|
+
children: ReactNode;
|
|
1002
|
+
config?: CommentsConfig;
|
|
1003
|
+
initialThreads?: CommentThread[];
|
|
1004
|
+
onThreadsChange?: (threads: CommentThread[]) => void;
|
|
1005
|
+
}
|
|
1006
|
+
/** Comments Provider Component */
|
|
1007
|
+
declare function CommentsProvider({ children, config, initialThreads, onThreadsChange, }: CommentsProviderProps): react_jsx_runtime.JSX.Element;
|
|
1008
|
+
/** Hook to use comments context */
|
|
1009
|
+
declare function useComments(): CommentsContextValue;
|
|
1010
|
+
/** Hook to check if comments is available (doesn't throw) */
|
|
1011
|
+
declare function useCommentsOptional(): CommentsContextValue | null;
|
|
1012
|
+
|
|
1013
|
+
/**
|
|
1014
|
+
* Comments Panel Component
|
|
1015
|
+
* Displays comment threads with reply functionality
|
|
1016
|
+
*/
|
|
1017
|
+
interface CommentsPanelProps {
|
|
1018
|
+
/** Panel position */
|
|
1019
|
+
position?: 'left' | 'right';
|
|
1020
|
+
/** Custom class name */
|
|
1021
|
+
className?: string;
|
|
1022
|
+
}
|
|
1023
|
+
/** Comments Panel Component */
|
|
1024
|
+
declare function CommentsPanel({ position, className }: CommentsPanelProps): react_jsx_runtime.JSX.Element | null;
|
|
1025
|
+
|
|
1026
|
+
/**
|
|
1027
|
+
* Version History Types
|
|
1028
|
+
* Types for document version history and change tracking
|
|
1029
|
+
*/
|
|
1030
|
+
/** Author of a version */
|
|
1031
|
+
interface VersionAuthor {
|
|
1032
|
+
/** Unique user identifier */
|
|
1033
|
+
id: string;
|
|
1034
|
+
/** Display name */
|
|
1035
|
+
name: string;
|
|
1036
|
+
/** Avatar URL (optional) */
|
|
1037
|
+
avatar?: string;
|
|
1038
|
+
}
|
|
1039
|
+
/** A single version/snapshot of the document */
|
|
1040
|
+
interface Version {
|
|
1041
|
+
/** Unique version identifier */
|
|
1042
|
+
id: string;
|
|
1043
|
+
/** Version number (incremental) */
|
|
1044
|
+
number: number;
|
|
1045
|
+
/** Version title/label (optional) */
|
|
1046
|
+
title?: string;
|
|
1047
|
+
/** Version description (optional) */
|
|
1048
|
+
description?: string;
|
|
1049
|
+
/** HTML content at this version */
|
|
1050
|
+
content: string;
|
|
1051
|
+
/** JSON content (if available) */
|
|
1052
|
+
jsonContent?: unknown;
|
|
1053
|
+
/** Plain text content */
|
|
1054
|
+
textContent: string;
|
|
1055
|
+
/** Author who created this version */
|
|
1056
|
+
author: VersionAuthor;
|
|
1057
|
+
/** Creation timestamp */
|
|
1058
|
+
createdAt: number;
|
|
1059
|
+
/** Word count at this version */
|
|
1060
|
+
wordCount: number;
|
|
1061
|
+
/** Character count at this version */
|
|
1062
|
+
characterCount: number;
|
|
1063
|
+
/** Is this version auto-saved or manual */
|
|
1064
|
+
isAutoSave: boolean;
|
|
1065
|
+
/** Is this a named/pinned version */
|
|
1066
|
+
isPinned: boolean;
|
|
1067
|
+
/** Tags for this version */
|
|
1068
|
+
tags?: string[];
|
|
1069
|
+
}
|
|
1070
|
+
/** Change between two versions */
|
|
1071
|
+
interface VersionChange {
|
|
1072
|
+
/** Type of change */
|
|
1073
|
+
type: 'addition' | 'deletion' | 'modification';
|
|
1074
|
+
/** Content that was changed */
|
|
1075
|
+
content: string;
|
|
1076
|
+
/** Position in document */
|
|
1077
|
+
position: number;
|
|
1078
|
+
}
|
|
1079
|
+
/** Version comparison result */
|
|
1080
|
+
interface VersionComparison {
|
|
1081
|
+
/** Source version ID */
|
|
1082
|
+
fromVersionId: string;
|
|
1083
|
+
/** Target version ID */
|
|
1084
|
+
toVersionId: string;
|
|
1085
|
+
/** List of changes */
|
|
1086
|
+
changes: VersionChange[];
|
|
1087
|
+
/** Summary statistics */
|
|
1088
|
+
stats: {
|
|
1089
|
+
additions: number;
|
|
1090
|
+
deletions: number;
|
|
1091
|
+
modifications: number;
|
|
1092
|
+
};
|
|
1093
|
+
}
|
|
1094
|
+
/** Version history state */
|
|
1095
|
+
interface VersionHistoryState {
|
|
1096
|
+
/** All versions */
|
|
1097
|
+
versions: Version[];
|
|
1098
|
+
/** Currently viewing version ID (null = current) */
|
|
1099
|
+
viewingVersionId: string | null;
|
|
1100
|
+
/** Is history panel open */
|
|
1101
|
+
isPanelOpen: boolean;
|
|
1102
|
+
/** Is comparing versions */
|
|
1103
|
+
isComparing: boolean;
|
|
1104
|
+
/** Version being compared from */
|
|
1105
|
+
compareFromId: string | null;
|
|
1106
|
+
/** Version being compared to */
|
|
1107
|
+
compareToId: string | null;
|
|
1108
|
+
/** Is auto-save enabled */
|
|
1109
|
+
autoSaveEnabled: boolean;
|
|
1110
|
+
/** Auto-save interval in ms */
|
|
1111
|
+
autoSaveInterval: number;
|
|
1112
|
+
}
|
|
1113
|
+
/** Version history event types */
|
|
1114
|
+
type VersionHistoryEvent = {
|
|
1115
|
+
type: 'version-created';
|
|
1116
|
+
version: Version;
|
|
1117
|
+
} | {
|
|
1118
|
+
type: 'version-deleted';
|
|
1119
|
+
versionId: string;
|
|
1120
|
+
} | {
|
|
1121
|
+
type: 'version-restored';
|
|
1122
|
+
versionId: string;
|
|
1123
|
+
} | {
|
|
1124
|
+
type: 'version-pinned';
|
|
1125
|
+
versionId: string;
|
|
1126
|
+
} | {
|
|
1127
|
+
type: 'version-unpinned';
|
|
1128
|
+
versionId: string;
|
|
1129
|
+
} | {
|
|
1130
|
+
type: 'version-renamed';
|
|
1131
|
+
versionId: string;
|
|
1132
|
+
title: string;
|
|
1133
|
+
} | {
|
|
1134
|
+
type: 'auto-save-toggled';
|
|
1135
|
+
enabled: boolean;
|
|
1136
|
+
};
|
|
1137
|
+
/** Version history configuration */
|
|
1138
|
+
interface VersionHistoryConfig {
|
|
1139
|
+
/** Current user for versioning */
|
|
1140
|
+
currentUser: VersionAuthor;
|
|
1141
|
+
/** Enable auto-save */
|
|
1142
|
+
autoSave?: boolean;
|
|
1143
|
+
/** Auto-save interval in ms (default: 60000 = 1 minute) */
|
|
1144
|
+
autoSaveInterval?: number;
|
|
1145
|
+
/** Maximum versions to keep (default: 100) */
|
|
1146
|
+
maxVersions?: number;
|
|
1147
|
+
/** Callback to persist versions */
|
|
1148
|
+
onSave?: (versions: Version[]) => Promise<void>;
|
|
1149
|
+
/** Callback to load versions */
|
|
1150
|
+
onLoad?: () => Promise<Version[]>;
|
|
1151
|
+
/** Callback when version is restored */
|
|
1152
|
+
onRestore?: (version: Version) => void;
|
|
1153
|
+
}
|
|
1154
|
+
/** Props for version history-enabled editor */
|
|
1155
|
+
interface VersionHistoryProps {
|
|
1156
|
+
/** Enable version history features */
|
|
1157
|
+
versionHistory?: VersionHistoryConfig;
|
|
1158
|
+
/** Initial versions */
|
|
1159
|
+
initialVersions?: Version[];
|
|
1160
|
+
/** Callback when versions change */
|
|
1161
|
+
onVersionsChange?: (versions: Version[]) => void;
|
|
1162
|
+
/** Show version history panel */
|
|
1163
|
+
showVersionPanel?: boolean;
|
|
1164
|
+
/** Version panel position */
|
|
1165
|
+
versionPanelPosition?: 'left' | 'right';
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
/** Context value type */
|
|
1169
|
+
interface VersionHistoryContextValue {
|
|
1170
|
+
state: VersionHistoryState;
|
|
1171
|
+
config: VersionHistoryConfig | null;
|
|
1172
|
+
createVersion: (content: string, jsonContent?: unknown, options?: {
|
|
1173
|
+
title?: string;
|
|
1174
|
+
isAutoSave?: boolean;
|
|
1175
|
+
}) => Version | null;
|
|
1176
|
+
deleteVersion: (versionId: string) => void;
|
|
1177
|
+
restoreVersion: (versionId: string) => string | null;
|
|
1178
|
+
pinVersion: (versionId: string) => void;
|
|
1179
|
+
unpinVersion: (versionId: string) => void;
|
|
1180
|
+
renameVersion: (versionId: string, title: string) => void;
|
|
1181
|
+
viewVersion: (versionId: string | null) => void;
|
|
1182
|
+
getVersionContent: (versionId: string) => string | null;
|
|
1183
|
+
compareVersions: (fromId: string, toId: string) => VersionComparison | null;
|
|
1184
|
+
startCompare: (fromId: string, toId: string) => void;
|
|
1185
|
+
stopCompare: () => void;
|
|
1186
|
+
togglePanel: (isOpen?: boolean) => void;
|
|
1187
|
+
setAutoSave: (enabled: boolean) => void;
|
|
1188
|
+
getVersion: (versionId: string) => Version | undefined;
|
|
1189
|
+
getLatestVersion: () => Version | undefined;
|
|
1190
|
+
getPinnedVersions: () => Version[];
|
|
1191
|
+
subscribe: (callback: (event: VersionHistoryEvent) => void) => () => void;
|
|
1192
|
+
isEnabled: boolean;
|
|
1193
|
+
}
|
|
1194
|
+
/** Provider props */
|
|
1195
|
+
interface VersionHistoryProviderProps {
|
|
1196
|
+
children: ReactNode;
|
|
1197
|
+
config?: VersionHistoryConfig;
|
|
1198
|
+
initialVersions?: Version[];
|
|
1199
|
+
onVersionsChange?: (versions: Version[]) => void;
|
|
1200
|
+
getCurrentContent?: () => {
|
|
1201
|
+
html: string;
|
|
1202
|
+
json?: unknown;
|
|
1203
|
+
text: string;
|
|
1204
|
+
};
|
|
1205
|
+
}
|
|
1206
|
+
/** Version History Provider Component */
|
|
1207
|
+
declare function VersionHistoryProvider({ children, config, initialVersions, onVersionsChange, getCurrentContent, }: VersionHistoryProviderProps): react_jsx_runtime.JSX.Element;
|
|
1208
|
+
/** Hook to use version history context */
|
|
1209
|
+
declare function useVersionHistory(): VersionHistoryContextValue;
|
|
1210
|
+
/** Hook to check if version history is available (doesn't throw) */
|
|
1211
|
+
declare function useVersionHistoryOptional(): VersionHistoryContextValue | null;
|
|
1212
|
+
|
|
1213
|
+
/**
|
|
1214
|
+
* Version History Panel Component
|
|
1215
|
+
* Displays version history with restore and compare functionality
|
|
1216
|
+
*/
|
|
1217
|
+
interface VersionHistoryPanelProps {
|
|
1218
|
+
/** Panel position */
|
|
1219
|
+
position?: 'left' | 'right';
|
|
1220
|
+
/** Custom class name */
|
|
1221
|
+
className?: string;
|
|
1222
|
+
}
|
|
1223
|
+
/** Version History Panel Component */
|
|
1224
|
+
declare function VersionHistoryPanel({ position, className }: VersionHistoryPanelProps): react_jsx_runtime.JSX.Element | null;
|
|
1225
|
+
|
|
1226
|
+
export { type AdapterComponentProps, type AdapterEditorRef, type BaseEditorConfig, type CollaborationConfig, type CollaborationEvent, type CollaborationProps, CollaborationProvider, type CollaborationState, type CollaborationStatus, type CollaborationUser, type Comment, type CommentAuthor, type CommentEvent, type CommentRange, type CommentThread, type CommentsConfig, CommentsPanel, type CommentsProps, CommentsProvider, type CommentsState, type CursorPosition, DEFAULT_FEATURES, DEFAULT_REACTION_EMOJIS, EMOJI_CATEGORIES, type EditorAdapter, type EditorFeatures, type EditorProps, type EditorRef, EditorRegistry, type EditorType, Emoji, FontSize, Fullscreen, Indent, type MediaFile as LegacyMediaFile, type ToolbarConfig as LegacyToolbarConfig, LineHeight, type MediaFile$1 as MediaFile, PresenceIndicator, Print, RichTextEditor, TipTapAdapter, TipTapEditorComponent, TipTapToolbar, type ToolbarButton, type ToolbarButtonType, type ToolbarConfig$1 as ToolbarConfig, type ToolbarPreset, type ToolbarPresetName, UnifiedEditor, type UnifiedEditorProps, type UnifiedEditorRef, type Version, type VersionAuthor, type VersionChange, type VersionComparison, type VersionHistoryConfig, type VersionHistoryEvent, VersionHistoryPanel, type VersionHistoryProps, VersionHistoryProvider, type VersionHistoryState, Video, blogToolbar, codeToolbar, compareEditorFeatures, customizeToolbar, emailToolbar, fullToolbar, getAdapter, getAllAdapters, getAvailableAdapters, getBestAvailableEditor, getDefaultEditorType, getEditorFeatures, getRegistryStats, getToolbarPreset, isEditorAvailable, mediumToolbar, minimalToolbar, registerAdapter, simpleToolbar, toolbarPresets, unregisterAdapter, useCollaboration, useCollaborationOptional, useComments, useCommentsOptional, useVersionHistory, useVersionHistoryOptional };
|