ct-rich-text-editor 1.0.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 +174 -0
- package/dist/App.d.ts +4 -0
- package/dist/Provider/EditorProvider.d.ts +19 -0
- package/dist/Provider/LexicalProvider.d.ts +7 -0
- package/dist/api/ai/index.d.ts +15 -0
- package/dist/api/auth.d.ts +99 -0
- package/dist/api/config/axios.d.ts +3 -0
- package/dist/api/config/endpoints.d.ts +11 -0
- package/dist/assets/style.css +1 -0
- package/dist/babel-1c4a328b.js +7479 -0
- package/dist/babel-1c4a328b.js.map +1 -0
- package/dist/components/AiPlugin/index.d.ts +4 -0
- package/dist/components/AlignMenu/AlignMenu.d.ts +4 -0
- package/dist/components/AlignMenu/index.d.ts +1 -0
- package/dist/components/BlockFormatMenu/BlockFormatMenu.d.ts +5 -0
- package/dist/components/BlockFormatMenu/constants.d.ts +14 -0
- package/dist/components/BlockFormatMenu/index.d.ts +1 -0
- package/dist/components/CodeActionMenuPlugin/components/CopyButton/index.d.ts +8 -0
- package/dist/components/CodeActionMenuPlugin/components/PrettierButton/index.d.ts +10 -0
- package/dist/components/CodeActionMenuPlugin/index.d.ts +5 -0
- package/dist/components/CodeActionMenuPlugin/utils.d.ts +1 -0
- package/dist/components/ColorPicker/ColorPicker.d.ts +5 -0
- package/dist/components/ColorPicker/index.d.ts +1 -0
- package/dist/components/ConfigurableEditorWithAuth.d.ts +15 -0
- package/dist/components/EmojiPickerWidget/EmojiPickerWidget.d.ts +5 -0
- package/dist/components/EmojiPickerWidget/index.d.ts +1 -0
- package/dist/components/FileUpload/InsertFileDialog.d.ts +7 -0
- package/dist/components/FileUpload/InsertFileUploadedDialogBody.d.ts +6 -0
- package/dist/components/FontFamilySelect/FontFamilyMenu.d.ts +9 -0
- package/dist/components/FontSizePicker/FontSizeControl.d.ts +4 -0
- package/dist/components/FormatTextMenu/FormatTextMenu.d.ts +5 -0
- package/dist/components/FormatTextMenu/index.d.ts +1 -0
- package/dist/components/ImageView/ImageDialog/ImageUploadDialogBody.d.ts +6 -0
- package/dist/components/ImageView/ImageDialog/index.d.ts +7 -0
- package/dist/components/ImageView/ImageResizer.d.ts +17 -0
- package/dist/components/ImageView/index.d.ts +15 -0
- package/dist/components/InsertMenu/InsertMenu.d.ts +4 -0
- package/dist/components/InsertMenu/index.d.ts +1 -0
- package/dist/components/Placeholder/Placeholder.d.ts +5 -0
- package/dist/components/Placeholder/index.d.ts +1 -0
- package/dist/components/TableColorPicker/index.d.ts +9 -0
- package/dist/components/TableModal/TableModal.d.ts +11 -0
- package/dist/components/Toolbar/Toolbar.d.ts +5 -0
- package/dist/components/Toolbar/index.d.ts +1 -0
- package/dist/components/Toolbar/styles.d.ts +2 -0
- package/dist/constants.d.ts +35 -0
- package/dist/context/ToolbarContext.d.ts +55 -0
- package/dist/editorConfig.d.ts +36 -0
- package/dist/estree-2cbea43c.js +4668 -0
- package/dist/estree-2cbea43c.js.map +1 -0
- package/dist/hooks/useBlockFormat.d.ts +22 -0
- package/dist/hooks/useColorPicker.d.ts +5 -0
- package/dist/hooks/useCustomCommands.d.ts +4 -0
- package/dist/hooks/useDebounce.d.ts +1 -0
- package/dist/hooks/useEditorToolbar.d.ts +11 -0
- package/dist/hooks/useInsertMenu.d.ts +9 -0
- package/dist/hooks/useModal.d.ts +5 -0
- package/dist/hooks/useS3Uploader.d.ts +11 -0
- package/dist/html-c18fb60e.js +2842 -0
- package/dist/html-c18fb60e.js.map +1 -0
- package/dist/index-229082fe.js +633 -0
- package/dist/index-229082fe.js.map +1 -0
- package/dist/index-65ff0713.js +34261 -0
- package/dist/index-65ff0713.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/main.d.ts +1 -0
- package/dist/markdown-39c3822b.js +3548 -0
- package/dist/markdown-39c3822b.js.map +1 -0
- package/dist/nodes/EmbedNode.d.ts +27 -0
- package/dist/nodes/ImageNode.d.ts +48 -0
- package/dist/nodes/MentionNode.d.ts +76 -0
- package/dist/pages/ConfigurableEditor/ConfigurableEditor.d.ts +14 -0
- package/dist/pages/ConfigurableEditor/index.d.ts +2 -0
- package/dist/pages/NotFound.d.ts +2 -0
- package/dist/pages/RichTextEditor.d.ts +6 -0
- package/dist/pages/TextareaEditor.d.ts +6 -0
- package/dist/pages/styles.d.ts +2 -0
- package/dist/plugins/AIChatPlugin.d.ts +6 -0
- package/dist/plugins/CodeHighlightPlugin.d.ts +4 -0
- package/dist/plugins/DragDropPastePlugin/index.d.ts +8 -0
- package/dist/plugins/EmbedPreviewPlugin/FloatingEmbedMenuPlugin.d.ts +4 -0
- package/dist/plugins/EmbedPreviewPlugin/index.d.ts +7 -0
- package/dist/plugins/FilePlugin.d.ts +8 -0
- package/dist/plugins/FloatingLinkEditorPlugin/index.d.ts +7 -0
- package/dist/plugins/FloatingTextFormatToolbarPlugin/index.d.ts +25 -0
- package/dist/plugins/HtmlCodeViewPlugin/index.d.ts +2 -0
- package/dist/plugins/ImagePlugin.d.ts +10 -0
- package/dist/plugins/LinkPlugin/index.d.ts +7 -0
- package/dist/plugins/LocalStoragePlugin.d.ts +9 -0
- package/dist/plugins/MentionsPlugin/index.d.ts +8 -0
- package/dist/plugins/RichTextPastePlugin/index.d.ts +1 -0
- package/dist/plugins/SignatureCanvasPlugin/SignatureCanvasDialog.d.ts +7 -0
- package/dist/plugins/SignatureCanvasPlugin/SignatureCanvasPlugin.d.ts +3 -0
- package/dist/plugins/SignatureCanvasPlugin/index.d.ts +2 -0
- package/dist/plugins/TableActionMenuPlugin/index.d.ts +7 -0
- package/dist/plugins/TableCellResizer/index.d.ts +3 -0
- package/dist/plugins/TableHoverActionsPlugin/index.d.ts +11 -0
- package/dist/plugins/TablePlugin.d.ts +1 -0
- package/dist/plugins/TreeViewPlugin.d.ts +4 -0
- package/dist/postcss-bbcc713e.js +5152 -0
- package/dist/postcss-bbcc713e.js.map +1 -0
- package/dist/standalone-36ad3877.js +2601 -0
- package/dist/standalone-36ad3877.js.map +1 -0
- package/dist/styles/PlaygroundEditorTheme.d.ts +4 -0
- package/dist/types.d.ts +131 -0
- package/dist/typescript-39d06710.js +13534 -0
- package/dist/typescript-39d06710.js.map +1 -0
- package/dist/ui/ColorPicker.d.ts +14 -0
- package/dist/ui/TextInput.d.ts +12 -0
- package/dist/utils/debounce.d.ts +7 -0
- package/dist/utils/getDOMRangeRect.d.ts +13 -0
- package/dist/utils/getSelectedNode.d.ts +4 -0
- package/dist/utils/helper.d.ts +3 -0
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/invarient.d.ts +1 -0
- package/dist/utils/setFloatingElemPosition.d.ts +8 -0
- package/dist/utils/setFloatingElemPositionForLinkEditor.d.ts +1 -0
- package/dist/utils/url.d.ts +9 -0
- package/dist/vite.svg +1 -0
- package/package.json +105 -0
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const AI_REPHRASE_COMMAND: import('../../../node_modules/lexical').LexicalCommand<unknown>;
|
|
2
|
+
export declare const AI_IMAGE_COMMAND: import('../../../node_modules/lexical').LexicalCommand<unknown>;
|
|
3
|
+
declare const AIRephrasePlugin: () => null;
|
|
4
|
+
export default AIRephrasePlugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './AlignMenu';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './BlockFormatMenu';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { LexicalEditor } from '../../../../../node_modules/lexical';
|
|
2
|
+
|
|
3
|
+
interface Props {
|
|
4
|
+
editor: LexicalEditor;
|
|
5
|
+
getCodeDOMNode: () => HTMLElement | null;
|
|
6
|
+
}
|
|
7
|
+
export declare function CopyButton({ editor, getCodeDOMNode }: Props): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { LexicalEditor } from '../../../../../node_modules/lexical';
|
|
2
|
+
|
|
3
|
+
interface Props {
|
|
4
|
+
lang: string;
|
|
5
|
+
editor: LexicalEditor;
|
|
6
|
+
getCodeDOMNode: () => HTMLElement | null;
|
|
7
|
+
}
|
|
8
|
+
export declare function canBePrettier(lang: string): boolean;
|
|
9
|
+
export declare function PrettierButton({ lang, editor, getCodeDOMNode }: Props): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useDebounce<T extends (...args: never[]) => void>(fn: T, ms: number, maxWait?: number): import('lodash-es').DebouncedFunc<(...args: Parameters<T>) => void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './ColorPicker';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ApiResponse } from '../api/auth';
|
|
3
|
+
|
|
4
|
+
interface ConfigurableEditorWithAuthProps {
|
|
5
|
+
apiKey: string;
|
|
6
|
+
initialContent?: string;
|
|
7
|
+
onChange?: (content: string) => void;
|
|
8
|
+
defaultFontFamilies?: string[];
|
|
9
|
+
mentionUserList?: string[];
|
|
10
|
+
onAuthSuccess?: () => void;
|
|
11
|
+
onAuthError?: (error: string) => void;
|
|
12
|
+
customVerifyKey?: (apiKey: string) => Promise<ApiResponse>;
|
|
13
|
+
}
|
|
14
|
+
declare const ConfigurableEditorWithAuth: React.FC<ConfigurableEditorWithAuthProps>;
|
|
15
|
+
export default ConfigurableEditorWithAuth;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './EmojiPickerWidget';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { LexicalEditor } from '../../../node_modules/lexical';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
|
|
4
|
+
interface FontFamilyMenuProps {
|
|
5
|
+
fonts?: string[];
|
|
6
|
+
activeEditor: LexicalEditor;
|
|
7
|
+
}
|
|
8
|
+
declare const FontFamilyMenu: FC<FontFamilyMenuProps>;
|
|
9
|
+
export default FontFamilyMenu;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './FormatTextMenu';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { LexicalEditor } from '../../../node_modules/lexical';
|
|
2
|
+
|
|
3
|
+
export default function ImageResizer({ onResizeStart, onResizeEnd, buttonRef, imageRef, maxWidth, editor, showCaption, setShowCaption, captionsEnabled, }: {
|
|
4
|
+
editor: LexicalEditor;
|
|
5
|
+
buttonRef: {
|
|
6
|
+
current: null | HTMLButtonElement;
|
|
7
|
+
};
|
|
8
|
+
imageRef: {
|
|
9
|
+
current: null | HTMLElement;
|
|
10
|
+
};
|
|
11
|
+
maxWidth?: number;
|
|
12
|
+
onResizeEnd: (width: "inherit" | number, height: "inherit" | number) => void;
|
|
13
|
+
onResizeStart: () => void;
|
|
14
|
+
setShowCaption: (show: boolean) => void;
|
|
15
|
+
showCaption: boolean;
|
|
16
|
+
captionsEnabled: boolean;
|
|
17
|
+
}): JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { LexicalCommand, LexicalEditor, NodeKey } from '../../../node_modules/lexical';
|
|
2
|
+
|
|
3
|
+
export declare const RIGHT_CLICK_IMAGE_COMMAND: LexicalCommand<MouseEvent>;
|
|
4
|
+
export default function ImageComponent({ src, altText, nodeKey, width, height, maxWidth, resizable, showCaption, caption, captionsEnabled, }: {
|
|
5
|
+
altText: string;
|
|
6
|
+
caption: LexicalEditor;
|
|
7
|
+
height: "inherit" | number;
|
|
8
|
+
maxWidth: number;
|
|
9
|
+
nodeKey: NodeKey;
|
|
10
|
+
resizable: boolean;
|
|
11
|
+
showCaption: boolean;
|
|
12
|
+
src: string;
|
|
13
|
+
width: "inherit" | number;
|
|
14
|
+
captionsEnabled: boolean;
|
|
15
|
+
}): JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './InsertMenu';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Placeholder';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
interface CustomModalProps {
|
|
4
|
+
title: string;
|
|
5
|
+
isOpen: boolean;
|
|
6
|
+
onClose: () => void;
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
footer: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export default function TableModal({ title, isOpen, onClose, children, footer, }: CustomModalProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Toolbar';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { CodeHighlightNode, CodeNode } from '../node_modules/@lexical/code';
|
|
2
|
+
import { LinkNode } from '../node_modules/@lexical/link';
|
|
3
|
+
import { ListItemNode, ListNode } from '../node_modules/@lexical/list';
|
|
4
|
+
import { InitialConfigType } from '../node_modules/@lexical/react/LexicalComposer';
|
|
5
|
+
import { HorizontalRuleNode } from '../node_modules/@lexical/react/LexicalHorizontalRuleNode';
|
|
6
|
+
import { HeadingNode, QuoteNode } from '../node_modules/@lexical/rich-text';
|
|
7
|
+
import { TableCellNode, TableNode, TableRowNode } from '../node_modules/@lexical/table';
|
|
8
|
+
import { TextFormatType } from '../node_modules/lexical';
|
|
9
|
+
import { EditorThemeClasses } from '../node_modules/lexical/LexicalEditor';
|
|
10
|
+
import { EmbedNode } from './nodes/EmbedNode';
|
|
11
|
+
import { ImageNode } from './nodes/ImageNode';
|
|
12
|
+
import { MentionNode } from './nodes/MentionNode';
|
|
13
|
+
import { AlignMenuItem, FormatTextMenuItem } from './types';
|
|
14
|
+
|
|
15
|
+
export declare const theme: EditorThemeClasses;
|
|
16
|
+
export declare const EDITOR_NODES: (typeof CodeNode | typeof EmbedNode | typeof LinkNode | typeof ImageNode | typeof MentionNode | typeof CodeHighlightNode | typeof HeadingNode | typeof QuoteNode | typeof ListNode | typeof ListItemNode | typeof HorizontalRuleNode | typeof TableNode | typeof TableCellNode | typeof TableRowNode)[];
|
|
17
|
+
export declare const initialConfig: InitialConfigType;
|
|
18
|
+
export declare const blockTypeToBlockName: {
|
|
19
|
+
bullet: string;
|
|
20
|
+
check: string;
|
|
21
|
+
code: string;
|
|
22
|
+
h1: string;
|
|
23
|
+
h2: string;
|
|
24
|
+
h3: string;
|
|
25
|
+
h4: string;
|
|
26
|
+
h5: string;
|
|
27
|
+
h6: string;
|
|
28
|
+
number: string;
|
|
29
|
+
paragraph: string;
|
|
30
|
+
quote: string;
|
|
31
|
+
};
|
|
32
|
+
export declare const initialHasFormat: Record<TextFormatType, boolean>;
|
|
33
|
+
export declare const alignMenuItems: AlignMenuItem[];
|
|
34
|
+
export declare const formatMenuItems: FormatTextMenuItem[];
|
|
35
|
+
export declare const LOWEST_PRIORITY = 1;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { ElementFormatType } from '../../node_modules/lexical';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
export declare const MIN_ALLOWED_FONT_SIZE = 8;
|
|
5
|
+
export declare const MAX_ALLOWED_FONT_SIZE = 72;
|
|
6
|
+
export declare const DEFAULT_FONT_SIZE = 15;
|
|
7
|
+
export declare const blockTypeToBlockName: {
|
|
8
|
+
bullet: string;
|
|
9
|
+
check: string;
|
|
10
|
+
code: string;
|
|
11
|
+
h1: string;
|
|
12
|
+
h2: string;
|
|
13
|
+
h3: string;
|
|
14
|
+
h4: string;
|
|
15
|
+
h5: string;
|
|
16
|
+
h6: string;
|
|
17
|
+
number: string;
|
|
18
|
+
paragraph: string;
|
|
19
|
+
quote: string;
|
|
20
|
+
};
|
|
21
|
+
declare const INITIAL_TOOLBAR_STATE: {
|
|
22
|
+
bgColor: string;
|
|
23
|
+
blockType: "number" | "code" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "bullet" | "check" | "paragraph" | "quote";
|
|
24
|
+
canRedo: boolean;
|
|
25
|
+
canUndo: boolean;
|
|
26
|
+
codeLanguage: string;
|
|
27
|
+
elementFormat: ElementFormatType;
|
|
28
|
+
fontColor: string;
|
|
29
|
+
fontFamily: string;
|
|
30
|
+
fontSize: string;
|
|
31
|
+
fontSizeInputValue: string;
|
|
32
|
+
isBold: boolean;
|
|
33
|
+
isCode: boolean;
|
|
34
|
+
isImageCaption: boolean;
|
|
35
|
+
isItalic: boolean;
|
|
36
|
+
isLink: boolean;
|
|
37
|
+
isRTL: boolean;
|
|
38
|
+
isStrikethrough: boolean;
|
|
39
|
+
isSubscript: boolean;
|
|
40
|
+
isSuperscript: boolean;
|
|
41
|
+
isUnderline: boolean;
|
|
42
|
+
rootType: "table" | "root";
|
|
43
|
+
};
|
|
44
|
+
type ToolbarState = typeof INITIAL_TOOLBAR_STATE;
|
|
45
|
+
type ToolbarStateKey = keyof ToolbarState;
|
|
46
|
+
type ToolbarStateValue<Key extends ToolbarStateKey> = ToolbarState[Key];
|
|
47
|
+
type ContextShape = {
|
|
48
|
+
toolbarState: ToolbarState;
|
|
49
|
+
updateToolbarState<Key extends ToolbarStateKey>(key: Key, value: ToolbarStateValue<Key>): void;
|
|
50
|
+
};
|
|
51
|
+
export declare const ToolbarContext: ({ children, }: {
|
|
52
|
+
children: ReactNode;
|
|
53
|
+
}) => JSX.Element;
|
|
54
|
+
export declare const useToolbarState: () => ContextShape;
|
|
55
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export declare const editorConfig: {
|
|
2
|
+
enableToolbar: boolean;
|
|
3
|
+
toolbarOptions: {
|
|
4
|
+
enableUndoRedo: boolean;
|
|
5
|
+
enableTextFormatting: boolean;
|
|
6
|
+
enableAlignment: boolean;
|
|
7
|
+
enableFontControls: boolean;
|
|
8
|
+
enableTableOptions: boolean;
|
|
9
|
+
enableInsertMenu: boolean;
|
|
10
|
+
enableColorPicker: boolean;
|
|
11
|
+
enableClearOptions: boolean;
|
|
12
|
+
enableEmojiPicker: boolean;
|
|
13
|
+
enableLinks: boolean;
|
|
14
|
+
enableFormatTextMenu: boolean;
|
|
15
|
+
enableCodeFormat: boolean;
|
|
16
|
+
enableAIChat: boolean;
|
|
17
|
+
};
|
|
18
|
+
enableFloatingMenu: boolean;
|
|
19
|
+
htmlViewOption: boolean;
|
|
20
|
+
floatingMenuOptions: {
|
|
21
|
+
bold: boolean;
|
|
22
|
+
italic: boolean;
|
|
23
|
+
underline: boolean;
|
|
24
|
+
uppercase: boolean;
|
|
25
|
+
lowercase: boolean;
|
|
26
|
+
capitalize: boolean;
|
|
27
|
+
strikethrough: boolean;
|
|
28
|
+
subscript: boolean;
|
|
29
|
+
superscript: boolean;
|
|
30
|
+
code: boolean;
|
|
31
|
+
link: boolean;
|
|
32
|
+
aiChat: boolean;
|
|
33
|
+
};
|
|
34
|
+
defaultFontFamilies: string[];
|
|
35
|
+
mentionUserList: string[];
|
|
36
|
+
};
|