@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.
Files changed (209) hide show
  1. package/README.md +102 -0
  2. package/dist/editor.css +2069 -0
  3. package/dist/editor.css.map +1 -0
  4. package/dist/editor.d.mts +45 -0
  5. package/dist/editor.d.ts +45 -0
  6. package/dist/editor.js +6155 -0
  7. package/dist/editor.js.map +1 -0
  8. package/dist/editor.mjs +6118 -0
  9. package/dist/editor.mjs.map +1 -0
  10. package/dist/render/client.d.mts +24 -0
  11. package/dist/render/client.d.ts +24 -0
  12. package/dist/render/client.js +98 -0
  13. package/dist/render/client.js.map +1 -0
  14. package/dist/render/client.mjs +74 -0
  15. package/dist/render/client.mjs.map +1 -0
  16. package/dist/render.d.mts +58 -0
  17. package/dist/render.d.ts +58 -0
  18. package/dist/render.js +2521 -0
  19. package/dist/render.js.map +1 -0
  20. package/dist/render.mjs +2484 -0
  21. package/dist/render.mjs.map +1 -0
  22. package/dist/styles/index.css +2068 -0
  23. package/package.json +92 -0
  24. package/src/editor/commands/items.ts +374 -0
  25. package/src/editor/commands/suggestion.tsx +146 -0
  26. package/src/editor/components/button/button.css +56 -0
  27. package/src/editor/components/button/button.tsx +35 -0
  28. package/src/editor/components/button/index.ts +1 -0
  29. package/src/editor/components/common-modal/common-modal.css +85 -0
  30. package/src/editor/components/common-modal/common-modal.tsx +58 -0
  31. package/src/editor/components/common-modal/index.ts +1 -0
  32. package/src/editor/components/index.ts +3 -0
  33. package/src/editor/components/input/index.ts +1 -0
  34. package/src/editor/components/input/input.css +43 -0
  35. package/src/editor/components/input/input.tsx +22 -0
  36. package/src/editor/context/dialog-command.tsx +47 -0
  37. package/src/editor/context/index.ts +2 -0
  38. package/src/editor/context/translations-context.tsx +28 -0
  39. package/src/editor/controls/bubble-menu-content.tsx +394 -0
  40. package/src/editor/controls/callout-menu.tsx +169 -0
  41. package/src/editor/controls/character-count.tsx +36 -0
  42. package/src/editor/controls/commands-list.tsx +117 -0
  43. package/src/editor/controls/drag-handle.tsx +98 -0
  44. package/src/editor/controls/emoji-picker.tsx +62 -0
  45. package/src/editor/controls/index.ts +5 -0
  46. package/src/editor/controls/table-menu.tsx +322 -0
  47. package/src/editor/dialogs/add-katex-dialog/add-katex-dialog.css +115 -0
  48. package/src/editor/dialogs/add-katex-dialog/add-katex-dialog.tsx +116 -0
  49. package/src/editor/dialogs/add-katex-dialog/index.ts +1 -0
  50. package/src/editor/dialogs/add-link-dialog/add-link-dialog.css +105 -0
  51. package/src/editor/dialogs/add-link-dialog/add-link-dialog.tsx +177 -0
  52. package/src/editor/dialogs/add-link-dialog/index.ts +1 -0
  53. package/src/editor/dialogs/add-video-dialog/add-video-dialog.css +146 -0
  54. package/src/editor/dialogs/add-video-dialog/add-video-dialog.tsx +157 -0
  55. package/src/editor/dialogs/add-video-dialog/index.ts +1 -0
  56. package/src/editor/dialogs/image-dialog/image-dialog.css +101 -0
  57. package/src/editor/dialogs/image-dialog/image-dialog.tsx +276 -0
  58. package/src/editor/dialogs/image-dialog/index.ts +1 -0
  59. package/src/editor/dialogs/index.ts +4 -0
  60. package/src/editor/editor.tsx +247 -0
  61. package/src/editor/handlers/create-image-upload-handler.ts +24 -0
  62. package/src/editor/handlers/dialog-handlers.ts +143 -0
  63. package/src/editor/handlers/index.ts +8 -0
  64. package/src/editor/index.ts +3 -0
  65. package/src/extensions/base/callout.ts +138 -0
  66. package/src/extensions/base/code-block.ts +24 -0
  67. package/src/extensions/base/compatibility.ts +493 -0
  68. package/src/extensions/base/copyable-text.ts +56 -0
  69. package/src/extensions/base/custom-quote.ts +174 -0
  70. package/src/extensions/base/figure.ts +141 -0
  71. package/src/extensions/base/index.ts +19 -0
  72. package/src/extensions/base/link.ts +18 -0
  73. package/src/extensions/base/myth-reality.ts +45 -0
  74. package/src/extensions/base/prompt.ts +109 -0
  75. package/src/extensions/base/video.ts +29 -0
  76. package/src/extensions/editor/callout.ts +43 -0
  77. package/src/extensions/editor/code-block.ts +9 -0
  78. package/src/extensions/editor/commands.ts +43 -0
  79. package/src/extensions/editor/copyable-text.ts +16 -0
  80. package/src/extensions/editor/custom-quote.ts +54 -0
  81. package/src/extensions/editor/figure.ts +20 -0
  82. package/src/extensions/editor/get-editor-extensions.ts +113 -0
  83. package/src/extensions/editor/index.ts +25 -0
  84. package/src/extensions/editor/prompt.ts +43 -0
  85. package/src/extensions/editor/video.ts +23 -0
  86. package/src/extensions/render/get-render-extensions.ts +74 -0
  87. package/src/extensions/render/index.ts +6 -0
  88. package/src/extensions/views/components/callout.tsx +70 -0
  89. package/src/extensions/views/components/code-block.tsx +73 -0
  90. package/src/extensions/views/components/copy-button.tsx +52 -0
  91. package/src/extensions/views/components/copyable-text.tsx +11 -0
  92. package/src/extensions/views/components/custom-quote.tsx +64 -0
  93. package/src/extensions/views/components/figure.tsx +63 -0
  94. package/src/extensions/views/components/index.ts +7 -0
  95. package/src/extensions/views/components/prompt.tsx +43 -0
  96. package/src/extensions/views/components/video.tsx +40 -0
  97. package/src/extensions/views/node-views/callout.tsx +51 -0
  98. package/src/extensions/views/node-views/code-block.tsx +30 -0
  99. package/src/extensions/views/node-views/copyable-text.tsx +10 -0
  100. package/src/extensions/views/node-views/custom-quote.tsx +66 -0
  101. package/src/extensions/views/node-views/figure.tsx +38 -0
  102. package/src/extensions/views/node-views/index.ts +7 -0
  103. package/src/extensions/views/node-views/prompt.tsx +35 -0
  104. package/src/extensions/views/node-views/video.tsx +19 -0
  105. package/src/icons/Check.tsx +12 -0
  106. package/src/icons/Copy.tsx +15 -0
  107. package/src/icons/DragIcon.tsx +10 -0
  108. package/src/icons/Edit.tsx +12 -0
  109. package/src/icons/Quote.tsx +10 -0
  110. package/src/icons/X.tsx +13 -0
  111. package/src/icons/color/TiptapCalloutError.tsx +25 -0
  112. package/src/icons/color/TiptapCalloutInfo.tsx +18 -0
  113. package/src/icons/color/TiptapCalloutSuccess.tsx +49 -0
  114. package/src/icons/color/TiptapCalloutWarning.tsx +28 -0
  115. package/src/icons/color/index.ts +4 -0
  116. package/src/icons/index.ts +60 -0
  117. package/src/icons/menu/AddImage.tsx +10 -0
  118. package/src/icons/menu/AlignCenter.tsx +10 -0
  119. package/src/icons/menu/AlignLeft.tsx +10 -0
  120. package/src/icons/menu/AlignRight.tsx +10 -0
  121. package/src/icons/menu/ArrowDown.tsx +13 -0
  122. package/src/icons/menu/ArrowLeft.tsx +13 -0
  123. package/src/icons/menu/ArrowRight.tsx +13 -0
  124. package/src/icons/menu/ArrowUp.tsx +13 -0
  125. package/src/icons/menu/Blockquote.tsx +7 -0
  126. package/src/icons/menu/Bold.tsx +10 -0
  127. package/src/icons/menu/BulletList.tsx +10 -0
  128. package/src/icons/menu/CalloutError.tsx +10 -0
  129. package/src/icons/menu/CalloutInfo.tsx +12 -0
  130. package/src/icons/menu/CalloutSuccess.tsx +10 -0
  131. package/src/icons/menu/CalloutWarning.tsx +12 -0
  132. package/src/icons/menu/ClearFormatting.tsx +10 -0
  133. package/src/icons/menu/Code.tsx +10 -0
  134. package/src/icons/menu/CodeBlock.tsx +10 -0
  135. package/src/icons/menu/Copyable.tsx +10 -0
  136. package/src/icons/menu/CustomQuote.tsx +17 -0
  137. package/src/icons/menu/DeleteColumn.tsx +17 -0
  138. package/src/icons/menu/DeleteRow.tsx +17 -0
  139. package/src/icons/menu/Details.tsx +10 -0
  140. package/src/icons/menu/H2.tsx +10 -0
  141. package/src/icons/menu/H3.tsx +10 -0
  142. package/src/icons/menu/H4.tsx +10 -0
  143. package/src/icons/menu/H5.tsx +10 -0
  144. package/src/icons/menu/H6.tsx +10 -0
  145. package/src/icons/menu/Highlight.tsx +13 -0
  146. package/src/icons/menu/HorizontalRule.tsx +7 -0
  147. package/src/icons/menu/Italic.tsx +10 -0
  148. package/src/icons/menu/Link.tsx +10 -0
  149. package/src/icons/menu/LinkOff.tsx +10 -0
  150. package/src/icons/menu/Math.tsx +10 -0
  151. package/src/icons/menu/MergeCells.tsx +10 -0
  152. package/src/icons/menu/MythReality.tsx +10 -0
  153. package/src/icons/menu/OrderedList.tsx +10 -0
  154. package/src/icons/menu/Prompt.tsx +18 -0
  155. package/src/icons/menu/Redo.tsx +14 -0
  156. package/src/icons/menu/SplitCells.tsx +7 -0
  157. package/src/icons/menu/Strikethrough.tsx +10 -0
  158. package/src/icons/menu/Subscript.tsx +10 -0
  159. package/src/icons/menu/Superscript.tsx +10 -0
  160. package/src/icons/menu/Table.tsx +14 -0
  161. package/src/icons/menu/TableColumnHeading.tsx +7 -0
  162. package/src/icons/menu/TableRowHeading.tsx +10 -0
  163. package/src/icons/menu/TextColor.tsx +13 -0
  164. package/src/icons/menu/Underline.tsx +10 -0
  165. package/src/icons/menu/Undo.tsx +14 -0
  166. package/src/icons/menu/Video.tsx +14 -0
  167. package/src/icons/menu/index.ts +49 -0
  168. package/src/render/index.ts +22 -0
  169. package/src/render/static-renderer-config.tsx +206 -0
  170. package/src/render/tiptap-interactivity-provider.tsx +78 -0
  171. package/src/render/tiptap-render.tsx +102 -0
  172. package/src/styles/components.css +10 -0
  173. package/src/styles/editor/base.css +39 -0
  174. package/src/styles/editor/callout-menu.css +81 -0
  175. package/src/styles/editor/controls.css +57 -0
  176. package/src/styles/editor/emoji-picker.css +113 -0
  177. package/src/styles/editor/index.css +9 -0
  178. package/src/styles/editor/menus.css +16 -0
  179. package/src/styles/editor/states.css +43 -0
  180. package/src/styles/editor/typography.css +165 -0
  181. package/src/styles/editor/utilities.css +71 -0
  182. package/src/styles/editor/variables.css +70 -0
  183. package/src/styles/extensions/callout.css +155 -0
  184. package/src/styles/extensions/code-block.css +109 -0
  185. package/src/styles/extensions/commands-list.css +83 -0
  186. package/src/styles/extensions/custom-quote.css +103 -0
  187. package/src/styles/extensions/details.css +87 -0
  188. package/src/styles/extensions/figure.css +66 -0
  189. package/src/styles/extensions/index.css +11 -0
  190. package/src/styles/extensions/math.css +32 -0
  191. package/src/styles/extensions/myth-reality.css +59 -0
  192. package/src/styles/extensions/prompt.css +75 -0
  193. package/src/styles/extensions/table.css +253 -0
  194. package/src/styles/extensions/video.css +53 -0
  195. package/src/styles/styles.css +3 -0
  196. package/src/translations/en.json +158 -0
  197. package/src/translations/ru.json +158 -0
  198. package/src/types/image-handler.ts +33 -0
  199. package/src/types/index.ts +1 -0
  200. package/src/utils/copy-to-clipboard.ts +23 -0
  201. package/src/utils/custom-emoji.ts +174 -0
  202. package/src/utils/detect-video-hosting.ts +106 -0
  203. package/src/utils/get-shared-extensions.ts +45 -0
  204. package/src/utils/get-translations.ts +25 -0
  205. package/src/utils/handle-exit-node.ts +61 -0
  206. package/src/utils/image-src-resolver.ts +74 -0
  207. package/src/utils/index.ts +2 -0
  208. package/src/utils/migrate-legacy-callouts.ts +59 -0
  209. package/src/utils/pluralize.ts +38 -0
