@lumir-company/editor 0.2.0 → 0.3.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/README.md +742 -925
- package/dist/index.d.mts +17 -21
- package/dist/index.d.ts +17 -21
- package/dist/index.js +230 -183
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +229 -183
- package/dist/index.mjs.map +1 -1
- package/dist/style.css +77 -4
- package/package.json +6 -5
package/dist/index.d.mts
CHANGED
|
@@ -18,17 +18,14 @@ interface LumirEditorProps {
|
|
|
18
18
|
initialEmptyBlocks?: number;
|
|
19
19
|
placeholder?: string;
|
|
20
20
|
uploadFile?: (file: File) => Promise<string>;
|
|
21
|
-
|
|
21
|
+
s3Upload?: {
|
|
22
|
+
apiEndpoint: string;
|
|
23
|
+
env: "development" | "production";
|
|
24
|
+
path: string;
|
|
25
|
+
};
|
|
22
26
|
allowVideoUpload?: boolean;
|
|
23
27
|
allowAudioUpload?: boolean;
|
|
24
28
|
allowFileUpload?: boolean;
|
|
25
|
-
pasteHandler?: (ctx: {
|
|
26
|
-
event: ClipboardEvent;
|
|
27
|
-
editor: EditorType;
|
|
28
|
-
defaultPasteHandler: (context?: {
|
|
29
|
-
pasteBehavior?: "prefer-markdown" | "prefer-html";
|
|
30
|
-
}) => boolean | undefined;
|
|
31
|
-
}) => boolean | undefined;
|
|
32
29
|
tables?: {
|
|
33
30
|
splitCells?: boolean;
|
|
34
31
|
cellBackgroundColor?: boolean;
|
|
@@ -38,13 +35,10 @@ interface LumirEditorProps {
|
|
|
38
35
|
heading?: {
|
|
39
36
|
levels?: (1 | 2 | 3 | 4 | 5 | 6)[];
|
|
40
37
|
};
|
|
41
|
-
animations?: boolean;
|
|
42
38
|
defaultStyles?: boolean;
|
|
43
39
|
disableExtensions?: string[];
|
|
44
|
-
domAttributes?: Record<string, string>;
|
|
45
40
|
tabBehavior?: "prefer-navigate-ui" | "prefer-indent";
|
|
46
41
|
trailingBlock?: boolean;
|
|
47
|
-
resolveFileUrl?: (url: string) => Promise<string>;
|
|
48
42
|
editable?: boolean;
|
|
49
43
|
theme?: "light" | "dark" | Partial<Record<string, unknown>> | {
|
|
50
44
|
light: Partial<Record<string, unknown>>;
|
|
@@ -53,17 +47,13 @@ interface LumirEditorProps {
|
|
|
53
47
|
formattingToolbar?: boolean;
|
|
54
48
|
linkToolbar?: boolean;
|
|
55
49
|
sideMenu?: boolean;
|
|
56
|
-
slashMenu?: boolean;
|
|
57
50
|
emojiPicker?: boolean;
|
|
58
51
|
filePanel?: boolean;
|
|
59
52
|
tableHandles?: boolean;
|
|
60
|
-
comments?: boolean;
|
|
61
53
|
onSelectionChange?: () => void;
|
|
62
54
|
className?: string;
|
|
63
|
-
includeDefaultStyles?: boolean;
|
|
64
55
|
sideMenuAddButton?: boolean;
|
|
65
56
|
onContentChange?: (content: DefaultPartialBlock[]) => void;
|
|
66
|
-
editorRef?: React.MutableRefObject<EditorType | null>;
|
|
67
57
|
}
|
|
68
58
|
|
|
69
59
|
/**
|
|
@@ -92,14 +82,12 @@ declare class ContentUtils {
|
|
|
92
82
|
* 콘텐츠 유효성 검증 및 기본값 설정
|
|
93
83
|
* @param content 사용자 제공 콘텐츠 (객체 배열 또는 JSON 문자열)
|
|
94
84
|
* @param emptyBlockCount 빈 블록 개수 (기본값: 3)
|
|
95
|
-
* @param placeholder 첫 번째 블록의 placeholder 텍스트
|
|
96
85
|
* @returns 검증된 콘텐츠 배열
|
|
97
86
|
*/
|
|
98
|
-
static validateContent(content?: DefaultPartialBlock[] | string, emptyBlockCount?: number
|
|
87
|
+
static validateContent(content?: DefaultPartialBlock[] | string, emptyBlockCount?: number): DefaultPartialBlock[];
|
|
99
88
|
/**
|
|
100
89
|
* 빈 블록들을 생성합니다
|
|
101
90
|
* @param emptyBlockCount 생성할 블록 개수
|
|
102
|
-
* @param placeholder 첫 번째 블록의 placeholder 텍스트
|
|
103
91
|
* @returns 생성된 빈 블록 배열
|
|
104
92
|
*/
|
|
105
93
|
private static createEmptyBlocks;
|
|
@@ -133,12 +121,20 @@ declare class EditorConfig {
|
|
|
133
121
|
* @param userExtensions 사용자 정의 비활성 확장
|
|
134
122
|
* @param allowVideo 비디오 업로드 허용 여부
|
|
135
123
|
* @param allowAudio 오디오 업로드 허용 여부
|
|
124
|
+
* @param allowFile 일반 파일 업로드 허용 여부
|
|
136
125
|
* @returns 비활성화할 확장 기능 목록
|
|
137
126
|
*/
|
|
138
|
-
static getDisabledExtensions(userExtensions?: string[], allowVideo?: boolean, allowAudio?: boolean): string[];
|
|
127
|
+
static getDisabledExtensions(userExtensions?: string[], allowVideo?: boolean, allowAudio?: boolean, allowFile?: boolean): string[];
|
|
139
128
|
}
|
|
140
|
-
declare function LumirEditor({ initialContent, initialEmptyBlocks,
|
|
129
|
+
declare function LumirEditor({ initialContent, initialEmptyBlocks, uploadFile, s3Upload, tables, heading, defaultStyles, disableExtensions, tabBehavior, trailingBlock, allowVideoUpload, allowAudioUpload, allowFileUpload, editable, theme, formattingToolbar, linkToolbar, sideMenu, emojiPicker, filePanel, tableHandles, onSelectionChange, className, sideMenuAddButton, onContentChange, }: LumirEditorProps): react_jsx_runtime.JSX.Element;
|
|
141
130
|
|
|
142
131
|
declare function cn(...inputs: (string | undefined | null | false)[]): string;
|
|
143
132
|
|
|
144
|
-
|
|
133
|
+
interface S3UploaderConfig {
|
|
134
|
+
apiEndpoint: string;
|
|
135
|
+
env: "production" | "development";
|
|
136
|
+
path: string;
|
|
137
|
+
}
|
|
138
|
+
declare const createS3Uploader: (config: S3UploaderConfig) => (file: File) => Promise<string>;
|
|
139
|
+
|
|
140
|
+
export { ContentUtils, type DefaultPartialBlock, EditorConfig, type EditorType, LumirEditor, type LumirEditorProps, type S3UploaderConfig, cn, createS3Uploader };
|
package/dist/index.d.ts
CHANGED
|
@@ -18,17 +18,14 @@ interface LumirEditorProps {
|
|
|
18
18
|
initialEmptyBlocks?: number;
|
|
19
19
|
placeholder?: string;
|
|
20
20
|
uploadFile?: (file: File) => Promise<string>;
|
|
21
|
-
|
|
21
|
+
s3Upload?: {
|
|
22
|
+
apiEndpoint: string;
|
|
23
|
+
env: "development" | "production";
|
|
24
|
+
path: string;
|
|
25
|
+
};
|
|
22
26
|
allowVideoUpload?: boolean;
|
|
23
27
|
allowAudioUpload?: boolean;
|
|
24
28
|
allowFileUpload?: boolean;
|
|
25
|
-
pasteHandler?: (ctx: {
|
|
26
|
-
event: ClipboardEvent;
|
|
27
|
-
editor: EditorType;
|
|
28
|
-
defaultPasteHandler: (context?: {
|
|
29
|
-
pasteBehavior?: "prefer-markdown" | "prefer-html";
|
|
30
|
-
}) => boolean | undefined;
|
|
31
|
-
}) => boolean | undefined;
|
|
32
29
|
tables?: {
|
|
33
30
|
splitCells?: boolean;
|
|
34
31
|
cellBackgroundColor?: boolean;
|
|
@@ -38,13 +35,10 @@ interface LumirEditorProps {
|
|
|
38
35
|
heading?: {
|
|
39
36
|
levels?: (1 | 2 | 3 | 4 | 5 | 6)[];
|
|
40
37
|
};
|
|
41
|
-
animations?: boolean;
|
|
42
38
|
defaultStyles?: boolean;
|
|
43
39
|
disableExtensions?: string[];
|
|
44
|
-
domAttributes?: Record<string, string>;
|
|
45
40
|
tabBehavior?: "prefer-navigate-ui" | "prefer-indent";
|
|
46
41
|
trailingBlock?: boolean;
|
|
47
|
-
resolveFileUrl?: (url: string) => Promise<string>;
|
|
48
42
|
editable?: boolean;
|
|
49
43
|
theme?: "light" | "dark" | Partial<Record<string, unknown>> | {
|
|
50
44
|
light: Partial<Record<string, unknown>>;
|
|
@@ -53,17 +47,13 @@ interface LumirEditorProps {
|
|
|
53
47
|
formattingToolbar?: boolean;
|
|
54
48
|
linkToolbar?: boolean;
|
|
55
49
|
sideMenu?: boolean;
|
|
56
|
-
slashMenu?: boolean;
|
|
57
50
|
emojiPicker?: boolean;
|
|
58
51
|
filePanel?: boolean;
|
|
59
52
|
tableHandles?: boolean;
|
|
60
|
-
comments?: boolean;
|
|
61
53
|
onSelectionChange?: () => void;
|
|
62
54
|
className?: string;
|
|
63
|
-
includeDefaultStyles?: boolean;
|
|
64
55
|
sideMenuAddButton?: boolean;
|
|
65
56
|
onContentChange?: (content: DefaultPartialBlock[]) => void;
|
|
66
|
-
editorRef?: React.MutableRefObject<EditorType | null>;
|
|
67
57
|
}
|
|
68
58
|
|
|
69
59
|
/**
|
|
@@ -92,14 +82,12 @@ declare class ContentUtils {
|
|
|
92
82
|
* 콘텐츠 유효성 검증 및 기본값 설정
|
|
93
83
|
* @param content 사용자 제공 콘텐츠 (객체 배열 또는 JSON 문자열)
|
|
94
84
|
* @param emptyBlockCount 빈 블록 개수 (기본값: 3)
|
|
95
|
-
* @param placeholder 첫 번째 블록의 placeholder 텍스트
|
|
96
85
|
* @returns 검증된 콘텐츠 배열
|
|
97
86
|
*/
|
|
98
|
-
static validateContent(content?: DefaultPartialBlock[] | string, emptyBlockCount?: number
|
|
87
|
+
static validateContent(content?: DefaultPartialBlock[] | string, emptyBlockCount?: number): DefaultPartialBlock[];
|
|
99
88
|
/**
|
|
100
89
|
* 빈 블록들을 생성합니다
|
|
101
90
|
* @param emptyBlockCount 생성할 블록 개수
|
|
102
|
-
* @param placeholder 첫 번째 블록의 placeholder 텍스트
|
|
103
91
|
* @returns 생성된 빈 블록 배열
|
|
104
92
|
*/
|
|
105
93
|
private static createEmptyBlocks;
|
|
@@ -133,12 +121,20 @@ declare class EditorConfig {
|
|
|
133
121
|
* @param userExtensions 사용자 정의 비활성 확장
|
|
134
122
|
* @param allowVideo 비디오 업로드 허용 여부
|
|
135
123
|
* @param allowAudio 오디오 업로드 허용 여부
|
|
124
|
+
* @param allowFile 일반 파일 업로드 허용 여부
|
|
136
125
|
* @returns 비활성화할 확장 기능 목록
|
|
137
126
|
*/
|
|
138
|
-
static getDisabledExtensions(userExtensions?: string[], allowVideo?: boolean, allowAudio?: boolean): string[];
|
|
127
|
+
static getDisabledExtensions(userExtensions?: string[], allowVideo?: boolean, allowAudio?: boolean, allowFile?: boolean): string[];
|
|
139
128
|
}
|
|
140
|
-
declare function LumirEditor({ initialContent, initialEmptyBlocks,
|
|
129
|
+
declare function LumirEditor({ initialContent, initialEmptyBlocks, uploadFile, s3Upload, tables, heading, defaultStyles, disableExtensions, tabBehavior, trailingBlock, allowVideoUpload, allowAudioUpload, allowFileUpload, editable, theme, formattingToolbar, linkToolbar, sideMenu, emojiPicker, filePanel, tableHandles, onSelectionChange, className, sideMenuAddButton, onContentChange, }: LumirEditorProps): react_jsx_runtime.JSX.Element;
|
|
141
130
|
|
|
142
131
|
declare function cn(...inputs: (string | undefined | null | false)[]): string;
|
|
143
132
|
|
|
144
|
-
|
|
133
|
+
interface S3UploaderConfig {
|
|
134
|
+
apiEndpoint: string;
|
|
135
|
+
env: "production" | "development";
|
|
136
|
+
path: string;
|
|
137
|
+
}
|
|
138
|
+
declare const createS3Uploader: (config: S3UploaderConfig) => (file: File) => Promise<string>;
|
|
139
|
+
|
|
140
|
+
export { ContentUtils, type DefaultPartialBlock, EditorConfig, type EditorType, LumirEditor, type LumirEditorProps, type S3UploaderConfig, cn, createS3Uploader };
|