@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.
Files changed (123) hide show
  1. package/README.md +103 -6
  2. package/dist/index.cjs +71 -164
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.mjs +29327 -26994
  5. package/dist/index.mjs.map +1 -0
  6. package/dist/style.css +1 -1
  7. package/dist/types/components/custom/blockquote-popover.d.ts +6 -0
  8. package/dist/types/components/custom/font-family-dropdown-menu/font-family-dropdown-menu.d.ts +9 -0
  9. package/dist/types/components/custom/font-family-dropdown-menu/index.d.ts +2 -0
  10. package/dist/types/components/custom/font-family-dropdown-menu/nanum-fonts.d.ts +31 -0
  11. package/dist/types/components/custom/font-size-dropdown-menu/font-size-dropdown-menu.d.ts +9 -0
  12. package/dist/types/components/custom/font-size-dropdown-menu/index.d.ts +1 -0
  13. package/dist/types/components/custom/hr-style-popover.d.ts +6 -0
  14. package/dist/types/components/custom/image-bubble-menu/image-bubble-menu.d.ts +5 -0
  15. package/dist/types/components/custom/image-bubble-menu/image-ratio-popover.d.ts +6 -0
  16. package/dist/types/components/custom/image-bubble-menu/index.d.ts +1 -0
  17. package/dist/types/components/custom/insert-table-popover.d.ts +6 -0
  18. package/dist/types/components/custom/list-style-popover.d.ts +6 -0
  19. package/dist/types/components/custom/table-bubble-menu/index.d.ts +1 -0
  20. package/dist/types/components/custom/table-bubble-menu/table-bubble-menu.d.ts +5 -0
  21. package/dist/types/components/custom/table-cell-background-color-popover.d.ts +6 -0
  22. package/dist/types/components/custom/text-style-dropdown-menu/index.d.ts +4 -0
  23. package/dist/types/components/custom/text-style-dropdown-menu/text-style-button.d.ts +14 -0
  24. package/dist/types/components/custom/text-style-dropdown-menu/text-style-dropdown-menu.d.ts +20 -0
  25. package/dist/types/components/custom/text-style-dropdown-menu/use-text-style-dropdown-menu.d.ts +26 -0
  26. package/dist/types/components/custom/text-style-dropdown-menu/use-text-style.d.ts +71 -0
  27. package/dist/types/components/custom/uploadable-dropdown-menu/index.d.ts +2 -0
  28. package/dist/types/components/custom/uploadable-dropdown-menu/uploadable-button.d.ts +17 -0
  29. package/dist/types/components/custom/uploadable-dropdown-menu/uploadable-dropdown-menu.d.ts +19 -0
  30. package/dist/types/components/tiptap-icons/align-center-icon.d.ts +1 -1
  31. package/dist/types/components/tiptap-icons/align-justify-icon.d.ts +1 -1
  32. package/dist/types/components/tiptap-icons/align-left-icon.d.ts +1 -1
  33. package/dist/types/components/tiptap-icons/align-right-icon.d.ts +1 -1
  34. package/dist/types/components/tiptap-icons/bold-icon.d.ts +1 -1
  35. package/dist/types/components/tiptap-icons/check-icon.d.ts +3 -0
  36. package/dist/types/components/tiptap-icons/chevron-down-icon.d.ts +1 -1
  37. package/dist/types/components/tiptap-icons/code2-icon.d.ts +1 -1
  38. package/dist/types/components/tiptap-icons/corner-down-left-icon.d.ts +3 -0
  39. package/dist/types/components/tiptap-icons/double-quotes-icon.d.ts +3 -0
  40. package/dist/types/components/tiptap-icons/external-link-icon.d.ts +3 -0
  41. package/dist/types/components/tiptap-icons/heading-five-icon.d.ts +1 -1
  42. package/dist/types/components/tiptap-icons/heading-four-icon.d.ts +1 -1
  43. package/dist/types/components/tiptap-icons/heading-icon.d.ts +1 -1
  44. package/dist/types/components/tiptap-icons/heading-one-icon.d.ts +1 -1
  45. package/dist/types/components/tiptap-icons/heading-six-icon.d.ts +1 -1
  46. package/dist/types/components/tiptap-icons/heading-three-icon.d.ts +1 -1
  47. package/dist/types/components/tiptap-icons/heading-two-icon.d.ts +1 -1
  48. package/dist/types/components/tiptap-icons/image-align-center.d.ts +3 -0
  49. package/dist/types/components/tiptap-icons/image-align-left.d.ts +3 -0
  50. package/dist/types/components/tiptap-icons/image-align-right.d.ts +3 -0
  51. package/dist/types/components/tiptap-icons/image-caption.d.ts +3 -0
  52. package/dist/types/components/tiptap-icons/image-ratio.d.ts +3 -0
  53. package/dist/types/components/tiptap-icons/italic-icon.d.ts +1 -1
  54. package/dist/types/components/tiptap-icons/link-icon.d.ts +3 -0
  55. package/dist/types/components/tiptap-icons/list-icon.d.ts +1 -1
  56. package/dist/types/components/tiptap-icons/list-ordered-icon.d.ts +1 -1
  57. package/dist/types/components/tiptap-icons/list-todo-icon.d.ts +1 -1
  58. package/dist/types/components/tiptap-icons/paragraph-icon.d.ts +3 -0
  59. package/dist/types/components/tiptap-icons/redo2-icon.d.ts +1 -1
  60. package/dist/types/components/tiptap-icons/separator-icon.d.ts +3 -0
  61. package/dist/types/components/tiptap-icons/strike-icon.d.ts +1 -1
  62. package/dist/types/components/tiptap-icons/subscript-icon.d.ts +1 -1
  63. package/dist/types/components/tiptap-icons/superscript-icon.d.ts +1 -1
  64. package/dist/types/components/tiptap-icons/table-icon.d.ts +3 -0
  65. package/dist/types/components/tiptap-icons/trash-icon.d.ts +3 -0
  66. package/dist/types/components/tiptap-icons/underline-icon.d.ts +1 -1
  67. package/dist/types/components/tiptap-icons/undo2-icon.d.ts +1 -1
  68. package/dist/types/components/tiptap-icons/uploadable-file-icon.d.ts +3 -0
  69. package/dist/types/components/tiptap-icons/uploadable-icon.d.ts +3 -0
  70. package/dist/types/components/tiptap-icons/uploadable-image-icon.d.ts +3 -0
  71. package/dist/types/components/tiptap-ui/heading-button/heading-button.d.ts +1 -1
  72. package/dist/types/components/tiptap-ui/heading-button/use-heading.d.ts +7 -7
  73. package/dist/types/components/tiptap-ui/heading-dropdown-menu/use-heading-dropdown-menu.d.ts +1 -1
  74. package/dist/types/components/tiptap-ui/link-popover/index.d.ts +2 -0
  75. package/dist/types/components/tiptap-ui/link-popover/link-popover.d.ts +57 -0
  76. package/dist/types/components/tiptap-ui/link-popover/use-link-popover.d.ts +117 -0
  77. package/dist/types/components/tiptap-ui/list-button/list-button.d.ts +1 -1
  78. package/dist/types/components/tiptap-ui/list-button/use-list.d.ts +4 -4
  79. package/dist/types/components/tiptap-ui/mark-button/mark-button.d.ts +1 -1
  80. package/dist/types/components/tiptap-ui/mark-button/use-mark.d.ts +8 -8
  81. package/dist/types/components/tiptap-ui/text-align-button/text-align-button.d.ts +1 -1
  82. package/dist/types/components/tiptap-ui/text-align-button/use-text-align.d.ts +5 -5
  83. package/dist/types/components/tiptap-ui/undo-redo-button/undo-redo-button.d.ts +1 -1
  84. package/dist/types/components/tiptap-ui/undo-redo-button/use-undo-redo.d.ts +3 -3
  85. package/dist/types/components/tiptap-ui-primitive/button/button.d.ts +0 -3
  86. package/dist/types/components/tiptap-ui-primitive/button-group/button-group.d.ts +10 -0
  87. package/dist/types/components/tiptap-ui-primitive/button-group/index.d.ts +1 -0
  88. package/dist/types/components/tiptap-ui-primitive/dropdown-menu/dropdown-menu.d.ts +2 -2
  89. package/dist/types/components/tiptap-ui-primitive/input/index.d.ts +1 -0
  90. package/dist/types/components/tiptap-ui-primitive/input/input.d.ts +2 -0
  91. package/dist/types/components/tiptap-ui-primitive/popover/popover.d.ts +3 -3
  92. package/dist/types/components/tiptap-ui-primitive/separator/separator.d.ts +2 -3
  93. package/dist/types/components/tiptap-ui-primitive/spacer/spacer.d.ts +1 -1
  94. package/dist/types/components/tiptap-ui-primitive/tooltip/tooltip.d.ts +1 -1
  95. package/dist/types/hooks/use-tiptap-editor.d.ts +1 -12
  96. package/dist/types/lib/fonts.d.ts +12 -0
  97. package/dist/types/lib/index.d.ts +6 -3
  98. package/dist/types/lib/tiptap-utils.d.ts +6 -1
  99. package/dist/types/tiptap/content.d.ts +6 -0
  100. package/dist/types/tiptap/contexts/FileHandlerContext.d.ts +7 -0
  101. package/dist/types/tiptap/extensions/BasicKit.d.ts +2 -0
  102. package/dist/types/tiptap/extensions/BlockquoteKit.d.ts +2 -0
  103. package/dist/types/tiptap/extensions/DefaultFileAttachmentComponent.d.ts +2 -0
  104. package/dist/types/tiptap/extensions/FigcaptionKit.d.ts +2 -0
  105. package/dist/types/tiptap/extensions/FigureKit.d.ts +16 -0
  106. package/dist/types/tiptap/extensions/FileAttachment.d.ts +13 -0
  107. package/dist/types/tiptap/extensions/FontFamilyKit.d.ts +10 -0
  108. package/dist/types/tiptap/extensions/FontSizeKit.d.ts +10 -0
  109. package/dist/types/tiptap/extensions/HrKit.d.ts +11 -0
  110. package/dist/types/tiptap/extensions/ImageKit.d.ts +1 -0
  111. package/dist/types/tiptap/extensions/Paragraph.d.ts +2 -0
  112. package/dist/types/tiptap/extensions/index.d.ts +8 -0
  113. package/dist/types/tiptap/extensions/table/index.d.ts +1 -0
  114. package/dist/types/tiptap/extensions/table/table-grip-menu.d.ts +13 -0
  115. package/dist/types/tiptap/extensions/table/table-kit.d.ts +3 -0
  116. package/dist/types/tiptap/extensions/table/table-row-column-utils.d.ts +16 -0
  117. package/dist/types/tiptap/extensions/table/table-view.d.ts +52 -0
  118. package/dist/types/tiptap/hooks/useFileHandler.d.ts +32 -0
  119. package/dist/types/tiptap/index.d.ts +10 -6
  120. package/dist/types/tiptap/menubar.d.ts +3 -2
  121. package/package.json +49 -26
  122. package/dist/types/tiptap/extensions/default-file-attachment.d.ts +0 -2
  123. 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~H4), 목록, 텍스트 정렬
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
- | `onFileInsert` | `(file: File) => void` | 파일이 에디터에 삽입될 호출 |
43
- | `onFileError` | `(error: Error) => void` | 파일 처리 오류 시 호출 |
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
- onFileInsert={(file) => console.log("삽입됨:", file.name)}
66
- onFileError={(error) => console.error(error)}
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