@junbyeol/tiptap-editor 0.1.5 → 1.0.13
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 +103 -6
- package/dist/index.cjs +71 -164
- package/dist/index.cjs.map +1 -0
- package/dist/index.mjs +29327 -26994
- package/dist/index.mjs.map +1 -0
- package/dist/style.css +1 -1
- package/dist/types/components/custom/blockquote-popover.d.ts +6 -0
- package/dist/types/components/custom/font-family-dropdown-menu/font-family-dropdown-menu.d.ts +9 -0
- package/dist/types/components/custom/font-family-dropdown-menu/index.d.ts +2 -0
- package/dist/types/components/custom/font-family-dropdown-menu/nanum-fonts.d.ts +31 -0
- package/dist/types/components/custom/font-size-dropdown-menu/font-size-dropdown-menu.d.ts +9 -0
- package/dist/types/components/custom/font-size-dropdown-menu/index.d.ts +1 -0
- package/dist/types/components/custom/hr-style-popover.d.ts +6 -0
- package/dist/types/components/custom/image-bubble-menu/image-bubble-menu.d.ts +5 -0
- package/dist/types/components/custom/image-bubble-menu/image-ratio-popover.d.ts +6 -0
- package/dist/types/components/custom/image-bubble-menu/index.d.ts +1 -0
- package/dist/types/components/custom/insert-table-popover.d.ts +6 -0
- package/dist/types/components/custom/list-style-popover.d.ts +6 -0
- package/dist/types/components/custom/table-bubble-menu/index.d.ts +1 -0
- package/dist/types/components/custom/table-bubble-menu/table-bubble-menu.d.ts +5 -0
- package/dist/types/components/custom/table-cell-background-color-popover.d.ts +6 -0
- package/dist/types/components/custom/text-style-dropdown-menu/index.d.ts +4 -0
- package/dist/types/components/custom/text-style-dropdown-menu/text-style-button.d.ts +14 -0
- package/dist/types/components/custom/text-style-dropdown-menu/text-style-dropdown-menu.d.ts +20 -0
- package/dist/types/components/custom/text-style-dropdown-menu/use-text-style-dropdown-menu.d.ts +26 -0
- package/dist/types/components/custom/text-style-dropdown-menu/use-text-style.d.ts +71 -0
- package/dist/types/components/custom/uploadable-dropdown-menu/index.d.ts +2 -0
- package/dist/types/components/custom/uploadable-dropdown-menu/uploadable-button.d.ts +17 -0
- package/dist/types/components/custom/uploadable-dropdown-menu/uploadable-dropdown-menu.d.ts +19 -0
- package/dist/types/components/tiptap-icons/align-center-icon.d.ts +1 -1
- package/dist/types/components/tiptap-icons/align-justify-icon.d.ts +1 -1
- package/dist/types/components/tiptap-icons/align-left-icon.d.ts +1 -1
- package/dist/types/components/tiptap-icons/align-right-icon.d.ts +1 -1
- package/dist/types/components/tiptap-icons/bold-icon.d.ts +1 -1
- package/dist/types/components/tiptap-icons/check-icon.d.ts +3 -0
- package/dist/types/components/tiptap-icons/chevron-down-icon.d.ts +1 -1
- package/dist/types/components/tiptap-icons/code2-icon.d.ts +1 -1
- package/dist/types/components/tiptap-icons/corner-down-left-icon.d.ts +3 -0
- package/dist/types/components/tiptap-icons/double-quotes-icon.d.ts +3 -0
- package/dist/types/components/tiptap-icons/external-link-icon.d.ts +3 -0
- package/dist/types/components/tiptap-icons/heading-five-icon.d.ts +1 -1
- package/dist/types/components/tiptap-icons/heading-four-icon.d.ts +1 -1
- package/dist/types/components/tiptap-icons/heading-icon.d.ts +1 -1
- package/dist/types/components/tiptap-icons/heading-one-icon.d.ts +1 -1
- package/dist/types/components/tiptap-icons/heading-six-icon.d.ts +1 -1
- package/dist/types/components/tiptap-icons/heading-three-icon.d.ts +1 -1
- package/dist/types/components/tiptap-icons/heading-two-icon.d.ts +1 -1
- package/dist/types/components/tiptap-icons/image-align-center.d.ts +3 -0
- package/dist/types/components/tiptap-icons/image-align-left.d.ts +3 -0
- package/dist/types/components/tiptap-icons/image-align-right.d.ts +3 -0
- package/dist/types/components/tiptap-icons/image-caption.d.ts +3 -0
- package/dist/types/components/tiptap-icons/image-ratio.d.ts +3 -0
- package/dist/types/components/tiptap-icons/italic-icon.d.ts +1 -1
- package/dist/types/components/tiptap-icons/link-icon.d.ts +3 -0
- package/dist/types/components/tiptap-icons/list-icon.d.ts +1 -1
- package/dist/types/components/tiptap-icons/list-ordered-icon.d.ts +1 -1
- package/dist/types/components/tiptap-icons/list-todo-icon.d.ts +1 -1
- package/dist/types/components/tiptap-icons/paragraph-icon.d.ts +3 -0
- package/dist/types/components/tiptap-icons/redo2-icon.d.ts +1 -1
- package/dist/types/components/tiptap-icons/separator-icon.d.ts +3 -0
- package/dist/types/components/tiptap-icons/strike-icon.d.ts +1 -1
- package/dist/types/components/tiptap-icons/subscript-icon.d.ts +1 -1
- package/dist/types/components/tiptap-icons/superscript-icon.d.ts +1 -1
- package/dist/types/components/tiptap-icons/table-icon.d.ts +3 -0
- package/dist/types/components/tiptap-icons/trash-icon.d.ts +3 -0
- package/dist/types/components/tiptap-icons/underline-icon.d.ts +1 -1
- package/dist/types/components/tiptap-icons/undo2-icon.d.ts +1 -1
- package/dist/types/components/tiptap-icons/uploadable-file-icon.d.ts +3 -0
- package/dist/types/components/tiptap-icons/uploadable-icon.d.ts +3 -0
- package/dist/types/components/tiptap-icons/uploadable-image-icon.d.ts +3 -0
- package/dist/types/components/tiptap-ui/heading-button/heading-button.d.ts +1 -1
- package/dist/types/components/tiptap-ui/heading-button/use-heading.d.ts +7 -7
- package/dist/types/components/tiptap-ui/heading-dropdown-menu/use-heading-dropdown-menu.d.ts +1 -1
- package/dist/types/components/tiptap-ui/link-popover/index.d.ts +2 -0
- package/dist/types/components/tiptap-ui/link-popover/link-popover.d.ts +57 -0
- package/dist/types/components/tiptap-ui/link-popover/use-link-popover.d.ts +117 -0
- package/dist/types/components/tiptap-ui/list-button/list-button.d.ts +1 -1
- package/dist/types/components/tiptap-ui/list-button/use-list.d.ts +4 -4
- package/dist/types/components/tiptap-ui/mark-button/mark-button.d.ts +1 -1
- package/dist/types/components/tiptap-ui/mark-button/use-mark.d.ts +8 -8
- package/dist/types/components/tiptap-ui/text-align-button/text-align-button.d.ts +1 -1
- package/dist/types/components/tiptap-ui/text-align-button/use-text-align.d.ts +5 -5
- package/dist/types/components/tiptap-ui/undo-redo-button/undo-redo-button.d.ts +1 -1
- package/dist/types/components/tiptap-ui/undo-redo-button/use-undo-redo.d.ts +3 -3
- package/dist/types/components/tiptap-ui-primitive/button/button.d.ts +0 -3
- package/dist/types/components/tiptap-ui-primitive/button-group/button-group.d.ts +10 -0
- package/dist/types/components/tiptap-ui-primitive/button-group/index.d.ts +1 -0
- package/dist/types/components/tiptap-ui-primitive/dropdown-menu/dropdown-menu.d.ts +2 -2
- package/dist/types/components/tiptap-ui-primitive/input/index.d.ts +1 -0
- package/dist/types/components/tiptap-ui-primitive/input/input.d.ts +2 -0
- package/dist/types/components/tiptap-ui-primitive/popover/popover.d.ts +3 -3
- package/dist/types/components/tiptap-ui-primitive/separator/separator.d.ts +2 -3
- package/dist/types/components/tiptap-ui-primitive/spacer/spacer.d.ts +1 -1
- package/dist/types/components/tiptap-ui-primitive/tooltip/tooltip.d.ts +1 -1
- package/dist/types/hooks/use-tiptap-editor.d.ts +1 -12
- package/dist/types/lib/fonts.d.ts +12 -0
- package/dist/types/lib/index.d.ts +6 -3
- package/dist/types/lib/tiptap-utils.d.ts +6 -1
- package/dist/types/tiptap/content.d.ts +6 -0
- package/dist/types/tiptap/contexts/FileHandlerContext.d.ts +7 -0
- package/dist/types/tiptap/extensions/BasicKit.d.ts +2 -0
- package/dist/types/tiptap/extensions/BlockquoteKit.d.ts +2 -0
- package/dist/types/tiptap/extensions/DefaultFileAttachmentComponent.d.ts +2 -0
- package/dist/types/tiptap/extensions/FigcaptionKit.d.ts +2 -0
- package/dist/types/tiptap/extensions/FigureKit.d.ts +16 -0
- package/dist/types/tiptap/extensions/FileAttachment.d.ts +13 -0
- package/dist/types/tiptap/extensions/FontFamilyKit.d.ts +10 -0
- package/dist/types/tiptap/extensions/FontSizeKit.d.ts +10 -0
- package/dist/types/tiptap/extensions/HrKit.d.ts +11 -0
- package/dist/types/tiptap/extensions/ImageKit.d.ts +1 -0
- package/dist/types/tiptap/extensions/Paragraph.d.ts +2 -0
- package/dist/types/tiptap/extensions/index.d.ts +8 -0
- package/dist/types/tiptap/extensions/table/index.d.ts +1 -0
- package/dist/types/tiptap/extensions/table/table-grip-menu.d.ts +13 -0
- package/dist/types/tiptap/extensions/table/table-kit.d.ts +3 -0
- package/dist/types/tiptap/extensions/table/table-row-column-utils.d.ts +16 -0
- package/dist/types/tiptap/extensions/table/table-view.d.ts +52 -0
- package/dist/types/tiptap/hooks/useFileHandler.d.ts +32 -0
- package/dist/types/tiptap/index.d.ts +10 -6
- package/dist/types/tiptap/menubar.d.ts +3 -2
- package/package.json +49 -26
- package/dist/types/tiptap/extensions/default-file-attachment.d.ts +0 -2
- package/dist/types/tiptap/extensions/file-attachment.d.ts +0 -13
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ React용 Tiptap 리치 텍스트 에디터 컴포넌트입니다. 텍스트 서
|
|
|
8
8
|
## 기능
|
|
9
9
|
|
|
10
10
|
- 텍스트 서식 (Bold, Italic, Strike, Underline, Code, 색상)
|
|
11
|
-
- 제목 (H1~
|
|
11
|
+
- 제목 (H1~H6), 목록, 텍스트 정렬
|
|
12
12
|
- 표 삽입 및 편집 (셀 병합, 배경색)
|
|
13
13
|
- 이미지 / 파일 드래그&드롭 및 붙여넣기
|
|
14
14
|
- 다크모드 지원
|
|
@@ -39,10 +39,11 @@ export default function App() {
|
|
|
39
39
|
| `minHeight` | `string` | 콘텐츠 영역 최소 높이 (기본값: `200px`) |
|
|
40
40
|
| `maxHeight` | `string` | 콘텐츠 영역 최대 높이. 초과 시 내부 스크롤 (기본값: 없음) |
|
|
41
41
|
| `uploadFile` | `(file: File) => Promise<string>` | 파일을 업로드하고 URL을 반환. 미제공 시 base64로 브라우저 메모리에 저장 |
|
|
42
|
-
| `
|
|
43
|
-
| `
|
|
42
|
+
| `onUploadStart` | `(file: File) => void` | 파일 업로드 시작 시 호출 |
|
|
43
|
+
| `onUploadSuccess` | `(file: File) => void` | 파일 업로드 성공 시 호출 |
|
|
44
|
+
| `onUploadError` | `(error: Error) => void` | 파일 업로드 오류 시 호출 |
|
|
44
45
|
| `allowNonImageFile` | `boolean` | 이미지 외 파일(PDF 등) 허용 여부 (기본값: `false`) |
|
|
45
|
-
| `FileAttachmentComponent` | `ComponentType<FileAttachmentAttributes>` | 비이미지 파일을 렌더링할
|
|
46
|
+
| `FileAttachmentComponent` | `ComponentType<FileAttachmentAttributes>` | 비이미지 파일을 렌더링할 컴포넌트. `allowNonImageFile`이 `true`일 때 유효 |
|
|
46
47
|
|
|
47
48
|
### 파일 업로드 예시
|
|
48
49
|
|
|
@@ -62,14 +63,110 @@ export default function App() {
|
|
|
62
63
|
return (
|
|
63
64
|
<TiptapEditor
|
|
64
65
|
uploadFile={uploadFile}
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
onUploadStart={(file) => console.log("업로드 시작:", file.name)}
|
|
67
|
+
onUploadSuccess={(file) => console.log("업로드 완료:", file.name)}
|
|
68
|
+
onUploadError={(error) => console.error(error)}
|
|
67
69
|
allowNonImageFile
|
|
68
70
|
/>
|
|
69
71
|
);
|
|
70
72
|
}
|
|
71
73
|
```
|
|
72
74
|
|
|
75
|
+
## 콘텐츠 렌더링 (읽기 전용)
|
|
76
|
+
|
|
77
|
+
저장된 HTML을 읽기 전용으로 표시할 때는 `TiptapContent`를 사용합니다. 에디터 없이 콘텐츠 스타일만 적용된 뷰어 역할을 합니다.
|
|
78
|
+
|
|
79
|
+
```tsx
|
|
80
|
+
import { TiptapContent } from "@junbyeol/tiptap-editor";
|
|
81
|
+
import "@junbyeol/tiptap-editor/style.css";
|
|
82
|
+
|
|
83
|
+
export default function PostPage({ post }) {
|
|
84
|
+
return <TiptapContent html={post.content} />;
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Props
|
|
89
|
+
|
|
90
|
+
| Prop | 타입 | 설명 |
|
|
91
|
+
| ----------- | -------- | --------------------------------------------- |
|
|
92
|
+
| `html` | `string` | 렌더링할 HTML 문자열 (필수) |
|
|
93
|
+
| `className` | `string` | 루트 `div`에 추가할 CSS 클래스 (선택) |
|
|
94
|
+
|
|
95
|
+
## 폰트 적용
|
|
96
|
+
|
|
97
|
+
에디터에서 선택할 수 있는 나눔 폰트 시리즈는 별도로 로드해야 합니다. **에디터 페이지와 Viewer 페이지 모두**에 적용해야 WYSIWYG이 보장됩니다.
|
|
98
|
+
|
|
99
|
+
이 패키지는 두 가지 방식으로 폰트 로드를 지원합니다.
|
|
100
|
+
|
|
101
|
+
### 방법 A: React 컴포넌트
|
|
102
|
+
|
|
103
|
+
`EditorFontStylesheets` 컴포넌트를 `<head>` 안에 렌더링합니다.
|
|
104
|
+
|
|
105
|
+
**Next.js App Router (`layout.tsx`)**
|
|
106
|
+
|
|
107
|
+
```tsx
|
|
108
|
+
import { EditorFontStylesheets } from "@junbyeol/tiptap-editor";
|
|
109
|
+
|
|
110
|
+
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
|
111
|
+
return (
|
|
112
|
+
<html>
|
|
113
|
+
<head>
|
|
114
|
+
<EditorFontStylesheets />
|
|
115
|
+
</head>
|
|
116
|
+
<body>{children}</body>
|
|
117
|
+
</html>
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
**Next.js Pages Router (`_document.tsx`)**
|
|
123
|
+
|
|
124
|
+
```tsx
|
|
125
|
+
import { Html, Head, Main, NextScript } from "next/document";
|
|
126
|
+
import { EditorFontStylesheets } from "@junbyeol/tiptap-editor";
|
|
127
|
+
|
|
128
|
+
export default function Document() {
|
|
129
|
+
return (
|
|
130
|
+
<Html>
|
|
131
|
+
<Head>
|
|
132
|
+
<EditorFontStylesheets />
|
|
133
|
+
</Head>
|
|
134
|
+
<body>
|
|
135
|
+
<Main />
|
|
136
|
+
<NextScript />
|
|
137
|
+
</body>
|
|
138
|
+
</Html>
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### 방법 B: 폰트 링크 데이터 직접 사용
|
|
144
|
+
|
|
145
|
+
`EDITOR_FONT_LINKS`를 직접 사용해 프레임워크에 맞게 삽입합니다.
|
|
146
|
+
|
|
147
|
+
```tsx
|
|
148
|
+
import { EDITOR_FONT_LINKS } from "@junbyeol/tiptap-editor";
|
|
149
|
+
|
|
150
|
+
// EDITOR_FONT_LINKS 구조:
|
|
151
|
+
// [{ family: "Nanum Gothic", href: "https://fonts.googleapis.com/..." }, ...]
|
|
152
|
+
|
|
153
|
+
// 예: React Helmet
|
|
154
|
+
import { Helmet } from "react-helmet";
|
|
155
|
+
|
|
156
|
+
export default function App() {
|
|
157
|
+
return (
|
|
158
|
+
<>
|
|
159
|
+
<Helmet>
|
|
160
|
+
{EDITOR_FONT_LINKS.map((font) => (
|
|
161
|
+
<link key={font.family} rel="stylesheet" href={font.href} />
|
|
162
|
+
))}
|
|
163
|
+
</Helmet>
|
|
164
|
+
{/* ... */}
|
|
165
|
+
</>
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
73
170
|
## 로컬 개발
|
|
74
171
|
|
|
75
172
|
```bash
|