@cyberyozh/text-editor 0.1.1
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 +102 -0
- package/dist/editor.css +2069 -0
- package/dist/editor.css.map +1 -0
- package/dist/editor.d.mts +45 -0
- package/dist/editor.d.ts +45 -0
- package/dist/editor.js +6155 -0
- package/dist/editor.js.map +1 -0
- package/dist/editor.mjs +6118 -0
- package/dist/editor.mjs.map +1 -0
- package/dist/render/client.d.mts +24 -0
- package/dist/render/client.d.ts +24 -0
- package/dist/render/client.js +98 -0
- package/dist/render/client.js.map +1 -0
- package/dist/render/client.mjs +74 -0
- package/dist/render/client.mjs.map +1 -0
- package/dist/render.d.mts +58 -0
- package/dist/render.d.ts +58 -0
- package/dist/render.js +2521 -0
- package/dist/render.js.map +1 -0
- package/dist/render.mjs +2484 -0
- package/dist/render.mjs.map +1 -0
- package/dist/styles/index.css +2068 -0
- package/package.json +92 -0
- package/src/editor/commands/items.ts +374 -0
- package/src/editor/commands/suggestion.tsx +146 -0
- package/src/editor/components/button/button.css +56 -0
- package/src/editor/components/button/button.tsx +35 -0
- package/src/editor/components/button/index.ts +1 -0
- package/src/editor/components/common-modal/common-modal.css +85 -0
- package/src/editor/components/common-modal/common-modal.tsx +58 -0
- package/src/editor/components/common-modal/index.ts +1 -0
- package/src/editor/components/index.ts +3 -0
- package/src/editor/components/input/index.ts +1 -0
- package/src/editor/components/input/input.css +43 -0
- package/src/editor/components/input/input.tsx +22 -0
- package/src/editor/context/dialog-command.tsx +47 -0
- package/src/editor/context/index.ts +2 -0
- package/src/editor/context/translations-context.tsx +28 -0
- package/src/editor/controls/bubble-menu-content.tsx +394 -0
- package/src/editor/controls/callout-menu.tsx +169 -0
- package/src/editor/controls/character-count.tsx +36 -0
- package/src/editor/controls/commands-list.tsx +117 -0
- package/src/editor/controls/drag-handle.tsx +98 -0
- package/src/editor/controls/emoji-picker.tsx +62 -0
- package/src/editor/controls/index.ts +5 -0
- package/src/editor/controls/table-menu.tsx +322 -0
- package/src/editor/dialogs/add-katex-dialog/add-katex-dialog.css +115 -0
- package/src/editor/dialogs/add-katex-dialog/add-katex-dialog.tsx +116 -0
- package/src/editor/dialogs/add-katex-dialog/index.ts +1 -0
- package/src/editor/dialogs/add-link-dialog/add-link-dialog.css +105 -0
- package/src/editor/dialogs/add-link-dialog/add-link-dialog.tsx +177 -0
- package/src/editor/dialogs/add-link-dialog/index.ts +1 -0
- package/src/editor/dialogs/add-video-dialog/add-video-dialog.css +146 -0
- package/src/editor/dialogs/add-video-dialog/add-video-dialog.tsx +157 -0
- package/src/editor/dialogs/add-video-dialog/index.ts +1 -0
- package/src/editor/dialogs/image-dialog/image-dialog.css +101 -0
- package/src/editor/dialogs/image-dialog/image-dialog.tsx +276 -0
- package/src/editor/dialogs/image-dialog/index.ts +1 -0
- package/src/editor/dialogs/index.ts +4 -0
- package/src/editor/editor.tsx +247 -0
- package/src/editor/handlers/create-image-upload-handler.ts +24 -0
- package/src/editor/handlers/dialog-handlers.ts +143 -0
- package/src/editor/handlers/index.ts +8 -0
- package/src/editor/index.ts +3 -0
- package/src/extensions/base/callout.ts +138 -0
- package/src/extensions/base/code-block.ts +24 -0
- package/src/extensions/base/compatibility.ts +493 -0
- package/src/extensions/base/copyable-text.ts +56 -0
- package/src/extensions/base/custom-quote.ts +174 -0
- package/src/extensions/base/figure.ts +141 -0
- package/src/extensions/base/index.ts +19 -0
- package/src/extensions/base/link.ts +18 -0
- package/src/extensions/base/myth-reality.ts +45 -0
- package/src/extensions/base/prompt.ts +109 -0
- package/src/extensions/base/video.ts +29 -0
- package/src/extensions/editor/callout.ts +43 -0
- package/src/extensions/editor/code-block.ts +9 -0
- package/src/extensions/editor/commands.ts +43 -0
- package/src/extensions/editor/copyable-text.ts +16 -0
- package/src/extensions/editor/custom-quote.ts +54 -0
- package/src/extensions/editor/figure.ts +20 -0
- package/src/extensions/editor/get-editor-extensions.ts +113 -0
- package/src/extensions/editor/index.ts +25 -0
- package/src/extensions/editor/prompt.ts +43 -0
- package/src/extensions/editor/video.ts +23 -0
- package/src/extensions/render/get-render-extensions.ts +74 -0
- package/src/extensions/render/index.ts +6 -0
- package/src/extensions/views/components/callout.tsx +70 -0
- package/src/extensions/views/components/code-block.tsx +73 -0
- package/src/extensions/views/components/copy-button.tsx +52 -0
- package/src/extensions/views/components/copyable-text.tsx +11 -0
- package/src/extensions/views/components/custom-quote.tsx +64 -0
- package/src/extensions/views/components/figure.tsx +63 -0
- package/src/extensions/views/components/index.ts +7 -0
- package/src/extensions/views/components/prompt.tsx +43 -0
- package/src/extensions/views/components/video.tsx +40 -0
- package/src/extensions/views/node-views/callout.tsx +51 -0
- package/src/extensions/views/node-views/code-block.tsx +30 -0
- package/src/extensions/views/node-views/copyable-text.tsx +10 -0
- package/src/extensions/views/node-views/custom-quote.tsx +66 -0
- package/src/extensions/views/node-views/figure.tsx +38 -0
- package/src/extensions/views/node-views/index.ts +7 -0
- package/src/extensions/views/node-views/prompt.tsx +35 -0
- package/src/extensions/views/node-views/video.tsx +19 -0
- package/src/icons/Check.tsx +12 -0
- package/src/icons/Copy.tsx +15 -0
- package/src/icons/DragIcon.tsx +10 -0
- package/src/icons/Edit.tsx +12 -0
- package/src/icons/Quote.tsx +10 -0
- package/src/icons/X.tsx +13 -0
- package/src/icons/color/TiptapCalloutError.tsx +25 -0
- package/src/icons/color/TiptapCalloutInfo.tsx +18 -0
- package/src/icons/color/TiptapCalloutSuccess.tsx +49 -0
- package/src/icons/color/TiptapCalloutWarning.tsx +28 -0
- package/src/icons/color/index.ts +4 -0
- package/src/icons/index.ts +60 -0
- package/src/icons/menu/AddImage.tsx +10 -0
- package/src/icons/menu/AlignCenter.tsx +10 -0
- package/src/icons/menu/AlignLeft.tsx +10 -0
- package/src/icons/menu/AlignRight.tsx +10 -0
- package/src/icons/menu/ArrowDown.tsx +13 -0
- package/src/icons/menu/ArrowLeft.tsx +13 -0
- package/src/icons/menu/ArrowRight.tsx +13 -0
- package/src/icons/menu/ArrowUp.tsx +13 -0
- package/src/icons/menu/Blockquote.tsx +7 -0
- package/src/icons/menu/Bold.tsx +10 -0
- package/src/icons/menu/BulletList.tsx +10 -0
- package/src/icons/menu/CalloutError.tsx +10 -0
- package/src/icons/menu/CalloutInfo.tsx +12 -0
- package/src/icons/menu/CalloutSuccess.tsx +10 -0
- package/src/icons/menu/CalloutWarning.tsx +12 -0
- package/src/icons/menu/ClearFormatting.tsx +10 -0
- package/src/icons/menu/Code.tsx +10 -0
- package/src/icons/menu/CodeBlock.tsx +10 -0
- package/src/icons/menu/Copyable.tsx +10 -0
- package/src/icons/menu/CustomQuote.tsx +17 -0
- package/src/icons/menu/DeleteColumn.tsx +17 -0
- package/src/icons/menu/DeleteRow.tsx +17 -0
- package/src/icons/menu/Details.tsx +10 -0
- package/src/icons/menu/H2.tsx +10 -0
- package/src/icons/menu/H3.tsx +10 -0
- package/src/icons/menu/H4.tsx +10 -0
- package/src/icons/menu/H5.tsx +10 -0
- package/src/icons/menu/H6.tsx +10 -0
- package/src/icons/menu/Highlight.tsx +13 -0
- package/src/icons/menu/HorizontalRule.tsx +7 -0
- package/src/icons/menu/Italic.tsx +10 -0
- package/src/icons/menu/Link.tsx +10 -0
- package/src/icons/menu/LinkOff.tsx +10 -0
- package/src/icons/menu/Math.tsx +10 -0
- package/src/icons/menu/MergeCells.tsx +10 -0
- package/src/icons/menu/MythReality.tsx +10 -0
- package/src/icons/menu/OrderedList.tsx +10 -0
- package/src/icons/menu/Prompt.tsx +18 -0
- package/src/icons/menu/Redo.tsx +14 -0
- package/src/icons/menu/SplitCells.tsx +7 -0
- package/src/icons/menu/Strikethrough.tsx +10 -0
- package/src/icons/menu/Subscript.tsx +10 -0
- package/src/icons/menu/Superscript.tsx +10 -0
- package/src/icons/menu/Table.tsx +14 -0
- package/src/icons/menu/TableColumnHeading.tsx +7 -0
- package/src/icons/menu/TableRowHeading.tsx +10 -0
- package/src/icons/menu/TextColor.tsx +13 -0
- package/src/icons/menu/Underline.tsx +10 -0
- package/src/icons/menu/Undo.tsx +14 -0
- package/src/icons/menu/Video.tsx +14 -0
- package/src/icons/menu/index.ts +49 -0
- package/src/render/index.ts +22 -0
- package/src/render/static-renderer-config.tsx +206 -0
- package/src/render/tiptap-interactivity-provider.tsx +78 -0
- package/src/render/tiptap-render.tsx +102 -0
- package/src/styles/components.css +10 -0
- package/src/styles/editor/base.css +39 -0
- package/src/styles/editor/callout-menu.css +81 -0
- package/src/styles/editor/controls.css +57 -0
- package/src/styles/editor/emoji-picker.css +113 -0
- package/src/styles/editor/index.css +9 -0
- package/src/styles/editor/menus.css +16 -0
- package/src/styles/editor/states.css +43 -0
- package/src/styles/editor/typography.css +165 -0
- package/src/styles/editor/utilities.css +71 -0
- package/src/styles/editor/variables.css +70 -0
- package/src/styles/extensions/callout.css +155 -0
- package/src/styles/extensions/code-block.css +109 -0
- package/src/styles/extensions/commands-list.css +83 -0
- package/src/styles/extensions/custom-quote.css +103 -0
- package/src/styles/extensions/details.css +87 -0
- package/src/styles/extensions/figure.css +66 -0
- package/src/styles/extensions/index.css +11 -0
- package/src/styles/extensions/math.css +32 -0
- package/src/styles/extensions/myth-reality.css +59 -0
- package/src/styles/extensions/prompt.css +75 -0
- package/src/styles/extensions/table.css +253 -0
- package/src/styles/extensions/video.css +53 -0
- package/src/styles/styles.css +3 -0
- package/src/translations/en.json +158 -0
- package/src/translations/ru.json +158 -0
- package/src/types/image-handler.ts +33 -0
- package/src/types/index.ts +1 -0
- package/src/utils/copy-to-clipboard.ts +23 -0
- package/src/utils/custom-emoji.ts +174 -0
- package/src/utils/detect-video-hosting.ts +106 -0
- package/src/utils/get-shared-extensions.ts +45 -0
- package/src/utils/get-translations.ts +25 -0
- package/src/utils/handle-exit-node.ts +61 -0
- package/src/utils/image-src-resolver.ts +74 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/migrate-legacy-callouts.ts +59 -0
- package/src/utils/pluralize.ts +38 -0
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--tiptap-table-header-bg--light: #f2f7fe;
|
|
3
|
+
--tiptap-table-header-bg--dark: #0d6efd26;
|
|
4
|
+
|
|
5
|
+
--tiptap-table-border--light: #e0e0e3;
|
|
6
|
+
--tiptap-table-border--dark: #0d6efd26;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.tableWrapper {
|
|
10
|
+
margin: 32px 0;
|
|
11
|
+
overflow-x: auto;
|
|
12
|
+
overflow-y: hidden;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.tableWrapper {
|
|
16
|
+
scrollbar-color: black transparent;
|
|
17
|
+
scrollbar-width: thin;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.tableWrapper::-webkit-scrollbar {
|
|
21
|
+
width: 6px;
|
|
22
|
+
height: 6px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.tableWrapper::-webkit-scrollbar-track {
|
|
26
|
+
border-radius: 10px;
|
|
27
|
+
background: transparent;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.tableWrapper::-webkit-scrollbar-thumb {
|
|
31
|
+
border-radius: 10px;
|
|
32
|
+
background: black;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.tableWrapper::-webkit-scrollbar-thumb:hover {
|
|
36
|
+
background: #333;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.tiptap table {
|
|
40
|
+
position: relative;
|
|
41
|
+
width: 100%;
|
|
42
|
+
max-width: 100%;
|
|
43
|
+
margin: 0;
|
|
44
|
+
overflow: hidden;
|
|
45
|
+
border-collapse: collapse;
|
|
46
|
+
table-layout: fixed;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.tiptap table p {
|
|
50
|
+
margin: 0 !important;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.tiptap table tr {
|
|
54
|
+
position: relative;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.tiptap th {
|
|
58
|
+
position: relative;
|
|
59
|
+
background-color: var(--tiptap-table-header-bg--light);
|
|
60
|
+
|
|
61
|
+
text-align: center;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.tiptap th p {
|
|
65
|
+
font-weight: 500;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
[data-theme="dark"] .tiptap th {
|
|
69
|
+
background-color: var(--tiptap-table-header-bg--dark);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.tiptap td,
|
|
73
|
+
.tiptap th {
|
|
74
|
+
box-sizing: border-box;
|
|
75
|
+
position: relative;
|
|
76
|
+
padding: 16px 24px;
|
|
77
|
+
border: 1px solid var(--tiptap-table-border--light);
|
|
78
|
+
text-align: center;
|
|
79
|
+
vertical-align: top;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
[data-theme="dark"] .tiptap td,
|
|
83
|
+
[data-theme="dark"] .tiptap th {
|
|
84
|
+
border-color: var(--tiptap-table-border--dark);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.tiptap[contenteditable="true"] td:hover,
|
|
88
|
+
.tiptap[contenteditable="true"] th:hover {
|
|
89
|
+
background-color: var(--tiptap-color-primary-subtle);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.tiptap .column-resize-handle {
|
|
93
|
+
position: absolute;
|
|
94
|
+
top: 0;
|
|
95
|
+
right: -2px;
|
|
96
|
+
bottom: -2px;
|
|
97
|
+
width: 4px;
|
|
98
|
+
background-color: var(--tiptap-color-primary-light);
|
|
99
|
+
pointer-events: none;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.resize-cursor {
|
|
103
|
+
cursor: ew-resize;
|
|
104
|
+
cursor: col-resize;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.table-indicator {
|
|
108
|
+
z-index: 101;
|
|
109
|
+
position: fixed;
|
|
110
|
+
margin: 0 !important;
|
|
111
|
+
pointer-events: auto;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.table-indicator__button {
|
|
115
|
+
display: flex;
|
|
116
|
+
align-items: center;
|
|
117
|
+
justify-content: center;
|
|
118
|
+
width: 24px;
|
|
119
|
+
height: 12px;
|
|
120
|
+
padding: 0;
|
|
121
|
+
border: 1px solid var(--tiptap-color-primary-light);
|
|
122
|
+
border-radius: 4px;
|
|
123
|
+
background-color: var(--tiptap-bg-surface-menu);
|
|
124
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
125
|
+
color: var(--tiptap-color-primary);
|
|
126
|
+
font-size: 18px;
|
|
127
|
+
cursor: pointer;
|
|
128
|
+
transition: all 150ms ease-in-out;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.table-indicator__button:hover {
|
|
132
|
+
background-color: var(--tiptap-color-primary);
|
|
133
|
+
color: white;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.table-indicator__button--row {
|
|
137
|
+
width: 12px;
|
|
138
|
+
height: 24px;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.table-context-menu {
|
|
142
|
+
z-index: 102;
|
|
143
|
+
position: fixed;
|
|
144
|
+
animation: slideIn 150ms ease-out;
|
|
145
|
+
pointer-events: auto;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
@keyframes slideIn {
|
|
149
|
+
from {
|
|
150
|
+
transform: scale(0.95);
|
|
151
|
+
opacity: 0;
|
|
152
|
+
}
|
|
153
|
+
to {
|
|
154
|
+
transform: scale(1);
|
|
155
|
+
opacity: 1;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.table-context-menu__content {
|
|
160
|
+
display: flex;
|
|
161
|
+
flex-direction: column;
|
|
162
|
+
width: 275px;
|
|
163
|
+
max-height: 300px;
|
|
164
|
+
padding: 12px;
|
|
165
|
+
overflow-y: auto;
|
|
166
|
+
gap: 6px;
|
|
167
|
+
border: 1px solid var(--tiptap-color-primary-light);
|
|
168
|
+
border-radius: var(--tiptap-radius);
|
|
169
|
+
background-color: var(--tiptap-bg-surface-menu);
|
|
170
|
+
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
|
|
171
|
+
scrollbar-color: black transparent;
|
|
172
|
+
scrollbar-width: thin;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.table-context-menu__content::-webkit-scrollbar {
|
|
176
|
+
width: 6px;
|
|
177
|
+
height: 6px;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.table-context-menu__content::-webkit-scrollbar-track {
|
|
181
|
+
border-radius: 10px;
|
|
182
|
+
background: transparent;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.table-context-menu__content::-webkit-scrollbar-thumb {
|
|
186
|
+
border-radius: 10px;
|
|
187
|
+
background: black;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.table-context-menu__content::-webkit-scrollbar-thumb:hover {
|
|
191
|
+
background: #333;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.table-context-menu__button {
|
|
195
|
+
display: flex;
|
|
196
|
+
align-items: center;
|
|
197
|
+
width: 100%;
|
|
198
|
+
padding: 6px 12px;
|
|
199
|
+
gap: 8px;
|
|
200
|
+
border: none;
|
|
201
|
+
border-radius: 4px;
|
|
202
|
+
outline: none;
|
|
203
|
+
background: transparent;
|
|
204
|
+
color: var(--tiptap-color-primary);
|
|
205
|
+
font-weight: 500;
|
|
206
|
+
font-size: 14px;
|
|
207
|
+
text-align: left;
|
|
208
|
+
cursor: pointer;
|
|
209
|
+
transition: all 0.15s ease-in-out;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.table-context-menu__button:hover {
|
|
213
|
+
outline: none;
|
|
214
|
+
background-color: var(--tiptap-color-primary);
|
|
215
|
+
color: var(--tiptap-state-control-active-color);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.table-context-menu__button:active {
|
|
219
|
+
outline: none;
|
|
220
|
+
background-color: var(--tiptap-color-primary);
|
|
221
|
+
color: var(--tiptap-state-control-active-color);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.table-context-menu__button--danger {
|
|
225
|
+
color: var(--tiptap-color-primary-error);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.table-context-menu__button--danger:hover {
|
|
229
|
+
outline: none;
|
|
230
|
+
background-color: var(--ui-error-bg);
|
|
231
|
+
color: var(--tiptap-color-primary-error);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.table-context-menu__button--danger:active {
|
|
235
|
+
outline: none;
|
|
236
|
+
background-color: var(--tiptap-color-primary-error);
|
|
237
|
+
color: white;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
.table-context-menu__button svg {
|
|
241
|
+
display: flex;
|
|
242
|
+
flex-shrink: 0;
|
|
243
|
+
align-items: center;
|
|
244
|
+
justify-content: center;
|
|
245
|
+
width: 20px;
|
|
246
|
+
height: 20px;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
.table-context-menu__divider {
|
|
250
|
+
height: 1px;
|
|
251
|
+
margin: 6px 0;
|
|
252
|
+
background-color: var(--tiptap-color-border);
|
|
253
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
[data-video] {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
margin: 24px 0;
|
|
5
|
+
padding: 0;
|
|
6
|
+
border-radius: 8px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.video-player-wrapper {
|
|
10
|
+
aspect-ratio: 16 / 9;
|
|
11
|
+
width: 100%;
|
|
12
|
+
max-width: 800px;
|
|
13
|
+
margin: 0 auto;
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
border-radius: 12px;
|
|
16
|
+
background-color: #000;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.video-iframe {
|
|
20
|
+
width: 100%;
|
|
21
|
+
height: 100%;
|
|
22
|
+
border: 0;
|
|
23
|
+
border-radius: 12px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.video-error {
|
|
27
|
+
display: flex;
|
|
28
|
+
align-items: center;
|
|
29
|
+
justify-content: center;
|
|
30
|
+
aspect-ratio: 16 / 9;
|
|
31
|
+
width: 100%;
|
|
32
|
+
max-width: 640px;
|
|
33
|
+
padding: 20px;
|
|
34
|
+
border-radius: 12px;
|
|
35
|
+
background-color: #f5f5f5;
|
|
36
|
+
color: #666;
|
|
37
|
+
font-size: 14px;
|
|
38
|
+
text-align: center;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.video-loading {
|
|
42
|
+
display: flex;
|
|
43
|
+
align-items: center;
|
|
44
|
+
justify-content: center;
|
|
45
|
+
width: 100%;
|
|
46
|
+
height: 100%;
|
|
47
|
+
color: #999;
|
|
48
|
+
font-size: 14px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.video-content {
|
|
52
|
+
margin-top: 8px;
|
|
53
|
+
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
{
|
|
2
|
+
"history": {
|
|
3
|
+
"undo": "Undo",
|
|
4
|
+
"redo": "Redo"
|
|
5
|
+
},
|
|
6
|
+
"headings": {
|
|
7
|
+
"h2": "Heading 2",
|
|
8
|
+
"h3": "Heading 3",
|
|
9
|
+
"h4": "Heading 4",
|
|
10
|
+
"h5": "Heading 5",
|
|
11
|
+
"h6": "Heading 6"
|
|
12
|
+
},
|
|
13
|
+
"media": {
|
|
14
|
+
"addImage": "Image",
|
|
15
|
+
"imageTitle": "Image title",
|
|
16
|
+
"imageAlt": "Alt text",
|
|
17
|
+
"deleteImage": "Delete image",
|
|
18
|
+
"previewLabel": "Preview",
|
|
19
|
+
"addLink": "Insert link",
|
|
20
|
+
"addVideo": "Video",
|
|
21
|
+
"addKatex": "Formula (KaTeX)"
|
|
22
|
+
},
|
|
23
|
+
"link": {
|
|
24
|
+
"title": "Link text",
|
|
25
|
+
"titleError": "Enter link text",
|
|
26
|
+
"titlePlaceholder": "Enter text to display...",
|
|
27
|
+
"url": "Link URL",
|
|
28
|
+
"urlPlaceholder": "https://example.com",
|
|
29
|
+
"addLink": "Add link",
|
|
30
|
+
"editLink": "Edit link",
|
|
31
|
+
"removeLink": "Remove link",
|
|
32
|
+
"invalidUrl": "Invalid URL",
|
|
33
|
+
"emptyUrl": "Enter link URL",
|
|
34
|
+
"addLinkTitle": "Add link",
|
|
35
|
+
"removeLinkTitle": "Remove link"
|
|
36
|
+
},
|
|
37
|
+
"lists": {
|
|
38
|
+
"bulletList": "Bullet list",
|
|
39
|
+
"orderedList": "Numbered list",
|
|
40
|
+
"details": "Details"
|
|
41
|
+
},
|
|
42
|
+
"blocks": {
|
|
43
|
+
"callout": "Callout",
|
|
44
|
+
"calloutSelectStyle": "Select style",
|
|
45
|
+
"calloutCustomColor": "Custom color",
|
|
46
|
+
"blockquote": "Quote",
|
|
47
|
+
"codeBlock": "Code block",
|
|
48
|
+
"customQuote": "Custom quote",
|
|
49
|
+
"horizontalRule": "Divider",
|
|
50
|
+
"mythReality": "Myth/Reality",
|
|
51
|
+
"prompt": "Prompt"
|
|
52
|
+
},
|
|
53
|
+
"mythReality": {
|
|
54
|
+
"myth": "Myth",
|
|
55
|
+
"reality": "Reality"
|
|
56
|
+
},
|
|
57
|
+
"customQuote": {
|
|
58
|
+
"textPlaceholder": "Enter quote text…",
|
|
59
|
+
"authorPlaceholder": "Enter author name…",
|
|
60
|
+
"signPlaceholder": "Enter role or source…"
|
|
61
|
+
},
|
|
62
|
+
"prompt": {
|
|
63
|
+
"headerPlaceholder": "Enter header…",
|
|
64
|
+
"contentPlaceholder": "Enter prompt…"
|
|
65
|
+
},
|
|
66
|
+
"codeBlock": {
|
|
67
|
+
"selectLanguage": "Select language",
|
|
68
|
+
"copyCode": "Copy code",
|
|
69
|
+
"copied": "Copied!"
|
|
70
|
+
},
|
|
71
|
+
"textFormatting": {
|
|
72
|
+
"superscript": "Superscript",
|
|
73
|
+
"subscript": "Subscript",
|
|
74
|
+
"bold": "Bold",
|
|
75
|
+
"italic": "Italic",
|
|
76
|
+
"underline": "Underline",
|
|
77
|
+
"strikethrough": "Strikethrough",
|
|
78
|
+
"clearFormatting": "Clear formatting",
|
|
79
|
+
"textColor": "Text color",
|
|
80
|
+
"highlightColor": "Highlight color",
|
|
81
|
+
"copyableText": "Copyable text"
|
|
82
|
+
},
|
|
83
|
+
"alignment": {
|
|
84
|
+
"alignLeft": "Align left",
|
|
85
|
+
"alignCenter": "Align center",
|
|
86
|
+
"alignRight": "Align right"
|
|
87
|
+
},
|
|
88
|
+
"table": {
|
|
89
|
+
"table": "Table",
|
|
90
|
+
"insertRowBefore": "Insert row above",
|
|
91
|
+
"insertRowAfter": "Insert row below",
|
|
92
|
+
"deleteRow": "Delete row",
|
|
93
|
+
"insertColumnBefore": "Insert column left",
|
|
94
|
+
"insertColumnAfter": "Insert column right",
|
|
95
|
+
"deleteColumn": "Delete column",
|
|
96
|
+
"toggleHeaderRow": "Toggle header row",
|
|
97
|
+
"toggleHeaderColumn": "Toggle header column",
|
|
98
|
+
"mergeCells": "Merge cells",
|
|
99
|
+
"splitCell": "Split cell"
|
|
100
|
+
},
|
|
101
|
+
"imageUpload": {
|
|
102
|
+
"dragActive": "Drop file here",
|
|
103
|
+
"dragInactive": "Drag file or click to select"
|
|
104
|
+
},
|
|
105
|
+
"imageDialog": {
|
|
106
|
+
"addTitle": "Add image",
|
|
107
|
+
"editTitle": "Edit image",
|
|
108
|
+
"captionLabel": "Image caption",
|
|
109
|
+
"captionPlaceholder": "Description under image...",
|
|
110
|
+
"save": "Save",
|
|
111
|
+
"add": "Add"
|
|
112
|
+
},
|
|
113
|
+
"videoUpload": {
|
|
114
|
+
"title": "Add video",
|
|
115
|
+
"urlLabel": "Video URL",
|
|
116
|
+
"urlPlaceholder": "Paste video URL here",
|
|
117
|
+
"supportedPlatforms": "Supported platforms:",
|
|
118
|
+
"emptyUrl": "Please enter video URL",
|
|
119
|
+
"unsupportedUrl": "Unsupported video URL. Please check URL and try again.",
|
|
120
|
+
"validationError": "Error validating video URL. Please try again.",
|
|
121
|
+
"add": "Add video",
|
|
122
|
+
"cancel": "Cancel",
|
|
123
|
+
"validating": "Validating..."
|
|
124
|
+
},
|
|
125
|
+
"katex": {
|
|
126
|
+
"addTitle": "Add KaTeX formula",
|
|
127
|
+
"editTitle": "Edit KaTeX formula",
|
|
128
|
+
"description": "Enter mathematical expression in KaTeX format. See",
|
|
129
|
+
"documentationLink": "KaTeX documentation",
|
|
130
|
+
"documentationLinkSuffix": "for syntax reference.",
|
|
131
|
+
"label": "Mathematical expression",
|
|
132
|
+
"placeholder": "e.g., x = \\frac{-b \\pm \\sqrt{b^2 - 4ac}}{2a}",
|
|
133
|
+
"add": "Add formula",
|
|
134
|
+
"update": "Update formula"
|
|
135
|
+
},
|
|
136
|
+
"floatingMenu": {
|
|
137
|
+
"addCustomQuote": "Add custom quote",
|
|
138
|
+
"addMythReality": "Add Myth/Reality block",
|
|
139
|
+
"addPrompt": "Add prompt",
|
|
140
|
+
"addSuccessCallout": "Add success callout",
|
|
141
|
+
"addInfoCallout": "Add info callout",
|
|
142
|
+
"addWarningCallout": "Add warning callout",
|
|
143
|
+
"addErrorCallout": "Add error callout"
|
|
144
|
+
},
|
|
145
|
+
"editor": {
|
|
146
|
+
"commandMenuPlaceholder": "Press \"/\" for commands...",
|
|
147
|
+
"detailsSummaryPlaceholder": "Summary...",
|
|
148
|
+
"emojiSearchPlaceholder": "Search...",
|
|
149
|
+
"noCommandsFound": "No commands found"
|
|
150
|
+
},
|
|
151
|
+
"characterCount": {
|
|
152
|
+
"characters": ["character", "characters", "characters"],
|
|
153
|
+
"words": ["word", "words", "words"]
|
|
154
|
+
},
|
|
155
|
+
"common": {
|
|
156
|
+
"cancel": "Cancel"
|
|
157
|
+
}
|
|
158
|
+
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
{
|
|
2
|
+
"history": {
|
|
3
|
+
"undo": "Отменить",
|
|
4
|
+
"redo": "Повторить"
|
|
5
|
+
},
|
|
6
|
+
"headings": {
|
|
7
|
+
"h2": "Заголовок 2",
|
|
8
|
+
"h3": "Заголовок 3",
|
|
9
|
+
"h4": "Заголовок 4",
|
|
10
|
+
"h5": "Заголовок 5",
|
|
11
|
+
"h6": "Заголовок 6"
|
|
12
|
+
},
|
|
13
|
+
"media": {
|
|
14
|
+
"addImage": "Изображение",
|
|
15
|
+
"imageTitle": "Название (title изображение)",
|
|
16
|
+
"imageAlt": "Alt",
|
|
17
|
+
"deleteImage": "Удалить изображение",
|
|
18
|
+
"previewLabel": "Предпросмотр",
|
|
19
|
+
"addLink": "Вставить ссылку",
|
|
20
|
+
"addVideo": "Видео",
|
|
21
|
+
"addKatex": "Формула (KaTeX)"
|
|
22
|
+
},
|
|
23
|
+
"link": {
|
|
24
|
+
"title": "Текст ссылки",
|
|
25
|
+
"titleError": "Введение текст ссылки",
|
|
26
|
+
"titlePlaceholder": "Введите текст для отображения...",
|
|
27
|
+
"url": "URL ссылки",
|
|
28
|
+
"urlPlaceholder": "https://example.com",
|
|
29
|
+
"addLink": "Добавить ссылку",
|
|
30
|
+
"editLink": "Редактировать ссылку",
|
|
31
|
+
"removeLink": "Удалить ссылку",
|
|
32
|
+
"invalidUrl": "Неверный URL",
|
|
33
|
+
"emptyUrl": "Введите URL ссылки",
|
|
34
|
+
"addLinkTitle": "Добавить ссылку",
|
|
35
|
+
"removeLinkTitle": "Удалить ссылку"
|
|
36
|
+
},
|
|
37
|
+
"lists": {
|
|
38
|
+
"bulletList": "Ненумерованный список",
|
|
39
|
+
"orderedList": "Нумерованный список",
|
|
40
|
+
"details": "Сворачиваемый блок"
|
|
41
|
+
},
|
|
42
|
+
"blocks": {
|
|
43
|
+
"callout": "Коллаут",
|
|
44
|
+
"calloutSelectStyle": "Выбрать стиль",
|
|
45
|
+
"calloutCustomColor": "Свой цвет",
|
|
46
|
+
"blockquote": "Цитата",
|
|
47
|
+
"codeBlock": "Блок кода",
|
|
48
|
+
"customQuote": "Расширенная цитата",
|
|
49
|
+
"horizontalRule": "Разделитель",
|
|
50
|
+
"mythReality": "Миф/Реальность",
|
|
51
|
+
"prompt": "Промпт"
|
|
52
|
+
},
|
|
53
|
+
"mythReality": {
|
|
54
|
+
"myth": "Миф",
|
|
55
|
+
"reality": "Реальность"
|
|
56
|
+
},
|
|
57
|
+
"customQuote": {
|
|
58
|
+
"textPlaceholder": "Введите текст цитаты…",
|
|
59
|
+
"authorPlaceholder": "Введите имя автора…",
|
|
60
|
+
"signPlaceholder": "Укажите роль или источник…"
|
|
61
|
+
},
|
|
62
|
+
"prompt": {
|
|
63
|
+
"headerPlaceholder": "Введите заголовок…",
|
|
64
|
+
"contentPlaceholder": "Введите промпт…"
|
|
65
|
+
},
|
|
66
|
+
"codeBlock": {
|
|
67
|
+
"selectLanguage": "Выберите язык",
|
|
68
|
+
"copyCode": "Копировать код",
|
|
69
|
+
"copied": "Скопировано!"
|
|
70
|
+
},
|
|
71
|
+
"textFormatting": {
|
|
72
|
+
"superscript": "Верхний индекс",
|
|
73
|
+
"subscript": "Нижний индекс",
|
|
74
|
+
"bold": "Жирный",
|
|
75
|
+
"italic": "Курсив",
|
|
76
|
+
"underline": "Подчеркивание",
|
|
77
|
+
"strikethrough": "Перечеркивание",
|
|
78
|
+
"clearFormatting": "Очистить форматирование",
|
|
79
|
+
"textColor": "Цвет текста",
|
|
80
|
+
"highlightColor": "Цвет выделения",
|
|
81
|
+
"copyableText": "Копируемый текст"
|
|
82
|
+
},
|
|
83
|
+
"alignment": {
|
|
84
|
+
"alignLeft": "Выравниваение слева",
|
|
85
|
+
"alignCenter": "Выравнивание по центру",
|
|
86
|
+
"alignRight": "Выравнивание справа"
|
|
87
|
+
},
|
|
88
|
+
"table": {
|
|
89
|
+
"table": "Таблица",
|
|
90
|
+
"insertRowBefore": "Вставить строку выше",
|
|
91
|
+
"insertRowAfter": "Вставить строку ниже",
|
|
92
|
+
"deleteRow": "Удалить строку",
|
|
93
|
+
"insertColumnBefore": "Вставить столбец слева",
|
|
94
|
+
"insertColumnAfter": "Вставить столбец справа",
|
|
95
|
+
"deleteColumn": "Удалить столбец",
|
|
96
|
+
"toggleHeaderRow": "Строка заголовок",
|
|
97
|
+
"toggleHeaderColumn": "Столбец заголовок",
|
|
98
|
+
"mergeCells": "Объединить ячейки",
|
|
99
|
+
"splitCell": "Разделить ячейку"
|
|
100
|
+
},
|
|
101
|
+
"imageUpload": {
|
|
102
|
+
"dragActive": "Отпустите файл здесь",
|
|
103
|
+
"dragInactive": "Перетащите файл или кликните, чтобы выбрать"
|
|
104
|
+
},
|
|
105
|
+
"imageDialog": {
|
|
106
|
+
"addTitle": "Добавление картинки",
|
|
107
|
+
"editTitle": "Редактирование изображения",
|
|
108
|
+
"captionLabel": "Подпись к изображению",
|
|
109
|
+
"captionPlaceholder": "Описание под изображением...",
|
|
110
|
+
"save": "Сохранить",
|
|
111
|
+
"add": "Добавить"
|
|
112
|
+
},
|
|
113
|
+
"videoUpload": {
|
|
114
|
+
"title": "Добавить видео",
|
|
115
|
+
"urlLabel": "URL видео",
|
|
116
|
+
"urlPlaceholder": "Вставьте URL видео здесь",
|
|
117
|
+
"supportedPlatforms": "Поддерживаемые платформы:",
|
|
118
|
+
"emptyUrl": "Пожалуйста, введите URL видео",
|
|
119
|
+
"unsupportedUrl": "Неподдерживаемый URL видео. Пожалуйста, проверьте URL и попробуйте снова.",
|
|
120
|
+
"validationError": "Ошибка при проверке URL видео. Пожалуйста, попробуйте снова.",
|
|
121
|
+
"add": "Добавить видео",
|
|
122
|
+
"cancel": "Отменить",
|
|
123
|
+
"validating": "Проверка..."
|
|
124
|
+
},
|
|
125
|
+
"katex": {
|
|
126
|
+
"addTitle": "Добавить формулу KaTeX",
|
|
127
|
+
"editTitle": "Редактировать формулу KaTeX",
|
|
128
|
+
"description": "Введите математическое выражение в формате KaTeX. Смотрите",
|
|
129
|
+
"documentationLink": "документацию KaTeX",
|
|
130
|
+
"documentationLinkSuffix": "для справки по синтаксису.",
|
|
131
|
+
"label": "Математическое выражение",
|
|
132
|
+
"placeholder": "например, x = \\frac{-b \\pm \\sqrt{b^2 - 4ac}}{2a}",
|
|
133
|
+
"add": "Добавить формулу",
|
|
134
|
+
"update": "Обновить формулу"
|
|
135
|
+
},
|
|
136
|
+
"floatingMenu": {
|
|
137
|
+
"addCustomQuote": "Добавить расширенную цитату",
|
|
138
|
+
"addMythReality": "Добавить блок Миф/Реальность",
|
|
139
|
+
"addPrompt": "Добавить промпт",
|
|
140
|
+
"addSuccessCallout": "Добавить коллаут (успех)",
|
|
141
|
+
"addInfoCallout": "Добавить коллаут (инфо)",
|
|
142
|
+
"addWarningCallout": "Добавить коллаут (идея)",
|
|
143
|
+
"addErrorCallout": "Добавить коллаут (ошибка)"
|
|
144
|
+
},
|
|
145
|
+
"editor": {
|
|
146
|
+
"commandMenuPlaceholder": "Нажмите \"/\" для вызова команд...",
|
|
147
|
+
"detailsSummaryPlaceholder": "Заголовок...",
|
|
148
|
+
"emojiSearchPlaceholder": "Поиск...",
|
|
149
|
+
"noCommandsFound": "Команды не найдены"
|
|
150
|
+
},
|
|
151
|
+
"characterCount": {
|
|
152
|
+
"characters": ["символ", "символа", "символов"],
|
|
153
|
+
"words": ["слово", "слова", "слов"]
|
|
154
|
+
},
|
|
155
|
+
"common": {
|
|
156
|
+
"cancel": "Отменить"
|
|
157
|
+
}
|
|
158
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface ImageUploadResult {
|
|
2
|
+
fileId?: string;
|
|
3
|
+
fileUrl?: string;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface ImageUploadHandler {
|
|
7
|
+
(file: File): Promise<ImageUploadResult>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface ImageGetHandler {
|
|
11
|
+
(fileId: string): string | null;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface ImageHandlers {
|
|
15
|
+
upload: ImageUploadHandler;
|
|
16
|
+
getImage?: ImageGetHandler;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface FigureAttrs {
|
|
20
|
+
fileId?: string;
|
|
21
|
+
src?: string;
|
|
22
|
+
alt?: string;
|
|
23
|
+
title?: string;
|
|
24
|
+
caption?: string;
|
|
25
|
+
width?: number | null;
|
|
26
|
+
height?: number | null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface TiptapImageAttrs extends FigureAttrs {}
|
|
30
|
+
|
|
31
|
+
export interface ImageDialogConfig {
|
|
32
|
+
onUpload: ImageUploadHandler;
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './image-handler';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export const copyToClipboard = (text: string): Promise<void> => {
|
|
2
|
+
if (navigator.clipboard && window.isSecureContext) {
|
|
3
|
+
return navigator.clipboard.writeText(text);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
return new Promise((resolve, reject) => {
|
|
7
|
+
const textarea = document.createElement("textarea");
|
|
8
|
+
textarea.value = text;
|
|
9
|
+
textarea.style.position = "fixed";
|
|
10
|
+
textarea.style.opacity = "0";
|
|
11
|
+
document.body.appendChild(textarea);
|
|
12
|
+
|
|
13
|
+
try {
|
|
14
|
+
textarea.select();
|
|
15
|
+
document.execCommand("copy");
|
|
16
|
+
resolve();
|
|
17
|
+
} catch (error) {
|
|
18
|
+
reject(error);
|
|
19
|
+
} finally {
|
|
20
|
+
document.body.removeChild(textarea);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
};
|