package/dist/render.js ADDED
@@ -0,0 +1,2521 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/render/index.ts
31
+ var render_exports = {};
32
+ __export(render_exports, {
33
+ TiptapRender: () => TiptapRender
34
+ });
35
+ module.exports = __toCommonJS(render_exports);
36
+
37
+ // src/render/tiptap-render.tsx
38
+ var import_react2 = require("@tiptap/static-renderer/pm/react");
39
+
40
+ // src/extensions/render/get-render-extensions.ts
41
+ var import_extension_mathematics = require("@tiptap/extension-mathematics");
42
+ var import_extension_table = require("@tiptap/extension-table");
43
+
44
+ // src/utils/handle-exit-node.ts
45
+ var import_state = require("@tiptap/pm/state");
46
+ function handleExitNode(editor, nodeName) {
47
+ const { view, schema } = editor;
48
+ const { state } = view;
49
+ const { selection } = state;
50
+ const $pos = selection.$from;
51
+ const currentNode = $pos.node();
52
+ let depth = $pos.depth;
53
+ let isInsideTargetNode = false;
54
+ let targetNodeDepth = 0;
55
+ while (depth > 0) {
56
+ const parentNode = $pos.node(depth);
57
+ if (parentNode.type.name === nodeName) {
58
+ isInsideTargetNode = true;
59
+ targetNodeDepth = depth;
60
+ break;
61
+ }
62
+ depth--;
63
+ }
64
+ const isCurrentNodeEmptyParagraph = currentNode.type.name === "paragraph" && currentNode.content.size === 0;
65
+ if (!isInsideTargetNode || !isCurrentNodeEmptyParagraph) {
66
+ return false;
67
+ }
68
+ const { tr } = state;
69
+ const posAfterTargetNode = $pos.after(targetNodeDepth);
70
+ const targetNode = $pos.node(targetNodeDepth);
71
+ let newPosAfterTargetNode = posAfterTargetNode;
72
+ if (targetNode.childCount > 1) {
73
+ const emptyParagraphStart = $pos.before();
74
+ const emptyParagraphEnd = $pos.after();
75
+ const deletionLength = emptyParagraphEnd - emptyParagraphStart;
76
+ tr.delete(emptyParagraphStart, emptyParagraphEnd);
77
+ newPosAfterTargetNode = posAfterTargetNode - deletionLength;
78
+ }
79
+ const paragraphNode = schema.nodes.paragraph.createAndFill();
80
+ if (!paragraphNode) return false;
81
+ tr.insert(newPosAfterTargetNode, paragraphNode);
82
+ tr.setSelection(import_state.TextSelection.create(tr.doc, newPosAfterTargetNode + 1));
83
+ view.dispatch(tr);
84
+ return true;
85
+ }
86
+
87
+ // src/utils/migrate-legacy-callouts.ts
88
+ var legacyTypeMap = {
89
+ question: "info",
90
+ idea: "warning",
91
+ info: "success",
92
+ error: "error"
93
+ };
94
+ function migrateLegacyCallouts(editor) {
95
+ const { doc, schema } = editor.state;
96
+ const calloutsToMigrate = [];
97
+ doc.descendants((node, pos) => {
98
+ if (node.type.name === "callout" && node.attrs.calloutType) {
99
+ calloutsToMigrate.push({ node, pos });
100
+ }
101
+ });
102
+ if (calloutsToMigrate.length === 0) return;
103
+ const tr = editor.state.tr;
104
+ calloutsToMigrate.sort((a, b) => b.pos - a.pos);
105
+ for (const { node, pos } of calloutsToMigrate) {
106
+ const oldType = node.attrs.calloutType;
107
+ const newType = legacyTypeMap[oldType] || oldType;
108
+ const hasInlineContent = node.content.size > 0 && !node.firstChild?.isBlock;
109
+ if (hasInlineContent) {
110
+ const paragraph = schema.nodes.paragraph?.create(null, node.content);
111
+ const newContent = paragraph ? [paragraph] : [];
112
+ tr.replaceRangeWith(
113
+ pos,
114
+ pos + node.nodeSize,
115
+ schema.nodes.callout.create(
116
+ {
117
+ type: newType,
118
+ calloutType: null,
119
+ callout: null
120
+ },
121
+ newContent
122
+ )
123
+ );
124
+ } else {
125
+ tr.setNodeMarkup(pos, void 0, {
126
+ ...node.attrs,
127
+ type: newType,
128
+ calloutType: null,
129
+ callout: null
130
+ });
131
+ }
132
+ }
133
+ editor.view.dispatch(tr);
134
+ }
135
+
136
+ // src/extensions/base/callout.ts
137
+ var import_core = require("@tiptap/core");
138
+ var legacyTypeMap2 = {
139
+ question: "info",
140
+ idea: "warning",
141
+ info: "success",
142
+ error: "error"
143
+ };
144
+ var BaseCallout = import_core.Node.create({
145
+ name: "callout",
146
+ group: "block",
147
+ content: "block+",
148
+ draggable: true,
149
+ isolating: true,
150
+ addAttributes() {
151
+ return {
152
+ type: {
153
+ default: "info",
154
+ parseHTML: (element) => {
155
+ if (typeof element === "string") return "info";
156
+ const dataCallout = element.getAttribute("data-callout");
157
+ if (dataCallout) {
158
+ return dataCallout;
159
+ }
160
+ const legacyType = element.getAttribute("calloutType");
161
+ if (legacyType) {
162
+ return legacyTypeMap2[legacyType];
163
+ }
164
+ if (element.classList) {
165
+ if (element.classList.contains("callout--error")) return "error";
166
+ if (element.classList.contains("callout--question")) return "info";
167
+ if (element.classList.contains("callout--idea")) return "warning";
168
+ if (element.classList.contains("callout--info")) return "success";
169
+ }
170
+ return "info";
171
+ },
172
+ renderHTML: (attributes) => {
173
+ return {
174
+ "data-callout": attributes.type
175
+ };
176
+ }
177
+ },
178
+ bgColor: {
179
+ default: null,
180
+ parseHTML: (element) => {
181
+ if (typeof element === "string") return null;
182
+ return element.getAttribute("data-bg-color");
183
+ },
184
+ renderHTML: (attributes) => {
185
+ if (!attributes.bgColor) return {};
186
+ return {
187
+ "data-bg-color": attributes.bgColor
188
+ };
189
+ }
190
+ },
191
+ emoji: {
192
+ default: null,
193
+ parseHTML: (element) => {
194
+ if (typeof element === "string") return null;
195
+ return element.getAttribute("data-emoji");
196
+ },
197
+ renderHTML: (attributes) => {
198
+ if (!attributes.emoji) return {};
199
+ return {
200
+ "data-emoji": attributes.emoji
201
+ };
202
+ }
203
+ },
204
+ calloutType: {
205
+ default: null,
206
+ parseHTML: (element) => element.getAttribute("calloutType"),
207
+ renderHTML: () => ({})
208
+ },
209
+ callout: {
210
+ default: null,
211
+ parseHTML: (element) => element.getAttribute("callout"),
212
+ renderHTML: () => ({})
213
+ }
214
+ };
215
+ },
216
+ onCreate() {
217
+ migrateLegacyCallouts(this.editor);
218
+ },
219
+ addKeyboardShortcuts() {
220
+ return {
221
+ Enter: () => handleExitNode(this.editor, this.name)
222
+ };
223
+ },
224
+ parseHTML() {
225
+ return [
226
+ {
227
+ tag: "div[data-callout]"
228
+ },
229
+ {
230
+ tag: "callout",
231
+ priority: 51
232
+ },
233
+ {
234
+ tag: "div",
235
+ priority: 50,
236
+ getAttrs: (element) => {
237
+ if (typeof element === "string") return false;
238
+ if (element.classList.contains("callout") || element.classList.contains("callout--error") || element.classList.contains("callout--question") || element.classList.contains("callout--idea") || element.classList.contains("callout--info")) {
239
+ return {};
240
+ }
241
+ return false;
242
+ }
243
+ }
244
+ ];
245
+ },
246
+ renderHTML({ HTMLAttributes }) {
247
+ return ["div", (0, import_core.mergeAttributes)(HTMLAttributes), 0];
248
+ }
249
+ });
250
+
251
+ // src/extensions/base/code-block.ts
252
+ var import_extension_code_block_lowlight = require("@tiptap/extension-code-block-lowlight");
253
+ var import_xml = __toESM(require("highlight.js/lib/languages/xml"));
254
+ var import_lowlight = require("lowlight");
255
+ var lowlight = (0, import_lowlight.createLowlight)(import_lowlight.common);
256
+ lowlight.register("html", import_xml.default);
257
+ var BaseCodeBlock = import_extension_code_block_lowlight.CodeBlockLowlight.configure({
258
+ lowlight
259
+ }).extend({
260
+ selectable: false,
261
+ draggable: true,
262
+ addAttributes() {
263
+ return {
264
+ language: {
265
+ default: null,
266
+ parseHTML: (element) => {
267
+ return element.querySelector("code")?.getAttribute("data-language") || "bash";
268
+ }
269
+ }
270
+ };
271
+ }
272
+ });
273
+
274
+ // src/extensions/base/copyable-text.ts
275
+ var import_core2 = require("@tiptap/core");
276
+ var CopyableText = import_core2.Mark.create({
277
+ name: "copyable-text",
278
+ addOptions() {
279
+ return {
280
+ HTMLAttributes: {
281
+ class: "copyable"
282
+ }
283
+ };
284
+ },
285
+ parseHTML() {
286
+ return [
287
+ {
288
+ tag: "span",
289
+ getAttrs: (element) => element.classList.contains("copyable") ? {} : false
290
+ }
291
+ ];
292
+ },
293
+ renderHTML({ HTMLAttributes }) {
294
+ return ["span", (0, import_core2.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
295
+ },
296
+ addCommands() {
297
+ return {
298
+ setCopyable: (attributes) => ({ commands }) => {
299
+ return commands.setMark(this.name, attributes);
300
+ },
301
+ toggleCopyable: (attributes) => ({ commands }) => {
302
+ return commands.toggleMark(this.name, attributes);
303
+ },
304
+ unsetCopyable: () => ({ commands }) => {
305
+ return commands.unsetMark(this.name);
306
+ }
307
+ };
308
+ }
309
+ });
310
+
311
+ // src/extensions/base/custom-quote.ts
312
+ var import_core3 = require("@tiptap/core");
313
+ var import_state2 = require("@tiptap/pm/state");
314
+ var BaseCustomQuote = import_core3.Node.create({
315
+ name: "customQuote",
316
+ group: "block",
317
+ content: "customQuoteText customQuoteAuthor customQuoteSign",
318
+ selectable: false,
319
+ draggable: true,
320
+ isolating: true,
321
+ addKeyboardShortcuts() {
322
+ return {
323
+ Enter: () => {
324
+ const { view, schema } = this.editor;
325
+ const { state } = view;
326
+ const { selection } = state;
327
+ const $pos = selection.$from;
328
+ let depth = $pos.depth;
329
+ let isInsideCustomQuote = false;
330
+ while (depth > 0) {
331
+ const parentNode = $pos.node(depth);
332
+ if (parentNode.type.name === this.name) {
333
+ isInsideCustomQuote = true;
334
+ break;
335
+ }
336
+ depth--;
337
+ }
338
+ if (!isInsideCustomQuote) {
339
+ return false;
340
+ }
341
+ const { tr } = state;
342
+ const posAfter = $pos.after(depth);
343
+ const paragraphNode = schema.nodes.paragraph.createAndFill();
344
+ if (!paragraphNode) return false;
345
+ tr.insert(posAfter, paragraphNode);
346
+ tr.setSelection(import_state2.TextSelection.create(tr.doc, posAfter + 1));
347
+ view.dispatch(tr);
348
+ return true;
349
+ }
350
+ };
351
+ },
352
+ parseHTML() {
353
+ return [
354
+ {
355
+ tag: "div[data-custom-quote]"
356
+ }
357
+ ];
358
+ },
359
+ renderHTML({ HTMLAttributes }) {
360
+ return ["div", (0, import_core3.mergeAttributes)(HTMLAttributes, { "data-custom-quote": "" }), 0];
361
+ }
362
+ });
363
+ var BaseCustomQuoteText = import_core3.Node.create({
364
+ name: "customQuoteText",
365
+ group: "block",
366
+ content: "inline*",
367
+ draggable: false,
368
+ selectable: true,
369
+ addAttributes() {
370
+ return {
371
+ open: {
372
+ default: true
373
+ }
374
+ };
375
+ },
376
+ addKeyboardShortcuts() {
377
+ return {
378
+ Enter: () => {
379
+ const { view, state } = this.editor;
380
+ const { tr, selection } = state;
381
+ const { $from } = selection;
382
+ if ($from.parent.type.name !== "customQuoteText") {
383
+ return false;
384
+ }
385
+ const posAfter = $from.after();
386
+ const nextNode = state.doc.nodeAt(posAfter);
387
+ if (!nextNode || nextNode.type.name !== "customQuoteAuthor") return false;
388
+ const nextNodeEnd = posAfter + nextNode.nodeSize - 1;
389
+ tr.setSelection(import_state2.TextSelection.create(tr.doc, nextNodeEnd));
390
+ view.dispatch(tr);
391
+ return true;
392
+ }
393
+ };
394
+ },
395
+ parseHTML() {
396
+ return [
397
+ {
398
+ tag: "div[data-custom-quote-text]"
399
+ }
400
+ ];
401
+ },
402
+ renderHTML({ HTMLAttributes }) {
403
+ return ["div", (0, import_core3.mergeAttributes)(HTMLAttributes, { "data-custom-quote-text": "" }), 0];
404
+ }
405
+ });
406
+ var BaseCustomQuoteAuthor = import_core3.Node.create({
407
+ name: "customQuoteAuthor",
408
+ group: "block",
409
+ content: "inline*",
410
+ selectable: true,
411
+ addKeyboardShortcuts() {
412
+ return {
413
+ Enter: () => {
414
+ const { view, state } = this.editor;
415
+ const { tr, selection } = state;
416
+ const { $from } = selection;
417
+ if ($from.parent.type.name !== "customQuoteAuthor") {
418
+ return false;
419
+ }
420
+ const posAfter = $from.after();
421
+ const nextNode = state.doc.nodeAt(posAfter);
422
+ if (!nextNode || nextNode.type.name !== "customQuoteSign") return false;
423
+ const nextNodeEnd = posAfter + nextNode.nodeSize - 1;
424
+ tr.setSelection(import_state2.TextSelection.create(tr.doc, nextNodeEnd));
425
+ view.dispatch(tr);
426
+ return true;
427
+ }
428
+ };
429
+ },
430
+ parseHTML() {
431
+ return [
432
+ {
433
+ tag: "div[data-custom-quote-author]"
434
+ }
435
+ ];
436
+ },
437
+ renderHTML({ HTMLAttributes }) {
438
+ return ["div", (0, import_core3.mergeAttributes)(HTMLAttributes, { "data-custom-quote-author": "" }), 0];
439
+ }
440
+ });
441
+ var BaseCustomQuoteSign = import_core3.Node.create({
442
+ name: "customQuoteSign",
443
+ group: "block",
444
+ content: "inline*",
445
+ selectable: true,
446
+ parseHTML() {
447
+ return [
448
+ {
449
+ tag: "div[data-custom-quote-sign]"
450
+ }
451
+ ];
452
+ },
453
+ renderHTML({ HTMLAttributes }) {
454
+ return ["div", (0, import_core3.mergeAttributes)(HTMLAttributes, { "data-custom-quote-sign": "" }), 0];
455
+ }
456
+ });
457
+
458
+ // src/extensions/base/link.ts
459
+ var import_extension_link = __toESM(require("@tiptap/extension-link"));
460
+ var LinkExtension = import_extension_link.default.extend({
461
+ addOptions() {
462
+ return {
463
+ ...this.parent?.(),
464
+ openOnClick: false,
465
+ linkOnPaste: true,
466
+ autolink: true,
467
+ protocols: ["http", "https", "mailto", "tel"]
468
+ };
469
+ }
470
+ }).configure({
471
+ openOnClick: false,
472
+ linkOnPaste: true,
473
+ autolink: true,
474
+ protocols: ["http", "https", "mailto", "tel"]
475
+ });
476
+
477
+ // src/extensions/base/myth-reality.ts
478
+ var import_core4 = require("@tiptap/core");
479
+ var BaseMythRealityBlock = import_core4.Node.create({
480
+ name: "mythRealityBlock",
481
+ group: "block",
482
+ content: "block+",
483
+ parseHTML() {
484
+ return [{ tag: "div[data-myth-reality-block]" }];
485
+ },
486
+ renderHTML({ HTMLAttributes }) {
487
+ return [
488
+ "div",
489
+ (0, import_core4.mergeAttributes)(HTMLAttributes, { "data-myth-reality-block": "" }),
490
+ ["div", { class: "myth-reality-block-content" }, 0]
491
+ ];
492
+ }
493
+ });
494
+ var BaseMythReality = import_core4.Node.create({
495
+ name: "mythReality",
496
+ group: "block",
497
+ content: "(mythRealityBlock) (mythRealityBlock)",
498
+ draggable: true,
499
+ isolating: true,
500
+ parseHTML() {
501
+ return [{ tag: "div[data-myth-reality]" }];
502
+ },
503
+ renderHTML({ HTMLAttributes }) {
504
+ return ["div", (0, import_core4.mergeAttributes)(HTMLAttributes, { "data-myth-reality": "" }), 0];
505
+ },
506
+ addKeyboardShortcuts() {
507
+ return {
508
+ Enter: () => handleExitNode(this.editor, this.name)
509
+ };
510
+ }
511
+ });
512
+
513
+ // src/extensions/base/prompt.ts
514
+ var import_core5 = require("@tiptap/core");
515
+ var import_state3 = require("@tiptap/pm/state");
516
+ var BasePrompt = import_core5.Node.create({
517
+ name: "prompt",
518
+ group: "block",
519
+ content: "(promptHeader | promptV2Header) (promptContent | promptV2Content)",
520
+ selectable: false,
521
+ draggable: true,
522
+ addKeyboardShortcuts() {
523
+ return {
524
+ Enter: () => {
525
+ const { view, schema } = this.editor;
526
+ const { state } = view;
527
+ const { selection } = state;
528
+ const $pos = selection.$from;
529
+ let depth = $pos.depth;
530
+ let isInsidePrompt = false;
531
+ while (depth > 0) {
532
+ const parentNode = $pos.node(depth);
533
+ if (parentNode.type.name === this.name) {
534
+ isInsidePrompt = true;
535
+ break;
536
+ }
537
+ depth--;
538
+ }
539
+ if (!isInsidePrompt) {
540
+ return false;
541
+ }
542
+ const { tr } = state;
543
+ const posAfter = $pos.after(depth);
544
+ const paragraphNode = schema.nodes.paragraph.createAndFill();
545
+ if (!paragraphNode) return false;
546
+ tr.insert(posAfter, paragraphNode);
547
+ tr.setSelection(import_state3.TextSelection.create(tr.doc, posAfter + 1));
548
+ view.dispatch(tr);
549
+ return true;
550
+ }
551
+ };
552
+ },
553
+ parseHTML() {
554
+ return [
555
+ {
556
+ tag: "div[data-prompt]"
557
+ }
558
+ ];
559
+ },
560
+ renderHTML({ HTMLAttributes }) {
561
+ return ["div", (0, import_core5.mergeAttributes)(HTMLAttributes, { "data-prompt": "" }), 0];
562
+ }
563
+ });
564
+ var BasePromptHeader = import_core5.Node.create({
565
+ name: "promptHeader",
566
+ group: "block",
567
+ content: "inline*",
568
+ selectable: true,
569
+ draggable: false,
570
+ parseHTML() {
571
+ return [
572
+ {
573
+ tag: "div[data-prompt-header]"
574
+ }
575
+ ];
576
+ },
577
+ renderHTML({ HTMLAttributes }) {
578
+ return ["div", (0, import_core5.mergeAttributes)(HTMLAttributes, { "data-prompt-header": "" }), 0];
579
+ }
580
+ // addNodeView() {
581
+ // return ReactNodeViewRenderer(PromptHeaderView);
582
+ // },
583
+ });
584
+ var BasePromptContent = import_core5.Node.create({
585
+ name: "promptContent",
586
+ group: "block",
587
+ content: "text*",
588
+ draggable: false,
589
+ selectable: true,
590
+ parseHTML() {
591
+ return [
592
+ {
593
+ tag: "div[data-prompt-content]"
594
+ }
595
+ ];
596
+ },
597
+ renderHTML({ HTMLAttributes }) {
598
+ return ["div", (0, import_core5.mergeAttributes)(HTMLAttributes, { "data-prompt-content": "" }), 0];
599
+ }
600
+ // addNodeView() {
601
+ // return ReactNodeViewRenderer(PromptContentView);
602
+ // },
603
+ });
604
+
605
+ // src/extensions/base/video.ts
606
+ var import_core6 = require("@tiptap/core");
607
+ var BaseVideo = import_core6.Node.create({
608
+ name: "video",
609
+ group: "block",
610
+ selectable: true,
611
+ draggable: true,
612
+ isolating: true,
613
+ addAttributes() {
614
+ return {
615
+ src: {
616
+ default: null
617
+ }
618
+ };
619
+ },
620
+ parseHTML() {
621
+ return [
622
+ {
623
+ tag: "video-embed"
624
+ }
625
+ ];
626
+ },
627
+ renderHTML({ HTMLAttributes }) {
628
+ return ["video-embed", HTMLAttributes];
629
+ }
630
+ });
631
+
632
+ // src/extensions/base/figure.ts
633
+ var import_core7 = require("@tiptap/core");
634
+ var import_extension_image = __toESM(require("@tiptap/extension-image"));
635
+
636
+ // src/utils/image-src-resolver.ts
637
+ function resolveImageSrc(attrs, options) {
638
+ const { fileId, src } = attrs;
639
+ const { getImageById } = options || {};
640
+ if (fileId && getImageById) {
641
+ const resolvedSrc = getImageById(fileId);
642
+ if (resolvedSrc) {
643
+ return resolvedSrc;
644
+ }
645
+ console.warn(`Failed to resolve fileId: ${fileId}`);
646
+ return "";
647
+ }
648
+ if (src) {
649
+ return src;
650
+ }
651
+ if (fileId) {
652
+ console.warn("fileId provided but no getImageById function - cannot resolve image");
653
+ return "";
654
+ }
655
+ return "";
656
+ }
657
+
658
+ // src/extensions/base/figure.ts
659
+ var BaseFigure = import_extension_image.default.extend({
660
+ name: "image",
661
+ group: "block",
662
+ content: "",
663
+ draggable: true,
664
+ isolating: true,
665
+ selectable: false,
666
+ addOptions() {
667
+ return {
668
+ HTMLAttributes: {},
669
+ getImageById: void 0,
670
+ onFigureClick: void 0
671
+ };
672
+ },
673
+ addAttributes() {
674
+ return {
675
+ ...this.parent?.(),
676
+ fileId: {
677
+ default: null,
678
+ parseHTML: (element) => {
679
+ const img = element.querySelector("img") || element;
680
+ return img.getAttribute("data-file-id") || element.getAttribute("data-file-id");
681
+ },
682
+ renderHTML: (attributes) => {
683
+ if (!attributes.fileId) return {};
684
+ return { "data-file-id": attributes.fileId };
685
+ }
686
+ },
687
+ caption: {
688
+ default: null,
689
+ parseHTML: (element) => element.querySelector("figcaption")?.textContent || null
690
+ }
691
+ };
692
+ },
693
+ parseHTML() {
694
+ return [
695
+ {
696
+ tag: "figure",
697
+ getAttrs: (element) => {
698
+ if (typeof element === "string") return false;
699
+ const img = element.querySelector("img");
700
+ return img ? {} : false;
701
+ }
702
+ },
703
+ {
704
+ tag: "img[src]",
705
+ getAttrs: (element) => {
706
+ if (typeof element === "string") return false;
707
+ return {};
708
+ }
709
+ }
710
+ ];
711
+ },
712
+ renderHTML({ node }) {
713
+ const resolvedSrc = resolveImageSrc(
714
+ {
715
+ fileId: node.attrs.fileId,
716
+ src: node.attrs.src
717
+ },
718
+ { getImageById: this.options.getImageById }
719
+ );
720
+ const figureAttrs = (0, import_core7.mergeAttributes)(this.options.HTMLAttributes);
721
+ const imgAttrs = {
722
+ src: resolvedSrc
723
+ };
724
+ if (node.attrs.fileId) imgAttrs["data-file-id"] = node.attrs.fileId;
725
+ if (node.attrs.alt) imgAttrs.alt = node.attrs.alt;
726
+ if (node.attrs.title) imgAttrs.title = node.attrs.title;
727
+ if (node.attrs.width) imgAttrs.width = node.attrs.width;
728
+ if (node.attrs.height) imgAttrs.height = node.attrs.height;
729
+ const hasCaption = node.attrs.caption && node.attrs.caption.trim().length > 0;
730
+ const figcaptionContent = hasCaption ? ["figcaption", {}, node.attrs.caption] : null;
731
+ return [
732
+ "figure",
733
+ figureAttrs,
734
+ ["img", imgAttrs],
735
+ ...figcaptionContent ? [figcaptionContent] : []
736
+ ];
737
+ },
738
+ addCommands() {
739
+ return {
740
+ ...this.parent?.(),
741
+ setFigure: (options) => ({ commands }) => {
742
+ return commands.insertContent({
743
+ type: this.name,
744
+ attrs: options
745
+ });
746
+ },
747
+ updateFigure: (options) => ({ commands }) => {
748
+ return commands.updateAttributes(this.name, options);
749
+ }
750
+ };
751
+ },
752
+ addPasteRules() {
753
+ return [
754
+ (0, import_core7.nodePasteRule)({
755
+ find: /!\[(.*?)\]\((.*?)(?:\s+"(.*?)")?\)/g,
756
+ type: this.type,
757
+ getAttributes: (match) => {
758
+ const [, alt, src, title] = match;
759
+ return { src, alt, title };
760
+ }
761
+ })
762
+ ];
763
+ }
764
+ });
765
+
766
+ // src/utils/get-shared-extensions.ts
767
+ var import_starter_kit = __toESM(require("@tiptap/starter-kit"));
768
+ var import_extension_details = require("@tiptap/extension-details");
769
+ var import_extension_highlight = __toESM(require("@tiptap/extension-highlight"));
770
+ var import_extension_subscript = __toESM(require("@tiptap/extension-subscript"));
771
+ var import_extension_superscript = __toESM(require("@tiptap/extension-superscript"));
772
+ var import_extension_text_align = __toESM(require("@tiptap/extension-text-align"));
773
+
774
+ // node_modules/@tiptap/extension-text-style/dist/index.js
775
+ var import_core8 = require("@tiptap/core");
776
+ var import_core9 = require("@tiptap/core");
777
+ var import_core10 = require("@tiptap/core");
778
+ var import_core11 = require("@tiptap/core");
779
+ var import_core12 = require("@tiptap/core");
780
+ var import_core13 = require("@tiptap/core");
781
+ var import_core14 = require("@tiptap/core");
782
+ var MAX_FIND_CHILD_SPAN_DEPTH = 20;
783
+ var findChildSpans = (element, depth = 0) => {
784
+ const childSpans = [];
785
+ if (!element.children.length || depth > MAX_FIND_CHILD_SPAN_DEPTH) {
786
+ return childSpans;
787
+ }
788
+ Array.from(element.children).forEach((child) => {
789
+ if (child.tagName === "SPAN") {
790
+ childSpans.push(child);
791
+ } else if (child.children.length) {
792
+ childSpans.push(...findChildSpans(child, depth + 1));
793
+ }
794
+ });
795
+ return childSpans;
796
+ };
797
+ var mergeNestedSpanStyles = (element) => {
798
+ if (!element.children.length) {
799
+ return;
800
+ }
801
+ const childSpans = findChildSpans(element);
802
+ if (!childSpans) {
803
+ return;
804
+ }
805
+ childSpans.forEach((childSpan) => {
806
+ var _a, _b;
807
+ const childStyle = childSpan.getAttribute("style");
808
+ const closestParentSpanStyleOfChild = (_b = (_a = childSpan.parentElement) == null ? void 0 : _a.closest("span")) == null ? void 0 : _b.getAttribute("style");
809
+ childSpan.setAttribute("style", `${closestParentSpanStyleOfChild};${childStyle}`);
810
+ });
811
+ };
812
+ var TextStyle = import_core8.Mark.create({
813
+ name: "textStyle",
814
+ priority: 101,
815
+ addOptions() {
816
+ return {
817
+ HTMLAttributes: {},
818
+ mergeNestedSpanStyles: true
819
+ };
820
+ },
821
+ parseHTML() {
822
+ return [
823
+ {
824
+ tag: "span",
825
+ consuming: false,
826
+ getAttrs: (element) => {
827
+ const hasStyles = element.hasAttribute("style");
828
+ if (!hasStyles) {
829
+ return false;
830
+ }
831
+ if (this.options.mergeNestedSpanStyles) {
832
+ mergeNestedSpanStyles(element);
833
+ }
834
+ return {};
835
+ }
836
+ }
837
+ ];
838
+ },
839
+ renderHTML({ HTMLAttributes }) {
840
+ return ["span", (0, import_core8.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
841
+ },
842
+ addCommands() {
843
+ return {
844
+ toggleTextStyle: (attributes) => ({ commands }) => {
845
+ return commands.toggleMark(this.name, attributes);
846
+ },
847
+ removeEmptyTextStyle: () => ({ tr }) => {
848
+ const { selection } = tr;
849
+ tr.doc.nodesBetween(selection.from, selection.to, (node, pos) => {
850
+ if (node.isTextblock) {
851
+ return true;
852
+ }
853
+ if (!node.marks.filter((mark) => mark.type === this.type).some((mark) => Object.values(mark.attrs).some((value) => !!value))) {
854
+ tr.removeMark(pos, pos + node.nodeSize, this.type);
855
+ }
856
+ });
857
+ return true;
858
+ }
859
+ };
860
+ }
861
+ });
862
+ var BackgroundColor = import_core9.Extension.create({
863
+ name: "backgroundColor",
864
+ addOptions() {
865
+ return {
866
+ types: ["textStyle"]
867
+ };
868
+ },
869
+ addGlobalAttributes() {
870
+ return [
871
+ {
872
+ types: this.options.types,
873
+ attributes: {
874
+ backgroundColor: {
875
+ default: null,
876
+ parseHTML: (element) => {
877
+ var _a;
878
+ const styleAttr = element.getAttribute("style");
879
+ if (styleAttr) {
880
+ const decls = styleAttr.split(";").map((s) => s.trim()).filter(Boolean);
881
+ for (let i = decls.length - 1; i >= 0; i -= 1) {
882
+ const parts = decls[i].split(":");
883
+ if (parts.length >= 2) {
884
+ const prop = parts[0].trim().toLowerCase();
885
+ const val = parts.slice(1).join(":").trim();
886
+ if (prop === "background-color") {
887
+ return val.replace(/['"]+/g, "");
888
+ }
889
+ }
890
+ }
891
+ }
892
+ return (_a = element.style.backgroundColor) == null ? void 0 : _a.replace(/['"]+/g, "");
893
+ },
894
+ renderHTML: (attributes) => {
895
+ if (!attributes.backgroundColor) {
896
+ return {};
897
+ }
898
+ return {
899
+ style: `background-color: ${attributes.backgroundColor}`
900
+ };
901
+ }
902
+ }
903
+ }
904
+ }
905
+ ];
906
+ },
907
+ addCommands() {
908
+ return {
909
+ setBackgroundColor: (backgroundColor) => ({ chain }) => {
910
+ return chain().setMark("textStyle", { backgroundColor }).run();
911
+ },
912
+ unsetBackgroundColor: () => ({ chain }) => {
913
+ return chain().setMark("textStyle", { backgroundColor: null }).removeEmptyTextStyle().run();
914
+ }
915
+ };
916
+ }
917
+ });
918
+ var Color = import_core10.Extension.create({
919
+ name: "color",
920
+ addOptions() {
921
+ return {
922
+ types: ["textStyle"]
923
+ };
924
+ },
925
+ addGlobalAttributes() {
926
+ return [
927
+ {
928
+ types: this.options.types,
929
+ attributes: {
930
+ color: {
931
+ default: null,
932
+ parseHTML: (element) => {
933
+ var _a;
934
+ const styleAttr = element.getAttribute("style");
935
+ if (styleAttr) {
936
+ const decls = styleAttr.split(";").map((s) => s.trim()).filter(Boolean);
937
+ for (let i = decls.length - 1; i >= 0; i -= 1) {
938
+ const parts = decls[i].split(":");
939
+ if (parts.length >= 2) {
940
+ const prop = parts[0].trim().toLowerCase();
941
+ const val = parts.slice(1).join(":").trim();
942
+ if (prop === "color") {
943
+ return val.replace(/['"]+/g, "");
944
+ }
945
+ }
946
+ }
947
+ }
948
+ return (_a = element.style.color) == null ? void 0 : _a.replace(/['"]+/g, "");
949
+ },
950
+ renderHTML: (attributes) => {
951
+ if (!attributes.color) {
952
+ return {};
953
+ }
954
+ return {
955
+ style: `color: ${attributes.color}`
956
+ };
957
+ }
958
+ }
959
+ }
960
+ }
961
+ ];
962
+ },
963
+ addCommands() {
964
+ return {
965
+ setColor: (color) => ({ chain }) => {
966
+ return chain().setMark("textStyle", { color }).run();
967
+ },
968
+ unsetColor: () => ({ chain }) => {
969
+ return chain().setMark("textStyle", { color: null }).removeEmptyTextStyle().run();
970
+ }
971
+ };
972
+ }
973
+ });
974
+ var FontFamily = import_core11.Extension.create({
975
+ name: "fontFamily",
976
+ addOptions() {
977
+ return {
978
+ types: ["textStyle"]
979
+ };
980
+ },
981
+ addGlobalAttributes() {
982
+ return [
983
+ {
984
+ types: this.options.types,
985
+ attributes: {
986
+ fontFamily: {
987
+ default: null,
988
+ parseHTML: (element) => element.style.fontFamily,
989
+ renderHTML: (attributes) => {
990
+ if (!attributes.fontFamily) {
991
+ return {};
992
+ }
993
+ return {
994
+ style: `font-family: ${attributes.fontFamily}`
995
+ };
996
+ }
997
+ }
998
+ }
999
+ }
1000
+ ];
1001
+ },
1002
+ addCommands() {
1003
+ return {
1004
+ setFontFamily: (fontFamily) => ({ chain }) => {
1005
+ return chain().setMark("textStyle", { fontFamily }).run();
1006
+ },
1007
+ unsetFontFamily: () => ({ chain }) => {
1008
+ return chain().setMark("textStyle", { fontFamily: null }).removeEmptyTextStyle().run();
1009
+ }
1010
+ };
1011
+ }
1012
+ });
1013
+ var FontSize = import_core12.Extension.create({
1014
+ name: "fontSize",
1015
+ addOptions() {
1016
+ return {
1017
+ types: ["textStyle"]
1018
+ };
1019
+ },
1020
+ addGlobalAttributes() {
1021
+ return [
1022
+ {
1023
+ types: this.options.types,
1024
+ attributes: {
1025
+ fontSize: {
1026
+ default: null,
1027
+ parseHTML: (element) => element.style.fontSize,
1028
+ renderHTML: (attributes) => {
1029
+ if (!attributes.fontSize) {
1030
+ return {};
1031
+ }
1032
+ return {
1033
+ style: `font-size: ${attributes.fontSize}`
1034
+ };
1035
+ }
1036
+ }
1037
+ }
1038
+ }
1039
+ ];
1040
+ },
1041
+ addCommands() {
1042
+ return {
1043
+ setFontSize: (fontSize) => ({ chain }) => {
1044
+ return chain().setMark("textStyle", { fontSize }).run();
1045
+ },
1046
+ unsetFontSize: () => ({ chain }) => {
1047
+ return chain().setMark("textStyle", { fontSize: null }).removeEmptyTextStyle().run();
1048
+ }
1049
+ };
1050
+ }
1051
+ });
1052
+ var LineHeight = import_core13.Extension.create({
1053
+ name: "lineHeight",
1054
+ addOptions() {
1055
+ return {
1056
+ types: ["textStyle"]
1057
+ };
1058
+ },
1059
+ addGlobalAttributes() {
1060
+ return [
1061
+ {
1062
+ types: this.options.types,
1063
+ attributes: {
1064
+ lineHeight: {
1065
+ default: null,
1066
+ parseHTML: (element) => element.style.lineHeight,
1067
+ renderHTML: (attributes) => {
1068
+ if (!attributes.lineHeight) {
1069
+ return {};
1070
+ }
1071
+ return {
1072
+ style: `line-height: ${attributes.lineHeight}`
1073
+ };
1074
+ }
1075
+ }
1076
+ }
1077
+ }
1078
+ ];
1079
+ },
1080
+ addCommands() {
1081
+ return {
1082
+ setLineHeight: (lineHeight) => ({ chain }) => {
1083
+ return chain().setMark("textStyle", { lineHeight }).run();
1084
+ },
1085
+ unsetLineHeight: () => ({ chain }) => {
1086
+ return chain().setMark("textStyle", { lineHeight: null }).removeEmptyTextStyle().run();
1087
+ }
1088
+ };
1089
+ }
1090
+ });
1091
+ var TextStyleKit = import_core14.Extension.create({
1092
+ name: "textStyleKit",
1093
+ addExtensions() {
1094
+ const extensions = [];
1095
+ if (this.options.backgroundColor !== false) {
1096
+ extensions.push(BackgroundColor.configure(this.options.backgroundColor));
1097
+ }
1098
+ if (this.options.color !== false) {
1099
+ extensions.push(Color.configure(this.options.color));
1100
+ }
1101
+ if (this.options.fontFamily !== false) {
1102
+ extensions.push(FontFamily.configure(this.options.fontFamily));
1103
+ }
1104
+ if (this.options.fontSize !== false) {
1105
+ extensions.push(FontSize.configure(this.options.fontSize));
1106
+ }
1107
+ if (this.options.lineHeight !== false) {
1108
+ extensions.push(LineHeight.configure(this.options.lineHeight));
1109
+ }
1110
+ if (this.options.textStyle !== false) {
1111
+ extensions.push(TextStyle.configure(this.options.textStyle));
1112
+ }
1113
+ return extensions;
1114
+ }
1115
+ });
1116
+
1117
+ // src/extensions/base/compatibility.ts
1118
+ var import_core15 = require("@tiptap/core");
1119
+ var import_state4 = require("@tiptap/pm/state");
1120
+ var import_extension_image2 = __toESM(require("@tiptap/extension-image"));
1121
+ var BaseLegacyBookAlert = import_core15.Node.create({
1122
+ name: "calloutAlert",
1123
+ group: "block",
1124
+ content: "block+",
1125
+ draggable: true,
1126
+ isolating: true,
1127
+ addAttributes() {
1128
+ return {
1129
+ type: {
1130
+ default: "error"
1131
+ }
1132
+ };
1133
+ },
1134
+ parseHTML() {
1135
+ return [
1136
+ {
1137
+ tag: 'div[data-type="callout-alert"]'
1138
+ }
1139
+ ];
1140
+ },
1141
+ addKeyboardShortcuts() {
1142
+ return {
1143
+ Enter: () => handleExitNode(this.editor, this.name)
1144
+ };
1145
+ },
1146
+ renderHTML({ HTMLAttributes }) {
1147
+ return ["div", (0, import_core15.mergeAttributes)(HTMLAttributes, { "data-type": "callout-alert" }), 0];
1148
+ }
1149
+ });
1150
+ var BaseLegacyBookTip = import_core15.Node.create({
1151
+ name: "calloutTip",
1152
+ group: "block",
1153
+ content: "block+",
1154
+ draggable: true,
1155
+ isolating: true,
1156
+ addAttributes() {
1157
+ return {
1158
+ type: {
1159
+ default: "info"
1160
+ }
1161
+ };
1162
+ },
1163
+ parseHTML() {
1164
+ return [
1165
+ {
1166
+ tag: 'div[data-type="callout-tip"]'
1167
+ }
1168
+ ];
1169
+ },
1170
+ renderHTML({ HTMLAttributes }) {
1171
+ return ["div", (0, import_core15.mergeAttributes)(HTMLAttributes, { "data-type": "callout-tip" }), 0];
1172
+ },
1173
+ addKeyboardShortcuts() {
1174
+ return {
1175
+ Enter: () => handleExitNode(this.editor, this.name)
1176
+ };
1177
+ }
1178
+ });
1179
+ var BaseLegacySEQuote = import_core15.Node.create({
1180
+ name: "customQuoteV2",
1181
+ group: "block",
1182
+ content: "customQuoteText customQuoteAuthor customQuoteSign",
1183
+ selectable: false,
1184
+ draggable: true,
1185
+ isolating: true,
1186
+ addKeyboardShortcuts() {
1187
+ return {
1188
+ Enter: () => {
1189
+ const { view, schema } = this.editor;
1190
+ const { state } = view;
1191
+ const { selection } = state;
1192
+ const $pos = selection.$from;
1193
+ let depth = $pos.depth;
1194
+ let isInsideCustomQuoteV2 = false;
1195
+ while (depth > 0) {
1196
+ const parentNode = $pos.node(depth);
1197
+ if (parentNode.type.name === this.name) {
1198
+ isInsideCustomQuoteV2 = true;
1199
+ break;
1200
+ }
1201
+ depth--;
1202
+ }
1203
+ if (!isInsideCustomQuoteV2) {
1204
+ return false;
1205
+ }
1206
+ const { tr } = state;
1207
+ const posAfter = $pos.after(depth);
1208
+ const paragraphNode = schema.nodes.paragraph.createAndFill();
1209
+ if (!paragraphNode) return false;
1210
+ tr.insert(posAfter, paragraphNode);
1211
+ tr.setSelection(import_state4.TextSelection.create(tr.doc, posAfter + 1));
1212
+ view.dispatch(tr);
1213
+ return true;
1214
+ }
1215
+ };
1216
+ },
1217
+ parseHTML() {
1218
+ return [
1219
+ {
1220
+ tag: "div[data-custom-quote-v2]"
1221
+ }
1222
+ ];
1223
+ },
1224
+ renderHTML({ HTMLAttributes }) {
1225
+ return ["div", (0, import_core15.mergeAttributes)(HTMLAttributes, { "data-custom-quote-v2": "" }), 0];
1226
+ }
1227
+ });
1228
+ var BaseLegacyPromptSE = import_core15.Node.create({
1229
+ name: "promptV2",
1230
+ group: "block",
1231
+ content: "(promptHeader | promptV2Header) (promptContent | promptV2Content)",
1232
+ selectable: false,
1233
+ draggable: true,
1234
+ addKeyboardShortcuts() {
1235
+ return {
1236
+ Enter: () => {
1237
+ const { view, schema } = this.editor;
1238
+ const { state } = view;
1239
+ const { selection } = state;
1240
+ const $pos = selection.$from;
1241
+ let depth = $pos.depth;
1242
+ let isInsidePromptV2 = false;
1243
+ while (depth > 0) {
1244
+ const parentNode = $pos.node(depth);
1245
+ if (parentNode.type.name === this.name) {
1246
+ isInsidePromptV2 = true;
1247
+ break;
1248
+ }
1249
+ depth--;
1250
+ }
1251
+ if (!isInsidePromptV2) {
1252
+ return false;
1253
+ }
1254
+ const { tr } = state;
1255
+ const posAfter = $pos.after(depth);
1256
+ const paragraphNode = schema.nodes.paragraph.createAndFill();
1257
+ if (!paragraphNode) return false;
1258
+ tr.insert(posAfter, paragraphNode);
1259
+ tr.setSelection(import_state4.TextSelection.create(tr.doc, posAfter + 1));
1260
+ view.dispatch(tr);
1261
+ return true;
1262
+ }
1263
+ };
1264
+ },
1265
+ parseHTML() {
1266
+ return [
1267
+ {
1268
+ tag: "div[data-prompt-v2]"
1269
+ }
1270
+ ];
1271
+ },
1272
+ renderHTML({ HTMLAttributes }) {
1273
+ return ["div", (0, import_core15.mergeAttributes)(HTMLAttributes, { "data-prompt": "" }), 0];
1274
+ }
1275
+ });
1276
+ var BaseLegacyPromptSEHeader = import_core15.Node.create({
1277
+ name: "promptV2Header",
1278
+ group: "block",
1279
+ content: "inline*",
1280
+ selectable: true,
1281
+ draggable: false,
1282
+ parseHTML() {
1283
+ return [
1284
+ {
1285
+ tag: "div[data-prompt-v2-header]"
1286
+ }
1287
+ ];
1288
+ },
1289
+ renderHTML({ HTMLAttributes }) {
1290
+ return ["div", (0, import_core15.mergeAttributes)(HTMLAttributes, { "data-prompt-header": "" }), 0];
1291
+ }
1292
+ // addNodeView() {
1293
+ // return ReactNodeViewRenderer(PromptHeaderView);
1294
+ // },
1295
+ });
1296
+ var BaseLegacyPromptSEContent = import_core15.Node.create({
1297
+ name: "promptV2Content",
1298
+ group: "block",
1299
+ content: "text*",
1300
+ draggable: false,
1301
+ selectable: true,
1302
+ parseHTML() {
1303
+ return [
1304
+ {
1305
+ tag: "div[data-prompt-v2-content]"
1306
+ }
1307
+ ];
1308
+ },
1309
+ renderHTML({ HTMLAttributes }) {
1310
+ return ["div", (0, import_core15.mergeAttributes)(HTMLAttributes, { "data-prompt-content": "" }), 0];
1311
+ }
1312
+ });
1313
+ var BaseLegacyCustomBlockquote = import_core15.Node.create({
1314
+ name: "customBlockquote",
1315
+ group: "block",
1316
+ content: "block+",
1317
+ draggable: true,
1318
+ parseHTML() {
1319
+ return [
1320
+ {
1321
+ tag: 'div[data-type="custom-blockquote"]'
1322
+ }
1323
+ ];
1324
+ },
1325
+ renderHTML() {
1326
+ return ["blockquote", 0];
1327
+ }
1328
+ });
1329
+ var BaseLegacyYouTube = import_core15.Node.create({
1330
+ name: "youtube",
1331
+ group: "block",
1332
+ selectable: true,
1333
+ draggable: true,
1334
+ isolating: true,
1335
+ addAttributes() {
1336
+ return {
1337
+ src: {
1338
+ default: null
1339
+ },
1340
+ width: {
1341
+ default: 640
1342
+ },
1343
+ height: {
1344
+ default: 480
1345
+ },
1346
+ start: {
1347
+ default: 0
1348
+ }
1349
+ };
1350
+ },
1351
+ parseHTML() {
1352
+ return [
1353
+ {
1354
+ tag: 'iframe[src*="youtube.com"]'
1355
+ },
1356
+ {
1357
+ tag: 'iframe[src*="youtu.be"]'
1358
+ }
1359
+ ];
1360
+ },
1361
+ renderHTML({ HTMLAttributes }) {
1362
+ return ["video-embed", { src: HTMLAttributes.src }];
1363
+ }
1364
+ });
1365
+ var LegacyInlineLatexSE = import_core15.Node.create({
1366
+ name: "inlineLatex",
1367
+ group: "inline",
1368
+ inline: true,
1369
+ content: "text*",
1370
+ atom: true,
1371
+ addAttributes() {
1372
+ return {
1373
+ latex: {
1374
+ default: "",
1375
+ parseHTML: (element) => element.getAttribute("data-latex") || element.textContent || ""
1376
+ }
1377
+ };
1378
+ },
1379
+ parseHTML() {
1380
+ return [
1381
+ {
1382
+ tag: "span.inline-latex"
1383
+ }
1384
+ ];
1385
+ },
1386
+ renderHTML({ HTMLAttributes }) {
1387
+ return ["code", (0, import_core15.mergeAttributes)(HTMLAttributes, { class: "inline-latex" }), 0];
1388
+ }
1389
+ });
1390
+ var BaseLegacyFigure = import_extension_image2.default.extend({
1391
+ name: "figure",
1392
+ group: "block",
1393
+ content: "inline*",
1394
+ draggable: true,
1395
+ isolating: true,
1396
+ selectable: false,
1397
+ addOptions() {
1398
+ return {
1399
+ HTMLAttributes: {},
1400
+ getImageById: void 0
1401
+ };
1402
+ },
1403
+ addAttributes() {
1404
+ return {
1405
+ ...this.parent?.(),
1406
+ fileId: {
1407
+ default: null,
1408
+ parseHTML: (element) => {
1409
+ const img = element.querySelector("img");
1410
+ const fileIdFromImg = img?.getAttribute("fileId") || img?.getAttribute("data-file-id");
1411
+ const fileIdFromFigure = element.getAttribute("fileId") || element.getAttribute("data-file-id");
1412
+ return fileIdFromImg ?? fileIdFromFigure;
1413
+ },
1414
+ renderHTML: (attributes) => {
1415
+ if (!attributes.fileId) return {};
1416
+ return { "data-file-id": attributes.fileId };
1417
+ }
1418
+ },
1419
+ src: {
1420
+ default: null,
1421
+ parseHTML: (element) => {
1422
+ const img = element.querySelector("img") || element;
1423
+ return img.getAttribute("src");
1424
+ }
1425
+ },
1426
+ alt: {
1427
+ default: null,
1428
+ parseHTML: (element) => {
1429
+ const img = element.querySelector("img") || element;
1430
+ return img.getAttribute("alt");
1431
+ }
1432
+ },
1433
+ title: {
1434
+ default: null,
1435
+ parseHTML: (element) => {
1436
+ const img = element.querySelector("img") || element;
1437
+ return img.getAttribute("title");
1438
+ }
1439
+ },
1440
+ caption: {
1441
+ default: null,
1442
+ parseHTML: (element) => {
1443
+ const caption = element.querySelector("figcaption");
1444
+ return caption ? caption.innerText : null;
1445
+ }
1446
+ }
1447
+ };
1448
+ },
1449
+ parseHTML() {
1450
+ return [
1451
+ {
1452
+ tag: "figure",
1453
+ getAttrs: (element) => {
1454
+ if (typeof element === "string") return false;
1455
+ const img = element.querySelector("img");
1456
+ return img ? {} : false;
1457
+ }
1458
+ },
1459
+ {
1460
+ tag: "img[src]"
1461
+ }
1462
+ ];
1463
+ },
1464
+ renderHTML({ node }) {
1465
+ const resolvedSrc = resolveImageSrc(
1466
+ {
1467
+ fileId: node.attrs.fileId,
1468
+ src: node.attrs.src
1469
+ },
1470
+ { getImageById: this.options.getImageById }
1471
+ );
1472
+ const figureAttrs = (0, import_core15.mergeAttributes)(this.options.HTMLAttributes);
1473
+ const imgAttrs = {
1474
+ src: resolvedSrc
1475
+ };
1476
+ if (node.attrs.fileId) imgAttrs["data-file-id"] = node.attrs.fileId;
1477
+ if (node.attrs.alt) imgAttrs.alt = node.attrs.alt;
1478
+ if (node.attrs.title) imgAttrs.title = node.attrs.title;
1479
+ if (node.attrs.width) imgAttrs.width = node.attrs.width;
1480
+ if (node.attrs.height) imgAttrs.height = node.attrs.height;
1481
+ const hasCaption = node.attrs.caption && node.attrs.caption.trim().length > 0;
1482
+ const figcaptionContent = hasCaption ? ["figcaption", {}, node.attrs.caption] : null;
1483
+ return [
1484
+ "figure",
1485
+ figureAttrs,
1486
+ ["img", imgAttrs],
1487
+ ...figcaptionContent ? [figcaptionContent] : []
1488
+ ];
1489
+ }
1490
+ });
1491
+
1492
+ // src/utils/get-shared-extensions.ts
1493
+ function getSharedExtensions() {
1494
+ return [
1495
+ import_starter_kit.default.configure({
1496
+ codeBlock: false,
1497
+ link: false
1498
+ }),
1499
+ import_extension_highlight.default.configure({ multicolor: true }),
1500
+ LinkExtension,
1501
+ import_extension_superscript.default,
1502
+ import_extension_subscript.default,
1503
+ import_extension_text_align.default.configure({
1504
+ types: ["heading", "paragraph"]
1505
+ }),
1506
+ TextStyleKit.configure({
1507
+ color: {
1508
+ types: ["textStyle"]
1509
+ }
1510
+ }),
1511
+ import_extension_details.Details.configure({
1512
+ persist: true,
1513
+ HTMLAttributes: {
1514
+ class: "details"
1515
+ }
1516
+ }),
1517
+ import_extension_details.DetailsSummary,
1518
+ import_extension_details.DetailsContent,
1519
+ BaseMythReality,
1520
+ BaseMythRealityBlock,
1521
+ LegacyInlineLatexSE
1522
+ ];
1523
+ }
1524
+
1525
+ // src/extensions/render/get-render-extensions.ts
1526
+ function getRenderExtensions() {
1527
+ const sharedExtensions = getSharedExtensions();
1528
+ return [
1529
+ ...sharedExtensions,
1530
+ CopyableText,
1531
+ BaseCallout,
1532
+ BaseCodeBlock,
1533
+ BaseCustomQuote,
1534
+ BaseCustomQuoteText,
1535
+ BaseCustomQuoteAuthor,
1536
+ BaseCustomQuoteSign,
1537
+ BasePrompt,
1538
+ BasePromptHeader,
1539
+ BasePromptContent,
1540
+ BaseVideo,
1541
+ BaseFigure,
1542
+ // Need to update
1543
+ import_extension_table.TableKit.configure({
1544
+ table: { resizable: false }
1545
+ }),
1546
+ import_extension_mathematics.Mathematics.configure({
1547
+ katexOptions: {
1548
+ throwOnError: false
1549
+ }
1550
+ }),
1551
+ // ========================================================================
1552
+ // Legacy Extensions (Deprecated - for backward compatibility only)
1553
+ // ========================================================================
1554
+ BaseLegacyBookAlert,
1555
+ BaseLegacyBookTip,
1556
+ BaseLegacySEQuote,
1557
+ BaseLegacyPromptSE,
1558
+ BaseLegacyPromptSEHeader,
1559
+ BaseLegacyPromptSEContent,
1560
+ BaseLegacyCustomBlockquote,
1561
+ BaseLegacyYouTube,
1562
+ BaseLegacyFigure
1563
+ // Update
1564
+ ];
1565
+ }
1566
+
1567
+ // src/render/static-renderer-config.tsx
1568
+ var import_katex = __toESM(require("katex"));
1569
+ var import_common = __toESM(require("highlight.js/lib/common"));
1570
+
1571
+ // src/icons/color/TiptapCalloutError.tsx
1572
+ var import_jsx_runtime = require("react/jsx-runtime");
1573
+ var SvgTiptapCalloutError = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 20 20", ...props, children: [
1574
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", { clipPath: "url(#tiptap-callout-error_svg__a)", children: [
1575
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1576
+ "path",
1577
+ {
1578
+ fill: "#E03757",
1579
+ d: "M10 0C4.477 0 0 4.477 0 10s4.477 10 10 10 10-4.477 10-10S15.523 0 10 0"
1580
+ }
1581
+ ),
1582
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1583
+ "path",
1584
+ {
1585
+ fill: "#F04760",
1586
+ d: "M4.692 15.603c6.011 0 10.885-4.874 10.885-10.885a10.9 10.9 0 0 0-.525-3.35A9.95 9.95 0 0 0 10 0C4.477 0 0 4.477 0 10a9.95 9.95 0 0 0 1.394 5.094c1.066.338 2.179.51 3.298.509"
1587
+ }
1588
+ ),
1589
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1590
+ "path",
1591
+ {
1592
+ fill: "#fff",
1593
+ d: "M9.996 16.783a1.626 1.626 0 1 1 0-3.251 1.626 1.626 0 0 1 0 3.251m1.575-5.598c-.027.252-.14.486-.321.663a1.13 1.13 0 0 1-.674.315h-.008q-.239.027-.48.027a6 6 0 0 1-.575-.027h-.007a1.13 1.13 0 0 1-.674-.315 1.1 1.1 0 0 1-.321-.663c-.04-.366-.059-2.914-.059-3.481 0-.568.02-3.122.059-3.488.027-.252.14-.487.32-.665.183-.177.42-.289.675-.315h.007q.287-.029.576-.017.24-.012.479.017h.008c.254.027.492.14.674.319.18.177.294.412.321.664.04.366.059 2.92.059 3.488 0 .567-.02 3.113-.059 3.478"
1594
+ }
1595
+ )
1596
+ ] }),
1597
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("clipPath", { id: "tiptap-callout-error_svg__a", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { fill: "#fff", d: "M0 0h20v20H0z" }) }) })
1598
+ ] });
1599
+ var TiptapCalloutError_default = SvgTiptapCalloutError;
1600
+
1601
+ // src/icons/color/TiptapCalloutInfo.tsx
1602
+ var import_jsx_runtime2 = require("react/jsx-runtime");
1603
+ var SvgTiptapCalloutInfo = (props) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 20 20", ...props, children: [
1604
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1605
+ "path",
1606
+ {
1607
+ fill: "#FE9738",
1608
+ d: "m11.654 11.196 3.51-2.75.549-4.789-4.06-2.234-1.647 2.264a2.79 2.79 0 0 1 1.531 2.28 2.8 2.8 0 0 1-1.85 2.84 3.96 3.96 0 0 0-2.624 3.728v.72c0 .937.76 1.697 1.696 1.697h2.482zm-4.895-3.32H4.277c-.937 0-1.697-.76-1.697-1.697q0-.432.06-.86C3.084 2.135 5.954-.196 9.172.015h2.482L9.888 1.797m1.353 14.796H8.759c-.937 0-1.696.76-1.696 1.696v.014c0 .938.76 1.697 1.696 1.697h2.18"
1609
+ }
1610
+ ),
1611
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1612
+ "path",
1613
+ {
1614
+ fill: "#FFD15B",
1615
+ d: "M11.241 14.951c-.937 0-1.697-.76-1.697-1.697v-.72a3.955 3.955 0 0 1 2.625-3.727 2.8 2.8 0 0 0 1.85-2.84A2.79 2.79 0 0 0 11.432 3.4a2.8 2.8 0 0 0-2.976 2.78 1.697 1.697 0 0 1-3.394 0q0-.434.06-.86C5.566 2.133 8.435-.198 11.654.014c3.055.2 5.527 2.653 5.75 5.706a6.2 6.2 0 0 1-4.104 6.286.56.56 0 0 0-.362.529v.72c0 .936-.76 1.696-1.697 1.696m0 5.05c-.937 0-1.697-.76-1.697-1.698v-.014a1.697 1.697 0 0 1 3.394 0v.014c0 .937-.76 1.697-1.697 1.697"
1616
+ }
1617
+ ),
1618
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1619
+ "path",
1620
+ {
1621
+ fill: "#FFC344",
1622
+ d: "M6.622 5.32q-.06.427-.06.86c0 .667.386 1.245.947 1.521A1.697 1.697 0 0 1 5.062 6.18q0-.432.06-.86C5.566 2.134 8.436-.197 11.654.014q.173.012.343.033C9.273.382 7.012 2.521 6.622 5.32m7.047 3.486a3.96 3.96 0 0 0-2.625 3.729v.72c0 .667.386 1.245.947 1.521a1.696 1.696 0 0 1-2.447-1.522v-.72a3.955 3.955 0 0 1 2.625-3.728 2.8 2.8 0 0 0 1.85-2.839 2.79 2.79 0 0 0-2.022-2.47 2.786 2.786 0 0 1 3.522 2.47 2.8 2.8 0 0 1-1.85 2.84m-1.678 11.02a1.696 1.696 0 0 1-2.447-1.522v-.015a1.697 1.697 0 0 1 2.448-1.523 1.7 1.7 0 0 0-.948 1.523v.014c0 .668.386 1.246.947 1.522"
1623
+ }
1624
+ )
1625
+ ] });
1626
+ var TiptapCalloutInfo_default = SvgTiptapCalloutInfo;
1627
+
1628
+ // src/icons/color/TiptapCalloutSuccess.tsx
1629
+ var import_jsx_runtime3 = require("react/jsx-runtime");
1630
+ var SvgTiptapCalloutSuccess = (props) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 20 20", ...props, children: [
1631
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("g", { clipPath: "url(#tiptap-callout-success_svg__a)", children: [
1632
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1633
+ "path",
1634
+ {
1635
+ fill: "#35495E",
1636
+ d: "M1.972 18.004.06 7.138a2.4 2.4 0 0 1-.035-.317 2.47 2.47 0 0 1 2.073-2.493l3.693-.652-.1 14.328z"
1637
+ }
1638
+ ),
1639
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1640
+ "path",
1641
+ {
1642
+ fill: "#2C3E50",
1643
+ d: "M16.186 17.528a.69.69 0 0 1-.548.517l-10.87 1.917a2.42 2.42 0 0 1-2.83-2.276 2.46 2.46 0 0 1 1.934-2.462l3.045.855h-.003l-2.742.487a1.037 1.037 0 0 0-.786 1.396 1.066 1.066 0 0 0 1.186.635l8.307-1.466z"
1644
+ }
1645
+ ),
1646
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1647
+ "path",
1648
+ {
1649
+ fill: "#F9EAB0",
1650
+ d: "m6.914 16.08-2.742.486a1.035 1.035 0 0 0-.786 1.396 1.066 1.066 0 0 0 1.186.635l8.307-1.466z"
1651
+ }
1652
+ ),
1653
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1654
+ "path",
1655
+ {
1656
+ fill: "#E64C3C",
1657
+ d: "M4.423 11.438 6.339.571a.695.695 0 0 1 .799-.559l10.785 1.902a2.47 2.47 0 0 1 2.074 2.495 3 3 0 0 1-.034.316l-1.917 10.867z"
1658
+ }
1659
+ ),
1660
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1661
+ "path",
1662
+ {
1663
+ fill: "#3F5C6C",
1664
+ d: "M15.668 3.612a.4.4 0 0 1-.06-.005l-7.81-1.378a.345.345 0 0 1 .12-.677l7.81 1.375a.345.345 0 0 1-.06.685M14.01 5.069a.3.3 0 0 1-.06-.005l-5.094-.897a.345.345 0 0 1 .12-.68l5.094.897a.345.345 0 0 1-.06.685"
1665
+ }
1666
+ ),
1667
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1668
+ "path",
1669
+ {
1670
+ fill: "#ECF0F1",
1671
+ d: "m14.727 6.608-7.131-1.26a.345.345 0 0 0-.4.28l-.6 3.395a.345.345 0 0 0 .28.4l7.13 1.26a.345.345 0 0 0 .4-.28l.6-3.396a.345.345 0 0 0-.28-.4"
1672
+ }
1673
+ ),
1674
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1675
+ "path",
1676
+ {
1677
+ fill: "#C03A2B",
1678
+ d: "M19.997 4.407a2 2 0 0 1-.035.317L18.045 15.59l-2.659-.81 1.542-8.738.365-2.063.373-2.11.258.045a2.47 2.47 0 0 1 2.073 2.493"
1679
+ }
1680
+ ),
1681
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1682
+ "path",
1683
+ {
1684
+ fill: "#802F34",
1685
+ d: "M16.007 12.78 5.22 10.88a.69.69 0 0 0-.238 1.358l10.865 1.914a1.038 1.038 0 0 1 .783 1.4 1.06 1.06 0 0 1-1.183.63L4.624 14.277a.69.69 0 0 0-.241 1.359l10.869 1.913a2.416 2.416 0 0 0 2.83-2.272 2.474 2.474 0 0 0-2.075-2.496"
1686
+ }
1687
+ ),
1688
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1689
+ "path",
1690
+ {
1691
+ fill: "#F9EAB0",
1692
+ d: "M16.63 15.552a1.06 1.06 0 0 1-1.182.63L4.624 14.277l.359-2.038 10.865 1.914a1.04 1.04 0 0 1 .783 1.4"
1693
+ }
1694
+ )
1695
+ ] }),
1696
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("clipPath", { id: "tiptap-callout-success_svg__a", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { fill: "#fff", d: "M0 0h20v20H0z" }) }) })
1697
+ ] });
1698
+ var TiptapCalloutSuccess_default = SvgTiptapCalloutSuccess;
1699
+
1700
+ // src/icons/color/TiptapCalloutWarning.tsx
1701
+ var import_jsx_runtime4 = require("react/jsx-runtime");
1702
+ var SvgTiptapCalloutWarning = (props) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 20 20", ...props, children: [
1703
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1704
+ "path",
1705
+ {
1706
+ fill: "#FFF59D",
1707
+ fillOpacity: 0.6,
1708
+ d: "M1.667 9.167a8.333 8.333 0 1 0 16.666 0 8.333 8.333 0 0 0-16.666 0"
1709
+ }
1710
+ ),
1711
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1712
+ "path",
1713
+ {
1714
+ fill: "#FBC02D",
1715
+ d: "M15.417 9.167c0-3.209-2.75-5.75-6.042-5.375-2.5.291-4.5 2.291-4.75 4.791a5.27 5.27 0 0 0 1.917 4.709c.583.5.958 1.208.958 2v.125h5v-.042c0-.75.333-1.5.917-2 1.208-1 2-2.5 2-4.208"
1716
+ }
1717
+ ),
1718
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1719
+ "path",
1720
+ {
1721
+ fill: "#FFF59D",
1722
+ d: "m12.75 8.417-1.25-.834a.45.45 0 0 0-.458 0L10 8.25l-1-.667a.45.45 0 0 0-.458 0l-1.25.834c-.084.083-.167.166-.167.291s0 .25.083.334L8.792 11v4.417h.833v-4.584c0-.083-.042-.166-.083-.25L8.167 8.875l.625-.417 1 .667a.45.45 0 0 0 .458 0l1-.667.625.417-1.375 1.708a.6.6 0 0 0-.083.25v4.584h.833V11l1.583-1.958a.32.32 0 0 0 .084-.334c-.042-.125-.084-.25-.167-.291"
1723
+ }
1724
+ ),
1725
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { fill: "#5C6BC0", d: "M8.75 18.334a1.25 1.25 0 1 0 2.5 0 1.25 1.25 0 0 0-2.5 0" }),
1726
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1727
+ "path",
1728
+ {
1729
+ fill: "#9FA8DA",
1730
+ d: "M10.833 18.75H9.167C8.25 18.75 7.5 18 7.5 17.083V15h5v2.083c0 .917-.75 1.667-1.667 1.667"
1731
+ }
1732
+ ),
1733
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1734
+ "path",
1735
+ {
1736
+ fill: "#5C6BC0",
1737
+ d: "m12.5 17.083-4.833.667c.125.291.375.583.666.75l3.917-.542q.25-.375.25-.875m-5-.958v.833l5-.708v-.834z"
1738
+ }
1739
+ )
1740
+ ] });
1741
+ var TiptapCalloutWarning_default = SvgTiptapCalloutWarning;
1742
+
1743
+ // src/utils/custom-emoji.ts
1744
+ var calloutIconComponents = {
1745
+ "callout-info": TiptapCalloutInfo_default,
1746
+ "callout-success": TiptapCalloutSuccess_default,
1747
+ "callout-warning": TiptapCalloutWarning_default,
1748
+ "callout-error": TiptapCalloutError_default
1749
+ };
1750
+
1751
+ // src/extensions/views/components/callout.tsx
1752
+ var import_jsx_runtime5 = require("react/jsx-runtime");
1753
+ var calloutIcons = {
1754
+ info: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(TiptapCalloutInfo_default, {}),
1755
+ warning: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(TiptapCalloutWarning_default, {}),
1756
+ success: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(TiptapCalloutSuccess_default, {}),
1757
+ error: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(TiptapCalloutError_default, {})
1758
+ };
1759
+ var legacyTypeMap3 = {
1760
+ question: "info",
1761
+ idea: "warning",
1762
+ info: "success",
1763
+ error: "error"
1764
+ };
1765
+ var Callout = ({ type, bgColor, emoji, children, iconWrapper, calloutType }) => {
1766
+ const isLegacySECallout = !!calloutType;
1767
+ const finalType = isLegacySECallout ? legacyTypeMap3[calloutType] : type;
1768
+ const hasCustomColor = !!bgColor;
1769
+ const className = hasCustomColor ? "callout-node" : `callout-node callout-${finalType}`;
1770
+ const style = hasCustomColor ? { backgroundColor: bgColor } : void 0;
1771
+ let icon;
1772
+ if (emoji) {
1773
+ if (emoji in calloutIconComponents) {
1774
+ const IconComponent = calloutIconComponents[emoji];
1775
+ icon = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(IconComponent, {});
1776
+ } else {
1777
+ icon = emoji;
1778
+ }
1779
+ } else {
1780
+ icon = calloutIcons[finalType];
1781
+ }
1782
+ const iconContent = iconWrapper ? iconWrapper(icon) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "callout-icon", children: icon });
1783
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1784
+ "div",
1785
+ {
1786
+ className,
1787
+ "data-callout-type": hasCustomColor ? void 0 : type,
1788
+ "data-bg-color": bgColor || void 0,
1789
+ "data-emoji": emoji || void 0,
1790
+ style,
1791
+ children: [
1792
+ iconContent,
1793
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "callout-content-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "callout-content", children }) })
1794
+ ]
1795
+ }
1796
+ );
1797
+ };
1798
+
1799
+ // src/extensions/views/components/code-block.tsx
1800
+ var import_react = require("react");
1801
+ var import_xml2 = __toESM(require("highlight.js/lib/languages/xml"));
1802
+ var import_lowlight2 = require("lowlight");
1803
+
1804
+ // src/icons/Check.tsx
1805
+ var import_jsx_runtime6 = require("react/jsx-runtime");
1806
+ var SvgCheck = (props) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1807
+ "path",
1808
+ {
1809
+ fill: "currentColor",
1810
+ fillRule: "evenodd",
1811
+ d: "M20.707 5.293a1 1 0 0 1 0 1.414l-11 11a1 1 0 0 1-1.414 0l-5-5a1 1 0 1 1 1.414-1.414L9 15.586 19.293 5.293a1 1 0 0 1 1.414 0",
1812
+ clipRule: "evenodd"
1813
+ }
1814
+ ) });
1815
+ var Check_default = SvgCheck;
1816
+
1817
+ // src/icons/Copy.tsx
1818
+ var import_jsx_runtime7 = require("react/jsx-runtime");
1819
+ var SvgCopy = (props) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 20 20", ...props, children: [
1820
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("g", { fill: "currentColor", fillRule: "evenodd", clipPath: "url(#copy_svg__a)", clipRule: "evenodd", children: [
1821
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M9.167 8.333a.833.833 0 0 0-.834.833v7.5c0 .46.373.834.833.834h7.5c.46 0 .834-.373.834-.834v-7.5a.833.833 0 0 0-.834-.833zm-2.5.833a2.5 2.5 0 0 1 2.5-2.5h7.5a2.5 2.5 0 0 1 2.5 2.5v7.5a2.5 2.5 0 0 1-2.5 2.5h-7.5a2.5 2.5 0 0 1-2.5-2.5z" }),
1822
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M3.334 2.5a.833.833 0 0 0-.834.833v7.5a.833.833 0 0 0 .833.834h.834a.833.833 0 0 1 0 1.667h-.833a2.5 2.5 0 0 1-2.5-2.5v-7.5a2.5 2.5 0 0 1 2.5-2.5h7.5a2.5 2.5 0 0 1 2.5 2.5v.833a.833.833 0 1 1-1.667 0v-.833a.834.834 0 0 0-.833-.834z" })
1823
+ ] }),
1824
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("clipPath", { id: "copy_svg__a", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { fill: "currentColor", d: "M0 0h20v20H0z" }) }) })
1825
+ ] });
1826
+ var Copy_default = SvgCopy;
1827
+
1828
+ // src/icons/DragIcon.tsx
1829
+ var import_jsx_runtime8 = require("react/jsx-runtime");
1830
+
1831
+ // src/icons/Edit.tsx
1832
+ var import_jsx_runtime9 = require("react/jsx-runtime");
1833
+ var SvgEdit = (props) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("svg", { fill: "none", viewBox: "0 0 18 18", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1834
+ "path",
1835
+ {
1836
+ fill: "currentColor",
1837
+ fillRule: "evenodd",
1838
+ d: "M11.745.91a.833.833 0 0 1 1.179 0l4.167 4.167a.833.833 0 0 1 0 1.179L6.257 17.089a.83.83 0 0 1-.589.244H1.501a.833.833 0 0 1-.833-.833v-4.167c0-.22.088-.433.244-.589zM2.335 12.68v2.988h2.988l10-10-2.988-2.988z",
1839
+ clipRule: "evenodd"
1840
+ }
1841
+ ) });
1842
+ var Edit_default = SvgEdit;
1843
+
1844
+ // src/icons/Quote.tsx
1845
+ var import_jsx_runtime10 = require("react/jsx-runtime");
1846
+ var SvgQuote = (props) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 48 48", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1847
+ "path",
1848
+ {
1849
+ fill: "currentColor",
1850
+ d: "M19.284 11.242c1.2-.504 1.703-1.937 1.161-3.098l-1.897-3.989c-.542-1.122-1.859-1.626-3.02-1.122-3.292 1.394-6.119 3.214-8.364 5.42-2.75 2.595-4.608 5.577-5.615 8.868C.542 20.65 0 25.18 0 30.95v11.888a2.33 2.33 0 0 0 2.323 2.323h15.218a2.33 2.33 0 0 0 2.323-2.323V27.62a2.33 2.33 0 0 0-2.323-2.323h-7.28c.078-3.912 1.007-7.048 2.71-9.41 1.395-1.897 3.486-3.446 6.313-4.646m27.337 0c1.2-.504 1.703-1.937 1.162-3.098l-1.898-3.95a2.315 2.315 0 0 0-3.02-1.122c-3.253 1.394-6.04 3.214-8.325 5.382-2.75 2.633-4.647 5.615-5.654 8.906q-1.51 4.879-1.51 13.591V42.84a2.33 2.33 0 0 0 2.324 2.323h15.217a2.33 2.33 0 0 0 2.324-2.323V27.62a2.33 2.33 0 0 0-2.324-2.323H37.6c.077-3.911 1.007-7.047 2.71-9.41 1.394-1.897 3.485-3.446 6.312-4.646"
1851
+ }
1852
+ ) });
1853
+ var Quote_default = SvgQuote;
1854
+
1855
+ // src/icons/X.tsx
1856
+ var import_jsx_runtime11 = require("react/jsx-runtime");
1857
+
1858
+ // src/icons/menu/AddImage.tsx
1859
+ var import_jsx_runtime12 = require("react/jsx-runtime");
1860
+
1861
+ // src/icons/menu/AlignCenter.tsx
1862
+ var import_jsx_runtime13 = require("react/jsx-runtime");
1863
+
1864
+ // src/icons/menu/AlignLeft.tsx
1865
+ var import_jsx_runtime14 = require("react/jsx-runtime");
1866
+
1867
+ // src/icons/menu/AlignRight.tsx
1868
+ var import_jsx_runtime15 = require("react/jsx-runtime");
1869
+
1870
+ // src/icons/menu/ArrowDown.tsx
1871
+ var import_jsx_runtime16 = require("react/jsx-runtime");
1872
+
1873
+ // src/icons/menu/ArrowLeft.tsx
1874
+ var import_jsx_runtime17 = require("react/jsx-runtime");
1875
+
1876
+ // src/icons/menu/ArrowRight.tsx
1877
+ var import_jsx_runtime18 = require("react/jsx-runtime");
1878
+
1879
+ // src/icons/menu/ArrowUp.tsx
1880
+ var import_jsx_runtime19 = require("react/jsx-runtime");
1881
+
1882
+ // src/icons/menu/Blockquote.tsx
1883
+ var import_jsx_runtime20 = require("react/jsx-runtime");
1884
+
1885
+ // src/icons/menu/Bold.tsx
1886
+ var import_jsx_runtime21 = require("react/jsx-runtime");
1887
+
1888
+ // src/icons/menu/BulletList.tsx
1889
+ var import_jsx_runtime22 = require("react/jsx-runtime");
1890
+
1891
+ // src/icons/menu/CalloutError.tsx
1892
+ var import_jsx_runtime23 = require("react/jsx-runtime");
1893
+
1894
+ // src/icons/menu/CalloutInfo.tsx
1895
+ var import_jsx_runtime24 = require("react/jsx-runtime");
1896
+
1897
+ // src/icons/menu/CalloutSuccess.tsx
1898
+ var import_jsx_runtime25 = require("react/jsx-runtime");
1899
+
1900
+ // src/icons/menu/CalloutWarning.tsx
1901
+ var import_jsx_runtime26 = require("react/jsx-runtime");
1902
+
1903
+ // src/icons/menu/ClearFormatting.tsx
1904
+ var import_jsx_runtime27 = require("react/jsx-runtime");
1905
+
1906
+ // src/icons/menu/CodeBlock.tsx
1907
+ var import_jsx_runtime28 = require("react/jsx-runtime");
1908
+
1909
+ // src/icons/menu/Copyable.tsx
1910
+ var import_jsx_runtime29 = require("react/jsx-runtime");
1911
+
1912
+ // src/icons/menu/CustomQuote.tsx
1913
+ var import_jsx_runtime30 = require("react/jsx-runtime");
1914
+
1915
+ // src/icons/menu/DeleteColumn.tsx
1916
+ var import_jsx_runtime31 = require("react/jsx-runtime");
1917
+
1918
+ // src/icons/menu/DeleteRow.tsx
1919
+ var import_jsx_runtime32 = require("react/jsx-runtime");
1920
+
1921
+ // src/icons/menu/Details.tsx
1922
+ var import_jsx_runtime33 = require("react/jsx-runtime");
1923
+
1924
+ // src/icons/menu/H2.tsx
1925
+ var import_jsx_runtime34 = require("react/jsx-runtime");
1926
+
1927
+ // src/icons/menu/H3.tsx
1928
+ var import_jsx_runtime35 = require("react/jsx-runtime");
1929
+
1930
+ // src/icons/menu/H4.tsx
1931
+ var import_jsx_runtime36 = require("react/jsx-runtime");
1932
+
1933
+ // src/icons/menu/H5.tsx
1934
+ var import_jsx_runtime37 = require("react/jsx-runtime");
1935
+
1936
+ // src/icons/menu/H6.tsx
1937
+ var import_jsx_runtime38 = require("react/jsx-runtime");
1938
+
1939
+ // src/icons/menu/Highlight.tsx
1940
+ var import_jsx_runtime39 = require("react/jsx-runtime");
1941
+
1942
+ // src/icons/menu/HorizontalRule.tsx
1943
+ var import_jsx_runtime40 = require("react/jsx-runtime");
1944
+
1945
+ // src/icons/menu/Italic.tsx
1946
+ var import_jsx_runtime41 = require("react/jsx-runtime");
1947
+
1948
+ // src/icons/menu/LinkOff.tsx
1949
+ var import_jsx_runtime42 = require("react/jsx-runtime");
1950
+
1951
+ // src/icons/menu/Link.tsx
1952
+ var import_jsx_runtime43 = require("react/jsx-runtime");
1953
+
1954
+ // src/icons/menu/Math.tsx
1955
+ var import_jsx_runtime44 = require("react/jsx-runtime");
1956
+
1957
+ // src/icons/menu/MergeCells.tsx
1958
+ var import_jsx_runtime45 = require("react/jsx-runtime");
1959
+
1960
+ // src/icons/menu/MythReality.tsx
1961
+ var import_jsx_runtime46 = require("react/jsx-runtime");
1962
+
1963
+ // src/icons/menu/OrderedList.tsx
1964
+ var import_jsx_runtime47 = require("react/jsx-runtime");
1965
+
1966
+ // src/icons/menu/Prompt.tsx
1967
+ var import_jsx_runtime48 = require("react/jsx-runtime");
1968
+
1969
+ // src/icons/menu/Redo.tsx
1970
+ var import_jsx_runtime49 = require("react/jsx-runtime");
1971
+
1972
+ // src/icons/menu/SplitCells.tsx
1973
+ var import_jsx_runtime50 = require("react/jsx-runtime");
1974
+
1975
+ // src/icons/menu/Strikethrough.tsx
1976
+ var import_jsx_runtime51 = require("react/jsx-runtime");
1977
+
1978
+ // src/icons/menu/Subscript.tsx
1979
+ var import_jsx_runtime52 = require("react/jsx-runtime");
1980
+
1981
+ // src/icons/menu/Superscript.tsx
1982
+ var import_jsx_runtime53 = require("react/jsx-runtime");
1983
+
1984
+ // src/icons/menu/TableColumnHeading.tsx
1985
+ var import_jsx_runtime54 = require("react/jsx-runtime");
1986
+
1987
+ // src/icons/menu/TableRowHeading.tsx
1988
+ var import_jsx_runtime55 = require("react/jsx-runtime");
1989
+
1990
+ // src/icons/menu/Table.tsx
1991
+ var import_jsx_runtime56 = require("react/jsx-runtime");
1992
+
1993
+ // src/icons/menu/TextColor.tsx
1994
+ var import_jsx_runtime57 = require("react/jsx-runtime");
1995
+
1996
+ // src/icons/menu/Underline.tsx
1997
+ var import_jsx_runtime58 = require("react/jsx-runtime");
1998
+
1999
+ // src/icons/menu/Undo.tsx
2000
+ var import_jsx_runtime59 = require("react/jsx-runtime");
2001
+
2002
+ // src/icons/menu/Video.tsx
2003
+ var import_jsx_runtime60 = require("react/jsx-runtime");
2004
+
2005
+ // src/extensions/views/components/copy-button.tsx
2006
+ var import_jsx_runtime61 = require("react/jsx-runtime");
2007
+ var CopyButton = ({ iconSize = 16, color = "black" }) => {
2008
+ return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
2009
+ "button",
2010
+ {
2011
+ className: `copy-button copy-icon-${color}`,
2012
+ "data-copy-action": "copy",
2013
+ type: "button",
2014
+ children: [
2015
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
2016
+ "span",
2017
+ {
2018
+ className: "copy-icon",
2019
+ "data-copy-icon": "default",
2020
+ children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
2021
+ Copy_default,
2022
+ {
2023
+ width: iconSize,
2024
+ height: iconSize
2025
+ }
2026
+ )
2027
+ }
2028
+ ),
2029
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
2030
+ "span",
2031
+ {
2032
+ className: "copy-icon-success",
2033
+ "data-copy-icon": "success",
2034
+ style: { display: "none" },
2035
+ children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
2036
+ Check_default,
2037
+ {
2038
+ width: iconSize,
2039
+ height: iconSize
2040
+ }
2041
+ )
2042
+ }
2043
+ )
2044
+ ]
2045
+ }
2046
+ );
2047
+ };
2048
+
2049
+ // src/extensions/views/components/code-block.tsx
2050
+ var import_jsx_runtime62 = require("react/jsx-runtime");
2051
+ var CodeBlock = ({
2052
+ language,
2053
+ isEditable,
2054
+ onLanguageChange,
2055
+ children,
2056
+ translations
2057
+ }) => {
2058
+ const languagesList = (0, import_react.useMemo)(() => {
2059
+ const lowlight2 = (0, import_lowlight2.createLowlight)(import_lowlight2.common);
2060
+ lowlight2.register("html", import_xml2.default);
2061
+ const list = lowlight2.listLanguages();
2062
+ return list.sort();
2063
+ }, []);
2064
+ const handleChange = (e) => {
2065
+ onLanguageChange?.(e.target.value);
2066
+ };
2067
+ return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "tiptap-code-block-wrapper", children: [
2068
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "tiptap-code-block-header", children: [
2069
+ isEditable ? /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
2070
+ "select",
2071
+ {
2072
+ className: "tiptap-code-block-language-select",
2073
+ value: language,
2074
+ onChange: handleChange,
2075
+ children: [
2076
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("option", { value: "", children: translations?.codeBlock.selectLanguage }),
2077
+ languagesList.map((lang) => /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
2078
+ "option",
2079
+ {
2080
+ value: lang,
2081
+ children: lang
2082
+ },
2083
+ lang
2084
+ ))
2085
+ ]
2086
+ }
2087
+ ) : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "tiptap-code-block-language-text", children: language || translations?.codeBlock.selectLanguage }),
2088
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
2089
+ CopyButton,
2090
+ {
2091
+ iconSize: 20,
2092
+ color: "white"
2093
+ }
2094
+ )
2095
+ ] }),
2096
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("pre", { className: "tiptap-code-block", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
2097
+ "code",
2098
+ {
2099
+ className: "tiptap-code-block-content",
2100
+ "data-copy-content": true,
2101
+ children
2102
+ }
2103
+ ) })
2104
+ ] });
2105
+ };
2106
+
2107
+ // src/extensions/views/components/copyable-text.tsx
2108
+ var import_jsx_runtime63 = require("react/jsx-runtime");
2109
+ var CopyableText2 = ({ children }) => {
2110
+ return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("span", { className: "copyable", children: [
2111
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { "data-copy-content": true, children }),
2112
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(CopyButton, { iconSize: 16 })
2113
+ ] });
2114
+ };
2115
+
2116
+ // src/extensions/views/components/custom-quote.tsx
2117
+ var import_jsx_runtime64 = require("react/jsx-runtime");
2118
+ var CustomQuote = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { "data-custom-quote": "", children: [
2119
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "custom-quote-divider" }),
2120
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "custom-quote-svg-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Quote_default, {}) }),
2121
+ children
2122
+ ] });
2123
+ var CustomQuoteText = ({ children, isEmpty, placeholder }) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
2124
+ "div",
2125
+ {
2126
+ "data-custom-quote-text": true,
2127
+ className: isEmpty ? "is-empty" : "",
2128
+ "data-placeholder": placeholder,
2129
+ children
2130
+ }
2131
+ );
2132
+ var CustomQuoteAuthor = ({ children, isEmpty, placeholder }) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
2133
+ "div",
2134
+ {
2135
+ "data-custom-quote-author": "",
2136
+ className: isEmpty ? "is-empty" : "",
2137
+ "data-placeholder": placeholder,
2138
+ children
2139
+ }
2140
+ );
2141
+ var CustomQuoteSign = ({ children, isEmpty, placeholder }) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
2142
+ "div",
2143
+ {
2144
+ "data-custom-quote-sign": "",
2145
+ className: isEmpty ? "is-empty" : "",
2146
+ "data-placeholder": placeholder,
2147
+ children
2148
+ }
2149
+ );
2150
+
2151
+ // src/extensions/views/components/figure.tsx
2152
+ var import_jsx_runtime65 = require("react/jsx-runtime");
2153
+ var Figure = ({
2154
+ src,
2155
+ alt,
2156
+ title,
2157
+ caption,
2158
+ width,
2159
+ height,
2160
+ isEditable,
2161
+ onEditClick,
2162
+ children,
2163
+ fileId,
2164
+ getImageById
2165
+ }) => {
2166
+ const resolvedSrc = resolveImageSrc({ fileId, src }, { getImageById });
2167
+ return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("figure", { children: [
2168
+ resolvedSrc && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "figure-image-container", children: [
2169
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
2170
+ "img",
2171
+ {
2172
+ src: resolvedSrc,
2173
+ alt: alt || "",
2174
+ title,
2175
+ width: width || void 0,
2176
+ height: height || void 0
2177
+ }
2178
+ ),
2179
+ isEditable && onEditClick && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
2180
+ "button",
2181
+ {
2182
+ type: "button",
2183
+ className: "figure-edit-button",
2184
+ onClick: onEditClick,
2185
+ contentEditable: false,
2186
+ "aria-label": "\u0420\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435",
2187
+ children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Edit_default, {})
2188
+ }
2189
+ )
2190
+ ] }),
2191
+ caption && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("figcaption", { children: caption }),
2192
+ children
2193
+ ] });
2194
+ };
2195
+
2196
+ // src/extensions/views/components/prompt.tsx
2197
+ var import_jsx_runtime66 = require("react/jsx-runtime");
2198
+ var PromptHeader = ({ children, isEmpty, placeholder }) => /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "prompt-header-wrapper", children: [
2199
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
2200
+ "div",
2201
+ {
2202
+ className: isEmpty ? "is-empty" : "",
2203
+ "data-placeholder": placeholder,
2204
+ children
2205
+ }
2206
+ ),
2207
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { className: "prompt-copy-icon-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
2208
+ CopyButton,
2209
+ {
2210
+ iconSize: 16,
2211
+ color: "prompt"
2212
+ }
2213
+ ) })
2214
+ ] });
2215
+ var PromptContent = ({ children, isEmpty, placeholder }) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "prompt-content-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
2216
+ "div",
2217
+ {
2218
+ className: isEmpty ? "is-empty" : "",
2219
+ "data-placeholder": placeholder,
2220
+ "data-copy-content": true,
2221
+ children
2222
+ }
2223
+ ) });
2224
+
2225
+ // src/utils/detect-video-hosting.ts
2226
+ var VIDEO_PATTERNS = {
2227
+ youtube: /(?:https?:\/\/)?(?:www\.)?(?:youtube\.com|youtu\.be)\/(?:watch\?v=|shorts\/)?([a-zA-Z0-9_-]{11})/,
2228
+ youtubeEmbed: /(?:https?:\/\/)?(?:www\.)?(?:youtube\.com|youtube-nocookie\.com)\/embed\/([a-zA-Z0-9_-]{11})/,
2229
+ vimeo: /(?:http|https)?:\/\/(?:www\.)?vimeo\.com\/(?:channels\/(?:\w+\/)?|groups\/(?:[^/]*)?\/videos\/)?(\d+)(?:|\/\?)/,
2230
+ rutube: /^https:\/\/rutube\.ru\/video\/([\w-]+)/,
2231
+ vk: /(?:https?:\/\/)?(?:vk\.com|vkvideo\.ru)\/video(-?\d+)_(\d+)/
2232
+ };
2233
+ var detectVideoHosting = (src) => {
2234
+ if (!src || typeof src !== "string") {
2235
+ return null;
2236
+ }
2237
+ const cleanSrc = src.trim();
2238
+ if (!cleanSrc) {
2239
+ return null;
2240
+ }
2241
+ try {
2242
+ const youTubeEmbedMatch = VIDEO_PATTERNS.youtubeEmbed.exec(cleanSrc);
2243
+ if (youTubeEmbedMatch?.[1]) {
2244
+ const videoId = youTubeEmbedMatch[1];
2245
+ return {
2246
+ hosting: "youtube" /* Youtube */,
2247
+ videoId,
2248
+ embedUrl: `https://www.youtube-nocookie.com/embed/${videoId}`
2249
+ };
2250
+ }
2251
+ const youTubeMatch = VIDEO_PATTERNS.youtube.exec(cleanSrc);
2252
+ if (youTubeMatch?.[1]) {
2253
+ const videoId = youTubeMatch[1];
2254
+ return {
2255
+ hosting: "youtube" /* Youtube */,
2256
+ videoId,
2257
+ embedUrl: `https://www.youtube-nocookie.com/embed/${videoId}`
2258
+ };
2259
+ }
2260
+ const vimeoMatch = VIDEO_PATTERNS.vimeo.exec(cleanSrc);
2261
+ if (vimeoMatch?.[1]) {
2262
+ const videoId = vimeoMatch[1];
2263
+ const hashRegex = /\/(\d+)\/([a-fA-F0-9]+)/;
2264
+ const hashMatch = hashRegex.exec(cleanSrc);
2265
+ const hash = hashMatch?.[2] || null;
2266
+ const hashParam = hash ? `?h=${hash}` : "";
2267
+ return {
2268
+ hosting: "vimeo" /* Vimeo */,
2269
+ videoId,
2270
+ embedUrl: `https://player.vimeo.com/video/${videoId}${hashParam}`
2271
+ };
2272
+ }
2273
+ const ruTubeMatch = VIDEO_PATTERNS.rutube.exec(cleanSrc);
2274
+ if (ruTubeMatch?.[1]) {
2275
+ const videoId = ruTubeMatch[1];
2276
+ return {
2277
+ hosting: "rutube" /* Rutube */,
2278
+ videoId,
2279
+ embedUrl: `https://rutube.ru/play/embed/${videoId}`
2280
+ };
2281
+ }
2282
+ const vkMatch = VIDEO_PATTERNS.vk.exec(cleanSrc);
2283
+ if (vkMatch?.[1] && vkMatch?.[2]) {
2284
+ const videoId = `${vkMatch[1]}_${vkMatch[2]}`;
2285
+ return {
2286
+ hosting: "vk" /* VK */,
2287
+ videoId,
2288
+ embedUrl: `https://vk.com/video_ext.php?oid=${vkMatch[1]}&id=${vkMatch[2]}`
2289
+ };
2290
+ }
2291
+ } catch {
2292
+ }
2293
+ return null;
2294
+ };
2295
+
2296
+ // src/extensions/views/components/video.tsx
2297
+ var import_jsx_runtime67 = require("react/jsx-runtime");
2298
+ var Video = ({ src, children }) => {
2299
+ const videoInfo = detectVideoHosting(src);
2300
+ if (!videoInfo?.embedUrl) {
2301
+ return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "video-node", children: [
2302
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: "video-error", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { children: "Unsupported or invalid video URL" }) }),
2303
+ children
2304
+ ] });
2305
+ }
2306
+ return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
2307
+ "div",
2308
+ {
2309
+ className: "video-node",
2310
+ "data-video": "",
2311
+ children: [
2312
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: "video-player-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
2313
+ "iframe",
2314
+ {
2315
+ className: "video-iframe",
2316
+ src: videoInfo?.embedUrl,
2317
+ title: "Video Player",
2318
+ allow: "autoplay; encrypted-media",
2319
+ allowFullScreen: true
2320
+ }
2321
+ ) }),
2322
+ children
2323
+ ]
2324
+ }
2325
+ );
2326
+ };
2327
+
2328
+ // src/render/static-renderer-config.tsx
2329
+ var import_jsx_runtime68 = require("react/jsx-runtime");
2330
+ var getNodeMapping = (getImageById) => ({
2331
+ callout({ node, children }) {
2332
+ return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Callout, { ...node.attrs, children });
2333
+ },
2334
+ codeBlock({ node, children }) {
2335
+ const language = node.attrs.language || "";
2336
+ let codeText = "";
2337
+ if (Array.isArray(children)) {
2338
+ codeText = children.map((child) => {
2339
+ if (child?.props?.node?.text) {
2340
+ return child.props.node.text;
2341
+ }
2342
+ return "";
2343
+ }).join("");
2344
+ }
2345
+ let highlightedHtml = "";
2346
+ try {
2347
+ if (!language) {
2348
+ highlightedHtml = import_common.default.highlightAuto(codeText).value;
2349
+ } else {
2350
+ highlightedHtml = import_common.default.highlight(codeText, { language }).value;
2351
+ }
2352
+ } catch (error) {
2353
+ console.warn(`Failed to highlight code for language "${language}":`, error);
2354
+ highlightedHtml = codeText.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
2355
+ }
2356
+ return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
2357
+ CodeBlock,
2358
+ {
2359
+ language,
2360
+ isEditable: false,
2361
+ children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("code", { dangerouslySetInnerHTML: { __html: highlightedHtml } })
2362
+ }
2363
+ );
2364
+ },
2365
+ customQuote({ children }) {
2366
+ return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(CustomQuote, { children });
2367
+ },
2368
+ customQuoteText({ children }) {
2369
+ return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(CustomQuoteText, { children });
2370
+ },
2371
+ customQuoteAuthor({ children }) {
2372
+ return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(CustomQuoteAuthor, { children });
2373
+ },
2374
+ customQuoteSign({ children }) {
2375
+ return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(CustomQuoteSign, { children });
2376
+ },
2377
+ promptHeader({ children }) {
2378
+ return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(PromptHeader, { children });
2379
+ },
2380
+ promptContent({ children }) {
2381
+ return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(PromptContent, { children });
2382
+ },
2383
+ video({ node }) {
2384
+ return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Video, { src: node.attrs.src });
2385
+ },
2386
+ figure({ node }) {
2387
+ return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Figure, { ...node.attrs, getImageById });
2388
+ },
2389
+ image({ node }) {
2390
+ return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Figure, { ...node.attrs, getImageById });
2391
+ },
2392
+ inlineMath({ node }) {
2393
+ const latex = node.attrs.latex || "";
2394
+ let html3 = "";
2395
+ try {
2396
+ html3 = import_katex.default.renderToString(latex, {
2397
+ throwOnError: false,
2398
+ output: "html"
2399
+ });
2400
+ } catch (error) {
2401
+ console.warn("KaTeX rendering error for inline math:", error);
2402
+ }
2403
+ return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
2404
+ "span",
2405
+ {
2406
+ className: "react-renderer node-inlineMath",
2407
+ dangerouslySetInnerHTML: { __html: html3 || latex }
2408
+ }
2409
+ );
2410
+ },
2411
+ // Block math (KaTeX) - from @tiptap/extension-mathematics
2412
+ blockMath({ node }) {
2413
+ const latex = node.attrs.latex || "";
2414
+ let html3 = "";
2415
+ try {
2416
+ html3 = import_katex.default.renderToString(latex, {
2417
+ throwOnError: false,
2418
+ output: "html",
2419
+ displayMode: true
2420
+ });
2421
+ } catch (error) {
2422
+ console.warn("KaTeX rendering error for block math:", error);
2423
+ }
2424
+ return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "react-renderer node-blockMath", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
2425
+ "div",
2426
+ {
2427
+ className: "tiptap-mathematics-render",
2428
+ "data-type": "math",
2429
+ "data-mode": "block",
2430
+ dangerouslySetInnerHTML: { __html: html3 || latex }
2431
+ }
2432
+ ) });
2433
+ },
2434
+ inlineLatex({ node }) {
2435
+ const latex = node.attrs.latex || "";
2436
+ let html3 = "";
2437
+ try {
2438
+ html3 = import_katex.default.renderToString(latex, {
2439
+ throwOnError: false,
2440
+ output: "html"
2441
+ });
2442
+ } catch (error) {
2443
+ console.warn("KaTeX rendering error for inline latex:", error);
2444
+ }
2445
+ return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
2446
+ "span",
2447
+ {
2448
+ className: "react-renderer node-inlineLatex inline-latex",
2449
+ dangerouslySetInnerHTML: { __html: html3 || latex }
2450
+ }
2451
+ );
2452
+ },
2453
+ /*
2454
+ COMPATABILITY
2455
+ */
2456
+ calloutAlert({ node, children }) {
2457
+ const type = node.attrs.type || "info";
2458
+ return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Callout, { type, children });
2459
+ },
2460
+ calloutTip({ node, children }) {
2461
+ const type = node.attrs.type || "info";
2462
+ return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Callout, { type, children });
2463
+ },
2464
+ customQuoteV2({ children }) {
2465
+ return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(CustomQuote, { children });
2466
+ },
2467
+ promptV2Header({ children }) {
2468
+ return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(PromptHeader, { children });
2469
+ },
2470
+ promptV2Content({ children }) {
2471
+ return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(PromptContent, { children });
2472
+ }
2473
+ });
2474
+ var nodeMapping = getNodeMapping();
2475
+ var markMapping = {
2476
+ "copyable-text"({ children }) {
2477
+ return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(CopyableText2, { children });
2478
+ }
2479
+ };
2480
+
2481
+ // src/render/tiptap-render.tsx
2482
+ var import_github_dark = require("highlight.js/styles/github-dark.css");
2483
+ var import_katex_min = require("katex/dist/katex.min.css");
2484
+ var import_jsx_runtime69 = require("react/jsx-runtime");
2485
+ function renderTiptapToReact(content, getImageById) {
2486
+ let parsedContent;
2487
+ try {
2488
+ if (typeof content === "string") {
2489
+ parsedContent = JSON.parse(content);
2490
+ } else {
2491
+ parsedContent = content;
2492
+ }
2493
+ } catch (error) {
2494
+ console.warn("Failed to parse Tiptap content:", error);
2495
+ parsedContent = { type: "doc", content: [{ type: "paragraph" }] };
2496
+ }
2497
+ const rendered = (0, import_react2.renderToReactElement)({
2498
+ extensions: getRenderExtensions(),
2499
+ content: parsedContent,
2500
+ options: {
2501
+ nodeMapping: getNodeMapping(getImageById),
2502
+ markMapping
2503
+ }
2504
+ });
2505
+ return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
2506
+ "div",
2507
+ {
2508
+ className: "tiptap",
2509
+ "data-tiptap-render": true,
2510
+ children: rendered
2511
+ }
2512
+ );
2513
+ }
2514
+ function TiptapRender({ content, getImageById }) {
2515
+ return renderTiptapToReact(content, getImageById);
2516
+ }
2517
+ // Annotate the CommonJS export names for ESM import in node:
2518
+ 0 && (module.exports = {
2519
+ TiptapRender
2520
+ });
2521
+ //# sourceMappingURL=render.js.map