@lumir-company/editor 0.1.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 +191 -0
- package/dist/index.d.mts +140 -0
- package/dist/index.d.ts +140 -0
- package/dist/index.js +496 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +473 -0
- package/dist/index.mjs.map +1 -0
- package/dist/style.css +70 -0
- package/package.json +72 -0
package/README.md
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
# LumirEditor
|
|
2
|
+
|
|
3
|
+
๐ผ๏ธ **์ด๋ฏธ์ง ์ ์ฉ** BlockNote ๊ธฐ๋ฐ Rich Text ์๋ํฐ
|
|
4
|
+
|
|
5
|
+
## โจ ํต์ฌ ํน์ง
|
|
6
|
+
|
|
7
|
+
- **์ด๋ฏธ์ง ์ ์ฉ**: ์ด๋ฏธ์ง ์
๋ก๋/๋๋๊ทธ์ค๋๋กญ๋ง ์ง์ (S3 ์ฐ๋ ๋๋ ์ปค์คํ
์
๋ก๋)
|
|
8
|
+
- **๋ก๋ฉ ์คํผ๋**: ์ด๋ฏธ์ง ์
๋ก๋ ์ค ์๋ ์คํผ๋ ํ์
|
|
9
|
+
- **์ ๋๋ฉ์ด์
์ต์ ํ**: ๊ธฐ๋ณธ ์ ๋๋ฉ์ด์
๋นํ์ฑํ๋ก ์ฑ๋ฅ ํฅ์
|
|
10
|
+
- **TypeScript**: ์์ ํ ํ์
์์ ์ฑ
|
|
11
|
+
- **๊ฒฝ๋ํ**: ๋น๋์ค/์ค๋์ค/ํ์ผ ์
๋ก๋ ๊ธฐ๋ฅ ์ ๊ฑฐ
|
|
12
|
+
|
|
13
|
+
## ๐ฆ ์ค์น
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install @lumir-company/editor
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## ๐ ๊ธฐ๋ณธ ์ฌ์ฉ๋ฒ
|
|
20
|
+
|
|
21
|
+
### 1. CSS ์ํฌํธ (ํ์)
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import "@lumir-company/editor/style.css";
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### 2. ๊ธฐ๋ณธ ์ฌ์ฉ
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
import { LumirEditor } from "@lumir-company/editor";
|
|
31
|
+
import "@lumir-company/editor/style.css";
|
|
32
|
+
|
|
33
|
+
export default function App() {
|
|
34
|
+
return (
|
|
35
|
+
<div className="w-full h-[400px]">
|
|
36
|
+
<LumirEditor onContentChange={(blocks) => console.log(blocks)} />
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### 3. Next.js์์ ์ฌ์ฉ (SSR ๋นํ์ฑํ)
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
"use client";
|
|
46
|
+
import dynamic from "next/dynamic";
|
|
47
|
+
|
|
48
|
+
const LumirEditor = dynamic(
|
|
49
|
+
() =>
|
|
50
|
+
import("@lumir-company/editor").then((m) => ({ default: m.LumirEditor })),
|
|
51
|
+
{ ssr: false }
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
export default function Editor() {
|
|
55
|
+
return (
|
|
56
|
+
<div className="w-full h-[500px]">
|
|
57
|
+
<LumirEditor />
|
|
58
|
+
</div>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## ๐ ํต์ฌ Props
|
|
64
|
+
|
|
65
|
+
| Prop | ํ์
| ๊ธฐ๋ณธ๊ฐ | ์ค๋ช
|
|
|
66
|
+
| ----------------- | ---------------------------------- | --------- | ---------------- |
|
|
67
|
+
| `initialContent` | `DefaultPartialBlock[] \| string` | - | ์ด๊ธฐ ์ฝํ
์ธ |
|
|
68
|
+
| `onContentChange` | `(blocks) => void` | - | ์ฝํ
์ธ ๋ณ๊ฒฝ ์ฝ๋ฐฑ |
|
|
69
|
+
| `uploadFile` | `(file: File) => Promise<string>` | - | ์ปค์คํ
์
๋ก๋ |
|
|
70
|
+
| `s3Upload` | `S3UploaderConfig` | - | S3 ์
๋ก๋ ์ค์ |
|
|
71
|
+
| `className` | `string` | `""` | CSS ํด๋์ค |
|
|
72
|
+
| `theme` | `"light" \| "dark" \| ThemeObject` | `"light"` | ์๋ํฐ ํ
๋ง |
|
|
73
|
+
| `editable` | `boolean` | `true` | ํธ์ง ๊ฐ๋ฅ ์ฌ๋ถ |
|
|
74
|
+
|
|
75
|
+
### S3 ์
๋ก๋ ์ค์
|
|
76
|
+
|
|
77
|
+
```tsx
|
|
78
|
+
interface S3UploaderConfig {
|
|
79
|
+
apiEndpoint: string; // '/api/s3/presigned' (ํ์)
|
|
80
|
+
env: "development" | "production"; // ํ๊ฒฝ (ํ์)
|
|
81
|
+
path: string; // ํ์ผ ๊ฒฝ๋ก (ํ์)
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
์ง์ ์ด๋ฏธ์ง ํ์ผ
|
|
86
|
+
"image/png", // PNG
|
|
87
|
+
"image/jpeg", // JPEG/JPG
|
|
88
|
+
"image/jpg", // JPG
|
|
89
|
+
"image/gif", // GIF (์ ๋๋ฉ์ด์
ํฌํจ)
|
|
90
|
+
"image/webp", // WebP
|
|
91
|
+
"image/bmp", // BMP
|
|
92
|
+
"image/svg+xml", // SVG
|
|
93
|
+
|
|
94
|
+
## ๐ผ๏ธ ์ด๋ฏธ์ง ์
๋ก๋ ๋ฐฉ์
|
|
95
|
+
|
|
96
|
+
### 1. S3 ์
๋ก๋ (๊ถ์ฅ)
|
|
97
|
+
|
|
98
|
+
```tsx
|
|
99
|
+
<LumirEditor
|
|
100
|
+
s3Upload={{
|
|
101
|
+
apiEndpoint: "/api/s3/presigned",
|
|
102
|
+
env: "development",
|
|
103
|
+
path: "depth1/depth2/depth3",
|
|
104
|
+
}}
|
|
105
|
+
onContentChange={(blocks) => console.log(blocks)}
|
|
106
|
+
/>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### 2. ์ปค์คํ
์
๋ก๋
|
|
110
|
+
|
|
111
|
+
```tsx
|
|
112
|
+
<LumirEditor
|
|
113
|
+
uploadFile={async (file) => {
|
|
114
|
+
const formData = new FormData();
|
|
115
|
+
formData.append("image", file);
|
|
116
|
+
const response = await fetch("/api/upload", {
|
|
117
|
+
method: "POST",
|
|
118
|
+
body: formData,
|
|
119
|
+
});
|
|
120
|
+
return (await response.json()).url;
|
|
121
|
+
}}
|
|
122
|
+
/>
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### 3. S3 Helper ํจ์ ์ฌ์ฉ
|
|
126
|
+
|
|
127
|
+
```tsx
|
|
128
|
+
import { LumirEditor, createS3Uploader } from "@lumir-company/editor";
|
|
129
|
+
|
|
130
|
+
const s3Uploader = createS3Uploader({
|
|
131
|
+
apiEndpoint: "/api/s3/presigned",
|
|
132
|
+
env: "production",
|
|
133
|
+
path: "images",
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
<LumirEditor uploadFile={s3Uploader} />;
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## ๐ ์ฃผ์ ํ์
|
|
140
|
+
|
|
141
|
+
```tsx
|
|
142
|
+
import type {
|
|
143
|
+
LumirEditorProps,
|
|
144
|
+
DefaultPartialBlock,
|
|
145
|
+
S3UploaderConfig,
|
|
146
|
+
ContentUtils,
|
|
147
|
+
EditorConfig,
|
|
148
|
+
} from "@lumir-company/editor";
|
|
149
|
+
|
|
150
|
+
// ์ฝํ
์ธ ๊ฒ์ฆ
|
|
151
|
+
const isValidContent = ContentUtils.isValidJSONString(jsonString);
|
|
152
|
+
const blocks = ContentUtils.parseJSONContent(jsonString);
|
|
153
|
+
|
|
154
|
+
// ์๋ํฐ ์ค์
|
|
155
|
+
const tableConfig = EditorConfig.getDefaultTableConfig();
|
|
156
|
+
const headingConfig = EditorConfig.getDefaultHeadingConfig();
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## ๐ก ์ฌ์ฉ ํ
|
|
160
|
+
|
|
161
|
+
```tsx
|
|
162
|
+
// 1. ์ปจํ
์ด๋ ํฌ๊ธฐ ์ค์
|
|
163
|
+
<div className="h-[400px]">
|
|
164
|
+
<LumirEditor />
|
|
165
|
+
</div>
|
|
166
|
+
|
|
167
|
+
// 2. ์ฝ๊ธฐ ์ ์ฉ ๋ชจ๋
|
|
168
|
+
<LumirEditor
|
|
169
|
+
editable={false}
|
|
170
|
+
initialContent={savedContent}
|
|
171
|
+
/>
|
|
172
|
+
|
|
173
|
+
// 3. ํ
๋ง ์ ์ฉ
|
|
174
|
+
<LumirEditor theme="dark" />
|
|
175
|
+
|
|
176
|
+
// 4. ๋ฐ์ํ ๋์์ธ
|
|
177
|
+
<div className="w-full h-64 md:h-96 lg:h-[500px]">
|
|
178
|
+
<LumirEditor className="h-full" />
|
|
179
|
+
</div>
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## โ ๏ธ ์ค์ ์ฌํญ
|
|
183
|
+
|
|
184
|
+
1. **CSS ์ํฌํธ ํ์**: `import "@lumir-company/editor/style.css";`
|
|
185
|
+
2. **Next.js SSR ๋นํ์ฑํ**: `dynamic`์ผ๋ก ํด๋ผ์ด์ธํธ ์ฌ์ด๋ ๋ ๋๋ง๋ง ์ฌ์ฉ
|
|
186
|
+
3. **์ด๋ฏธ์ง๋ง ์ง์**: PNG, JPG, GIF, WebP, BMP, SVG (๋น๋์ค/์ค๋์ค/ํ์ผ โ)
|
|
187
|
+
4. **S3 ์ค์ **: ๊ณ์ธต ๊ตฌ์กฐ `{env}/{path}/{filename}`
|
|
188
|
+
|
|
189
|
+
## ๐ ๋ผ์ด์ ์ค
|
|
190
|
+
|
|
191
|
+
MIT License
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { PartialBlock, DefaultBlockSchema, DefaultInlineContentSchema, DefaultStyleSchema, BlockNoteEditor } from '@blocknote/core';
|
|
3
|
+
export { BlockNoteEditor, DefaultBlockSchema, DefaultInlineContentSchema, DefaultStyleSchema, PartialBlock } from '@blocknote/core';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* LumirEditor์์ ์ฌ์ฉํ๋ BlockNote ์๋ํฐ ํ์
|
|
7
|
+
*/
|
|
8
|
+
type EditorType = BlockNoteEditor<DefaultBlockSchema, DefaultInlineContentSchema, DefaultStyleSchema>;
|
|
9
|
+
/**
|
|
10
|
+
* LumirEditor์์ ์ฌ์ฉํ๋ ๊ธฐ๋ณธ ๋ธ๋ก ํ์
|
|
11
|
+
*/
|
|
12
|
+
type DefaultPartialBlock = PartialBlock<DefaultBlockSchema, DefaultInlineContentSchema, DefaultStyleSchema>;
|
|
13
|
+
/**
|
|
14
|
+
* LumirEditor ์ปดํฌ๋ํธ์ Props ์ธํฐํ์ด์ค
|
|
15
|
+
*/
|
|
16
|
+
interface LumirEditorProps {
|
|
17
|
+
initialContent?: DefaultPartialBlock[] | string;
|
|
18
|
+
initialEmptyBlocks?: number;
|
|
19
|
+
placeholder?: string;
|
|
20
|
+
uploadFile?: (file: File) => Promise<string>;
|
|
21
|
+
s3Upload?: {
|
|
22
|
+
apiEndpoint: string;
|
|
23
|
+
env: "development" | "production";
|
|
24
|
+
path: string;
|
|
25
|
+
};
|
|
26
|
+
allowVideoUpload?: boolean;
|
|
27
|
+
allowAudioUpload?: boolean;
|
|
28
|
+
allowFileUpload?: boolean;
|
|
29
|
+
tables?: {
|
|
30
|
+
splitCells?: boolean;
|
|
31
|
+
cellBackgroundColor?: boolean;
|
|
32
|
+
cellTextColor?: boolean;
|
|
33
|
+
headers?: boolean;
|
|
34
|
+
};
|
|
35
|
+
heading?: {
|
|
36
|
+
levels?: (1 | 2 | 3 | 4 | 5 | 6)[];
|
|
37
|
+
};
|
|
38
|
+
defaultStyles?: boolean;
|
|
39
|
+
disableExtensions?: string[];
|
|
40
|
+
tabBehavior?: "prefer-navigate-ui" | "prefer-indent";
|
|
41
|
+
trailingBlock?: boolean;
|
|
42
|
+
editable?: boolean;
|
|
43
|
+
theme?: "light" | "dark" | Partial<Record<string, unknown>> | {
|
|
44
|
+
light: Partial<Record<string, unknown>>;
|
|
45
|
+
dark: Partial<Record<string, unknown>>;
|
|
46
|
+
};
|
|
47
|
+
formattingToolbar?: boolean;
|
|
48
|
+
linkToolbar?: boolean;
|
|
49
|
+
sideMenu?: boolean;
|
|
50
|
+
emojiPicker?: boolean;
|
|
51
|
+
filePanel?: boolean;
|
|
52
|
+
tableHandles?: boolean;
|
|
53
|
+
onSelectionChange?: () => void;
|
|
54
|
+
className?: string;
|
|
55
|
+
sideMenuAddButton?: boolean;
|
|
56
|
+
onContentChange?: (content: DefaultPartialBlock[]) => void;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* ์ฝํ
์ธ ๊ด๋ฆฌ ์ ํธ๋ฆฌํฐ
|
|
61
|
+
* ๊ธฐ๋ณธ ๋ธ๋ก ์์ฑ ๋ฐ ์ฝํ
์ธ ๊ฒ์ฆ ๋ก์ง์ ๋ด๋น
|
|
62
|
+
*/
|
|
63
|
+
declare class ContentUtils {
|
|
64
|
+
/**
|
|
65
|
+
* JSON ๋ฌธ์์ด์ ์ ํจ์ฑ์ ๊ฒ์ฆํฉ๋๋ค
|
|
66
|
+
* @param jsonString ๊ฒ์ฆํ JSON ๋ฌธ์์ด
|
|
67
|
+
* @returns ์ ํจํ JSON ๋ฌธ์์ด์ธ์ง ์ฌ๋ถ
|
|
68
|
+
*/
|
|
69
|
+
static isValidJSONString(jsonString: string): boolean;
|
|
70
|
+
/**
|
|
71
|
+
* JSON ๋ฌธ์์ด์ DefaultPartialBlock ๋ฐฐ์ด๋ก ํ์ฑํฉ๋๋ค
|
|
72
|
+
* @param jsonString JSON ๋ฌธ์์ด
|
|
73
|
+
* @returns ํ์ฑ๋ ๋ธ๋ก ๋ฐฐ์ด ๋๋ null (ํ์ฑ ์คํจ ์)
|
|
74
|
+
*/
|
|
75
|
+
static parseJSONContent(jsonString: string): DefaultPartialBlock[] | null;
|
|
76
|
+
/**
|
|
77
|
+
* ๊ธฐ๋ณธ paragraph ๋ธ๋ก ์์ฑ
|
|
78
|
+
* @returns ๊ธฐ๋ณธ ์ค์ ์ด ์ ์ฉ๋ DefaultPartialBlock
|
|
79
|
+
*/
|
|
80
|
+
static createDefaultBlock(): DefaultPartialBlock;
|
|
81
|
+
/**
|
|
82
|
+
* ์ฝํ
์ธ ์ ํจ์ฑ ๊ฒ์ฆ ๋ฐ ๊ธฐ๋ณธ๊ฐ ์ค์
|
|
83
|
+
* @param content ์ฌ์ฉ์ ์ ๊ณต ์ฝํ
์ธ (๊ฐ์ฒด ๋ฐฐ์ด ๋๋ JSON ๋ฌธ์์ด)
|
|
84
|
+
* @param emptyBlockCount ๋น ๋ธ๋ก ๊ฐ์ (๊ธฐ๋ณธ๊ฐ: 3)
|
|
85
|
+
* @returns ๊ฒ์ฆ๋ ์ฝํ
์ธ ๋ฐฐ์ด
|
|
86
|
+
*/
|
|
87
|
+
static validateContent(content?: DefaultPartialBlock[] | string, emptyBlockCount?: number): DefaultPartialBlock[];
|
|
88
|
+
/**
|
|
89
|
+
* ๋น ๋ธ๋ก๋ค์ ์์ฑํฉ๋๋ค
|
|
90
|
+
* @param emptyBlockCount ์์ฑํ ๋ธ๋ก ๊ฐ์
|
|
91
|
+
* @returns ์์ฑ๋ ๋น ๋ธ๋ก ๋ฐฐ์ด
|
|
92
|
+
*/
|
|
93
|
+
private static createEmptyBlocks;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* ์๋ํฐ ์ค์ ๊ด๋ฆฌ ์ ํธ๋ฆฌํฐ
|
|
97
|
+
* ๊ฐ์ข
์ค์ ์ ๊ธฐ๋ณธ๊ฐ๊ณผ ๊ฒ์ฆ ๋ก์ง์ ๋ด๋น
|
|
98
|
+
*/
|
|
99
|
+
declare class EditorConfig {
|
|
100
|
+
/**
|
|
101
|
+
* ํ
์ด๋ธ ์ค์ ๊ธฐ๋ณธ๊ฐ ์ ์ฉ
|
|
102
|
+
* @param userTables ์ฌ์ฉ์ ํ
์ด๋ธ ์ค์
|
|
103
|
+
* @returns ๊ธฐ๋ณธ๊ฐ์ด ์ ์ฉ๋ ํ
์ด๋ธ ์ค์
|
|
104
|
+
*/
|
|
105
|
+
static getDefaultTableConfig(userTables?: LumirEditorProps["tables"]): {
|
|
106
|
+
splitCells: boolean;
|
|
107
|
+
cellBackgroundColor: boolean;
|
|
108
|
+
cellTextColor: boolean;
|
|
109
|
+
headers: boolean;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* ํค๋ฉ ์ค์ ๊ธฐ๋ณธ๊ฐ ์ ์ฉ
|
|
113
|
+
* @param userHeading ์ฌ์ฉ์ ํค๋ฉ ์ค์
|
|
114
|
+
* @returns ๊ธฐ๋ณธ๊ฐ์ด ์ ์ฉ๋ ํค๋ฉ ์ค์
|
|
115
|
+
*/
|
|
116
|
+
static getDefaultHeadingConfig(userHeading?: LumirEditorProps["heading"]): {
|
|
117
|
+
levels?: (1 | 2 | 3 | 4 | 5 | 6)[];
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* ๋นํ์ฑํํ ํ์ฅ ๊ธฐ๋ฅ ๋ชฉ๋ก ์์ฑ
|
|
121
|
+
* @param userExtensions ์ฌ์ฉ์ ์ ์ ๋นํ์ฑ ํ์ฅ
|
|
122
|
+
* @param allowVideo ๋น๋์ค ์
๋ก๋ ํ์ฉ ์ฌ๋ถ
|
|
123
|
+
* @param allowAudio ์ค๋์ค ์
๋ก๋ ํ์ฉ ์ฌ๋ถ
|
|
124
|
+
* @param allowFile ์ผ๋ฐ ํ์ผ ์
๋ก๋ ํ์ฉ ์ฌ๋ถ
|
|
125
|
+
* @returns ๋นํ์ฑํํ ํ์ฅ ๊ธฐ๋ฅ ๋ชฉ๋ก
|
|
126
|
+
*/
|
|
127
|
+
static getDisabledExtensions(userExtensions?: string[], allowVideo?: boolean, allowAudio?: boolean, allowFile?: boolean): string[];
|
|
128
|
+
}
|
|
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;
|
|
130
|
+
|
|
131
|
+
declare function cn(...inputs: (string | undefined | null | false)[]): string;
|
|
132
|
+
|
|
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
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { PartialBlock, DefaultBlockSchema, DefaultInlineContentSchema, DefaultStyleSchema, BlockNoteEditor } from '@blocknote/core';
|
|
3
|
+
export { BlockNoteEditor, DefaultBlockSchema, DefaultInlineContentSchema, DefaultStyleSchema, PartialBlock } from '@blocknote/core';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* LumirEditor์์ ์ฌ์ฉํ๋ BlockNote ์๋ํฐ ํ์
|
|
7
|
+
*/
|
|
8
|
+
type EditorType = BlockNoteEditor<DefaultBlockSchema, DefaultInlineContentSchema, DefaultStyleSchema>;
|
|
9
|
+
/**
|
|
10
|
+
* LumirEditor์์ ์ฌ์ฉํ๋ ๊ธฐ๋ณธ ๋ธ๋ก ํ์
|
|
11
|
+
*/
|
|
12
|
+
type DefaultPartialBlock = PartialBlock<DefaultBlockSchema, DefaultInlineContentSchema, DefaultStyleSchema>;
|
|
13
|
+
/**
|
|
14
|
+
* LumirEditor ์ปดํฌ๋ํธ์ Props ์ธํฐํ์ด์ค
|
|
15
|
+
*/
|
|
16
|
+
interface LumirEditorProps {
|
|
17
|
+
initialContent?: DefaultPartialBlock[] | string;
|
|
18
|
+
initialEmptyBlocks?: number;
|
|
19
|
+
placeholder?: string;
|
|
20
|
+
uploadFile?: (file: File) => Promise<string>;
|
|
21
|
+
s3Upload?: {
|
|
22
|
+
apiEndpoint: string;
|
|
23
|
+
env: "development" | "production";
|
|
24
|
+
path: string;
|
|
25
|
+
};
|
|
26
|
+
allowVideoUpload?: boolean;
|
|
27
|
+
allowAudioUpload?: boolean;
|
|
28
|
+
allowFileUpload?: boolean;
|
|
29
|
+
tables?: {
|
|
30
|
+
splitCells?: boolean;
|
|
31
|
+
cellBackgroundColor?: boolean;
|
|
32
|
+
cellTextColor?: boolean;
|
|
33
|
+
headers?: boolean;
|
|
34
|
+
};
|
|
35
|
+
heading?: {
|
|
36
|
+
levels?: (1 | 2 | 3 | 4 | 5 | 6)[];
|
|
37
|
+
};
|
|
38
|
+
defaultStyles?: boolean;
|
|
39
|
+
disableExtensions?: string[];
|
|
40
|
+
tabBehavior?: "prefer-navigate-ui" | "prefer-indent";
|
|
41
|
+
trailingBlock?: boolean;
|
|
42
|
+
editable?: boolean;
|
|
43
|
+
theme?: "light" | "dark" | Partial<Record<string, unknown>> | {
|
|
44
|
+
light: Partial<Record<string, unknown>>;
|
|
45
|
+
dark: Partial<Record<string, unknown>>;
|
|
46
|
+
};
|
|
47
|
+
formattingToolbar?: boolean;
|
|
48
|
+
linkToolbar?: boolean;
|
|
49
|
+
sideMenu?: boolean;
|
|
50
|
+
emojiPicker?: boolean;
|
|
51
|
+
filePanel?: boolean;
|
|
52
|
+
tableHandles?: boolean;
|
|
53
|
+
onSelectionChange?: () => void;
|
|
54
|
+
className?: string;
|
|
55
|
+
sideMenuAddButton?: boolean;
|
|
56
|
+
onContentChange?: (content: DefaultPartialBlock[]) => void;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* ์ฝํ
์ธ ๊ด๋ฆฌ ์ ํธ๋ฆฌํฐ
|
|
61
|
+
* ๊ธฐ๋ณธ ๋ธ๋ก ์์ฑ ๋ฐ ์ฝํ
์ธ ๊ฒ์ฆ ๋ก์ง์ ๋ด๋น
|
|
62
|
+
*/
|
|
63
|
+
declare class ContentUtils {
|
|
64
|
+
/**
|
|
65
|
+
* JSON ๋ฌธ์์ด์ ์ ํจ์ฑ์ ๊ฒ์ฆํฉ๋๋ค
|
|
66
|
+
* @param jsonString ๊ฒ์ฆํ JSON ๋ฌธ์์ด
|
|
67
|
+
* @returns ์ ํจํ JSON ๋ฌธ์์ด์ธ์ง ์ฌ๋ถ
|
|
68
|
+
*/
|
|
69
|
+
static isValidJSONString(jsonString: string): boolean;
|
|
70
|
+
/**
|
|
71
|
+
* JSON ๋ฌธ์์ด์ DefaultPartialBlock ๋ฐฐ์ด๋ก ํ์ฑํฉ๋๋ค
|
|
72
|
+
* @param jsonString JSON ๋ฌธ์์ด
|
|
73
|
+
* @returns ํ์ฑ๋ ๋ธ๋ก ๋ฐฐ์ด ๋๋ null (ํ์ฑ ์คํจ ์)
|
|
74
|
+
*/
|
|
75
|
+
static parseJSONContent(jsonString: string): DefaultPartialBlock[] | null;
|
|
76
|
+
/**
|
|
77
|
+
* ๊ธฐ๋ณธ paragraph ๋ธ๋ก ์์ฑ
|
|
78
|
+
* @returns ๊ธฐ๋ณธ ์ค์ ์ด ์ ์ฉ๋ DefaultPartialBlock
|
|
79
|
+
*/
|
|
80
|
+
static createDefaultBlock(): DefaultPartialBlock;
|
|
81
|
+
/**
|
|
82
|
+
* ์ฝํ
์ธ ์ ํจ์ฑ ๊ฒ์ฆ ๋ฐ ๊ธฐ๋ณธ๊ฐ ์ค์
|
|
83
|
+
* @param content ์ฌ์ฉ์ ์ ๊ณต ์ฝํ
์ธ (๊ฐ์ฒด ๋ฐฐ์ด ๋๋ JSON ๋ฌธ์์ด)
|
|
84
|
+
* @param emptyBlockCount ๋น ๋ธ๋ก ๊ฐ์ (๊ธฐ๋ณธ๊ฐ: 3)
|
|
85
|
+
* @returns ๊ฒ์ฆ๋ ์ฝํ
์ธ ๋ฐฐ์ด
|
|
86
|
+
*/
|
|
87
|
+
static validateContent(content?: DefaultPartialBlock[] | string, emptyBlockCount?: number): DefaultPartialBlock[];
|
|
88
|
+
/**
|
|
89
|
+
* ๋น ๋ธ๋ก๋ค์ ์์ฑํฉ๋๋ค
|
|
90
|
+
* @param emptyBlockCount ์์ฑํ ๋ธ๋ก ๊ฐ์
|
|
91
|
+
* @returns ์์ฑ๋ ๋น ๋ธ๋ก ๋ฐฐ์ด
|
|
92
|
+
*/
|
|
93
|
+
private static createEmptyBlocks;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* ์๋ํฐ ์ค์ ๊ด๋ฆฌ ์ ํธ๋ฆฌํฐ
|
|
97
|
+
* ๊ฐ์ข
์ค์ ์ ๊ธฐ๋ณธ๊ฐ๊ณผ ๊ฒ์ฆ ๋ก์ง์ ๋ด๋น
|
|
98
|
+
*/
|
|
99
|
+
declare class EditorConfig {
|
|
100
|
+
/**
|
|
101
|
+
* ํ
์ด๋ธ ์ค์ ๊ธฐ๋ณธ๊ฐ ์ ์ฉ
|
|
102
|
+
* @param userTables ์ฌ์ฉ์ ํ
์ด๋ธ ์ค์
|
|
103
|
+
* @returns ๊ธฐ๋ณธ๊ฐ์ด ์ ์ฉ๋ ํ
์ด๋ธ ์ค์
|
|
104
|
+
*/
|
|
105
|
+
static getDefaultTableConfig(userTables?: LumirEditorProps["tables"]): {
|
|
106
|
+
splitCells: boolean;
|
|
107
|
+
cellBackgroundColor: boolean;
|
|
108
|
+
cellTextColor: boolean;
|
|
109
|
+
headers: boolean;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* ํค๋ฉ ์ค์ ๊ธฐ๋ณธ๊ฐ ์ ์ฉ
|
|
113
|
+
* @param userHeading ์ฌ์ฉ์ ํค๋ฉ ์ค์
|
|
114
|
+
* @returns ๊ธฐ๋ณธ๊ฐ์ด ์ ์ฉ๋ ํค๋ฉ ์ค์
|
|
115
|
+
*/
|
|
116
|
+
static getDefaultHeadingConfig(userHeading?: LumirEditorProps["heading"]): {
|
|
117
|
+
levels?: (1 | 2 | 3 | 4 | 5 | 6)[];
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* ๋นํ์ฑํํ ํ์ฅ ๊ธฐ๋ฅ ๋ชฉ๋ก ์์ฑ
|
|
121
|
+
* @param userExtensions ์ฌ์ฉ์ ์ ์ ๋นํ์ฑ ํ์ฅ
|
|
122
|
+
* @param allowVideo ๋น๋์ค ์
๋ก๋ ํ์ฉ ์ฌ๋ถ
|
|
123
|
+
* @param allowAudio ์ค๋์ค ์
๋ก๋ ํ์ฉ ์ฌ๋ถ
|
|
124
|
+
* @param allowFile ์ผ๋ฐ ํ์ผ ์
๋ก๋ ํ์ฉ ์ฌ๋ถ
|
|
125
|
+
* @returns ๋นํ์ฑํํ ํ์ฅ ๊ธฐ๋ฅ ๋ชฉ๋ก
|
|
126
|
+
*/
|
|
127
|
+
static getDisabledExtensions(userExtensions?: string[], allowVideo?: boolean, allowAudio?: boolean, allowFile?: boolean): string[];
|
|
128
|
+
}
|
|
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;
|
|
130
|
+
|
|
131
|
+
declare function cn(...inputs: (string | undefined | null | false)[]): string;
|
|
132
|
+
|
|
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 };
|