neuphlo-editor 2.4.2 → 2.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.
@@ -1384,6 +1384,8 @@ var handleCommandNavigation = (event) => {
1384
1384
  var import_extension_collaboration = __toESM(require("@tiptap/extension-collaboration"), 1);
1385
1385
  var import_extension_collaboration_caret = __toESM(require("@tiptap/extension-collaboration-caret"), 1);
1386
1386
  var import_extension_underline = __toESM(require("@tiptap/extension-underline"), 1);
1387
+ var import_extension_list = require("@tiptap/extension-list");
1388
+ var import_react12 = require("@tiptap/react");
1387
1389
 
1388
1390
  // src/headless/extensions/VideoBlock/VideoBlock.ts
1389
1391
  var import_core5 = require("@tiptap/core");
@@ -1460,6 +1462,21 @@ var VideoBlock = import_core5.Node.create({
1460
1462
  });
1461
1463
 
1462
1464
  // src/headless/extensions/extension-kit.ts
1465
+ var TaskItem = import_extension_list.TaskItem.extend({
1466
+ addOptions() {
1467
+ return {
1468
+ ...this.parent?.(),
1469
+ nodeView: null
1470
+ };
1471
+ },
1472
+ addNodeView() {
1473
+ const custom = this.options.nodeView;
1474
+ if (custom) {
1475
+ return (0, import_react12.ReactNodeViewRenderer)(custom);
1476
+ }
1477
+ return this.parent?.();
1478
+ }
1479
+ });
1463
1480
  var ExtensionKit = (options) => {
1464
1481
  const enableSlashCommand = options?.slashCommand !== false;
1465
1482
  const extensions = [
@@ -1467,6 +1484,8 @@ var ExtensionKit = (options) => {
1467
1484
  CodeBlock,
1468
1485
  Link,
1469
1486
  import_extension_underline.default,
1487
+ import_extension_list.TaskList,
1488
+ TaskItem.configure({ nested: true, nodeView: options?.taskItemView }),
1470
1489
  ImageBlock.configure({
1471
1490
  uploadImage: options?.uploadImage,
1472
1491
  browseAssets: options?.browseAssets,
@@ -1565,13 +1584,13 @@ var extension_kit_default = ExtensionKit;
1565
1584
 
1566
1585
  // src/react/menus/TextMenu.tsx
1567
1586
  var import_state4 = require("@tiptap/pm/state");
1568
- var import_react13 = require("@tiptap/react");
1587
+ var import_react14 = require("@tiptap/react");
1569
1588
  var import_menus = require("@tiptap/react/menus");
1570
1589
  var import_icons_react2 = require("@tabler/icons-react");
1571
- var import_react14 = require("react");
1590
+ var import_react15 = require("react");
1572
1591
 
1573
1592
  // src/react/menus/MenuList.tsx
1574
- var import_react12 = require("react");
1593
+ var import_react13 = require("react");
1575
1594
  var import_icons_react = require("@tabler/icons-react");
1576
1595
  var import_jsx_runtime6 = require("react/jsx-runtime");
1577
1596
  function MenuList({
@@ -1581,10 +1600,10 @@ function MenuList({
1581
1600
  onSelect,
1582
1601
  buttonClassName
1583
1602
  }) {
1584
- const [open, setOpen] = (0, import_react12.useState)(false);
1585
- const [label, setLabel] = (0, import_react12.useState)("Paragraph");
1586
- const rootRef = (0, import_react12.useRef)(null);
1587
- const computeLabel = (0, import_react12.useCallback)(() => {
1603
+ const [open, setOpen] = (0, import_react13.useState)(false);
1604
+ const [label, setLabel] = (0, import_react13.useState)("Paragraph");
1605
+ const rootRef = (0, import_react13.useRef)(null);
1606
+ const computeLabel = (0, import_react13.useCallback)(() => {
1588
1607
  if (!editor) return "Paragraph";
1589
1608
  if (editor.isActive("heading", { level: 1 })) return "Heading 1";
1590
1609
  if (editor.isActive("heading", { level: 2 })) return "Heading 2";
@@ -1597,7 +1616,7 @@ function MenuList({
1597
1616
  if (editor.isActive("codeBlock")) return "Code Block";
1598
1617
  return "Paragraph";
1599
1618
  }, [editor]);
1600
- (0, import_react12.useEffect)(() => {
1619
+ (0, import_react13.useEffect)(() => {
1601
1620
  setLabel(computeLabel());
1602
1621
  if (!editor) return;
1603
1622
  const update = () => setLabel(computeLabel());
@@ -1610,7 +1629,7 @@ function MenuList({
1610
1629
  editor.off("update", update);
1611
1630
  };
1612
1631
  }, [editor, computeLabel]);
1613
- (0, import_react12.useEffect)(() => {
1632
+ (0, import_react13.useEffect)(() => {
1614
1633
  if (!editor) return;
1615
1634
  const close = () => setOpen(false);
1616
1635
  editor.on("selectionUpdate", close);
@@ -1620,7 +1639,7 @@ function MenuList({
1620
1639
  editor.off("blur", close);
1621
1640
  };
1622
1641
  }, [editor]);
1623
- (0, import_react12.useEffect)(() => {
1642
+ (0, import_react13.useEffect)(() => {
1624
1643
  const handlePointerDown = (e) => {
1625
1644
  if (!open) return;
1626
1645
  const el = rootRef.current;
@@ -1635,7 +1654,7 @@ function MenuList({
1635
1654
  onSelect?.();
1636
1655
  setOpen(false);
1637
1656
  };
1638
- const isActive = (0, import_react12.useCallback)((name) => label === name, [label]);
1657
+ const isActive = (0, import_react13.useCallback)((name) => label === name, [label]);
1639
1658
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { ref: rootRef, className: "nph-dropdown", children: [
1640
1659
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1641
1660
  "button",
@@ -1831,11 +1850,11 @@ function TextMenu({
1831
1850
  leadingExtras,
1832
1851
  trailingExtras
1833
1852
  }) {
1834
- const { editor } = (0, import_react13.useCurrentEditor)();
1835
- const [isAddingLink, setIsAddingLink] = (0, import_react14.useState)(false);
1836
- const [linkUrl, setLinkUrl] = (0, import_react14.useState)("");
1837
- const linkInputRef = (0, import_react14.useRef)(null);
1838
- const editorState = (0, import_react13.useEditorState)({
1853
+ const { editor } = (0, import_react14.useCurrentEditor)();
1854
+ const [isAddingLink, setIsAddingLink] = (0, import_react15.useState)(false);
1855
+ const [linkUrl, setLinkUrl] = (0, import_react15.useState)("");
1856
+ const linkInputRef = (0, import_react15.useRef)(null);
1857
+ const editorState = (0, import_react14.useEditorState)({
1839
1858
  editor,
1840
1859
  selector: (ctx) => {
1841
1860
  if (!ctx.editor) return null;
@@ -1853,7 +1872,7 @@ function TextMenu({
1853
1872
  };
1854
1873
  }
1855
1874
  });
1856
- (0, import_react14.useEffect)(() => {
1875
+ (0, import_react15.useEffect)(() => {
1857
1876
  if (isAddingLink && linkInputRef.current) {
1858
1877
  linkInputRef.current.focus();
1859
1878
  }
@@ -1893,6 +1912,7 @@ function TextMenu({
1893
1912
  import_menus.BubbleMenu,
1894
1913
  {
1895
1914
  editor,
1915
+ pluginKey: "textBubbleMenu",
1896
1916
  shouldShow: ({ editor: e, state, from, to, view }) => {
1897
1917
  if (e.isActive("imageBlock")) return false;
1898
1918
  if (e.isActive("videoBlock")) return false;
@@ -1911,7 +1931,7 @@ function TextMenu({
1911
1931
  return true;
1912
1932
  },
1913
1933
  children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: className ? `bubble-menu ${className}` : "bubble-menu", children: [
1914
- leadingExtras && editor ? leadingExtras.map((renderExtra, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react14.Fragment, { children: renderExtra(editor) }, `leading-extra-${index}`)) : null,
1934
+ leadingExtras && editor ? leadingExtras.map((renderExtra, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react15.Fragment, { children: renderExtra(editor) }, `leading-extra-${index}`)) : null,
1915
1935
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(MenuList, { editor }),
1916
1936
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Separator, {}),
1917
1937
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
@@ -2073,17 +2093,17 @@ function TextMenu({
2073
2093
  )
2074
2094
  ] });
2075
2095
  })(),
2076
- trailingExtras && editor ? trailingExtras.map((renderExtra, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react14.Fragment, { children: renderExtra(editor) }, `trailing-extra-${index}`)) : null
2096
+ trailingExtras && editor ? trailingExtras.map((renderExtra, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react15.Fragment, { children: renderExtra(editor) }, `trailing-extra-${index}`)) : null
2077
2097
  ] })
2078
2098
  }
2079
2099
  );
2080
2100
  }
2081
2101
 
2082
2102
  // src/react/menus/SlashMenu.tsx
2083
- var import_react15 = require("@tiptap/react");
2103
+ var import_react16 = require("@tiptap/react");
2084
2104
  var import_jotai6 = require("jotai");
2085
2105
  var import_icons_react3 = require("@tabler/icons-react");
2086
- var import_react16 = require("react");
2106
+ var import_react17 = require("react");
2087
2107
  var import_jsx_runtime8 = require("react/jsx-runtime");
2088
2108
  var SLASH_COMMANDS = [
2089
2109
  {
@@ -2213,9 +2233,9 @@ var SLASH_COMMANDS = [
2213
2233
  }
2214
2234
  ];
2215
2235
  function SlashMenu({ className }) {
2216
- const { editor } = (0, import_react15.useCurrentEditor)();
2236
+ const { editor } = (0, import_react16.useCurrentEditor)();
2217
2237
  const query = (0, import_jotai6.useAtomValue)(queryAtom, { store: novelStore });
2218
- const filteredGroups = (0, import_react16.useMemo)(() => {
2238
+ const filteredGroups = (0, import_react17.useMemo)(() => {
2219
2239
  if (!query) return SLASH_COMMANDS;
2220
2240
  const q = query.toLowerCase();
2221
2241
  return SLASH_COMMANDS.map((group) => ({
@@ -2256,37 +2276,37 @@ function SlashMenu({ className }) {
2256
2276
  }
2257
2277
 
2258
2278
  // src/react/menus/LinkMenu.tsx
2259
- var import_react17 = require("@tiptap/react");
2279
+ var import_react18 = require("@tiptap/react");
2260
2280
  var import_menus2 = require("@tiptap/react/menus");
2261
- var import_react18 = require("react");
2281
+ var import_react19 = require("react");
2262
2282
  var import_icons_react4 = require("@tabler/icons-react");
2263
2283
  var import_jsx_runtime9 = require("react/jsx-runtime");
2264
2284
  function LinkMenu() {
2265
- const { editor } = (0, import_react17.useCurrentEditor)();
2266
- const [url, setUrl] = (0, import_react18.useState)("");
2267
- const [isEditing, setIsEditing] = (0, import_react18.useState)(false);
2268
- const inputRef = (0, import_react18.useRef)(null);
2285
+ const { editor } = (0, import_react18.useCurrentEditor)();
2286
+ const [url, setUrl] = (0, import_react19.useState)("");
2287
+ const [isEditing, setIsEditing] = (0, import_react19.useState)(false);
2288
+ const inputRef = (0, import_react19.useRef)(null);
2269
2289
  const currentUrl = editor?.getAttributes("link")?.href || "";
2270
- (0, import_react18.useEffect)(() => {
2290
+ (0, import_react19.useEffect)(() => {
2271
2291
  setUrl(currentUrl);
2272
2292
  }, [currentUrl]);
2273
- (0, import_react18.useEffect)(() => {
2293
+ (0, import_react19.useEffect)(() => {
2274
2294
  if (isEditing && inputRef.current) {
2275
2295
  inputRef.current.focus();
2276
2296
  inputRef.current.select();
2277
2297
  }
2278
2298
  }, [isEditing]);
2279
- const handleSetLink = (0, import_react18.useCallback)(() => {
2299
+ const handleSetLink = (0, import_react19.useCallback)(() => {
2280
2300
  if (!editor || !url) return;
2281
2301
  editor.chain().focus().extendMarkRange("link").setLink({ href: url }).run();
2282
2302
  setIsEditing(false);
2283
2303
  }, [editor, url]);
2284
- const handleRemoveLink = (0, import_react18.useCallback)(() => {
2304
+ const handleRemoveLink = (0, import_react19.useCallback)(() => {
2285
2305
  if (!editor) return;
2286
2306
  editor.chain().focus().unsetLink().run();
2287
2307
  setIsEditing(false);
2288
2308
  }, [editor]);
2289
- const handleOpenLink = (0, import_react18.useCallback)(() => {
2309
+ const handleOpenLink = (0, import_react19.useCallback)(() => {
2290
2310
  if (url || currentUrl) {
2291
2311
  window.open(url || currentUrl, "_blank", "noopener,noreferrer");
2292
2312
  }
@@ -2402,20 +2422,20 @@ function LinkMenu() {
2402
2422
 
2403
2423
  // src/react/menus/ImageMenu.tsx
2404
2424
  var import_state5 = require("@tiptap/pm/state");
2405
- var import_react19 = require("@tiptap/react");
2425
+ var import_react20 = require("@tiptap/react");
2406
2426
  var import_menus3 = require("@tiptap/react/menus");
2407
2427
  var import_icons_react5 = require("@tabler/icons-react");
2408
- var import_react20 = require("react");
2428
+ var import_react21 = require("react");
2409
2429
  var import_jsx_runtime10 = require("react/jsx-runtime");
2410
2430
  function ImageMenu({
2411
2431
  className,
2412
2432
  leadingExtras,
2413
2433
  trailingExtras
2414
2434
  }) {
2415
- const { editor } = (0, import_react19.useCurrentEditor)();
2416
- const [size, setSize] = (0, import_react20.useState)(100);
2417
- const [align, setAlign] = (0, import_react20.useState)("left");
2418
- (0, import_react20.useEffect)(() => {
2435
+ const { editor } = (0, import_react20.useCurrentEditor)();
2436
+ const [size, setSize] = (0, import_react21.useState)(100);
2437
+ const [align, setAlign] = (0, import_react21.useState)("left");
2438
+ (0, import_react21.useEffect)(() => {
2419
2439
  if (!editor) return;
2420
2440
  const update = () => {
2421
2441
  if (!editor.isActive("imageBlock")) return;
@@ -2460,6 +2480,7 @@ function ImageMenu({
2460
2480
  import_menus3.BubbleMenu,
2461
2481
  {
2462
2482
  editor,
2483
+ pluginKey: "imageBubbleMenu",
2463
2484
  shouldShow: ({ editor: e, state }) => {
2464
2485
  if (!e.isActive("imageBlock")) return false;
2465
2486
  const { selection } = state;
@@ -2468,7 +2489,7 @@ function ImageMenu({
2468
2489
  },
2469
2490
  updateDelay: 0,
2470
2491
  children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: className ? `bubble-menu ${className}` : "bubble-menu", children: [
2471
- leadingExtras && editor ? leadingExtras.map((renderExtra, index) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react20.Fragment, { children: renderExtra(editor) }, `image-leading-extra-${index}`)) : null,
2492
+ leadingExtras && editor ? leadingExtras.map((renderExtra, index) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react21.Fragment, { children: renderExtra(editor) }, `image-leading-extra-${index}`)) : null,
2472
2493
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
2473
2494
  "div",
2474
2495
  {
@@ -2568,32 +2589,32 @@ function ImageMenu({
2568
2589
  children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_icons_react5.IconTrash, { size: 16 })
2569
2590
  }
2570
2591
  ),
2571
- trailingExtras && editor ? trailingExtras.map((renderExtra, index) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react20.Fragment, { children: renderExtra(editor) }, `image-trailing-extra-${index}`)) : null
2592
+ trailingExtras && editor ? trailingExtras.map((renderExtra, index) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react21.Fragment, { children: renderExtra(editor) }, `image-trailing-extra-${index}`)) : null
2572
2593
  ] })
2573
2594
  }
2574
2595
  );
2575
2596
  }
2576
2597
 
2577
2598
  // src/react/menus/ImageBlock/ImageBlockView.tsx
2578
- var import_react26 = require("@tiptap/react");
2579
- var import_react27 = require("react");
2599
+ var import_react27 = require("@tiptap/react");
2600
+ var import_react28 = require("react");
2580
2601
  var import_icons_react9 = require("@tabler/icons-react");
2581
2602
 
2582
2603
  // src/react/menus/ImageBlock/ImageBlockMenu.tsx
2583
2604
  var import_state6 = require("@tiptap/pm/state");
2584
- var import_react22 = require("@tiptap/react");
2585
- var import_react23 = require("react");
2605
+ var import_react23 = require("@tiptap/react");
2606
+ var import_react24 = require("react");
2586
2607
 
2587
2608
  // src/react/menus/ImageBlock/ImageBlockWidth.tsx
2588
- var import_react21 = require("react");
2609
+ var import_react22 = require("react");
2589
2610
  var import_jsx_runtime11 = require("react/jsx-runtime");
2590
- var ImageBlockWidth = (0, import_react21.memo)(
2611
+ var ImageBlockWidth = (0, import_react22.memo)(
2591
2612
  ({ onChange, value }) => {
2592
- const [currentValue, setCurrentValue] = (0, import_react21.useState)(value);
2593
- (0, import_react21.useEffect)(() => {
2613
+ const [currentValue, setCurrentValue] = (0, import_react22.useState)(value);
2614
+ (0, import_react22.useEffect)(() => {
2594
2615
  setCurrentValue(value);
2595
2616
  }, [value]);
2596
- const handleChange = (0, import_react21.useCallback)(
2617
+ const handleChange = (0, import_react22.useCallback)(
2597
2618
  (e) => {
2598
2619
  const nextValue = parseInt(e.target.value);
2599
2620
  onChange(nextValue);
@@ -2648,8 +2669,8 @@ ImageBlockWidth.displayName = "ImageBlockWidth";
2648
2669
  var import_icons_react6 = require("@tabler/icons-react");
2649
2670
  var import_jsx_runtime12 = require("react/jsx-runtime");
2650
2671
  var ImageBlockMenu = ({ editor, getPos, appendTo }) => {
2651
- const menuRef = (0, import_react23.useRef)(null);
2652
- const { isVisible, align, width } = (0, import_react22.useEditorState)({
2672
+ const menuRef = (0, import_react24.useRef)(null);
2673
+ const { isVisible, align, width } = (0, import_react23.useEditorState)({
2653
2674
  editor,
2654
2675
  selector: (ctx) => {
2655
2676
  if (!ctx.editor) return { isVisible: false, align: "center", width: 100 };
@@ -2671,22 +2692,22 @@ var ImageBlockMenu = ({ editor, getPos, appendTo }) => {
2671
2692
  return { isVisible: visible, align: currentAlign, width: currentWidth };
2672
2693
  }
2673
2694
  });
2674
- const onAlignImageLeft = (0, import_react23.useCallback)(() => {
2695
+ const onAlignImageLeft = (0, import_react24.useCallback)(() => {
2675
2696
  editor.chain().focus(void 0, { scrollIntoView: false }).setImageBlockAlign("left").run();
2676
2697
  }, [editor]);
2677
- const onAlignImageCenter = (0, import_react23.useCallback)(() => {
2698
+ const onAlignImageCenter = (0, import_react24.useCallback)(() => {
2678
2699
  editor.chain().focus(void 0, { scrollIntoView: false }).setImageBlockAlign("center").run();
2679
2700
  }, [editor]);
2680
- const onAlignImageRight = (0, import_react23.useCallback)(() => {
2701
+ const onAlignImageRight = (0, import_react24.useCallback)(() => {
2681
2702
  editor.chain().focus(void 0, { scrollIntoView: false }).setImageBlockAlign("right").run();
2682
2703
  }, [editor]);
2683
- const onWidthChange = (0, import_react23.useCallback)(
2704
+ const onWidthChange = (0, import_react24.useCallback)(
2684
2705
  (value) => {
2685
2706
  editor.chain().focus(void 0, { scrollIntoView: false }).setImageBlockWidth(value).run();
2686
2707
  },
2687
2708
  [editor]
2688
2709
  );
2689
- const onRemoveImage = (0, import_react23.useCallback)(() => {
2710
+ const onRemoveImage = (0, import_react24.useCallback)(() => {
2690
2711
  editor.chain().focus(void 0, { scrollIntoView: false }).deleteSelection().run();
2691
2712
  }, [editor]);
2692
2713
  if (!isVisible) return null;
@@ -2769,7 +2790,7 @@ var ImageBlockMenu = ({ editor, getPos, appendTo }) => {
2769
2790
 
2770
2791
  // src/react/menus/ImageBlock/ImageUploader.tsx
2771
2792
  var import_icons_react8 = require("@tabler/icons-react");
2772
- var import_react24 = require("react");
2793
+ var import_react25 = require("react");
2773
2794
 
2774
2795
  // src/react/menus/ImageBlock/ImageBlockLoading.tsx
2775
2796
  var import_icons_react7 = require("@tabler/icons-react");
@@ -2787,14 +2808,14 @@ var ImageBlockLoading = () => {
2787
2808
  // src/react/menus/ImageBlock/ImageUploader.tsx
2788
2809
  var import_jsx_runtime14 = require("react/jsx-runtime");
2789
2810
  var ImageUploader = ({ onUpload, editor }) => {
2790
- const [loading, setLoading] = (0, import_react24.useState)(false);
2791
- const [draggedInside, setDraggedInside] = (0, import_react24.useState)(false);
2792
- const fileInputRef = (0, import_react24.useRef)(null);
2811
+ const [loading, setLoading] = (0, import_react25.useState)(false);
2812
+ const [draggedInside, setDraggedInside] = (0, import_react25.useState)(false);
2813
+ const fileInputRef = (0, import_react25.useRef)(null);
2793
2814
  const imageExtension = editor.extensionManager.extensions.find(
2794
2815
  (ext) => ext.name === "imageBlock"
2795
2816
  );
2796
2817
  const browseAssets = imageExtension?.options?.browseAssets;
2797
- const uploadFile = (0, import_react24.useCallback)(
2818
+ const uploadFile = (0, import_react25.useCallback)(
2798
2819
  async (file) => {
2799
2820
  setLoading(true);
2800
2821
  try {
@@ -2813,10 +2834,10 @@ var ImageUploader = ({ onUpload, editor }) => {
2813
2834
  },
2814
2835
  [imageExtension, onUpload]
2815
2836
  );
2816
- const handleUploadClick = (0, import_react24.useCallback)(() => {
2837
+ const handleUploadClick = (0, import_react25.useCallback)(() => {
2817
2838
  fileInputRef.current?.click();
2818
2839
  }, []);
2819
- const onFileChange = (0, import_react24.useCallback)(
2840
+ const onFileChange = (0, import_react25.useCallback)(
2820
2841
  (e) => {
2821
2842
  const file = e.target.files?.[0];
2822
2843
  if (file) {
@@ -2825,7 +2846,7 @@ var ImageUploader = ({ onUpload, editor }) => {
2825
2846
  },
2826
2847
  [uploadFile]
2827
2848
  );
2828
- const onDrop = (0, import_react24.useCallback)(
2849
+ const onDrop = (0, import_react25.useCallback)(
2829
2850
  (e) => {
2830
2851
  e.preventDefault();
2831
2852
  e.stopPropagation();
@@ -2837,12 +2858,12 @@ var ImageUploader = ({ onUpload, editor }) => {
2837
2858
  },
2838
2859
  [uploadFile]
2839
2860
  );
2840
- const onDragEnter = (0, import_react24.useCallback)((e) => {
2861
+ const onDragEnter = (0, import_react25.useCallback)((e) => {
2841
2862
  e.preventDefault();
2842
2863
  e.stopPropagation();
2843
2864
  setDraggedInside(true);
2844
2865
  }, []);
2845
- const onDragLeave = (0, import_react24.useCallback)((e) => {
2866
+ const onDragLeave = (0, import_react25.useCallback)((e) => {
2846
2867
  e.preventDefault();
2847
2868
  e.stopPropagation();
2848
2869
  setDraggedInside(false);
@@ -2917,16 +2938,16 @@ var ImageUploader = ({ onUpload, editor }) => {
2917
2938
  };
2918
2939
 
2919
2940
  // src/react/menus/ImageBlock/ImageResizeHandle.tsx
2920
- var import_react25 = require("react");
2941
+ var import_react26 = require("react");
2921
2942
  var import_jsx_runtime15 = require("react/jsx-runtime");
2922
2943
  function ImageResizeHandle({
2923
2944
  children,
2924
2945
  onResize,
2925
2946
  currentWidth
2926
2947
  }) {
2927
- const containerRef = (0, import_react25.useRef)(null);
2928
- const [isResizing, setIsResizing] = (0, import_react25.useState)(false);
2929
- const handleMouseDown = (0, import_react25.useCallback)(
2948
+ const containerRef = (0, import_react26.useRef)(null);
2949
+ const [isResizing, setIsResizing] = (0, import_react26.useState)(false);
2950
+ const handleMouseDown = (0, import_react26.useCallback)(
2930
2951
  (e, side) => {
2931
2952
  e.preventDefault();
2932
2953
  e.stopPropagation();
@@ -2986,19 +3007,19 @@ function ImageResizeHandle({
2986
3007
  var import_jsx_runtime16 = require("react/jsx-runtime");
2987
3008
  var ImageBlockView = (props) => {
2988
3009
  const { editor, getPos, node, updateAttributes } = props;
2989
- const imageWrapperRef = (0, import_react27.useRef)(null);
2990
- const [imageError, setImageError] = (0, import_react27.useState)(false);
3010
+ const imageWrapperRef = (0, import_react28.useRef)(null);
3011
+ const [imageError, setImageError] = (0, import_react28.useState)(false);
2991
3012
  const { src, width, align, alt, loading } = node.attrs;
2992
- const handleUpload = (0, import_react27.useCallback)(
3013
+ const handleUpload = (0, import_react28.useCallback)(
2993
3014
  (url) => {
2994
3015
  updateAttributes({ src: url, loading: false });
2995
3016
  },
2996
3017
  [updateAttributes]
2997
3018
  );
2998
- const onClick = (0, import_react27.useCallback)(() => {
3019
+ const onClick = (0, import_react28.useCallback)(() => {
2999
3020
  editor.commands.setNodeSelection(getPos());
3000
3021
  }, [getPos, editor.commands]);
3001
- const handleResize = (0, import_react27.useCallback)(
3022
+ const handleResize = (0, import_react28.useCallback)(
3002
3023
  (widthPercent) => {
3003
3024
  updateAttributes({ width: `${widthPercent}%` });
3004
3025
  },
@@ -3021,14 +3042,14 @@ var ImageBlockView = (props) => {
3021
3042
  position: "relative"
3022
3043
  });
3023
3044
  if (!src || src === "") {
3024
- if (!editor.isEditable) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react26.NodeViewWrapper, {});
3025
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react26.NodeViewWrapper, { style: { width: "100%", marginTop: "0.5rem", marginBottom: "0.5rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { ref: imageWrapperRef, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ImageUploader, { onUpload: handleUpload, editor }) }) });
3045
+ if (!editor.isEditable) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react27.NodeViewWrapper, {});
3046
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react27.NodeViewWrapper, { style: { width: "100%", marginTop: "0.5rem", marginBottom: "0.5rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { ref: imageWrapperRef, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ImageUploader, { onUpload: handleUpload, editor }) }) });
3026
3047
  }
3027
3048
  if (loading) {
3028
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react26.NodeViewWrapper, { style: getWrapperStyle(), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { ref: imageWrapperRef, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ImageBlockLoading, {}) }) });
3049
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react27.NodeViewWrapper, { style: getWrapperStyle(), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { ref: imageWrapperRef, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ImageBlockLoading, {}) }) });
3029
3050
  }
3030
3051
  if (imageError) {
3031
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react26.NodeViewWrapper, { style: getWrapperStyle(), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { contentEditable: false, ref: imageWrapperRef, style: getContentStyle(), children: [
3052
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react27.NodeViewWrapper, { style: getWrapperStyle(), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { contentEditable: false, ref: imageWrapperRef, style: getContentStyle(), children: [
3032
3053
  /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "nph-image-block-error", onClick, children: [
3033
3054
  /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_icons_react9.IconPhotoOff, { size: 32 }),
3034
3055
  /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: "Image could not be loaded" })
@@ -3036,7 +3057,7 @@ var ImageBlockView = (props) => {
3036
3057
  editor.isEditable && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ImageBlockMenu, { editor, getPos, appendTo: imageWrapperRef })
3037
3058
  ] }) });
3038
3059
  }
3039
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react26.NodeViewWrapper, { style: getWrapperStyle(), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { contentEditable: false, ref: imageWrapperRef, style: getContentStyle(), children: [
3060
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react27.NodeViewWrapper, { style: getWrapperStyle(), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { contentEditable: false, ref: imageWrapperRef, style: getContentStyle(), children: [
3040
3061
  editor.isEditable ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ImageResizeHandle, { onResize: handleResize, currentWidth: width, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3041
3062
  "img",
3042
3063
  {
@@ -3061,18 +3082,18 @@ var ImageBlockView = (props) => {
3061
3082
 
3062
3083
  // src/react/menus/VideoBlock/VideoBlockView.tsx
3063
3084
  var import_state8 = require("@tiptap/pm/state");
3064
- var import_react30 = require("@tiptap/react");
3065
- var import_react31 = require("react");
3085
+ var import_react31 = require("@tiptap/react");
3086
+ var import_react32 = require("react");
3066
3087
 
3067
3088
  // src/react/menus/VideoBlock/VideoBlockMenu.tsx
3068
3089
  var import_state7 = require("@tiptap/pm/state");
3069
- var import_react28 = require("@tiptap/react");
3070
- var import_react29 = require("react");
3090
+ var import_react29 = require("@tiptap/react");
3091
+ var import_react30 = require("react");
3071
3092
  var import_icons_react10 = require("@tabler/icons-react");
3072
3093
  var import_jsx_runtime17 = require("react/jsx-runtime");
3073
3094
  var VideoBlockMenu = ({ editor, getPos }) => {
3074
- const menuRef = (0, import_react29.useRef)(null);
3075
- const { isVisible, align, width } = (0, import_react28.useEditorState)({
3095
+ const menuRef = (0, import_react30.useRef)(null);
3096
+ const { isVisible, align, width } = (0, import_react29.useEditorState)({
3076
3097
  editor,
3077
3098
  selector: (ctx) => {
3078
3099
  if (!ctx.editor) return { isVisible: false, align: "center", width: 100 };
@@ -3092,22 +3113,22 @@ var VideoBlockMenu = ({ editor, getPos }) => {
3092
3113
  return { isVisible: isThisNode, align: currentAlign, width: currentWidth };
3093
3114
  }
3094
3115
  });
3095
- const onAlignLeft = (0, import_react29.useCallback)(() => {
3116
+ const onAlignLeft = (0, import_react30.useCallback)(() => {
3096
3117
  editor.chain().focus(void 0, { scrollIntoView: false }).setVideoBlockAlign("left").run();
3097
3118
  }, [editor]);
3098
- const onAlignCenter = (0, import_react29.useCallback)(() => {
3119
+ const onAlignCenter = (0, import_react30.useCallback)(() => {
3099
3120
  editor.chain().focus(void 0, { scrollIntoView: false }).setVideoBlockAlign("center").run();
3100
3121
  }, [editor]);
3101
- const onAlignRight = (0, import_react29.useCallback)(() => {
3122
+ const onAlignRight = (0, import_react30.useCallback)(() => {
3102
3123
  editor.chain().focus(void 0, { scrollIntoView: false }).setVideoBlockAlign("right").run();
3103
3124
  }, [editor]);
3104
- const onWidthChange = (0, import_react29.useCallback)(
3125
+ const onWidthChange = (0, import_react30.useCallback)(
3105
3126
  (value) => {
3106
3127
  editor.chain().focus(void 0, { scrollIntoView: false }).setVideoBlockWidth(value).run();
3107
3128
  },
3108
3129
  [editor]
3109
3130
  );
3110
- const onRemove = (0, import_react29.useCallback)(() => {
3131
+ const onRemove = (0, import_react30.useCallback)(() => {
3111
3132
  editor.chain().focus(void 0, { scrollIntoView: false }).deleteSelection().run();
3112
3133
  }, [editor]);
3113
3134
  if (!isVisible) return null;
@@ -3213,11 +3234,11 @@ function toEmbedUrl(url) {
3213
3234
  }
3214
3235
  var VideoBlockView = (props) => {
3215
3236
  const { editor, getPos, node, updateAttributes } = props;
3216
- const wrapperRef = (0, import_react31.useRef)(null);
3237
+ const wrapperRef = (0, import_react32.useRef)(null);
3217
3238
  const { src, width, align } = node.attrs;
3218
- const [inputUrl, setInputUrl] = (0, import_react31.useState)("");
3219
- const [videoError, setVideoError] = (0, import_react31.useState)(false);
3220
- const isSelected = (0, import_react30.useEditorState)({
3239
+ const [inputUrl, setInputUrl] = (0, import_react32.useState)("");
3240
+ const [videoError, setVideoError] = (0, import_react32.useState)(false);
3241
+ const isSelected = (0, import_react31.useEditorState)({
3221
3242
  editor,
3222
3243
  selector: (ctx) => {
3223
3244
  if (!ctx.editor) return false;
@@ -3225,12 +3246,12 @@ var VideoBlockView = (props) => {
3225
3246
  return selection instanceof import_state8.NodeSelection && selection.from === getPos();
3226
3247
  }
3227
3248
  });
3228
- const handleEmbed = (0, import_react31.useCallback)(() => {
3249
+ const handleEmbed = (0, import_react32.useCallback)(() => {
3229
3250
  if (!inputUrl.trim()) return;
3230
3251
  const embedUrl = toEmbedUrl(inputUrl.trim());
3231
3252
  updateAttributes({ src: embedUrl });
3232
3253
  }, [inputUrl, updateAttributes]);
3233
- const handleKeyDown = (0, import_react31.useCallback)(
3254
+ const handleKeyDown = (0, import_react32.useCallback)(
3234
3255
  (e) => {
3235
3256
  if (e.key === "Enter") {
3236
3257
  e.preventDefault();
@@ -3239,7 +3260,7 @@ var VideoBlockView = (props) => {
3239
3260
  },
3240
3261
  [handleEmbed]
3241
3262
  );
3242
- const onClick = (0, import_react31.useCallback)(() => {
3263
+ const onClick = (0, import_react32.useCallback)(() => {
3243
3264
  editor.commands.setNodeSelection(getPos());
3244
3265
  }, [getPos, editor.commands]);
3245
3266
  const getWrapperStyle = () => {
@@ -3256,8 +3277,8 @@ var VideoBlockView = (props) => {
3256
3277
  }
3257
3278
  };
3258
3279
  if (!src || src === "") {
3259
- if (!editor.isEditable) return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react30.NodeViewWrapper, {});
3260
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react30.NodeViewWrapper, { style: getWrapperStyle(), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { ref: wrapperRef, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "nph-video-placeholder", onClick, children: [
3280
+ if (!editor.isEditable) return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react31.NodeViewWrapper, {});
3281
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react31.NodeViewWrapper, { style: getWrapperStyle(), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { ref: wrapperRef, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "nph-video-placeholder", onClick, children: [
3261
3282
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "nph-video-placeholder__icon", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_icons_react11.IconVideo, { size: 28, stroke: 1.5 }) }),
3262
3283
  /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", gap: "2px" }, children: [
3263
3284
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style: { fontSize: "14px", fontWeight: 600, lineHeight: "20px" }, children: "Add a video" }),
@@ -3293,7 +3314,7 @@ var VideoBlockView = (props) => {
3293
3314
  ] }) }) });
3294
3315
  }
3295
3316
  if (videoError) {
3296
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react30.NodeViewWrapper, { style: getWrapperStyle(), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { contentEditable: false, ref: wrapperRef, style: { position: "relative" }, children: [
3317
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react31.NodeViewWrapper, { style: getWrapperStyle(), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { contentEditable: false, ref: wrapperRef, style: { position: "relative" }, children: [
3297
3318
  /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "nph-video-block-error", onClick, children: [
3298
3319
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_icons_react11.IconVideoOff, { size: 32 }),
3299
3320
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: "Video could not be loaded" }),
@@ -3302,7 +3323,7 @@ var VideoBlockView = (props) => {
3302
3323
  editor.isEditable && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(VideoBlockMenu, { editor, getPos })
3303
3324
  ] }) });
3304
3325
  }
3305
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react30.NodeViewWrapper, { style: getWrapperStyle(), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
3326
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react31.NodeViewWrapper, { style: getWrapperStyle(), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
3306
3327
  "div",
3307
3328
  {
3308
3329
  contentEditable: false,
@@ -3336,22 +3357,22 @@ var VideoBlockView = (props) => {
3336
3357
 
3337
3358
  // src/react/menus/DragHandle/BlockActionMenu.tsx
3338
3359
  var import_icons_react12 = require("@tabler/icons-react");
3339
- var import_react32 = require("react");
3360
+ var import_react33 = require("react");
3340
3361
  var import_jsx_runtime19 = require("react/jsx-runtime");
3341
3362
  function BlockActionMenu({ editor, onClose }) {
3342
- const executeAndClose = (0, import_react32.useCallback)(
3363
+ const executeAndClose = (0, import_react33.useCallback)(
3343
3364
  (fn) => {
3344
3365
  fn();
3345
3366
  onClose();
3346
3367
  },
3347
3368
  [onClose]
3348
3369
  );
3349
- const handleDelete = (0, import_react32.useCallback)(() => {
3370
+ const handleDelete = (0, import_react33.useCallback)(() => {
3350
3371
  executeAndClose(() => {
3351
3372
  editor.commands.deleteSelection();
3352
3373
  });
3353
3374
  }, [editor, executeAndClose]);
3354
- const handleDuplicate = (0, import_react32.useCallback)(() => {
3375
+ const handleDuplicate = (0, import_react33.useCallback)(() => {
3355
3376
  executeAndClose(() => {
3356
3377
  const { state } = editor;
3357
3378
  const { selection } = state;
@@ -3366,7 +3387,7 @@ function BlockActionMenu({ editor, onClose }) {
3366
3387
  }
3367
3388
  });
3368
3389
  }, [editor, executeAndClose]);
3369
- const handleMoveUp = (0, import_react32.useCallback)(() => {
3390
+ const handleMoveUp = (0, import_react33.useCallback)(() => {
3370
3391
  executeAndClose(() => {
3371
3392
  const { state } = editor;
3372
3393
  const { selection } = state;
@@ -3389,7 +3410,7 @@ function BlockActionMenu({ editor, onClose }) {
3389
3410
  }).run();
3390
3411
  });
3391
3412
  }, [editor, executeAndClose]);
3392
- const handleMoveDown = (0, import_react32.useCallback)(() => {
3413
+ const handleMoveDown = (0, import_react33.useCallback)(() => {
3393
3414
  executeAndClose(() => {
3394
3415
  const { state } = editor;
3395
3416
  const { selection } = state;
@@ -3414,7 +3435,7 @@ function BlockActionMenu({ editor, onClose }) {
3414
3435
  }).run();
3415
3436
  });
3416
3437
  }, [editor, executeAndClose]);
3417
- const handleCopyToClipboard = (0, import_react32.useCallback)(() => {
3438
+ const handleCopyToClipboard = (0, import_react33.useCallback)(() => {
3418
3439
  executeAndClose(() => {
3419
3440
  const { state } = editor;
3420
3441
  const { selection } = state;
@@ -3499,14 +3520,14 @@ function BlockActionMenu({ editor, onClose }) {
3499
3520
  }
3500
3521
 
3501
3522
  // src/react/menus/TableMenu.tsx
3502
- var import_react33 = require("@tiptap/react");
3523
+ var import_react34 = require("@tiptap/react");
3503
3524
  var import_icons_react13 = require("@tabler/icons-react");
3504
- var import_react34 = require("react");
3525
+ var import_react35 = require("react");
3505
3526
  var import_react_dom2 = require("react-dom");
3506
3527
  var import_jsx_runtime20 = require("react/jsx-runtime");
3507
3528
  function TableMenu({ className: _className }) {
3508
- const { editor } = (0, import_react33.useCurrentEditor)();
3509
- const tableInfo = (0, import_react33.useEditorState)({
3529
+ const { editor } = (0, import_react34.useCurrentEditor)();
3530
+ const tableInfo = (0, import_react34.useEditorState)({
3510
3531
  editor,
3511
3532
  selector: (ctx) => {
3512
3533
  if (!ctx.editor) return null;
@@ -3519,19 +3540,19 @@ function TableMenu({ className: _className }) {
3519
3540
  return null;
3520
3541
  }
3521
3542
  });
3522
- const [colGrips, setColGrips] = (0, import_react34.useState)([]);
3523
- const [rowGrips, setRowGrips] = (0, import_react34.useState)([]);
3524
- const [dropdown, setDropdown] = (0, import_react34.useState)(null);
3525
- const [tableRect, setTableRect] = (0, import_react34.useState)(null);
3526
- const [isHovering, setIsHovering] = (0, import_react34.useState)(false);
3527
- const [drag, setDrag] = (0, import_react34.useState)(null);
3528
- const dropdownRef = (0, import_react34.useRef)(null);
3529
- const dragRef = (0, import_react34.useRef)(null);
3530
- const getTableDom = (0, import_react34.useCallback)(() => {
3543
+ const [colGrips, setColGrips] = (0, import_react35.useState)([]);
3544
+ const [rowGrips, setRowGrips] = (0, import_react35.useState)([]);
3545
+ const [dropdown, setDropdown] = (0, import_react35.useState)(null);
3546
+ const [tableRect, setTableRect] = (0, import_react35.useState)(null);
3547
+ const [isHovering, setIsHovering] = (0, import_react35.useState)(false);
3548
+ const [drag, setDrag] = (0, import_react35.useState)(null);
3549
+ const dropdownRef = (0, import_react35.useRef)(null);
3550
+ const dragRef = (0, import_react35.useRef)(null);
3551
+ const getTableDom = (0, import_react35.useCallback)(() => {
3531
3552
  if (!editor || !tableInfo) return null;
3532
3553
  return editor.view.nodeDOM(tableInfo.pos);
3533
3554
  }, [editor, tableInfo]);
3534
- const measureGrips = (0, import_react34.useCallback)(() => {
3555
+ const measureGrips = (0, import_react35.useCallback)(() => {
3535
3556
  const tableDom = getTableDom();
3536
3557
  if (!tableDom) {
3537
3558
  setColGrips([]);
@@ -3568,7 +3589,7 @@ function TableMenu({ className: _className }) {
3568
3589
  });
3569
3590
  setRowGrips(newRowGrips);
3570
3591
  }, [getTableDom]);
3571
- (0, import_react34.useEffect)(() => {
3592
+ (0, import_react35.useEffect)(() => {
3572
3593
  if (!tableInfo) {
3573
3594
  setColGrips([]);
3574
3595
  setRowGrips([]);
@@ -3602,7 +3623,7 @@ function TableMenu({ className: _className }) {
3602
3623
  window.removeEventListener("scroll", handleScroll);
3603
3624
  };
3604
3625
  }, [tableInfo, getTableDom, measureGrips]);
3605
- (0, import_react34.useEffect)(() => {
3626
+ (0, import_react35.useEffect)(() => {
3606
3627
  if (!dropdown) return;
3607
3628
  const handlePointerDown = (e) => {
3608
3629
  if (dropdownRef.current && !dropdownRef.current.contains(e.target)) {
@@ -3612,7 +3633,7 @@ function TableMenu({ className: _className }) {
3612
3633
  document.addEventListener("pointerdown", handlePointerDown);
3613
3634
  return () => document.removeEventListener("pointerdown", handlePointerDown);
3614
3635
  }, [dropdown]);
3615
- (0, import_react34.useEffect)(() => {
3636
+ (0, import_react35.useEffect)(() => {
3616
3637
  if (!editor || !dropdown) return;
3617
3638
  const handleTransaction = () => setDropdown(null);
3618
3639
  editor.on("transaction", handleTransaction);
@@ -3620,7 +3641,7 @@ function TableMenu({ className: _className }) {
3620
3641
  editor.off("transaction", handleTransaction);
3621
3642
  };
3622
3643
  }, [editor, dropdown]);
3623
- const handleColGripClick = (0, import_react34.useCallback)(
3644
+ const handleColGripClick = (0, import_react35.useCallback)(
3624
3645
  (index, e) => {
3625
3646
  e.preventDefault();
3626
3647
  e.stopPropagation();
@@ -3644,7 +3665,7 @@ function TableMenu({ className: _className }) {
3644
3665
  },
3645
3666
  [editor, tableInfo, getTableDom]
3646
3667
  );
3647
- const handleRowGripClick = (0, import_react34.useCallback)(
3668
+ const handleRowGripClick = (0, import_react35.useCallback)(
3648
3669
  (index, e) => {
3649
3670
  e.preventDefault();
3650
3671
  e.stopPropagation();
@@ -3669,7 +3690,7 @@ function TableMenu({ className: _className }) {
3669
3690
  },
3670
3691
  [editor, tableInfo, getTableDom]
3671
3692
  );
3672
- const moveColumn = (0, import_react34.useCallback)(
3693
+ const moveColumn = (0, import_react35.useCallback)(
3673
3694
  (from, to) => {
3674
3695
  if (!editor || !tableInfo || from === to) return;
3675
3696
  const { state } = editor;
@@ -3696,7 +3717,7 @@ function TableMenu({ className: _className }) {
3696
3717
  },
3697
3718
  [editor, tableInfo]
3698
3719
  );
3699
- const moveRow = (0, import_react34.useCallback)(
3720
+ const moveRow = (0, import_react35.useCallback)(
3700
3721
  (from, to) => {
3701
3722
  if (!editor || !tableInfo || from === to) return;
3702
3723
  const { state } = editor;
@@ -3719,7 +3740,7 @@ function TableMenu({ className: _className }) {
3719
3740
  },
3720
3741
  [editor, tableInfo]
3721
3742
  );
3722
- const handleGripDragStart = (0, import_react34.useCallback)(
3743
+ const handleGripDragStart = (0, import_react35.useCallback)(
3723
3744
  (type, index, e) => {
3724
3745
  e.preventDefault();
3725
3746
  e.stopPropagation();
@@ -4015,9 +4036,44 @@ function TableMenu({ className: _className }) {
4015
4036
  );
4016
4037
  }
4017
4038
 
4018
- // src/react/Editor.tsx
4019
- var import_react35 = require("react");
4039
+ // src/react/menus/TaskItem/TaskItemView.tsx
4040
+ var import_react36 = require("@tiptap/react");
4020
4041
  var import_jsx_runtime21 = require("react/jsx-runtime");
4042
+ var createTaskItemView = (Checkbox) => {
4043
+ const TaskItemView = ({ node, updateAttributes }) => {
4044
+ const checked = !!node.attrs.checked;
4045
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
4046
+ import_react36.NodeViewWrapper,
4047
+ {
4048
+ as: "li",
4049
+ "data-checked": checked,
4050
+ className: "nph-task-item",
4051
+ children: [
4052
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("label", { contentEditable: false, className: "nph-task-item__checkbox", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4053
+ Checkbox,
4054
+ {
4055
+ checked,
4056
+ onCheckedChange: (value) => updateAttributes({ checked: value === true })
4057
+ }
4058
+ ) }),
4059
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4060
+ import_react36.NodeViewContent,
4061
+ {
4062
+ as: "div",
4063
+ className: "nph-task-item__content" + (checked ? " nph-task-item__content--checked" : "")
4064
+ }
4065
+ )
4066
+ ]
4067
+ }
4068
+ );
4069
+ };
4070
+ TaskItemView.displayName = "TaskItemView";
4071
+ return TaskItemView;
4072
+ };
4073
+
4074
+ // src/react/Editor.tsx
4075
+ var import_react37 = require("react");
4076
+ var import_jsx_runtime22 = require("react/jsx-runtime");
4021
4077
  function Editor5({
4022
4078
  content,
4023
4079
  className,
@@ -4037,12 +4093,19 @@ function Editor5({
4037
4093
  mentionOptions,
4038
4094
  referenceOptions,
4039
4095
  slashCommand,
4040
- placeholder
4096
+ placeholder,
4097
+ taskItemView,
4098
+ checkboxComponent
4041
4099
  }) {
4042
- const [actionMenuAnchor, setActionMenuAnchor] = (0, import_react35.useState)(null);
4043
- const [actionMenuEditor, setActionMenuEditor] = (0, import_react35.useState)(null);
4044
- const actionMenuRef = (0, import_react35.useRef)(null);
4045
- (0, import_react35.useEffect)(() => {
4100
+ const resolvedTaskItemView = (0, import_react37.useMemo)(() => {
4101
+ if (taskItemView) return taskItemView;
4102
+ if (checkboxComponent) return createTaskItemView(checkboxComponent);
4103
+ return void 0;
4104
+ }, [taskItemView, checkboxComponent]);
4105
+ const [actionMenuAnchor, setActionMenuAnchor] = (0, import_react37.useState)(null);
4106
+ const [actionMenuEditor, setActionMenuEditor] = (0, import_react37.useState)(null);
4107
+ const actionMenuRef = (0, import_react37.useRef)(null);
4108
+ (0, import_react37.useEffect)(() => {
4046
4109
  if (!actionMenuAnchor) return;
4047
4110
  const handlePointerDown = (e) => {
4048
4111
  if (actionMenuRef.current && !actionMenuRef.current.contains(e.target)) {
@@ -4052,7 +4115,7 @@ function Editor5({
4052
4115
  document.addEventListener("pointerdown", handlePointerDown);
4053
4116
  return () => document.removeEventListener("pointerdown", handlePointerDown);
4054
4117
  }, [actionMenuAnchor]);
4055
- const dragHandleCallbacks = (0, import_react35.useMemo)(
4118
+ const dragHandleCallbacks = (0, import_react37.useMemo)(
4056
4119
  () => ({
4057
4120
  onAddBlock: (editor) => {
4058
4121
  const { state } = editor;
@@ -4090,11 +4153,11 @@ function Editor5({
4090
4153
  };
4091
4154
  const textExtras = normalizeExtras(bubbleMenuExtras?.text);
4092
4155
  const imageExtras = normalizeExtras(bubbleMenuExtras?.image);
4093
- const handleCloseActionMenu = (0, import_react35.useCallback)(() => {
4156
+ const handleCloseActionMenu = (0, import_react37.useCallback)(() => {
4094
4157
  setActionMenuAnchor(null);
4095
4158
  }, []);
4096
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className, children: [
4097
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(EditorRoot, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
4159
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className, children: [
4160
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(EditorRoot, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
4098
4161
  EditorContent,
4099
4162
  {
4100
4163
  onUpdate,
@@ -4109,6 +4172,7 @@ function Editor5({
4109
4172
  collaboration,
4110
4173
  imageBlockView: ImageBlockView,
4111
4174
  videoBlockView: VideoBlockView,
4175
+ taskItemView: resolvedTaskItemView,
4112
4176
  mention: mentionOptions,
4113
4177
  reference: referenceOptions,
4114
4178
  slashCommand,
@@ -4127,27 +4191,27 @@ function Editor5({
4127
4191
  }
4128
4192
  },
4129
4193
  children: [
4130
- showTextMenu ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4194
+ showTextMenu ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4131
4195
  TextMenu,
4132
4196
  {
4133
4197
  leadingExtras: textExtras.start,
4134
4198
  trailingExtras: textExtras.end
4135
4199
  }
4136
4200
  ) : null,
4137
- showImageMenu ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4201
+ showImageMenu ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4138
4202
  ImageMenu,
4139
4203
  {
4140
4204
  leadingExtras: imageExtras.start,
4141
4205
  trailingExtras: imageExtras.end
4142
4206
  }
4143
4207
  ) : null,
4144
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(LinkMenu, {}),
4145
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TableMenu, {}),
4146
- showSlashMenu ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(SlashMenu, {}) : null
4208
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(LinkMenu, {}),
4209
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TableMenu, {}),
4210
+ showSlashMenu ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SlashMenu, {}) : null
4147
4211
  ]
4148
4212
  }
4149
4213
  ) }),
4150
- actionMenuAnchor && actionMenuEditor && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4214
+ actionMenuAnchor && actionMenuEditor && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4151
4215
  "div",
4152
4216
  {
4153
4217
  ref: actionMenuRef,
@@ -4157,7 +4221,7 @@ function Editor5({
4157
4221
  top: actionMenuAnchor.getBoundingClientRect().bottom + 4,
4158
4222
  left: actionMenuAnchor.getBoundingClientRect().left
4159
4223
  },
4160
- children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4224
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4161
4225
  BlockActionMenu,
4162
4226
  {
4163
4227
  editor: actionMenuEditor,
@@ -4170,18 +4234,18 @@ function Editor5({
4170
4234
  }
4171
4235
 
4172
4236
  // src/react/TableOfContents.tsx
4173
- var import_react36 = require("@tiptap/react");
4174
- var import_react37 = require("react");
4175
- var import_jsx_runtime22 = require("react/jsx-runtime");
4237
+ var import_react38 = require("@tiptap/react");
4238
+ var import_react39 = require("react");
4239
+ var import_jsx_runtime23 = require("react/jsx-runtime");
4176
4240
  function TableOfContents({
4177
4241
  className,
4178
4242
  itemClassName,
4179
4243
  activeClassName
4180
4244
  }) {
4181
- const { editor } = (0, import_react36.useCurrentEditor)();
4182
- const [activeId, setActiveId] = (0, import_react37.useState)(null);
4183
- const observerRef = (0, import_react37.useRef)(null);
4184
- const headings = (0, import_react36.useEditorState)({
4245
+ const { editor } = (0, import_react38.useCurrentEditor)();
4246
+ const [activeId, setActiveId] = (0, import_react39.useState)(null);
4247
+ const observerRef = (0, import_react39.useRef)(null);
4248
+ const headings = (0, import_react38.useEditorState)({
4185
4249
  editor,
4186
4250
  selector: (ctx) => {
4187
4251
  if (!ctx.editor) return [];
@@ -4200,7 +4264,7 @@ function TableOfContents({
4200
4264
  return items;
4201
4265
  }
4202
4266
  });
4203
- (0, import_react37.useEffect)(() => {
4267
+ (0, import_react39.useEffect)(() => {
4204
4268
  if (!editor || !headings || headings.length === 0) return;
4205
4269
  observerRef.current?.disconnect();
4206
4270
  const callback = (entries) => {
@@ -4231,7 +4295,7 @@ function TableOfContents({
4231
4295
  observer.disconnect();
4232
4296
  };
4233
4297
  }, [editor, headings]);
4234
- const handleClick = (0, import_react37.useCallback)(
4298
+ const handleClick = (0, import_react39.useCallback)(
4235
4299
  (pos) => {
4236
4300
  if (!editor) return;
4237
4301
  editor.chain().focus().setTextSelection(pos + 1).run();
@@ -4246,13 +4310,13 @@ function TableOfContents({
4246
4310
  [editor]
4247
4311
  );
4248
4312
  if (!editor || !headings || headings.length === 0) return null;
4249
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("nav", { className: className ?? "nph-toc", children: headings.map((heading) => {
4313
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("nav", { className: className ?? "nph-toc", children: headings.map((heading) => {
4250
4314
  const isActive = activeId === heading.id;
4251
4315
  const itemClass = [
4252
4316
  itemClassName ?? "nph-toc__item",
4253
4317
  isActive ? activeClassName ?? "nph-toc__item--active" : ""
4254
4318
  ].filter(Boolean).join(" ");
4255
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4319
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4256
4320
  "button",
4257
4321
  {
4258
4322
  type: "button",