@layers-app/editor 0.0.17-editor-02 → 0.0.18

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.d.ts CHANGED
@@ -1,21 +1,10 @@
1
- import { $getNodeByKey } from 'lexical';
2
1
  import { CLEAR_EDITOR_COMMAND } from 'lexical';
3
- import { DOMExportOutput } from 'lexical';
4
2
  import { Dropzone } from '@mantine/dropzone';
5
- import { EditorConfig } from 'lexical';
6
3
  import { LexicalEditor as EditorType } from 'lexical';
7
- import { ElementNode } from 'lexical';
8
4
  import { FOCUS_COMMAND } from 'lexical';
9
5
  import { JSX as JSX_2 } from 'react/jsx-runtime';
10
- import { MarkNode } from '@lexical/mark';
11
- import { NodeKey } from 'lexical';
12
- import { RangeSelection } from 'lexical';
13
6
  import { SerializedEditorState } from 'lexical';
14
- import { SerializedElementNode } from 'lexical';
15
7
  import { SerializedLexicalNode } from 'lexical';
16
- import { Spread } from 'lexical';
17
-
18
- export { $getNodeByKey }
19
8
 
20
9
  export declare type ActiveUserProfile<DATA extends object> = EditorUser<DATA> & {
21
10
  id: string;
@@ -23,11 +12,9 @@ export declare type ActiveUserProfile<DATA extends object> = EditorUser<DATA> &
23
12
 
24
13
  export { CLEAR_EDITOR_COMMAND }
25
14
 
26
- declare type CommentResolve = 'ACCEPTED' | 'REJECTED' | null;
27
-
28
15
  export { Dropzone }
29
16
 
30
- export declare const Editor: <USER_DATA extends object, CHILD_PAGE extends PageData>({ initialContent, onChange, outputFormat, mode, maxHeight, onBlur, onFocus, fetchUploadImage, fetchDeleteImage, currentUser, commentOptions, workspaceMembers, maxImageSize, contentModalUploadImage, maxImageSizeError, debounce: debounceMs, disable, ws, excludeNodes, imagePickerSettings, childPages, language, editorRef, }: EditorProps<USER_DATA, CHILD_PAGE>) => JSX_2.Element;
17
+ export declare const Editor: <USER_DATA extends object, CHILD_PAGE extends PageData>({ initialContent, onChange, outputFormat, mode, maxHeight, onBlur, onFocus, fetchUploadMedia, fetchDeleteMedia, maxImageSize, contentModalUploadImage, maxImageSizeError, debounce: debounceMs, disable, ws, excludeNodes, imagePickerSettings, childPages, language, editorRef, }: EditorProps<USER_DATA, CHILD_PAGE>) => JSX_2.Element;
31
18
 
32
19
  declare interface EditorProps<USER_DATA extends object = object, PAGE_DATA extends PageData = PageData> {
33
20
  initialContent: Root | string;
@@ -37,14 +24,11 @@ declare interface EditorProps<USER_DATA extends object = object, PAGE_DATA exten
37
24
  onFocus?: () => void;
38
25
  mode?: Mode;
39
26
  maxHeight?: number;
40
- fetchUploadImage?: FetchUploadImage;
41
- fetchDeleteImage?: FetchDeleteImage;
27
+ fetchUploadMedia?: fetchUploadMedia;
28
+ fetchDeleteMedia?: fetchDeleteMedia;
42
29
  maxImageSize?: number;
43
30
  contentModalUploadImage?: React.FunctionComponent;
44
31
  maxImageSizeError?: () => void;
45
- currentUser?: IUser;
46
- commentOptions?: ICommentOptions;
47
- workspaceMembers?: IMember[];
48
32
  debounce?: number;
49
33
  disable?: boolean;
50
34
  ws?: EditorWebSocketProps<USER_DATA>;
@@ -74,109 +58,12 @@ declare interface EditorWebSocketProps<USER_DATA extends object> {
74
58
 
75
59
  declare type ErrorDeleteImage = (error?: Error) => void;
76
60
 
77
- export declare class ExtendMarkNode extends MarkNode implements ElementNode {
78
- __extendIds: string[];
79
- __resolve: CommentResolve;
80
- constructor(idsExtend: string[], resolve?: CommentResolve, key?: NodeKey);
81
- static getType(): string;
82
- static clone(node: ExtendMarkNode): ExtendMarkNode;
83
- static importJSON(serializedNode: SerializedMarkNode): ExtendMarkNode;
84
- static importDOM(): null;
85
- resolveThreat(value: CommentResolve): CommentResolve;
86
- createDOM(config: EditorConfig): HTMLElement;
87
- exportDOM(editor: EditorType): DOMExportOutput;
88
- updateDOM(prevNode: MarkNode, element: HTMLElement, config: EditorConfig): boolean;
89
- exportJSON(): SerializedMarkNode;
90
- excludeFromCopy(_destination: 'clone' | 'html'): boolean;
91
- updateExtendId(tempId: string, realId: string): void;
92
- }
93
-
94
- declare type FetchDeleteImage = (id: string, success: SuccessDeleteImage, error?: ErrorDeleteImage) => void;
61
+ declare type fetchDeleteMedia = (id: string, success: SuccessDeleteImage, error?: ErrorDeleteImage) => void;
95
62
 
96
- declare type FetchUploadImage = (file: File, success: SuccessUploadImage, error?: ErrorDeleteImage) => void;
63
+ declare type fetchUploadMedia = (file: File, success: SuccessUploadImage, error?: ErrorDeleteImage) => void;
97
64
 
98
65
  export { FOCUS_COMMAND }
99
66
 
100
- declare interface ICommentActions {
101
- fetchCommentsApi: (params: IFetchCommentsParams) => Promise<void>;
102
- resolveCommentApi: (params: IResolveCommentParams) => Promise<void>;
103
- commentReactionApi: (params: ICommentReactionParams) => Promise<void>;
104
- deleteReactionApi: (params: IDeleteReactionParams) => Promise<void>;
105
- deleteCommentApi: (params: IDeleteCommentParams) => Promise<void>;
106
- restoreCommentApi: (params: IRestoreCommentParams) => Promise<void>;
107
- updateCommentTextApi: (params: IUpdateCommentTextParams) => Promise<void>;
108
- deleteCommentImageApi: (params: IDeleteCommentImageParams) => Promise<void>;
109
- submitCommentApi: (params: ISubmitCommentParams) => Promise<void>;
110
- getReactionsApi: (params: IGetReactionsParams) => Promise<{
111
- content: ICommentReaction[];
112
- }>;
113
- getPhotosApi: (params: IGetPhotosParams) => Promise<File[]>;
114
- uploadCommentFileApi: (params: IUploadCommentFileParams) => Promise<void>;
115
- }
116
-
117
- declare interface ICommentOptions {
118
- showComments: boolean;
119
- setShowComments: (value?: boolean) => void;
120
- pageId: string;
121
- workspaceInfo: {
122
- title: string;
123
- icon: string;
124
- };
125
- commentActions: ICommentActions;
126
- }
127
-
128
- declare interface ICommentReaction {
129
- id: string;
130
- commentId: string;
131
- parentId: string;
132
- parentType: 'COMMENT' | 'THREAD';
133
- reaction: string;
134
- userId: string;
135
- createdAt: string;
136
- deleted: boolean;
137
- deletedAt: string;
138
- version: number;
139
- }
140
-
141
- declare interface ICommentReactionParams {
142
- commentId: string;
143
- author: string;
144
- emojiValue: string;
145
- onSuccess?: (data: ICommentReaction) => void;
146
- onError: () => void;
147
- }
148
-
149
- declare interface IDeleteCommentImageParams {
150
- photoToRemove: string;
151
- onSuccess?: () => void;
152
- }
153
-
154
- declare interface IDeleteCommentParams {
155
- deleteCommentId: string;
156
- onSuccess?: () => void;
157
- }
158
-
159
- declare interface IDeleteReactionParams {
160
- reactionId: string;
161
- onSuccess?: () => void;
162
- onError: () => void;
163
- }
164
-
165
- declare interface IFetchCommentsParams {
166
- fetchPageComments?: boolean;
167
- pageId: string;
168
- fetchCommentComments?: boolean;
169
- onSuccess: (data: any) => void;
170
- }
171
-
172
- declare interface IGetPhotosParams {
173
- commentId: string;
174
- }
175
-
176
- declare interface IGetReactionsParams {
177
- commentId: string;
178
- }
179
-
180
67
  declare type ImagePickerSettings = {
181
68
  maxUploadFiles?: number;
182
69
  unsplashClientId?: string;
@@ -185,79 +72,8 @@ declare type ImagePickerSettings = {
185
72
  link?: boolean;
186
73
  };
187
74
 
188
- declare interface IMember {
189
- accepted: boolean;
190
- avatarUrl: string;
191
- email: string;
192
- expiresAt: string | null;
193
- invitationId: string | null;
194
- invitationToken: string | null;
195
- name: string;
196
- roleType: string;
197
- roleId: string;
198
- userId: string;
199
- }
200
-
201
- declare interface IResolveCommentParams {
202
- threatId: string;
203
- resolveValue: 'ACCEPTED' | 'REJECTED';
204
- onSuccess?: () => void;
205
- onError?: () => void;
206
- }
207
-
208
- declare interface IRestoreCommentParams {
209
- commentId: string;
210
- onSuccess?: () => void;
211
- }
212
-
213
- declare interface ISubmitCommentParams {
214
- text: string;
215
- parentType: string;
216
- parentId: string;
217
- onSuccess?: (data: any) => void;
218
- }
219
-
220
- declare interface IUpdateCommentTextParams {
221
- commentId: string;
222
- textValue: string;
223
- onSuccess?: () => void;
224
- onError?: () => void;
225
- }
226
-
227
- declare interface IUploadCommentFileParams {
228
- file: File;
229
- commentId: string;
230
- onSuccess?: (data: any) => void;
231
- }
232
-
233
- declare interface IUser {
234
- activeWorkspaceId: string;
235
- createdAt: string;
236
- darkMode: boolean;
237
- email: string;
238
- id: string;
239
- lang: string;
240
- metaData: {
241
- cover: Record<string, any>;
242
- about: string;
243
- socialNetworks: any[];
244
- fontFamily: string;
245
- };
246
- name: string;
247
- nickname: string;
248
- plan: 'FREE' | 'PRO' | 'BUSINESS' | string;
249
- profilePicture: {
250
- url: string;
251
- };
252
- timeZone: string | null;
253
- twoFactorEnabled: boolean;
254
- workspaces: any[];
255
- }
256
-
257
75
  declare type Mode = 'comment' | 'default' | 'full' | 'editor';
258
76
 
259
- export { NodeKey }
260
-
261
77
  declare type outputFormat = 'html' | 'json';
262
78
 
263
79
  declare interface PageData {
@@ -267,21 +83,15 @@ declare interface PageData {
267
83
  order: number;
268
84
  }
269
85
 
270
- export { RangeSelection }
271
-
272
86
  export declare type Root = SerializedEditorState<SerializedLexicalNode>;
273
87
 
274
- declare type SerializedMarkNode = Spread<{
275
- ids: Array<string>;
276
- }, SerializedElementNode>;
277
-
278
88
  export declare const StylesProvider: ({ children }: {
279
89
  children: React.ReactNode;
280
90
  }) => JSX_2.Element;
281
91
 
282
92
  declare type SuccessDeleteImage = () => void;
283
93
 
284
- declare type SuccessUploadImage = (url: string, id: string) => void;
94
+ declare type SuccessUploadImage = (url: string, id: string, data?: Object) => void;
285
95
 
286
96
  export { }
287
97