@cyberyozh/text-editor 0.3.2 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/editor.css +35 -43
  2. package/dist/editor.css.map +1 -1
  3. package/dist/editor.d.mts +20 -2
  4. package/dist/editor.d.ts +20 -2
  5. package/dist/editor.js +397 -327
  6. package/dist/editor.js.map +1 -1
  7. package/dist/editor.mjs +320 -246
  8. package/dist/editor.mjs.map +1 -1
  9. package/dist/render.d.mts +9 -1
  10. package/dist/render.d.ts +9 -1
  11. package/dist/render.js +40 -10
  12. package/dist/render.js.map +1 -1
  13. package/dist/render.mjs +45 -11
  14. package/dist/render.mjs.map +1 -1
  15. package/dist/styles/index.css +35 -43
  16. package/package.json +1 -1
  17. package/src/editor/components/dialog-error/dialog-error.css +35 -0
  18. package/src/editor/components/dialog-error/dialog-error.tsx +65 -0
  19. package/src/editor/components/dialog-error/index.ts +1 -0
  20. package/src/editor/components/index.ts +1 -0
  21. package/src/editor/dialogs/add-link-dialog/add-link-dialog.css +0 -9
  22. package/src/editor/dialogs/add-link-dialog/add-link-dialog.tsx +2 -2
  23. package/src/editor/dialogs/add-video-dialog/add-video-dialog.css +0 -9
  24. package/src/editor/dialogs/add-video-dialog/add-video-dialog.tsx +2 -2
  25. package/src/editor/dialogs/image-dialog/image-dialog.css +1 -29
  26. package/src/editor/dialogs/image-dialog/image-dialog.tsx +7 -13
  27. package/src/editor/editor.tsx +8 -0
  28. package/src/editor/index.ts +1 -0
  29. package/src/extensions/base/link.test.ts +60 -0
  30. package/src/extensions/base/link.ts +61 -9
  31. package/src/extensions/editor/get-editor-extensions.ts +3 -1
  32. package/src/styles/components.css +1 -0
  33. package/src/translations/en.json +4 -4
  34. package/src/translations/ru.json +4 -4
  35. package/src/types/common.ts +3 -0
  36. package/src/types/index.ts +1 -0
  37. package/src/utils/get-shared-extensions.ts +20 -4
  38. package/src/utils/html-to-tiptap-content.ts +13 -4
  39. package/src/utils/index.ts +1 -0
  40. package/src/utils/is-combined-error.ts +9 -0
package/dist/editor.mjs CHANGED
@@ -1446,6 +1446,11 @@ function pluralize(count, forms) {
1446
1446
  return forms[2];
1447
1447
  }
1448
1448
 
1449
+ // src/utils/is-combined-error.ts
1450
+ function isCombinedError(error) {
1451
+ return error instanceof Error && Array.isArray(error?.cause) && error.cause.length > 0 && error.cause.every((e) => e instanceof Error);
1452
+ }
1453
+
1449
1454
  // src/editor/controls/character-count.tsx
1450
1455
  import { jsx as jsx62, jsxs as jsxs14 } from "react/jsx-runtime";
1451
1456
  var CharacterCount = ({ editor }) => {
@@ -1861,6 +1866,43 @@ var CommonModal = ({ open, handleClose, children }) => {
1861
1866
  );
1862
1867
  };
1863
1868
 
1869
+ // src/editor/components/dialog-error/dialog-error.tsx
1870
+ import { useMemo } from "react";
1871
+ import { jsx as jsx67, jsxs as jsxs18 } from "react/jsx-runtime";
1872
+ var DialogError = ({ error, onClose, className }) => {
1873
+ const translations2 = useTiptapTranslations();
1874
+ const renderedMessage = useMemo(() => {
1875
+ if (typeof error === "string") {
1876
+ return error || translations2.common.unknownError;
1877
+ }
1878
+ if (isCombinedError(error)) {
1879
+ const safeErrors = error.cause.filter((e) => Boolean(e.message));
1880
+ const errorsToDisplay = safeErrors.length === error.cause.length ? safeErrors : [new Error(translations2.common.unknownError), ...safeErrors];
1881
+ if (errorsToDisplay.length === 1) {
1882
+ return errorsToDisplay[0].message;
1883
+ }
1884
+ return /* @__PURE__ */ jsx67("ul", { className: "dialog-error-list", children: errorsToDisplay.map((cause, index) => /* @__PURE__ */ jsx67("li", { children: cause.message }, `${index}_${cause.message}`)) });
1885
+ }
1886
+ if (error instanceof Error) {
1887
+ return error.message || translations2.common.unknownError;
1888
+ }
1889
+ return translations2.common.unknownError;
1890
+ }, [error, translations2]);
1891
+ return /* @__PURE__ */ jsxs18("div", { className: `dialog-error ${className || ""}`, children: [
1892
+ renderedMessage,
1893
+ onClose && /* @__PURE__ */ jsx67(
1894
+ "button",
1895
+ {
1896
+ type: "button",
1897
+ className: "dialog-error-clear-button",
1898
+ onClick: onClose,
1899
+ "aria-label": translations2.common.clearError,
1900
+ children: /* @__PURE__ */ jsx67(X_default, {})
1901
+ }
1902
+ )
1903
+ ] });
1904
+ };
1905
+
1864
1906
  // src/utils/image-src-resolver.ts
1865
1907
  function resolveImageSrc(attrs, options) {
1866
1908
  const { fileId, src } = attrs;
@@ -1884,7 +1926,7 @@ function resolveImageSrc(attrs, options) {
1884
1926
  }
1885
1927
 
1886
1928
  // src/editor/dialogs/image-dialog/image-dialog.tsx
1887
- import { Fragment as Fragment2, jsx as jsx67, jsxs as jsxs18 } from "react/jsx-runtime";
1929
+ import { Fragment as Fragment2, jsx as jsx68, jsxs as jsxs19 } from "react/jsx-runtime";
1888
1930
  var ImageDialog = ({
1889
1931
  open,
1890
1932
  onClose,
@@ -2042,7 +2084,7 @@ var ImageDialog = ({
2042
2084
  });
2043
2085
  handleClose();
2044
2086
  } catch (error) {
2045
- setFileUploadError(error instanceof Error ? error : new Error(translations2.imageDialog.unknownError));
2087
+ setFileUploadError(error instanceof Error ? error : new Error(translations2.common.unknownError));
2046
2088
  } finally {
2047
2089
  setIsUploading(false);
2048
2090
  }
@@ -2070,27 +2112,27 @@ var ImageDialog = ({
2070
2112
  const dialogTitle = isAddMode ? translations2.imageDialog.addTitle : translations2.imageDialog.editTitle;
2071
2113
  const saveButtonText = isAddMode ? translations2.imageDialog.add : translations2.imageDialog.save;
2072
2114
  const dragPlaceholder = dragActive ? translations2.imageUpload.dragActive : translations2.imageUpload.dragInactive;
2073
- return /* @__PURE__ */ jsxs18(
2115
+ return /* @__PURE__ */ jsxs19(
2074
2116
  CommonModal,
2075
2117
  {
2076
2118
  open,
2077
2119
  handleClose,
2078
2120
  children: [
2079
- /* @__PURE__ */ jsx67("p", { className: "image-dialog-title", children: dialogTitle }),
2080
- /* @__PURE__ */ jsx67("hr", { className: "image-dialog-divider" }),
2081
- /* @__PURE__ */ jsx67("div", { className: "image-dialog-form-container", children: /* @__PURE__ */ jsxs18("div", { className: "image-dialog-form", children: [
2082
- hasImage ? /* @__PURE__ */ jsxs18("div", { className: "image-dialog-preview-wrapper", children: [
2083
- isAddMode && /* @__PURE__ */ jsx67(
2121
+ /* @__PURE__ */ jsx68("p", { className: "image-dialog-title", children: dialogTitle }),
2122
+ /* @__PURE__ */ jsx68("hr", { className: "image-dialog-divider" }),
2123
+ /* @__PURE__ */ jsx68("div", { className: "image-dialog-form-container", children: /* @__PURE__ */ jsxs19("div", { className: "image-dialog-form", children: [
2124
+ hasImage ? /* @__PURE__ */ jsxs19("div", { className: "image-dialog-preview-wrapper", children: [
2125
+ isAddMode && /* @__PURE__ */ jsx68(
2084
2126
  "button",
2085
2127
  {
2086
2128
  type: "button",
2087
2129
  className: "image-dialog-delete-button",
2088
2130
  onClick: clearImageFormFields,
2089
2131
  "aria-label": translations2.media.deleteImage,
2090
- children: /* @__PURE__ */ jsx67(X_default, {})
2132
+ children: /* @__PURE__ */ jsx68(X_default, {})
2091
2133
  }
2092
2134
  ),
2093
- /* @__PURE__ */ jsx67(
2135
+ /* @__PURE__ */ jsx68(
2094
2136
  "img",
2095
2137
  {
2096
2138
  src: formState.fileUrl,
@@ -2100,7 +2142,7 @@ var ImageDialog = ({
2100
2142
  className: "image-dialog-preview"
2101
2143
  }
2102
2144
  )
2103
- ] }) : isAddMode && /* @__PURE__ */ jsxs18(
2145
+ ] }) : isAddMode && /* @__PURE__ */ jsxs19(
2104
2146
  "div",
2105
2147
  {
2106
2148
  className: `image-dialog-drag-area ${dragActive ? "image-dialog-drag-area-active" : ""}`,
@@ -2110,7 +2152,7 @@ var ImageDialog = ({
2110
2152
  onDragLeave: handleDragLeave,
2111
2153
  onDrop: handleDrop,
2112
2154
  children: [
2113
- /* @__PURE__ */ jsx67(
2155
+ /* @__PURE__ */ jsx68(
2114
2156
  "input",
2115
2157
  {
2116
2158
  type: "file",
@@ -2121,12 +2163,12 @@ var ImageDialog = ({
2121
2163
  accept: "image/*"
2122
2164
  }
2123
2165
  ),
2124
- /* @__PURE__ */ jsx67("p", { style: { textAlign: "center" }, children: dragPlaceholder })
2166
+ /* @__PURE__ */ jsx68("p", { style: { textAlign: "center" }, children: dragPlaceholder })
2125
2167
  ]
2126
2168
  }
2127
2169
  ),
2128
- hasImage && /* @__PURE__ */ jsxs18(Fragment2, { children: [
2129
- /* @__PURE__ */ jsx67(
2170
+ hasImage && /* @__PURE__ */ jsxs19(Fragment2, { children: [
2171
+ /* @__PURE__ */ jsx68(
2130
2172
  Input,
2131
2173
  {
2132
2174
  label: translations2.media.imageTitle,
@@ -2134,7 +2176,7 @@ var ImageDialog = ({
2134
2176
  onChange: (e) => setFormState((prev) => ({ ...prev, title: e.target.value }))
2135
2177
  }
2136
2178
  ),
2137
- /* @__PURE__ */ jsx67(
2179
+ /* @__PURE__ */ jsx68(
2138
2180
  Input,
2139
2181
  {
2140
2182
  label: translations2.media.imageAlt,
@@ -2142,7 +2184,7 @@ var ImageDialog = ({
2142
2184
  onChange: (e) => setFormState((prev) => ({ ...prev, alt: e.target.value }))
2143
2185
  }
2144
2186
  ),
2145
- /* @__PURE__ */ jsx67(
2187
+ /* @__PURE__ */ jsx68(
2146
2188
  Input,
2147
2189
  {
2148
2190
  label: translations2.imageDialog.captionLabel,
@@ -2153,21 +2195,16 @@ var ImageDialog = ({
2153
2195
  )
2154
2196
  ] })
2155
2197
  ] }) }),
2156
- fileUploadError && /* @__PURE__ */ jsxs18("div", { className: "image-dialog-error", children: [
2157
- fileUploadError.message || translations2.imageDialog.unknownError,
2158
- /* @__PURE__ */ jsx67(
2159
- "button",
2160
- {
2161
- type: "button",
2162
- className: "image-dialog-error-clear-button",
2163
- onClick: () => setFileUploadError(null),
2164
- "aria-label": translations2.imageDialog.clearError,
2165
- children: /* @__PURE__ */ jsx67(X_default, {})
2166
- }
2167
- )
2168
- ] }),
2169
- /* @__PURE__ */ jsxs18("div", { className: "image-dialog-actions", children: [
2170
- /* @__PURE__ */ jsx67(
2198
+ fileUploadError && /* @__PURE__ */ jsx68(
2199
+ DialogError,
2200
+ {
2201
+ error: fileUploadError,
2202
+ onClose: () => setFileUploadError(null),
2203
+ className: "image-dialog-error-spacing"
2204
+ }
2205
+ ),
2206
+ /* @__PURE__ */ jsxs19("div", { className: "image-dialog-actions", children: [
2207
+ /* @__PURE__ */ jsx68(
2171
2208
  Button,
2172
2209
  {
2173
2210
  type: "button",
@@ -2177,7 +2214,7 @@ var ImageDialog = ({
2177
2214
  children: translations2.common.cancel
2178
2215
  }
2179
2216
  ),
2180
- /* @__PURE__ */ jsx67(
2217
+ /* @__PURE__ */ jsx68(
2181
2218
  Button,
2182
2219
  {
2183
2220
  isLoading: isUploading,
@@ -2195,7 +2232,7 @@ var ImageDialog = ({
2195
2232
 
2196
2233
  // src/editor/dialogs/add-katex-dialog/add-katex-dialog.tsx
2197
2234
  import { useEffect as useEffect6, useRef as useRef7, useState as useState7 } from "react";
2198
- import { jsx as jsx68, jsxs as jsxs19 } from "react/jsx-runtime";
2235
+ import { jsx as jsx69, jsxs as jsxs20 } from "react/jsx-runtime";
2199
2236
  var AddKatexDialog = ({
2200
2237
  open,
2201
2238
  onClose,
@@ -2230,19 +2267,19 @@ var AddKatexDialog = ({
2230
2267
  handleSubmit();
2231
2268
  }
2232
2269
  };
2233
- return /* @__PURE__ */ jsxs19(
2270
+ return /* @__PURE__ */ jsxs20(
2234
2271
  CommonModal,
2235
2272
  {
2236
2273
  open,
2237
2274
  handleClose,
2238
2275
  children: [
2239
- /* @__PURE__ */ jsx68("p", { className: "katex-dialog-title", children: initialContent ? translations2.katex.editTitle : translations2.katex.addTitle }),
2240
- /* @__PURE__ */ jsx68("hr", { className: "katex-dialog-divider" }),
2241
- /* @__PURE__ */ jsxs19("div", { className: "katex-dialog-content", children: [
2242
- /* @__PURE__ */ jsxs19("p", { className: "katex-dialog-description", children: [
2276
+ /* @__PURE__ */ jsx69("p", { className: "katex-dialog-title", children: initialContent ? translations2.katex.editTitle : translations2.katex.addTitle }),
2277
+ /* @__PURE__ */ jsx69("hr", { className: "katex-dialog-divider" }),
2278
+ /* @__PURE__ */ jsxs20("div", { className: "katex-dialog-content", children: [
2279
+ /* @__PURE__ */ jsxs20("p", { className: "katex-dialog-description", children: [
2243
2280
  translations2.katex.description,
2244
2281
  " ",
2245
- /* @__PURE__ */ jsx68(
2282
+ /* @__PURE__ */ jsx69(
2246
2283
  "a",
2247
2284
  {
2248
2285
  href: "https://katex.org/docs/supported.html",
@@ -2254,8 +2291,8 @@ var AddKatexDialog = ({
2254
2291
  " ",
2255
2292
  translations2.katex.documentationLinkSuffix
2256
2293
  ] }),
2257
- /* @__PURE__ */ jsxs19("div", { className: "katex-dialog-form-group", children: [
2258
- /* @__PURE__ */ jsx68(
2294
+ /* @__PURE__ */ jsxs20("div", { className: "katex-dialog-form-group", children: [
2295
+ /* @__PURE__ */ jsx69(
2259
2296
  "label",
2260
2297
  {
2261
2298
  htmlFor: "katex-content",
@@ -2263,7 +2300,7 @@ var AddKatexDialog = ({
2263
2300
  children: translations2.katex.label
2264
2301
  }
2265
2302
  ),
2266
- /* @__PURE__ */ jsx68(
2303
+ /* @__PURE__ */ jsx69(
2267
2304
  "textarea",
2268
2305
  {
2269
2306
  ref: contentInputRef,
@@ -2278,8 +2315,8 @@ var AddKatexDialog = ({
2278
2315
  )
2279
2316
  ] })
2280
2317
  ] }),
2281
- /* @__PURE__ */ jsxs19("div", { className: "katex-dialog-actions", children: [
2282
- /* @__PURE__ */ jsx68(
2318
+ /* @__PURE__ */ jsxs20("div", { className: "katex-dialog-actions", children: [
2319
+ /* @__PURE__ */ jsx69(
2283
2320
  "button",
2284
2321
  {
2285
2322
  className: "katex-dialog-button-cancel",
@@ -2288,7 +2325,7 @@ var AddKatexDialog = ({
2288
2325
  children: translations2.common.cancel
2289
2326
  }
2290
2327
  ),
2291
- /* @__PURE__ */ jsx68(
2328
+ /* @__PURE__ */ jsx69(
2292
2329
  "button",
2293
2330
  {
2294
2331
  className: "katex-dialog-button-submit",
@@ -2305,7 +2342,7 @@ var AddKatexDialog = ({
2305
2342
 
2306
2343
  // src/editor/dialogs/add-link-dialog/add-link-dialog.tsx
2307
2344
  import { useEffect as useEffect7, useRef as useRef8, useState as useState8 } from "react";
2308
- import { jsx as jsx69, jsxs as jsxs20 } from "react/jsx-runtime";
2345
+ import { jsx as jsx70, jsxs as jsxs21 } from "react/jsx-runtime";
2309
2346
  var AddLinkDialog = ({
2310
2347
  open,
2311
2348
  onClose,
@@ -2385,17 +2422,17 @@ var AddLinkDialog = ({
2385
2422
  handleSubmit();
2386
2423
  }
2387
2424
  };
2388
- return /* @__PURE__ */ jsxs20(
2425
+ return /* @__PURE__ */ jsxs21(
2389
2426
  CommonModal,
2390
2427
  {
2391
2428
  open,
2392
2429
  handleClose,
2393
2430
  children: [
2394
- /* @__PURE__ */ jsx69("p", { className: "link-dialog-title", children: linkDialogContext?.href ? translations2.link.editLink : translations2.link.addLink }),
2395
- /* @__PURE__ */ jsx69("hr", { className: "link-dialog-divider" }),
2396
- /* @__PURE__ */ jsxs20("div", { className: "link-dialog-content", children: [
2397
- /* @__PURE__ */ jsxs20("div", { className: "link-dialog-form-group", children: [
2398
- /* @__PURE__ */ jsx69(
2431
+ /* @__PURE__ */ jsx70("p", { className: "link-dialog-title", children: linkDialogContext?.href ? translations2.link.editLink : translations2.link.addLink }),
2432
+ /* @__PURE__ */ jsx70("hr", { className: "link-dialog-divider" }),
2433
+ /* @__PURE__ */ jsxs21("div", { className: "link-dialog-content", children: [
2434
+ /* @__PURE__ */ jsxs21("div", { className: "link-dialog-form-group", children: [
2435
+ /* @__PURE__ */ jsx70(
2399
2436
  "label",
2400
2437
  {
2401
2438
  htmlFor: "link-title",
@@ -2403,7 +2440,7 @@ var AddLinkDialog = ({
2403
2440
  children: translations2.link.title
2404
2441
  }
2405
2442
  ),
2406
- /* @__PURE__ */ jsx69(
2443
+ /* @__PURE__ */ jsx70(
2407
2444
  "input",
2408
2445
  {
2409
2446
  ref: titleInputRef,
@@ -2417,8 +2454,8 @@ var AddLinkDialog = ({
2417
2454
  }
2418
2455
  )
2419
2456
  ] }),
2420
- /* @__PURE__ */ jsxs20("div", { className: "link-dialog-form-group", children: [
2421
- /* @__PURE__ */ jsx69(
2457
+ /* @__PURE__ */ jsxs21("div", { className: "link-dialog-form-group", children: [
2458
+ /* @__PURE__ */ jsx70(
2422
2459
  "label",
2423
2460
  {
2424
2461
  htmlFor: "link-url",
@@ -2426,7 +2463,7 @@ var AddLinkDialog = ({
2426
2463
  children: translations2.link.url
2427
2464
  }
2428
2465
  ),
2429
- /* @__PURE__ */ jsx69(
2466
+ /* @__PURE__ */ jsx70(
2430
2467
  "input",
2431
2468
  {
2432
2469
  id: "link-url",
@@ -2439,9 +2476,9 @@ var AddLinkDialog = ({
2439
2476
  }
2440
2477
  )
2441
2478
  ] }),
2442
- /* @__PURE__ */ jsxs20("div", { className: "link-dialog-form-group", children: [
2443
- /* @__PURE__ */ jsxs20("label", { className: "link-dialog-checkbox-label", children: [
2444
- /* @__PURE__ */ jsx69(
2479
+ /* @__PURE__ */ jsxs21("div", { className: "link-dialog-form-group", children: [
2480
+ /* @__PURE__ */ jsxs21("label", { className: "link-dialog-checkbox-label", children: [
2481
+ /* @__PURE__ */ jsx70(
2445
2482
  "input",
2446
2483
  {
2447
2484
  type: "checkbox",
@@ -2449,13 +2486,13 @@ var AddLinkDialog = ({
2449
2486
  onChange: (e) => setOpenInNewTab(e.target.checked)
2450
2487
  }
2451
2488
  ),
2452
- /* @__PURE__ */ jsx69("span", { children: translations2.link.openInNewTab })
2489
+ /* @__PURE__ */ jsx70("span", { children: translations2.link.openInNewTab })
2453
2490
  ] }),
2454
- /* @__PURE__ */ jsx69("p", { className: "link-dialog-help-text", children: translations2.link.openInNewTabHelp })
2491
+ /* @__PURE__ */ jsx70("p", { className: "link-dialog-help-text", children: translations2.link.openInNewTabHelp })
2455
2492
  ] }),
2456
- /* @__PURE__ */ jsxs20("div", { className: "link-dialog-form-group", children: [
2457
- /* @__PURE__ */ jsxs20("label", { className: "link-dialog-checkbox-label", children: [
2458
- /* @__PURE__ */ jsx69(
2493
+ /* @__PURE__ */ jsxs21("div", { className: "link-dialog-form-group", children: [
2494
+ /* @__PURE__ */ jsxs21("label", { className: "link-dialog-checkbox-label", children: [
2495
+ /* @__PURE__ */ jsx70(
2459
2496
  "input",
2460
2497
  {
2461
2498
  type: "checkbox",
@@ -2463,14 +2500,14 @@ var AddLinkDialog = ({
2463
2500
  onChange: (e) => setAddNoopener(e.target.checked)
2464
2501
  }
2465
2502
  ),
2466
- /* @__PURE__ */ jsx69("span", { children: translations2.link.addNofollow })
2503
+ /* @__PURE__ */ jsx70("span", { children: translations2.link.addNofollow })
2467
2504
  ] }),
2468
- /* @__PURE__ */ jsx69("p", { className: "link-dialog-help-text", children: translations2.link.addNofollowHelp })
2505
+ /* @__PURE__ */ jsx70("p", { className: "link-dialog-help-text", children: translations2.link.addNofollowHelp })
2469
2506
  ] }),
2470
- error && /* @__PURE__ */ jsx69("div", { className: "link-dialog-error", children: error })
2507
+ error && /* @__PURE__ */ jsx70(DialogError, { error })
2471
2508
  ] }),
2472
- /* @__PURE__ */ jsxs20("div", { className: "link-dialog-actions", children: [
2473
- /* @__PURE__ */ jsx69(
2509
+ /* @__PURE__ */ jsxs21("div", { className: "link-dialog-actions", children: [
2510
+ /* @__PURE__ */ jsx70(
2474
2511
  "button",
2475
2512
  {
2476
2513
  className: "link-dialog-button-cancel",
@@ -2479,7 +2516,7 @@ var AddLinkDialog = ({
2479
2516
  children: translations2.common.cancel
2480
2517
  }
2481
2518
  ),
2482
- /* @__PURE__ */ jsx69(
2519
+ /* @__PURE__ */ jsx70(
2483
2520
  "button",
2484
2521
  {
2485
2522
  className: "link-dialog-button-submit",
@@ -2569,7 +2606,7 @@ var detectVideoHosting = (src) => {
2569
2606
  };
2570
2607
 
2571
2608
  // src/editor/dialogs/add-video-dialog/add-video-dialog.tsx
2572
- import { jsx as jsx70, jsxs as jsxs21 } from "react/jsx-runtime";
2609
+ import { jsx as jsx71, jsxs as jsxs22 } from "react/jsx-runtime";
2573
2610
  var SUPPORTED_PLATFORMS = {
2574
2611
  ["youtube" /* Youtube */]: "YouTube",
2575
2612
  ["vimeo" /* Vimeo */]: "Vimeo",
@@ -2636,17 +2673,17 @@ var AddVideoDialog = ({ open, onClose, onVideoAdd }) => {
2636
2673
  handleSubmit();
2637
2674
  }
2638
2675
  };
2639
- return /* @__PURE__ */ jsxs21(
2676
+ return /* @__PURE__ */ jsxs22(
2640
2677
  CommonModal,
2641
2678
  {
2642
2679
  open,
2643
2680
  handleClose,
2644
2681
  children: [
2645
- /* @__PURE__ */ jsx70("p", { className: "video-dialog-title", children: translations2.videoUpload.title }),
2646
- /* @__PURE__ */ jsx70("hr", { className: "video-dialog-divider" }),
2647
- /* @__PURE__ */ jsxs21("div", { className: "video-dialog-content", children: [
2648
- /* @__PURE__ */ jsxs21("div", { className: "video-dialog-form-group", children: [
2649
- /* @__PURE__ */ jsx70(
2682
+ /* @__PURE__ */ jsx71("p", { className: "video-dialog-title", children: translations2.videoUpload.title }),
2683
+ /* @__PURE__ */ jsx71("hr", { className: "video-dialog-divider" }),
2684
+ /* @__PURE__ */ jsxs22("div", { className: "video-dialog-content", children: [
2685
+ /* @__PURE__ */ jsxs22("div", { className: "video-dialog-form-group", children: [
2686
+ /* @__PURE__ */ jsx71(
2650
2687
  "label",
2651
2688
  {
2652
2689
  htmlFor: "video-url",
@@ -2654,7 +2691,7 @@ var AddVideoDialog = ({ open, onClose, onVideoAdd }) => {
2654
2691
  children: translations2.videoUpload.urlLabel
2655
2692
  }
2656
2693
  ),
2657
- /* @__PURE__ */ jsx70(
2694
+ /* @__PURE__ */ jsx71(
2658
2695
  "input",
2659
2696
  {
2660
2697
  ref: urlInputRef,
@@ -2670,14 +2707,14 @@ var AddVideoDialog = ({ open, onClose, onVideoAdd }) => {
2670
2707
  }
2671
2708
  )
2672
2709
  ] }),
2673
- /* @__PURE__ */ jsxs21("div", { className: "video-dialog-help-text", children: [
2674
- /* @__PURE__ */ jsx70("p", { className: "video-dialog-help-title", children: translations2.videoUpload.supportedPlatforms }),
2675
- /* @__PURE__ */ jsx70("ul", { className: "video-dialog-platform-list", children: Object.entries(SUPPORTED_PLATFORMS).map(([key, name]) => /* @__PURE__ */ jsx70("li", { children: name }, key)) })
2710
+ /* @__PURE__ */ jsxs22("div", { className: "video-dialog-help-text", children: [
2711
+ /* @__PURE__ */ jsx71("p", { className: "video-dialog-help-title", children: translations2.videoUpload.supportedPlatforms }),
2712
+ /* @__PURE__ */ jsx71("ul", { className: "video-dialog-platform-list", children: Object.entries(SUPPORTED_PLATFORMS).map(([key, name]) => /* @__PURE__ */ jsx71("li", { children: name }, key)) })
2676
2713
  ] }),
2677
- error && /* @__PURE__ */ jsx70("div", { className: "video-dialog-error", children: error })
2714
+ error && /* @__PURE__ */ jsx71(DialogError, { error })
2678
2715
  ] }),
2679
- /* @__PURE__ */ jsxs21("div", { className: "video-dialog-actions", children: [
2680
- /* @__PURE__ */ jsx70(
2716
+ /* @__PURE__ */ jsxs22("div", { className: "video-dialog-actions", children: [
2717
+ /* @__PURE__ */ jsx71(
2681
2718
  "button",
2682
2719
  {
2683
2720
  className: "video-dialog-button-cancel",
@@ -2687,7 +2724,7 @@ var AddVideoDialog = ({ open, onClose, onVideoAdd }) => {
2687
2724
  children: translations2.videoUpload.cancel
2688
2725
  }
2689
2726
  ),
2690
- /* @__PURE__ */ jsx70(
2727
+ /* @__PURE__ */ jsx71(
2691
2728
  "button",
2692
2729
  {
2693
2730
  className: "video-dialog-button-submit",
@@ -4260,8 +4297,29 @@ var isSameDomain = (url) => {
4260
4297
  return false;
4261
4298
  }
4262
4299
  };
4300
+ var isTrustedDomain = (url, trustedDomains) => {
4301
+ try {
4302
+ const { hostname } = new URL(url);
4303
+ if (typeof window !== "undefined" && hostname === window.location.hostname) {
4304
+ return true;
4305
+ }
4306
+ return trustedDomains.some((trusted) => {
4307
+ const domain2 = trusted.toLowerCase();
4308
+ return hostname === domain2 || hostname.endsWith(`.${domain2}`);
4309
+ });
4310
+ } catch {
4311
+ return false;
4312
+ }
4313
+ };
4263
4314
  var LinkExtension = Link.extend({
4315
+ addOptions() {
4316
+ return {
4317
+ ...this.parent?.() ?? {},
4318
+ trustedDomains: []
4319
+ };
4320
+ },
4264
4321
  addAttributes() {
4322
+ const { trustedDomains } = this.options;
4265
4323
  return {
4266
4324
  ...this.parent?.(),
4267
4325
  target: {
@@ -4275,7 +4333,7 @@ var LinkExtension = Link.extend({
4275
4333
  default: null,
4276
4334
  parseHTML: (element) => {
4277
4335
  const href = element.getAttribute("href") ?? "";
4278
- return isSameDomain(href) ? null : "noopener noreferrer nofollow";
4336
+ return isTrustedDomain(href, trustedDomains) ? null : "noopener noreferrer nofollow";
4279
4337
  }
4280
4338
  }
4281
4339
  };
@@ -4293,15 +4351,20 @@ var LinkExtension = Link.extend({
4293
4351
  protocols,
4294
4352
  defaultProtocol
4295
4353
  })
4296
- ).filter((link) => this.options.shouldAutoLink?.(link.value) !== false).map((link) => ({ text: link.value, data: { href: link.href }, index: link.start })),
4354
+ ).filter(
4355
+ (link) => this.options.shouldAutoLink?.(link.value) !== false
4356
+ ).map((link) => ({
4357
+ text: link.value,
4358
+ data: { href: link.href },
4359
+ index: link.start
4360
+ })),
4297
4361
  type: this.type,
4298
4362
  getAttributes: (match) => {
4299
4363
  const href = match.data?.href ?? "";
4300
- const sameDomain = isSameDomain(href);
4301
4364
  return {
4302
4365
  href,
4303
- target: sameDomain ? "_self" : "_blank",
4304
- rel: sameDomain ? null : "noopener noreferrer nofollow"
4366
+ target: isSameDomain(href) ? "_self" : "_blank",
4367
+ rel: isTrustedDomain(href, this.options.trustedDomains) ? null : "noopener noreferrer nofollow"
4305
4368
  };
4306
4369
  }
4307
4370
  })
@@ -4316,7 +4379,11 @@ var LinkExtension = Link.extend({
4316
4379
  if (!view.editable) return false;
4317
4380
  const range = getMarkRange(view.state.doc.resolve(pos), this.type);
4318
4381
  if (!range) return false;
4319
- const selection = TextSelection3.create(view.state.doc, range.from, range.to);
4382
+ const selection = TextSelection3.create(
4383
+ view.state.doc,
4384
+ range.from,
4385
+ range.to
4386
+ );
4320
4387
  view.dispatch(view.state.tr.setSelection(selection));
4321
4388
  return true;
4322
4389
  }
@@ -5073,24 +5140,24 @@ import { NodeViewContent, NodeViewWrapper } from "@tiptap/react";
5073
5140
  import { useState as useState10 } from "react";
5074
5141
 
5075
5142
  // src/icons/color/TiptapCalloutError.tsx
5076
- import { jsx as jsx71, jsxs as jsxs22 } from "react/jsx-runtime";
5077
- var SvgTiptapCalloutError = (props) => /* @__PURE__ */ jsxs22("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 20 20", ...props, children: [
5078
- /* @__PURE__ */ jsxs22("g", { clipPath: "url(#tiptap-callout-error_svg__a)", children: [
5079
- /* @__PURE__ */ jsx71(
5143
+ import { jsx as jsx72, jsxs as jsxs23 } from "react/jsx-runtime";
5144
+ var SvgTiptapCalloutError = (props) => /* @__PURE__ */ jsxs23("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 20 20", ...props, children: [
5145
+ /* @__PURE__ */ jsxs23("g", { clipPath: "url(#tiptap-callout-error_svg__a)", children: [
5146
+ /* @__PURE__ */ jsx72(
5080
5147
  "path",
5081
5148
  {
5082
5149
  fill: "#E03757",
5083
5150
  d: "M10 0C4.477 0 0 4.477 0 10s4.477 10 10 10 10-4.477 10-10S15.523 0 10 0"
5084
5151
  }
5085
5152
  ),
5086
- /* @__PURE__ */ jsx71(
5153
+ /* @__PURE__ */ jsx72(
5087
5154
  "path",
5088
5155
  {
5089
5156
  fill: "#F04760",
5090
5157
  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"
5091
5158
  }
5092
5159
  ),
5093
- /* @__PURE__ */ jsx71(
5160
+ /* @__PURE__ */ jsx72(
5094
5161
  "path",
5095
5162
  {
5096
5163
  fill: "#fff",
@@ -5098,28 +5165,28 @@ var SvgTiptapCalloutError = (props) => /* @__PURE__ */ jsxs22("svg", { xmlns: "h
5098
5165
  }
5099
5166
  )
5100
5167
  ] }),
5101
- /* @__PURE__ */ jsx71("defs", { children: /* @__PURE__ */ jsx71("clipPath", { id: "tiptap-callout-error_svg__a", children: /* @__PURE__ */ jsx71("path", { fill: "#fff", d: "M0 0h20v20H0z" }) }) })
5168
+ /* @__PURE__ */ jsx72("defs", { children: /* @__PURE__ */ jsx72("clipPath", { id: "tiptap-callout-error_svg__a", children: /* @__PURE__ */ jsx72("path", { fill: "#fff", d: "M0 0h20v20H0z" }) }) })
5102
5169
  ] });
5103
5170
  var TiptapCalloutError_default = SvgTiptapCalloutError;
5104
5171
 
5105
5172
  // src/icons/color/TiptapCalloutInfo.tsx
5106
- import { jsx as jsx72, jsxs as jsxs23 } from "react/jsx-runtime";
5107
- var SvgTiptapCalloutInfo = (props) => /* @__PURE__ */ jsxs23("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 20 20", ...props, children: [
5108
- /* @__PURE__ */ jsx72(
5173
+ import { jsx as jsx73, jsxs as jsxs24 } from "react/jsx-runtime";
5174
+ var SvgTiptapCalloutInfo = (props) => /* @__PURE__ */ jsxs24("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 20 20", ...props, children: [
5175
+ /* @__PURE__ */ jsx73(
5109
5176
  "path",
5110
5177
  {
5111
5178
  fill: "#FE9738",
5112
5179
  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"
5113
5180
  }
5114
5181
  ),
5115
- /* @__PURE__ */ jsx72(
5182
+ /* @__PURE__ */ jsx73(
5116
5183
  "path",
5117
5184
  {
5118
5185
  fill: "#FFD15B",
5119
5186
  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"
5120
5187
  }
5121
5188
  ),
5122
- /* @__PURE__ */ jsx72(
5189
+ /* @__PURE__ */ jsx73(
5123
5190
  "path",
5124
5191
  {
5125
5192
  fill: "#FFC344",
@@ -5130,66 +5197,66 @@ var SvgTiptapCalloutInfo = (props) => /* @__PURE__ */ jsxs23("svg", { xmlns: "ht
5130
5197
  var TiptapCalloutInfo_default = SvgTiptapCalloutInfo;
5131
5198
 
5132
5199
  // src/icons/color/TiptapCalloutSuccess.tsx
5133
- import { jsx as jsx73, jsxs as jsxs24 } from "react/jsx-runtime";
5134
- var SvgTiptapCalloutSuccess = (props) => /* @__PURE__ */ jsxs24("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 20 20", ...props, children: [
5135
- /* @__PURE__ */ jsxs24("g", { clipPath: "url(#tiptap-callout-success_svg__a)", children: [
5136
- /* @__PURE__ */ jsx73(
5200
+ import { jsx as jsx74, jsxs as jsxs25 } from "react/jsx-runtime";
5201
+ var SvgTiptapCalloutSuccess = (props) => /* @__PURE__ */ jsxs25("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 20 20", ...props, children: [
5202
+ /* @__PURE__ */ jsxs25("g", { clipPath: "url(#tiptap-callout-success_svg__a)", children: [
5203
+ /* @__PURE__ */ jsx74(
5137
5204
  "path",
5138
5205
  {
5139
5206
  fill: "#35495E",
5140
5207
  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"
5141
5208
  }
5142
5209
  ),
5143
- /* @__PURE__ */ jsx73(
5210
+ /* @__PURE__ */ jsx74(
5144
5211
  "path",
5145
5212
  {
5146
5213
  fill: "#2C3E50",
5147
5214
  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"
5148
5215
  }
5149
5216
  ),
5150
- /* @__PURE__ */ jsx73(
5217
+ /* @__PURE__ */ jsx74(
5151
5218
  "path",
5152
5219
  {
5153
5220
  fill: "#F9EAB0",
5154
5221
  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"
5155
5222
  }
5156
5223
  ),
5157
- /* @__PURE__ */ jsx73(
5224
+ /* @__PURE__ */ jsx74(
5158
5225
  "path",
5159
5226
  {
5160
5227
  fill: "#E64C3C",
5161
5228
  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"
5162
5229
  }
5163
5230
  ),
5164
- /* @__PURE__ */ jsx73(
5231
+ /* @__PURE__ */ jsx74(
5165
5232
  "path",
5166
5233
  {
5167
5234
  fill: "#3F5C6C",
5168
5235
  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"
5169
5236
  }
5170
5237
  ),
5171
- /* @__PURE__ */ jsx73(
5238
+ /* @__PURE__ */ jsx74(
5172
5239
  "path",
5173
5240
  {
5174
5241
  fill: "#ECF0F1",
5175
5242
  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"
5176
5243
  }
5177
5244
  ),
5178
- /* @__PURE__ */ jsx73(
5245
+ /* @__PURE__ */ jsx74(
5179
5246
  "path",
5180
5247
  {
5181
5248
  fill: "#C03A2B",
5182
5249
  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"
5183
5250
  }
5184
5251
  ),
5185
- /* @__PURE__ */ jsx73(
5252
+ /* @__PURE__ */ jsx74(
5186
5253
  "path",
5187
5254
  {
5188
5255
  fill: "#802F34",
5189
5256
  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"
5190
5257
  }
5191
5258
  ),
5192
- /* @__PURE__ */ jsx73(
5259
+ /* @__PURE__ */ jsx74(
5193
5260
  "path",
5194
5261
  {
5195
5262
  fill: "#F9EAB0",
@@ -5197,14 +5264,14 @@ var SvgTiptapCalloutSuccess = (props) => /* @__PURE__ */ jsxs24("svg", { xmlns:
5197
5264
  }
5198
5265
  )
5199
5266
  ] }),
5200
- /* @__PURE__ */ jsx73("defs", { children: /* @__PURE__ */ jsx73("clipPath", { id: "tiptap-callout-success_svg__a", children: /* @__PURE__ */ jsx73("path", { fill: "#fff", d: "M0 0h20v20H0z" }) }) })
5267
+ /* @__PURE__ */ jsx74("defs", { children: /* @__PURE__ */ jsx74("clipPath", { id: "tiptap-callout-success_svg__a", children: /* @__PURE__ */ jsx74("path", { fill: "#fff", d: "M0 0h20v20H0z" }) }) })
5201
5268
  ] });
5202
5269
  var TiptapCalloutSuccess_default = SvgTiptapCalloutSuccess;
5203
5270
 
5204
5271
  // src/icons/color/TiptapCalloutWarning.tsx
5205
- import { jsx as jsx74, jsxs as jsxs25 } from "react/jsx-runtime";
5206
- var SvgTiptapCalloutWarning = (props) => /* @__PURE__ */ jsxs25("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 20 20", ...props, children: [
5207
- /* @__PURE__ */ jsx74(
5272
+ import { jsx as jsx75, jsxs as jsxs26 } from "react/jsx-runtime";
5273
+ var SvgTiptapCalloutWarning = (props) => /* @__PURE__ */ jsxs26("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 20 20", ...props, children: [
5274
+ /* @__PURE__ */ jsx75(
5208
5275
  "path",
5209
5276
  {
5210
5277
  fill: "#FFF59D",
@@ -5212,29 +5279,29 @@ var SvgTiptapCalloutWarning = (props) => /* @__PURE__ */ jsxs25("svg", { xmlns:
5212
5279
  d: "M1.667 9.167a8.333 8.333 0 1 0 16.666 0 8.333 8.333 0 0 0-16.666 0"
5213
5280
  }
5214
5281
  ),
5215
- /* @__PURE__ */ jsx74(
5282
+ /* @__PURE__ */ jsx75(
5216
5283
  "path",
5217
5284
  {
5218
5285
  fill: "#FBC02D",
5219
5286
  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"
5220
5287
  }
5221
5288
  ),
5222
- /* @__PURE__ */ jsx74(
5289
+ /* @__PURE__ */ jsx75(
5223
5290
  "path",
5224
5291
  {
5225
5292
  fill: "#FFF59D",
5226
5293
  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"
5227
5294
  }
5228
5295
  ),
5229
- /* @__PURE__ */ jsx74("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" }),
5230
- /* @__PURE__ */ jsx74(
5296
+ /* @__PURE__ */ jsx75("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" }),
5297
+ /* @__PURE__ */ jsx75(
5231
5298
  "path",
5232
5299
  {
5233
5300
  fill: "#9FA8DA",
5234
5301
  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"
5235
5302
  }
5236
5303
  ),
5237
- /* @__PURE__ */ jsx74(
5304
+ /* @__PURE__ */ jsx75(
5238
5305
  "path",
5239
5306
  {
5240
5307
  fill: "#5C6BC0",
@@ -5387,12 +5454,12 @@ var calloutCustomEmojis = [
5387
5454
  ];
5388
5455
 
5389
5456
  // src/extensions/views/components/callout.tsx
5390
- import { jsx as jsx75, jsxs as jsxs26 } from "react/jsx-runtime";
5457
+ import { jsx as jsx76, jsxs as jsxs27 } from "react/jsx-runtime";
5391
5458
  var calloutIcons = {
5392
- info: /* @__PURE__ */ jsx75(TiptapCalloutInfo_default, {}),
5393
- warning: /* @__PURE__ */ jsx75(TiptapCalloutWarning_default, {}),
5394
- success: /* @__PURE__ */ jsx75(TiptapCalloutSuccess_default, {}),
5395
- error: /* @__PURE__ */ jsx75(TiptapCalloutError_default, {})
5459
+ info: /* @__PURE__ */ jsx76(TiptapCalloutInfo_default, {}),
5460
+ warning: /* @__PURE__ */ jsx76(TiptapCalloutWarning_default, {}),
5461
+ success: /* @__PURE__ */ jsx76(TiptapCalloutSuccess_default, {}),
5462
+ error: /* @__PURE__ */ jsx76(TiptapCalloutError_default, {})
5396
5463
  };
5397
5464
  var legacyTypeMap3 = {
5398
5465
  question: "info",
@@ -5410,15 +5477,15 @@ var Callout = ({ type, bgColor, emoji: emoji2, children, iconWrapper, calloutTyp
5410
5477
  if (emoji2) {
5411
5478
  if (emoji2 in calloutIconComponents) {
5412
5479
  const IconComponent = calloutIconComponents[emoji2];
5413
- icon = /* @__PURE__ */ jsx75(IconComponent, {});
5480
+ icon = /* @__PURE__ */ jsx76(IconComponent, {});
5414
5481
  } else {
5415
5482
  icon = emoji2;
5416
5483
  }
5417
5484
  } else {
5418
5485
  icon = calloutIcons[finalType];
5419
5486
  }
5420
- const iconContent = iconWrapper ? iconWrapper(icon) : /* @__PURE__ */ jsx75("div", { className: "callout-icon", children: icon });
5421
- return /* @__PURE__ */ jsxs26(
5487
+ const iconContent = iconWrapper ? iconWrapper(icon) : /* @__PURE__ */ jsx76("div", { className: "callout-icon", children: icon });
5488
+ return /* @__PURE__ */ jsxs27(
5422
5489
  "div",
5423
5490
  {
5424
5491
  className,
@@ -5428,33 +5495,33 @@ var Callout = ({ type, bgColor, emoji: emoji2, children, iconWrapper, calloutTyp
5428
5495
  style,
5429
5496
  children: [
5430
5497
  iconContent,
5431
- /* @__PURE__ */ jsx75("div", { className: "callout-content-wrapper", children: /* @__PURE__ */ jsx75("div", { className: "callout-content", children }) })
5498
+ /* @__PURE__ */ jsx76("div", { className: "callout-content-wrapper", children: /* @__PURE__ */ jsx76("div", { className: "callout-content", children }) })
5432
5499
  ]
5433
5500
  }
5434
5501
  );
5435
5502
  };
5436
5503
 
5437
5504
  // src/extensions/views/components/code-block.tsx
5438
- import { useMemo } from "react";
5505
+ import { useMemo as useMemo2 } from "react";
5439
5506
  import html2 from "highlight.js/lib/languages/xml";
5440
5507
  import { common as common2, createLowlight as createLowlight2 } from "lowlight";
5441
5508
 
5442
5509
  // src/extensions/views/components/copy-button.tsx
5443
- import { jsx as jsx76, jsxs as jsxs27 } from "react/jsx-runtime";
5510
+ import { jsx as jsx77, jsxs as jsxs28 } from "react/jsx-runtime";
5444
5511
  var CopyButton = ({ iconSize = 16, color = "black" }) => {
5445
- return /* @__PURE__ */ jsxs27(
5512
+ return /* @__PURE__ */ jsxs28(
5446
5513
  "button",
5447
5514
  {
5448
5515
  className: `copy-button copy-icon-${color}`,
5449
5516
  "data-copy-action": "copy",
5450
5517
  type: "button",
5451
5518
  children: [
5452
- /* @__PURE__ */ jsx76(
5519
+ /* @__PURE__ */ jsx77(
5453
5520
  "span",
5454
5521
  {
5455
5522
  className: "copy-icon",
5456
5523
  "data-copy-icon": "default",
5457
- children: /* @__PURE__ */ jsx76(
5524
+ children: /* @__PURE__ */ jsx77(
5458
5525
  Copy_default,
5459
5526
  {
5460
5527
  width: iconSize,
@@ -5463,13 +5530,13 @@ var CopyButton = ({ iconSize = 16, color = "black" }) => {
5463
5530
  )
5464
5531
  }
5465
5532
  ),
5466
- /* @__PURE__ */ jsx76(
5533
+ /* @__PURE__ */ jsx77(
5467
5534
  "span",
5468
5535
  {
5469
5536
  className: "copy-icon-success",
5470
5537
  "data-copy-icon": "success",
5471
5538
  style: { display: "none" },
5472
- children: /* @__PURE__ */ jsx76(
5539
+ children: /* @__PURE__ */ jsx77(
5473
5540
  Check_default,
5474
5541
  {
5475
5542
  width: iconSize,
@@ -5484,7 +5551,7 @@ var CopyButton = ({ iconSize = 16, color = "black" }) => {
5484
5551
  };
5485
5552
 
5486
5553
  // src/extensions/views/components/code-block.tsx
5487
- import { jsx as jsx77, jsxs as jsxs28 } from "react/jsx-runtime";
5554
+ import { jsx as jsx78, jsxs as jsxs29 } from "react/jsx-runtime";
5488
5555
  var CodeBlock = ({
5489
5556
  language,
5490
5557
  isEditable,
@@ -5492,7 +5559,7 @@ var CodeBlock = ({
5492
5559
  children,
5493
5560
  translations: translations2
5494
5561
  }) => {
5495
- const languagesList = useMemo(() => {
5562
+ const languagesList = useMemo2(() => {
5496
5563
  const lowlight2 = createLowlight2(common2);
5497
5564
  lowlight2.register("html", html2);
5498
5565
  const list = lowlight2.listLanguages();
@@ -5501,17 +5568,17 @@ var CodeBlock = ({
5501
5568
  const handleChange = (e) => {
5502
5569
  onLanguageChange?.(e.target.value);
5503
5570
  };
5504
- return /* @__PURE__ */ jsxs28("div", { className: "tiptap-code-block-wrapper", children: [
5505
- /* @__PURE__ */ jsxs28("div", { className: "tiptap-code-block-header", children: [
5506
- isEditable ? /* @__PURE__ */ jsxs28(
5571
+ return /* @__PURE__ */ jsxs29("div", { className: "tiptap-code-block-wrapper", children: [
5572
+ /* @__PURE__ */ jsxs29("div", { className: "tiptap-code-block-header", children: [
5573
+ isEditable ? /* @__PURE__ */ jsxs29(
5507
5574
  "select",
5508
5575
  {
5509
5576
  className: "tiptap-code-block-language-select",
5510
5577
  value: language,
5511
5578
  onChange: handleChange,
5512
5579
  children: [
5513
- /* @__PURE__ */ jsx77("option", { value: "", children: translations2?.codeBlock.selectLanguage }),
5514
- languagesList.map((lang) => /* @__PURE__ */ jsx77(
5580
+ /* @__PURE__ */ jsx78("option", { value: "", children: translations2?.codeBlock.selectLanguage }),
5581
+ languagesList.map((lang) => /* @__PURE__ */ jsx78(
5515
5582
  "option",
5516
5583
  {
5517
5584
  value: lang,
@@ -5521,8 +5588,8 @@ var CodeBlock = ({
5521
5588
  ))
5522
5589
  ]
5523
5590
  }
5524
- ) : /* @__PURE__ */ jsx77("span", { className: "tiptap-code-block-language-text", children: language || translations2?.codeBlock.selectLanguage }),
5525
- /* @__PURE__ */ jsx77(
5591
+ ) : /* @__PURE__ */ jsx78("span", { className: "tiptap-code-block-language-text", children: language || translations2?.codeBlock.selectLanguage }),
5592
+ /* @__PURE__ */ jsx78(
5526
5593
  CopyButton,
5527
5594
  {
5528
5595
  iconSize: 20,
@@ -5530,7 +5597,7 @@ var CodeBlock = ({
5530
5597
  }
5531
5598
  )
5532
5599
  ] }),
5533
- /* @__PURE__ */ jsx77("pre", { className: "tiptap-code-block", children: /* @__PURE__ */ jsx77(
5600
+ /* @__PURE__ */ jsx78("pre", { className: "tiptap-code-block", children: /* @__PURE__ */ jsx78(
5534
5601
  "code",
5535
5602
  {
5536
5603
  className: "tiptap-code-block-content",
@@ -5542,22 +5609,22 @@ var CodeBlock = ({
5542
5609
  };
5543
5610
 
5544
5611
  // src/extensions/views/components/copyable-text.tsx
5545
- import { jsx as jsx78, jsxs as jsxs29 } from "react/jsx-runtime";
5612
+ import { jsx as jsx79, jsxs as jsxs30 } from "react/jsx-runtime";
5546
5613
  var CopyableText2 = ({ children }) => {
5547
- return /* @__PURE__ */ jsxs29("span", { className: "copyable", children: [
5548
- /* @__PURE__ */ jsx78("span", { "data-copy-content": true, children }),
5549
- /* @__PURE__ */ jsx78(CopyButton, { iconSize: 16 })
5614
+ return /* @__PURE__ */ jsxs30("span", { className: "copyable", children: [
5615
+ /* @__PURE__ */ jsx79("span", { "data-copy-content": true, children }),
5616
+ /* @__PURE__ */ jsx79(CopyButton, { iconSize: 16 })
5550
5617
  ] });
5551
5618
  };
5552
5619
 
5553
5620
  // src/extensions/views/components/custom-quote.tsx
5554
- import { jsx as jsx79, jsxs as jsxs30 } from "react/jsx-runtime";
5555
- var CustomQuote = ({ children }) => /* @__PURE__ */ jsxs30("div", { "data-custom-quote": "", children: [
5556
- /* @__PURE__ */ jsx79("div", { className: "custom-quote-divider" }),
5557
- /* @__PURE__ */ jsx79("div", { className: "custom-quote-svg-wrapper", children: /* @__PURE__ */ jsx79(Quote_default, {}) }),
5621
+ import { jsx as jsx80, jsxs as jsxs31 } from "react/jsx-runtime";
5622
+ var CustomQuote = ({ children }) => /* @__PURE__ */ jsxs31("div", { "data-custom-quote": "", children: [
5623
+ /* @__PURE__ */ jsx80("div", { className: "custom-quote-divider" }),
5624
+ /* @__PURE__ */ jsx80("div", { className: "custom-quote-svg-wrapper", children: /* @__PURE__ */ jsx80(Quote_default, {}) }),
5558
5625
  children
5559
5626
  ] });
5560
- var CustomQuoteText = ({ children, isEmpty, placeholder }) => /* @__PURE__ */ jsx79(
5627
+ var CustomQuoteText = ({ children, isEmpty, placeholder }) => /* @__PURE__ */ jsx80(
5561
5628
  "div",
5562
5629
  {
5563
5630
  "data-custom-quote-text": true,
@@ -5566,7 +5633,7 @@ var CustomQuoteText = ({ children, isEmpty, placeholder }) => /* @__PURE__ */ js
5566
5633
  children
5567
5634
  }
5568
5635
  );
5569
- var CustomQuoteAuthor = ({ children, isEmpty, placeholder }) => /* @__PURE__ */ jsx79(
5636
+ var CustomQuoteAuthor = ({ children, isEmpty, placeholder }) => /* @__PURE__ */ jsx80(
5570
5637
  "div",
5571
5638
  {
5572
5639
  "data-custom-quote-author": "",
@@ -5575,7 +5642,7 @@ var CustomQuoteAuthor = ({ children, isEmpty, placeholder }) => /* @__PURE__ */
5575
5642
  children
5576
5643
  }
5577
5644
  );
5578
- var CustomQuoteSign = ({ children, isEmpty, placeholder }) => /* @__PURE__ */ jsx79(
5645
+ var CustomQuoteSign = ({ children, isEmpty, placeholder }) => /* @__PURE__ */ jsx80(
5579
5646
  "div",
5580
5647
  {
5581
5648
  "data-custom-quote-sign": "",
@@ -5586,7 +5653,7 @@ var CustomQuoteSign = ({ children, isEmpty, placeholder }) => /* @__PURE__ */ js
5586
5653
  );
5587
5654
 
5588
5655
  // src/extensions/views/components/figure.tsx
5589
- import { jsx as jsx80, jsxs as jsxs31 } from "react/jsx-runtime";
5656
+ import { jsx as jsx81, jsxs as jsxs32 } from "react/jsx-runtime";
5590
5657
  var Figure = ({
5591
5658
  src,
5592
5659
  alt,
@@ -5601,9 +5668,9 @@ var Figure = ({
5601
5668
  getImageById
5602
5669
  }) => {
5603
5670
  const resolvedSrc = resolveImageSrc({ fileId, src }, { getImageById });
5604
- return /* @__PURE__ */ jsxs31("figure", { children: [
5605
- resolvedSrc && /* @__PURE__ */ jsxs31("div", { className: "figure-image-container", children: [
5606
- /* @__PURE__ */ jsx80(
5671
+ return /* @__PURE__ */ jsxs32("figure", { children: [
5672
+ resolvedSrc && /* @__PURE__ */ jsxs32("div", { className: "figure-image-container", children: [
5673
+ /* @__PURE__ */ jsx81(
5607
5674
  "img",
5608
5675
  {
5609
5676
  src: resolvedSrc,
@@ -5613,7 +5680,7 @@ var Figure = ({
5613
5680
  height: height || void 0
5614
5681
  }
5615
5682
  ),
5616
- isEditable && onEditClick && /* @__PURE__ */ jsx80(
5683
+ isEditable && onEditClick && /* @__PURE__ */ jsx81(
5617
5684
  "button",
5618
5685
  {
5619
5686
  type: "button",
@@ -5621,19 +5688,19 @@ var Figure = ({
5621
5688
  onClick: onEditClick,
5622
5689
  contentEditable: false,
5623
5690
  "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",
5624
- children: /* @__PURE__ */ jsx80(Edit_default, {})
5691
+ children: /* @__PURE__ */ jsx81(Edit_default, {})
5625
5692
  }
5626
5693
  )
5627
5694
  ] }),
5628
- caption && /* @__PURE__ */ jsx80("figcaption", { children: caption }),
5695
+ caption && /* @__PURE__ */ jsx81("figcaption", { children: caption }),
5629
5696
  children
5630
5697
  ] });
5631
5698
  };
5632
5699
 
5633
5700
  // src/extensions/views/components/prompt.tsx
5634
- import { jsx as jsx81, jsxs as jsxs32 } from "react/jsx-runtime";
5635
- var PromptHeader = ({ children, isEmpty, placeholder }) => /* @__PURE__ */ jsxs32("div", { className: "prompt-header-wrapper", children: [
5636
- /* @__PURE__ */ jsx81(
5701
+ import { jsx as jsx82, jsxs as jsxs33 } from "react/jsx-runtime";
5702
+ var PromptHeader = ({ children, isEmpty, placeholder }) => /* @__PURE__ */ jsxs33("div", { className: "prompt-header-wrapper", children: [
5703
+ /* @__PURE__ */ jsx82(
5637
5704
  "div",
5638
5705
  {
5639
5706
  className: isEmpty ? "is-empty" : "",
@@ -5641,7 +5708,7 @@ var PromptHeader = ({ children, isEmpty, placeholder }) => /* @__PURE__ */ jsxs3
5641
5708
  children
5642
5709
  }
5643
5710
  ),
5644
- /* @__PURE__ */ jsx81("span", { className: "prompt-copy-icon-wrapper", children: /* @__PURE__ */ jsx81(
5711
+ /* @__PURE__ */ jsx82("span", { className: "prompt-copy-icon-wrapper", children: /* @__PURE__ */ jsx82(
5645
5712
  CopyButton,
5646
5713
  {
5647
5714
  iconSize: 16,
@@ -5649,7 +5716,7 @@ var PromptHeader = ({ children, isEmpty, placeholder }) => /* @__PURE__ */ jsxs3
5649
5716
  }
5650
5717
  ) })
5651
5718
  ] });
5652
- var PromptContent = ({ children, isEmpty, placeholder }) => /* @__PURE__ */ jsx81("div", { className: "prompt-content-wrapper", children: /* @__PURE__ */ jsx81(
5719
+ var PromptContent = ({ children, isEmpty, placeholder }) => /* @__PURE__ */ jsx82("div", { className: "prompt-content-wrapper", children: /* @__PURE__ */ jsx82(
5653
5720
  "div",
5654
5721
  {
5655
5722
  className: isEmpty ? "is-empty" : "",
@@ -5660,22 +5727,22 @@ var PromptContent = ({ children, isEmpty, placeholder }) => /* @__PURE__ */ jsx8
5660
5727
  ) });
5661
5728
 
5662
5729
  // src/extensions/views/components/video.tsx
5663
- import { jsx as jsx82, jsxs as jsxs33 } from "react/jsx-runtime";
5730
+ import { jsx as jsx83, jsxs as jsxs34 } from "react/jsx-runtime";
5664
5731
  var Video = ({ src, children }) => {
5665
5732
  const videoInfo = detectVideoHosting(src);
5666
5733
  if (!videoInfo?.embedUrl) {
5667
- return /* @__PURE__ */ jsxs33("div", { className: "video-node", children: [
5668
- /* @__PURE__ */ jsx82("div", { className: "video-error", children: /* @__PURE__ */ jsx82("span", { children: "Unsupported or invalid video URL" }) }),
5734
+ return /* @__PURE__ */ jsxs34("div", { className: "video-node", children: [
5735
+ /* @__PURE__ */ jsx83("div", { className: "video-error", children: /* @__PURE__ */ jsx83("span", { children: "Unsupported or invalid video URL" }) }),
5669
5736
  children
5670
5737
  ] });
5671
5738
  }
5672
- return /* @__PURE__ */ jsxs33(
5739
+ return /* @__PURE__ */ jsxs34(
5673
5740
  "div",
5674
5741
  {
5675
5742
  className: "video-node",
5676
5743
  "data-video": "",
5677
5744
  children: [
5678
- /* @__PURE__ */ jsx82("div", { className: "video-player-wrapper", children: /* @__PURE__ */ jsx82(
5745
+ /* @__PURE__ */ jsx83("div", { className: "video-player-wrapper", children: /* @__PURE__ */ jsx83(
5679
5746
  "iframe",
5680
5747
  {
5681
5748
  className: "video-iframe",
@@ -5694,7 +5761,7 @@ var Video = ({ src, children }) => {
5694
5761
  // src/editor/controls/emoji-picker.tsx
5695
5762
  import { useEffect as useEffect9, useRef as useRef10 } from "react";
5696
5763
  import EmojiPicker from "emoji-picker-react";
5697
- import { jsx as jsx83 } from "react/jsx-runtime";
5764
+ import { jsx as jsx84 } from "react/jsx-runtime";
5698
5765
  var EmojiPickerComponent = ({ isOpen, onClose, onEmojiSelect }) => {
5699
5766
  const pickerRef = useRef10(null);
5700
5767
  const translations2 = useTiptapTranslations();
@@ -5712,12 +5779,12 @@ var EmojiPickerComponent = ({ isOpen, onClose, onEmojiSelect }) => {
5712
5779
  };
5713
5780
  }, [isOpen, onClose]);
5714
5781
  if (!isOpen) return null;
5715
- return /* @__PURE__ */ jsx83(
5782
+ return /* @__PURE__ */ jsx84(
5716
5783
  "div",
5717
5784
  {
5718
5785
  ref: pickerRef,
5719
5786
  className: "tiptap__emoji-picker-wrapper",
5720
- children: /* @__PURE__ */ jsx83(
5787
+ children: /* @__PURE__ */ jsx84(
5721
5788
  EmojiPicker,
5722
5789
  {
5723
5790
  skinTonesDisabled: true,
@@ -5742,7 +5809,7 @@ var EmojiPickerComponent = ({ isOpen, onClose, onEmojiSelect }) => {
5742
5809
  };
5743
5810
 
5744
5811
  // src/extensions/views/node-views/callout.tsx
5745
- import { jsx as jsx84, jsxs as jsxs34 } from "react/jsx-runtime";
5812
+ import { jsx as jsx85, jsxs as jsxs35 } from "react/jsx-runtime";
5746
5813
  var CalloutView = (props) => {
5747
5814
  const type = props.node.attrs.type || "info";
5748
5815
  const bgColor = props.node.attrs.bgColor;
@@ -5757,23 +5824,23 @@ var CalloutView = (props) => {
5757
5824
  props.updateAttributes({ emoji: newEmoji });
5758
5825
  setShowEmojiPicker(false);
5759
5826
  };
5760
- return /* @__PURE__ */ jsx84(NodeViewWrapper, { children: /* @__PURE__ */ jsx84(
5827
+ return /* @__PURE__ */ jsx85(NodeViewWrapper, { children: /* @__PURE__ */ jsx85(
5761
5828
  Callout,
5762
5829
  {
5763
5830
  type,
5764
5831
  bgColor,
5765
5832
  emoji: emoji2,
5766
- iconWrapper: (icon) => /* @__PURE__ */ jsxs34("div", { className: "callout-icon-wrapper", children: [
5767
- /* @__PURE__ */ jsx84(
5833
+ iconWrapper: (icon) => /* @__PURE__ */ jsxs35("div", { className: "callout-icon-wrapper", children: [
5834
+ /* @__PURE__ */ jsx85(
5768
5835
  "button",
5769
5836
  {
5770
5837
  className: "callout-icon-button",
5771
5838
  onClick: handleIconClick,
5772
5839
  type: "button",
5773
- children: /* @__PURE__ */ jsx84("div", { className: "callout-icon", children: icon })
5840
+ children: /* @__PURE__ */ jsx85("div", { className: "callout-icon", children: icon })
5774
5841
  }
5775
5842
  ),
5776
- /* @__PURE__ */ jsx84(
5843
+ /* @__PURE__ */ jsx85(
5777
5844
  EmojiPickerComponent,
5778
5845
  {
5779
5846
  isOpen: showEmojiPicker,
@@ -5782,7 +5849,7 @@ var CalloutView = (props) => {
5782
5849
  }
5783
5850
  )
5784
5851
  ] }),
5785
- children: /* @__PURE__ */ jsx84(NodeViewContent, { as: "div" })
5852
+ children: /* @__PURE__ */ jsx85(NodeViewContent, { as: "div" })
5786
5853
  }
5787
5854
  ) });
5788
5855
  };
@@ -5790,7 +5857,7 @@ var CalloutView = (props) => {
5790
5857
  // src/extensions/views/node-views/code-block.tsx
5791
5858
  import { useState as useState11 } from "react";
5792
5859
  import { NodeViewContent as NodeViewContent2, NodeViewWrapper as NodeViewWrapper2 } from "@tiptap/react";
5793
- import { jsx as jsx85 } from "react/jsx-runtime";
5860
+ import { jsx as jsx86 } from "react/jsx-runtime";
5794
5861
  var CodeBlockView = (props) => {
5795
5862
  const [selectedLanguage, setSelectedLanguage] = useState11(props.node.attrs.language ?? "");
5796
5863
  const translations2 = useTiptapTranslations();
@@ -5798,71 +5865,71 @@ var CodeBlockView = (props) => {
5798
5865
  props.updateAttributes({ language });
5799
5866
  setSelectedLanguage(language);
5800
5867
  };
5801
- return /* @__PURE__ */ jsx85(NodeViewWrapper2, { children: /* @__PURE__ */ jsx85(
5868
+ return /* @__PURE__ */ jsx86(NodeViewWrapper2, { children: /* @__PURE__ */ jsx86(
5802
5869
  CodeBlock,
5803
5870
  {
5804
5871
  language: selectedLanguage,
5805
5872
  isEditable: props.editor.isEditable,
5806
5873
  onLanguageChange: handleLanguageChange,
5807
5874
  translations: translations2,
5808
- children: /* @__PURE__ */ jsx85(NodeViewContent2, {})
5875
+ children: /* @__PURE__ */ jsx86(NodeViewContent2, {})
5809
5876
  }
5810
5877
  ) });
5811
5878
  };
5812
5879
 
5813
5880
  // src/extensions/views/node-views/copyable-text.tsx
5814
5881
  import { MarkViewContent } from "@tiptap/react";
5815
- import { jsx as jsx86 } from "react/jsx-runtime";
5882
+ import { jsx as jsx87 } from "react/jsx-runtime";
5816
5883
  var CopyableTextView = () => {
5817
- return /* @__PURE__ */ jsx86(CopyableText2, { children: /* @__PURE__ */ jsx86(MarkViewContent, {}) });
5884
+ return /* @__PURE__ */ jsx87(CopyableText2, { children: /* @__PURE__ */ jsx87(MarkViewContent, {}) });
5818
5885
  };
5819
5886
 
5820
5887
  // src/extensions/views/node-views/custom-quote.tsx
5821
5888
  import { NodeViewContent as NodeViewContent3, NodeViewWrapper as NodeViewWrapper3 } from "@tiptap/react";
5822
- import { jsx as jsx87 } from "react/jsx-runtime";
5889
+ import { jsx as jsx88 } from "react/jsx-runtime";
5823
5890
  var CustomQuoteView = () => {
5824
- return /* @__PURE__ */ jsx87(NodeViewWrapper3, { children: /* @__PURE__ */ jsx87(CustomQuote, { children: /* @__PURE__ */ jsx87(NodeViewContent3, {}) }) });
5891
+ return /* @__PURE__ */ jsx88(NodeViewWrapper3, { children: /* @__PURE__ */ jsx88(CustomQuote, { children: /* @__PURE__ */ jsx88(NodeViewContent3, {}) }) });
5825
5892
  };
5826
5893
  var CustomQuoteTextView = (props) => {
5827
5894
  const isEmpty = !props.node.content.size;
5828
5895
  const translations2 = useTiptapTranslations();
5829
- return /* @__PURE__ */ jsx87(NodeViewWrapper3, { children: /* @__PURE__ */ jsx87(
5896
+ return /* @__PURE__ */ jsx88(NodeViewWrapper3, { children: /* @__PURE__ */ jsx88(
5830
5897
  CustomQuoteText,
5831
5898
  {
5832
5899
  isEmpty,
5833
5900
  placeholder: translations2.customQuote.textPlaceholder,
5834
- children: /* @__PURE__ */ jsx87(NodeViewContent3, { className: isEmpty ? "is-empty" : "" })
5901
+ children: /* @__PURE__ */ jsx88(NodeViewContent3, { className: isEmpty ? "is-empty" : "" })
5835
5902
  }
5836
5903
  ) });
5837
5904
  };
5838
5905
  var CustomQuoteAuthorView = (props) => {
5839
5906
  const isEmpty = !props.node.content.size;
5840
5907
  const translations2 = useTiptapTranslations();
5841
- return /* @__PURE__ */ jsx87(NodeViewWrapper3, { children: /* @__PURE__ */ jsx87(
5908
+ return /* @__PURE__ */ jsx88(NodeViewWrapper3, { children: /* @__PURE__ */ jsx88(
5842
5909
  CustomQuoteAuthor,
5843
5910
  {
5844
5911
  isEmpty,
5845
5912
  placeholder: translations2.customQuote.authorPlaceholder,
5846
- children: /* @__PURE__ */ jsx87(NodeViewContent3, { className: isEmpty ? "is-empty" : "" })
5913
+ children: /* @__PURE__ */ jsx88(NodeViewContent3, { className: isEmpty ? "is-empty" : "" })
5847
5914
  }
5848
5915
  ) });
5849
5916
  };
5850
5917
  var CustomQuoteSignView = (props) => {
5851
5918
  const isEmpty = !props.node.content.size;
5852
5919
  const translations2 = useTiptapTranslations();
5853
- return /* @__PURE__ */ jsx87(NodeViewWrapper3, { children: /* @__PURE__ */ jsx87(
5920
+ return /* @__PURE__ */ jsx88(NodeViewWrapper3, { children: /* @__PURE__ */ jsx88(
5854
5921
  CustomQuoteSign,
5855
5922
  {
5856
5923
  isEmpty,
5857
5924
  placeholder: translations2.customQuote.signPlaceholder,
5858
- children: /* @__PURE__ */ jsx87(NodeViewContent3, { className: isEmpty ? "is-empty" : "" })
5925
+ children: /* @__PURE__ */ jsx88(NodeViewContent3, { className: isEmpty ? "is-empty" : "" })
5859
5926
  }
5860
5927
  ) });
5861
5928
  };
5862
5929
 
5863
5930
  // src/extensions/views/node-views/figure.tsx
5864
5931
  import { NodeViewWrapper as NodeViewWrapper4 } from "@tiptap/react";
5865
- import { jsx as jsx88 } from "react/jsx-runtime";
5932
+ import { jsx as jsx89 } from "react/jsx-runtime";
5866
5933
  var FigureView = ({ node, getPos, editor }) => {
5867
5934
  const { fileId, src, alt, title, caption, width, height } = node.attrs;
5868
5935
  const imageExtension = editor.extensionManager.extensions.find((ext) => ext.name === "image");
@@ -5871,12 +5938,12 @@ var FigureView = ({ node, getPos, editor }) => {
5871
5938
  const handleEditClick = () => {
5872
5939
  onFigureClick?.(node.attrs, getPos());
5873
5940
  };
5874
- return /* @__PURE__ */ jsx88(
5941
+ return /* @__PURE__ */ jsx89(
5875
5942
  NodeViewWrapper4,
5876
5943
  {
5877
5944
  className: "figure-node-view",
5878
5945
  "data-drag-handle": true,
5879
- children: /* @__PURE__ */ jsx88(
5946
+ children: /* @__PURE__ */ jsx89(
5880
5947
  Figure,
5881
5948
  {
5882
5949
  fileId,
@@ -5897,38 +5964,38 @@ var FigureView = ({ node, getPos, editor }) => {
5897
5964
 
5898
5965
  // src/extensions/views/node-views/prompt.tsx
5899
5966
  import { NodeViewContent as NodeViewContent4, NodeViewWrapper as NodeViewWrapper5 } from "@tiptap/react";
5900
- import { jsx as jsx89 } from "react/jsx-runtime";
5967
+ import { jsx as jsx90 } from "react/jsx-runtime";
5901
5968
  var PromptHeaderView = (props) => {
5902
5969
  const isEmpty = !props.node.content.size;
5903
5970
  const translations2 = useTiptapTranslations();
5904
- return /* @__PURE__ */ jsx89(NodeViewWrapper5, { children: /* @__PURE__ */ jsx89(
5971
+ return /* @__PURE__ */ jsx90(NodeViewWrapper5, { children: /* @__PURE__ */ jsx90(
5905
5972
  PromptHeader,
5906
5973
  {
5907
5974
  isEmpty,
5908
5975
  placeholder: translations2.prompt.headerPlaceholder,
5909
- children: /* @__PURE__ */ jsx89(NodeViewContent4, { className: isEmpty ? "is-empty" : "" })
5976
+ children: /* @__PURE__ */ jsx90(NodeViewContent4, { className: isEmpty ? "is-empty" : "" })
5910
5977
  }
5911
5978
  ) });
5912
5979
  };
5913
5980
  var PromptContentView = (props) => {
5914
5981
  const isEmpty = !props.node.content.size;
5915
5982
  const translations2 = useTiptapTranslations();
5916
- return /* @__PURE__ */ jsx89(NodeViewWrapper5, { children: /* @__PURE__ */ jsx89(
5983
+ return /* @__PURE__ */ jsx90(NodeViewWrapper5, { children: /* @__PURE__ */ jsx90(
5917
5984
  PromptContent,
5918
5985
  {
5919
5986
  isEmpty,
5920
5987
  placeholder: translations2.prompt.contentPlaceholder,
5921
- children: /* @__PURE__ */ jsx89(NodeViewContent4, { className: isEmpty ? "is-empty" : "" })
5988
+ children: /* @__PURE__ */ jsx90(NodeViewContent4, { className: isEmpty ? "is-empty" : "" })
5922
5989
  }
5923
5990
  ) });
5924
5991
  };
5925
5992
 
5926
5993
  // src/extensions/views/node-views/video.tsx
5927
5994
  import { NodeViewContent as NodeViewContent5, NodeViewWrapper as NodeViewWrapper6 } from "@tiptap/react";
5928
- import { jsx as jsx90 } from "react/jsx-runtime";
5995
+ import { jsx as jsx91 } from "react/jsx-runtime";
5929
5996
  var VideoView = (props) => {
5930
5997
  const { src } = props.node.attrs;
5931
- return /* @__PURE__ */ jsx90(NodeViewWrapper6, { children: /* @__PURE__ */ jsx90(Video, { src, children: /* @__PURE__ */ jsx90(
5998
+ return /* @__PURE__ */ jsx91(NodeViewWrapper6, { children: /* @__PURE__ */ jsx91(Video, { src, children: /* @__PURE__ */ jsx91(
5932
5999
  NodeViewContent5,
5933
6000
  {
5934
6001
  as: "div",
@@ -6032,7 +6099,11 @@ var Commands = Extension.create({
6032
6099
 
6033
6100
  // src/utils/get-shared-extensions.ts
6034
6101
  import StarterKit from "@tiptap/starter-kit";
6035
- import { Details, DetailsContent, DetailsSummary } from "@tiptap/extension-details";
6102
+ import {
6103
+ Details,
6104
+ DetailsContent,
6105
+ DetailsSummary
6106
+ } from "@tiptap/extension-details";
6036
6107
  import Highlight from "@tiptap/extension-highlight";
6037
6108
  import Subscript from "@tiptap/extension-subscript";
6038
6109
  import Superscript from "@tiptap/extension-superscript";
@@ -6375,14 +6446,14 @@ var TextStyleKit = Extension6.create({
6375
6446
  });
6376
6447
 
6377
6448
  // src/utils/get-shared-extensions.ts
6378
- function getSharedExtensions() {
6449
+ function getSharedExtensions(options = {}) {
6379
6450
  return [
6380
6451
  StarterKit.configure({
6381
6452
  codeBlock: false,
6382
6453
  link: false
6383
6454
  }),
6384
6455
  Highlight.configure({ multicolor: true }),
6385
- LinkExtension,
6456
+ LinkExtension.configure({ trustedDomains: options.trustedDomains ?? [] }),
6386
6457
  Superscript,
6387
6458
  Subscript,
6388
6459
  TextAlign.configure({
@@ -6623,9 +6694,10 @@ function getEditorExtensions(options) {
6623
6694
  isEditable = false,
6624
6695
  getImageById,
6625
6696
  onKatexClick,
6626
- onFigureClick
6697
+ onFigureClick,
6698
+ trustedDomains
6627
6699
  } = options;
6628
- const sharedExtensions = getSharedExtensions();
6700
+ const sharedExtensions = getSharedExtensions({ trustedDomains });
6629
6701
  return [
6630
6702
  ...sharedExtensions,
6631
6703
  Callout2,
@@ -7225,7 +7297,7 @@ var filterCommandItems = (items, query) => {
7225
7297
  };
7226
7298
 
7227
7299
  // src/editor/commands/suggestion.tsx
7228
- import { jsx as jsx91 } from "react/jsx-runtime";
7300
+ import { jsx as jsx92 } from "react/jsx-runtime";
7229
7301
  var component = null;
7230
7302
  var closeMenu = () => {
7231
7303
  if (component) {
@@ -7239,7 +7311,7 @@ var mapCommandMenuItemToCommandItem = (item) => {
7239
7311
  const IconComponent = item.icon;
7240
7312
  return {
7241
7313
  title: item.title,
7242
- icon: /* @__PURE__ */ jsx91(IconComponent, {}),
7314
+ icon: /* @__PURE__ */ jsx92(IconComponent, {}),
7243
7315
  command: ({ editor, range }) => {
7244
7316
  editor.chain().focus().deleteRange(range).run();
7245
7317
  item.onClick(editor);
@@ -7448,9 +7520,7 @@ var ru_default = {
7448
7520
  captionPlaceholder: "\u041E\u043F\u0438\u0441\u0430\u043D\u0438\u0435 \u043F\u043E\u0434 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435\u043C...",
7449
7521
  save: "\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C",
7450
7522
  add: "\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C",
7451
- invalidFileType: "\u0424\u0430\u0439\u043B \u043D\u0435 \u044F\u0432\u043B\u044F\u0435\u0442\u0441\u044F \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435\u043C",
7452
- unknownError: "\u041D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u0430\u044F \u043E\u0448\u0438\u0431\u043A\u0430",
7453
- clearError: "\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C \u043E\u0448\u0438\u0431\u043A\u0443"
7523
+ invalidFileType: "\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0444\u043E\u0440\u043C\u0430\u0442 \u0444\u0430\u0439\u043B\u0430."
7454
7524
  },
7455
7525
  videoUpload: {
7456
7526
  title: "\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0432\u0438\u0434\u0435\u043E",
@@ -7495,7 +7565,9 @@ var ru_default = {
7495
7565
  words: ["\u0441\u043B\u043E\u0432\u043E", "\u0441\u043B\u043E\u0432\u0430", "\u0441\u043B\u043E\u0432"]
7496
7566
  },
7497
7567
  common: {
7498
- cancel: "\u041E\u0442\u043C\u0435\u043D\u0438\u0442\u044C"
7568
+ cancel: "\u041E\u0442\u043C\u0435\u043D\u0438\u0442\u044C",
7569
+ unknownError: "\u041D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u0430\u044F \u043E\u0448\u0438\u0431\u043A\u0430",
7570
+ clearError: "\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C \u043E\u0448\u0438\u0431\u043A\u0443"
7499
7571
  }
7500
7572
  };
7501
7573
 
@@ -7615,9 +7687,7 @@ var en_default = {
7615
7687
  captionPlaceholder: "Description under image...",
7616
7688
  save: "Save",
7617
7689
  add: "Add",
7618
- invalidFileType: "File is not an image",
7619
- unknownError: "Unknown error",
7620
- clearError: "Clear error"
7690
+ invalidFileType: "Invalid file format."
7621
7691
  },
7622
7692
  videoUpload: {
7623
7693
  title: "Add video",
@@ -7662,7 +7732,9 @@ var en_default = {
7662
7732
  words: ["word", "words", "words"]
7663
7733
  },
7664
7734
  common: {
7665
- cancel: "Cancel"
7735
+ cancel: "Cancel",
7736
+ unknownError: "Unknown error",
7737
+ clearError: "Clear error"
7666
7738
  }
7667
7739
  };
7668
7740
 
@@ -7676,7 +7748,7 @@ function getTranslations(lang) {
7676
7748
  }
7677
7749
 
7678
7750
  // src/editor/editor.tsx
7679
- import { Fragment as Fragment5, jsx as jsx92, jsxs as jsxs35 } from "react/jsx-runtime";
7751
+ import { Fragment as Fragment5, jsx as jsx93, jsxs as jsxs36 } from "react/jsx-runtime";
7680
7752
  function TiptapContent({
7681
7753
  content,
7682
7754
  handleChange,
@@ -7684,7 +7756,8 @@ function TiptapContent({
7684
7756
  isEditable = true,
7685
7757
  isDisabled = false,
7686
7758
  lang,
7687
- error
7759
+ error,
7760
+ trustedDomains
7688
7761
  }) {
7689
7762
  const [linkDialogContext, setLinkDialogContext] = useState13(null);
7690
7763
  const [katexDialogContext, setKatexDialogContext] = useState13(
@@ -7719,6 +7792,7 @@ function TiptapContent({
7719
7792
  suggestion: createSuggestions(translations2, !!imageHandlers),
7720
7793
  isEditable: isEditable && !disabled,
7721
7794
  getImageById: imageHandlers?.getImage,
7795
+ trustedDomains,
7722
7796
  onKatexClick: (latex, pos) => {
7723
7797
  setKatexDialogContext({ latex, pos });
7724
7798
  openDialogCommand("katex");
@@ -7823,16 +7897,16 @@ function TiptapContent({
7823
7897
  return true;
7824
7898
  };
7825
7899
  if (!editor) return null;
7826
- return /* @__PURE__ */ jsxs35(Fragment5, { children: [
7827
- /* @__PURE__ */ jsx92(DragHandle, { editor }),
7828
- isEditable && !disabled && /* @__PURE__ */ jsx92(TableMenu, { editor }),
7829
- isEditable && !disabled && /* @__PURE__ */ jsx92(
7900
+ return /* @__PURE__ */ jsxs36(Fragment5, { children: [
7901
+ /* @__PURE__ */ jsx93(DragHandle, { editor }),
7902
+ isEditable && !disabled && /* @__PURE__ */ jsx93(TableMenu, { editor }),
7903
+ isEditable && !disabled && /* @__PURE__ */ jsx93(
7830
7904
  BubbleMenu,
7831
7905
  {
7832
7906
  shouldShow: shouldBubbleMenuShow,
7833
7907
  editor,
7834
7908
  options: { placement: "bottom", offset: 8, flip: true },
7835
- children: /* @__PURE__ */ jsx92(
7909
+ children: /* @__PURE__ */ jsx93(
7836
7910
  BubbleMenuContent,
7837
7911
  {
7838
7912
  editor,
@@ -7841,19 +7915,19 @@ function TiptapContent({
7841
7915
  )
7842
7916
  }
7843
7917
  ),
7844
- /* @__PURE__ */ jsxs35(
7918
+ /* @__PURE__ */ jsxs36(
7845
7919
  "div",
7846
7920
  {
7847
7921
  className: `tiptap-content-wrapper ${!!error ? "has-error" : ""} ${disabled ? "is-disabled" : ""}`,
7848
7922
  children: [
7849
- /* @__PURE__ */ jsx92(EditorContent, { editor }),
7850
- isEditable && !disabled && /* @__PURE__ */ jsx92(CharacterCount, { editor })
7923
+ /* @__PURE__ */ jsx93(EditorContent, { editor }),
7924
+ isEditable && !disabled && /* @__PURE__ */ jsx93(CharacterCount, { editor })
7851
7925
  ]
7852
7926
  }
7853
7927
  ),
7854
- !!error && /* @__PURE__ */ jsx92("p", { className: "tiptap-error-message", children: error }),
7855
- isEditable && /* @__PURE__ */ jsxs35(Fragment5, { children: [
7856
- activeDialog === "image" && /* @__PURE__ */ jsx92(
7928
+ !!error && /* @__PURE__ */ jsx93("p", { className: "tiptap-error-message", children: error }),
7929
+ isEditable && /* @__PURE__ */ jsxs36(Fragment5, { children: [
7930
+ activeDialog === "image" && /* @__PURE__ */ jsx93(
7857
7931
  ImageDialog,
7858
7932
  {
7859
7933
  open: true,
@@ -7867,7 +7941,7 @@ function TiptapContent({
7867
7941
  mode: editFigureContext ? "edit" : "add"
7868
7942
  }
7869
7943
  ),
7870
- activeDialog === "link" && /* @__PURE__ */ jsx92(
7944
+ activeDialog === "link" && /* @__PURE__ */ jsx93(
7871
7945
  AddLinkDialog,
7872
7946
  {
7873
7947
  open: true,
@@ -7876,7 +7950,7 @@ function TiptapContent({
7876
7950
  linkDialogContext
7877
7951
  }
7878
7952
  ),
7879
- activeDialog === "video" && /* @__PURE__ */ jsx92(
7953
+ activeDialog === "video" && /* @__PURE__ */ jsx93(
7880
7954
  AddVideoDialog,
7881
7955
  {
7882
7956
  open: true,
@@ -7884,7 +7958,7 @@ function TiptapContent({
7884
7958
  onVideoAdd: handleVideoAdd
7885
7959
  }
7886
7960
  ),
7887
- activeDialog === "katex" && /* @__PURE__ */ jsx92(
7961
+ activeDialog === "katex" && /* @__PURE__ */ jsx93(
7888
7962
  AddKatexDialog,
7889
7963
  {
7890
7964
  open: true,
@@ -7899,7 +7973,7 @@ function TiptapContent({
7899
7973
  var Tiptap = (props) => {
7900
7974
  const { lang = "ru" } = props;
7901
7975
  const translations2 = getTranslations(lang);
7902
- return /* @__PURE__ */ jsx92(TiptapTranslationsProvider, { translations: translations2, children: /* @__PURE__ */ jsx92(DialogCommandProvider, { children: /* @__PURE__ */ jsx92(TiptapContent, { ...props }) }) });
7976
+ return /* @__PURE__ */ jsx93(TiptapTranslationsProvider, { translations: translations2, children: /* @__PURE__ */ jsx93(DialogCommandProvider, { children: /* @__PURE__ */ jsx93(TiptapContent, { ...props }) }) });
7903
7977
  };
7904
7978
 
7905
7979
  // src/utils/html-to-tiptap-content.ts
@@ -7908,7 +7982,7 @@ import { TableKit as TableKit2 } from "@tiptap/extension-table";
7908
7982
  function isJSONContent(value) {
7909
7983
  return typeof value === "object" && value !== null && "type" in value && typeof value.type === "string";
7910
7984
  }
7911
- function htmlToTiptapContent(content) {
7985
+ function htmlToTiptapContent(content, options = {}) {
7912
7986
  if (isJSONContent(content)) {
7913
7987
  return content;
7914
7988
  }
@@ -7924,7 +7998,7 @@ function htmlToTiptapContent(content) {
7924
7998
  if (!content || content.trim() === "") {
7925
7999
  return { type: "doc", content: [{ type: "paragraph" }] };
7926
8000
  }
7927
- const sharedExtensions = getSharedExtensions();
8001
+ const sharedExtensions = getSharedExtensions(options);
7928
8002
  const extensions = [...sharedExtensions, BaseFigure, TableKit2, BaseCodeBlock];
7929
8003
  try {
7930
8004
  return generateJSON(content, extensions);