@kopexa/tiptap 17.2.0 → 17.2.2

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 (53) hide show
  1. package/dist/{chunk-E5NW3MJZ.mjs → chunk-3ZPLSXTZ.mjs} +3 -3
  2. package/dist/{chunk-7SRL3P4B.mjs → chunk-5QFCLKHL.mjs} +7 -7
  3. package/dist/{chunk-NEHW62L7.mjs → chunk-6552DQWB.mjs} +2 -2
  4. package/dist/{chunk-5GFFTVMZ.mjs → chunk-DSBJFMHK.mjs} +4 -28
  5. package/dist/chunk-EAAQE5ZV.mjs +283 -0
  6. package/dist/chunk-HTJ2RXOG.mjs +32 -0
  7. package/dist/{chunk-LMCQMSW2.mjs → chunk-KYLBKQ2E.mjs} +12 -154
  8. package/dist/chunk-N3JE67CS.mjs +81 -0
  9. package/dist/{chunk-UU6JK5HX.mjs → chunk-SSJMKQ5G.mjs} +33 -20
  10. package/dist/chunk-Z365KVQY.mjs +34 -0
  11. package/dist/extensions/image/image-view.d.mts +3 -3
  12. package/dist/extensions/image/image-view.d.ts +3 -3
  13. package/dist/extensions/image/image-view.js +13 -181
  14. package/dist/extensions/image/image-view.mjs +2 -2
  15. package/dist/extensions/image/index.d.mts +12 -49
  16. package/dist/extensions/image/index.d.ts +12 -49
  17. package/dist/extensions/image/index.js +18 -231
  18. package/dist/extensions/image/index.mjs +3 -3
  19. package/dist/extensions/image/messages.d.mts +2 -30
  20. package/dist/extensions/image/messages.d.ts +2 -30
  21. package/dist/extensions/image/messages.js +4 -32
  22. package/dist/extensions/image/messages.mjs +1 -1
  23. package/dist/extensions/image-upload/image-upload-view.d.mts +12 -0
  24. package/dist/extensions/image-upload/image-upload-view.d.ts +12 -0
  25. package/dist/extensions/image-upload/image-upload-view.js +338 -0
  26. package/dist/extensions/image-upload/image-upload-view.mjs +12 -0
  27. package/dist/extensions/image-upload/index.d.mts +46 -0
  28. package/dist/extensions/image-upload/index.d.ts +46 -0
  29. package/dist/extensions/image-upload/index.js +414 -0
  30. package/dist/extensions/image-upload/index.mjs +16 -0
  31. package/dist/extensions/image-upload/messages.d.mts +32 -0
  32. package/dist/extensions/image-upload/messages.d.ts +32 -0
  33. package/dist/extensions/image-upload/messages.js +61 -0
  34. package/dist/extensions/image-upload/messages.mjs +7 -0
  35. package/dist/extensions/math/index.mjs +1 -1
  36. package/dist/hooks/use-create-editor.js +562 -393
  37. package/dist/hooks/use-create-editor.mjs +13 -10
  38. package/dist/index.d.mts +4 -1
  39. package/dist/index.d.ts +4 -1
  40. package/dist/index.js +956 -785
  41. package/dist/index.mjs +39 -33
  42. package/dist/presets/basic/editor-header.mjs +14 -14
  43. package/dist/presets/basic/index.js +953 -784
  44. package/dist/presets/basic/index.mjs +32 -29
  45. package/dist/ui/slash-dropdown-menu/index.js +2 -2
  46. package/dist/ui/slash-dropdown-menu/index.mjs +4 -4
  47. package/dist/ui/slash-dropdown-menu/slash-dropdown-menu.js +2 -2
  48. package/dist/ui/slash-dropdown-menu/slash-dropdown-menu.mjs +2 -2
  49. package/dist/ui/slash-dropdown-menu/use-slash-dropdown-menu.js +2 -2
  50. package/dist/ui/slash-dropdown-menu/use-slash-dropdown-menu.mjs +1 -1
  51. package/package.json +25 -24
  52. package/dist/chunk-WAAH3NLG.mjs +0 -77
  53. package/dist/{chunk-QAE2D4KV.mjs → chunk-FDPXD6VC.mjs} +11 -11
package/dist/index.js CHANGED
@@ -35,6 +35,7 @@ __export(index_exports, {
35
35
  Editor: () => BasicEditor,
36
36
  EditorFileProvider: () => EditorFileProvider,
37
37
  ImageNode: () => ImageNode,
38
+ ImageUploadNode: () => ImageUploadNode,
38
39
  InlineMath: () => InlineMath,
39
40
  MathBlock: () => MathBlock,
40
41
  TocNode: () => TocNode,
@@ -461,7 +462,7 @@ var CalloutNode = import_core.Node.create({
461
462
  });
462
463
 
463
464
  // src/extensions/image/index.ts
464
- var import_core2 = require("@tiptap/core");
465
+ var import_extension_image = require("@tiptap/extension-image");
465
466
  var import_react8 = require("@tiptap/react");
466
467
 
467
468
  // src/extensions/image/image-view.tsx
@@ -479,6 +480,10 @@ var messages2 = (0, import_react_intl3.defineMessages)({
479
480
  id: "editor.image.loading",
480
481
  defaultMessage: "Loading image..."
481
482
  },
483
+ uploading: {
484
+ id: "editor.image.uploading",
485
+ defaultMessage: "Uploading..."
486
+ },
482
487
  error: {
483
488
  id: "editor.image.error",
484
489
  defaultMessage: "Failed to load image"
@@ -487,38 +492,6 @@ var messages2 = (0, import_react_intl3.defineMessages)({
487
492
  id: "editor.image.upload_error",
488
493
  defaultMessage: "Failed to upload image"
489
494
  },
490
- uploading: {
491
- id: "editor.image.uploading",
492
- defaultMessage: "Uploading..."
493
- },
494
- upload_placeholder: {
495
- id: "editor.image.upload_placeholder",
496
- defaultMessage: "Click to upload or drag & drop"
497
- },
498
- upload_hint: {
499
- id: "editor.image.upload_hint",
500
- defaultMessage: "PNG, JPG, GIF, WebP, SVG"
501
- },
502
- alt_text: {
503
- id: "editor.image.alt_text",
504
- defaultMessage: "Alt text"
505
- },
506
- alt_placeholder: {
507
- id: "editor.image.alt_placeholder",
508
- defaultMessage: "Describe the image..."
509
- },
510
- files_not_supported: {
511
- id: "editor.image.files_not_supported",
512
- defaultMessage: "File upload is not configured"
513
- },
514
- file_too_large: {
515
- id: "editor.image.file_too_large",
516
- defaultMessage: "File is too large (max {maxSize})"
517
- },
518
- invalid_type: {
519
- id: "editor.image.invalid_type",
520
- defaultMessage: "Invalid file type"
521
- },
522
495
  retry: {
523
496
  id: "editor.image.retry",
524
497
  defaultMessage: "Retry"
@@ -535,7 +508,7 @@ function ImageNodeView({ editor, node, getPos }) {
535
508
  var _a;
536
509
  const intl = (0, import_react_intl4.useIntl)();
537
510
  const fileHandler = useEditorFile();
538
- const attrs = node.attrs;
511
+ const { src, alt, title, uploadState, uploadProgress } = node.attrs;
539
512
  const isEditable = (0, import_react6.useEditorState)({
540
513
  editor,
541
514
  selector: ({ editor: e }) => {
@@ -543,7 +516,6 @@ function ImageNodeView({ editor, node, getPos }) {
543
516
  return (_a2 = e == null ? void 0 : e.isEditable) != null ? _a2 : false;
544
517
  }
545
518
  });
546
- const { src, alt, title, uploadState, uploadProgress } = attrs;
547
519
  const [resolvedUrl, setResolvedUrl] = (0, import_react7.useState)(null);
548
520
  const [resolveState, setResolveState] = (0, import_react7.useState)("idle");
549
521
  const needsResolve = (_a = fileHandler == null ? void 0 : fileHandler.isReference(src)) != null ? _a : false;
@@ -555,7 +527,8 @@ function ImageNodeView({ editor, node, getPos }) {
555
527
  return;
556
528
  }
557
529
  if (!fileHandler) {
558
- setResolveState("error");
530
+ setResolvedUrl(src);
531
+ setResolveState("resolved");
559
532
  return;
560
533
  }
561
534
  setResolveState("loading");
@@ -581,156 +554,16 @@ function ImageNodeView({ editor, node, getPos }) {
581
554
  to: pos + node.nodeSize
582
555
  });
583
556
  }, [editor, getPos, node.nodeSize]);
584
- const fileInputRef = (0, import_react7.useRef)(null);
585
- const handleFileSelect = (0, import_react7.useCallback)(
586
- async (file) => {
587
- if (!fileHandler) return;
588
- const pos = getPos();
589
- if (pos === void 0) return;
590
- editor.view.dispatch(
591
- editor.state.tr.setNodeMarkup(pos, void 0, {
592
- ...attrs,
593
- uploadState: "uploading",
594
- uploadProgress: 0
595
- })
596
- );
597
- try {
598
- const ref = await fileHandler.upload(file, (percent) => {
599
- const currentPos = getPos();
600
- if (currentPos === void 0) return;
601
- editor.view.dispatch(
602
- editor.state.tr.setNodeMarkup(currentPos, void 0, {
603
- ...attrs,
604
- uploadState: "uploading",
605
- uploadProgress: percent
606
- })
607
- );
608
- });
609
- const finalPos = getPos();
610
- if (finalPos === void 0) return;
611
- editor.view.dispatch(
612
- editor.state.tr.setNodeMarkup(finalPos, void 0, {
613
- src: ref,
614
- uploadState: null,
615
- uploadProgress: null
616
- })
617
- );
618
- } catch {
619
- const errorPos = getPos();
620
- if (errorPos === void 0) return;
621
- editor.view.dispatch(
622
- editor.state.tr.setNodeMarkup(errorPos, void 0, {
623
- ...attrs,
624
- uploadState: "error",
625
- uploadProgress: null
626
- })
627
- );
628
- }
629
- },
630
- [fileHandler, editor, getPos, attrs]
631
- );
632
- const handleInputChange = (0, import_react7.useCallback)(
633
- (e) => {
634
- var _a2;
635
- const file = (_a2 = e.target.files) == null ? void 0 : _a2[0];
636
- if (file) {
637
- handleFileSelect(file);
638
- }
639
- },
640
- [handleFileSelect]
641
- );
642
- const handleDrop = (0, import_react7.useCallback)(
643
- (e) => {
644
- e.preventDefault();
645
- e.stopPropagation();
646
- const file = e.dataTransfer.files[0];
647
- if (file == null ? void 0 : file.type.startsWith("image/")) {
648
- handleFileSelect(file);
649
- }
650
- },
651
- [handleFileSelect]
652
- );
653
- const handleDragOver = (0, import_react7.useCallback)((e) => {
654
- e.preventDefault();
655
- e.stopPropagation();
656
- }, []);
657
- const styles = (0, import_react7.useMemo)(() => (0, import_theme2.imagePlaceholder)({ size: "md" }), []);
658
557
  const errorStyles = (0, import_react7.useMemo)(
659
558
  () => (0, import_theme2.imagePlaceholder)({ size: "md", variant: "error" }),
660
559
  []
661
560
  );
662
- const uploadingStyles = (0, import_react7.useMemo)(
561
+ const loadingStyles = (0, import_react7.useMemo)(
663
562
  () => (0, import_theme2.imagePlaceholder)({ size: "md", variant: "uploading" }),
664
563
  []
665
564
  );
666
- const disabledStyles = (0, import_react7.useMemo)(
667
- () => (0, import_theme2.imagePlaceholder)({ size: "md", variant: "disabled" }),
668
- []
669
- );
670
- const isEmpty = !src;
671
- if (isEmpty && !uploadState) {
672
- if (!fileHandler) {
673
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react6.NodeViewWrapper, { className: "my-4", "data-type": "image", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: disabledStyles.root(), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: disabledStyles.content(), children: [
674
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons3.ImageIcon, { className: disabledStyles.icon() }),
675
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: disabledStyles.text(), children: intl.formatMessage(messages2.files_not_supported) }),
676
- isEditable && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
677
- import_button2.IconButton,
678
- {
679
- size: "sm",
680
- variant: "ghost",
681
- onClick: handleRemove,
682
- "aria-label": intl.formatMessage(messages2.remove),
683
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons3.TrashIcon, { className: "size-4" })
684
- }
685
- )
686
- ] }) }) });
687
- }
688
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react6.NodeViewWrapper, { className: "my-4", "data-type": "image", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
689
- "div",
690
- {
691
- className: styles.root(),
692
- onClick: () => {
693
- var _a2;
694
- return (_a2 = fileInputRef.current) == null ? void 0 : _a2.click();
695
- },
696
- onDrop: handleDrop,
697
- onDragOver: handleDragOver,
698
- children: [
699
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: styles.content(), children: [
700
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons3.UploadIcon, { className: styles.icon() }),
701
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: styles.text(), children: intl.formatMessage(messages2.upload_placeholder) }),
702
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: styles.hint(), children: intl.formatMessage(messages2.upload_hint) })
703
- ] }),
704
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
705
- "input",
706
- {
707
- ref: fileInputRef,
708
- type: "file",
709
- accept: "image/*",
710
- className: "hidden",
711
- onChange: handleInputChange
712
- }
713
- ),
714
- isEditable && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
715
- import_button2.IconButton,
716
- {
717
- size: "sm",
718
- variant: "ghost",
719
- className: styles.removeButton(),
720
- onClick: (e) => {
721
- e.stopPropagation();
722
- handleRemove();
723
- },
724
- "aria-label": intl.formatMessage(messages2.remove),
725
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons3.TrashIcon, { className: "size-3.5" })
726
- }
727
- )
728
- ]
729
- }
730
- ) });
731
- }
732
565
  if (uploadState === "uploading") {
733
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react6.NodeViewWrapper, { className: "my-4", "data-type": "image", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: uploadingStyles.root(), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: uploadingStyles.content(), children: [
566
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react6.NodeViewWrapper, { className: "my-4", "data-type": "image", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: loadingStyles.root(), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: loadingStyles.content(), children: [
734
567
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "relative size-12", children: [
735
568
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
736
569
  "svg",
@@ -772,14 +605,14 @@ function ImageNodeView({ editor, node, getPos }) {
772
605
  "%"
773
606
  ] })
774
607
  ] }),
775
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: uploadingStyles.text(), children: intl.formatMessage(messages2.uploading) })
608
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: loadingStyles.text(), children: intl.formatMessage(messages2.uploading) })
776
609
  ] }) }) });
777
610
  }
778
611
  if (uploadState === "error") {
779
612
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react6.NodeViewWrapper, { className: "my-4", "data-type": "image", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: errorStyles.root(), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: errorStyles.content(), children: [
780
613
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons3.AlertCircleIcon, { className: errorStyles.icon() }),
781
614
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: errorStyles.text(), children: intl.formatMessage(messages2.upload_error) }),
782
- isEditable && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "flex gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
615
+ isEditable && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
783
616
  import_button2.IconButton,
784
617
  {
785
618
  size: "sm",
@@ -788,11 +621,11 @@ function ImageNodeView({ editor, node, getPos }) {
788
621
  "aria-label": intl.formatMessage(messages2.remove),
789
622
  children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons3.TrashIcon, { className: "size-4" })
790
623
  }
791
- ) })
624
+ )
792
625
  ] }) }) });
793
626
  }
794
627
  if (resolveState === "loading") {
795
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react6.NodeViewWrapper, { className: "my-4", "data-type": "image", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: `${uploadingStyles.root()} animate-pulse`, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: uploadingStyles.text(), children: intl.formatMessage(messages2.loading) }) }) });
628
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react6.NodeViewWrapper, { className: "my-4", "data-type": "image", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: `${loadingStyles.root()} animate-pulse`, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: loadingStyles.text(), children: intl.formatMessage(messages2.loading) }) }) });
796
629
  }
797
630
  if (resolveState === "error") {
798
631
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react6.NodeViewWrapper, { className: "my-4", "data-type": "image", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: errorStyles.root(), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: errorStyles.content(), children: [
@@ -847,34 +680,345 @@ function ImageNodeView({ editor, node, getPos }) {
847
680
  }
848
681
 
849
682
  // src/extensions/image/index.ts
850
- var ImageNode = import_core2.Node.create({
851
- name: "image",
683
+ var ImageNode = import_extension_image.Image.extend({
684
+ addAttributes() {
685
+ var _a;
686
+ return {
687
+ ...(_a = this.parent) == null ? void 0 : _a.call(this),
688
+ // Upload state for drag & drop / paste uploads
689
+ uploadState: {
690
+ default: null,
691
+ rendered: false
692
+ },
693
+ uploadProgress: {
694
+ default: null,
695
+ rendered: false
696
+ }
697
+ };
698
+ },
699
+ addNodeView() {
700
+ return (0, import_react8.ReactNodeViewRenderer)(ImageNodeView);
701
+ }
702
+ });
703
+
704
+ // src/extensions/image-upload/index.ts
705
+ var import_core2 = require("@tiptap/core");
706
+ var import_react11 = require("@tiptap/react");
707
+
708
+ // src/extensions/image-upload/image-upload-view.tsx
709
+ var import_button3 = require("@kopexa/button");
710
+ var import_icons4 = require("@kopexa/icons");
711
+ var import_theme3 = require("@kopexa/theme");
712
+ var import_react9 = require("@tiptap/react");
713
+ var import_react10 = require("react");
714
+ var import_react_intl6 = require("react-intl");
715
+
716
+ // src/extensions/image-upload/messages.ts
717
+ var import_react_intl5 = require("react-intl");
718
+ var messages3 = (0, import_react_intl5.defineMessages)({
719
+ upload_error: {
720
+ id: "editor.image.upload_error",
721
+ defaultMessage: "Failed to upload image"
722
+ },
723
+ uploading: {
724
+ id: "editor.image.uploading",
725
+ defaultMessage: "Uploading..."
726
+ },
727
+ upload_placeholder: {
728
+ id: "editor.image.upload_placeholder",
729
+ defaultMessage: "Click to upload or drag & drop"
730
+ },
731
+ upload_hint: {
732
+ id: "editor.image.upload_hint",
733
+ defaultMessage: "PNG, JPG, GIF, WebP, SVG"
734
+ },
735
+ click_to_retry: {
736
+ id: "editor.image.click_to_retry",
737
+ defaultMessage: "Click to try again"
738
+ },
739
+ files_not_supported: {
740
+ id: "editor.image.files_not_supported",
741
+ defaultMessage: "File upload is not configured"
742
+ },
743
+ remove: {
744
+ id: "editor.image.remove",
745
+ defaultMessage: "Remove"
746
+ }
747
+ });
748
+
749
+ // src/extensions/image-upload/image-upload-view.tsx
750
+ var import_jsx_runtime5 = require("react/jsx-runtime");
751
+ function ImageUploadNodeView({ editor, node, getPos }) {
752
+ const intl = (0, import_react_intl6.useIntl)();
753
+ const fileHandler = useEditorFile();
754
+ const isEditable = (0, import_react9.useEditorState)({
755
+ editor,
756
+ selector: ({ editor: e }) => {
757
+ var _a;
758
+ return (_a = e == null ? void 0 : e.isEditable) != null ? _a : false;
759
+ }
760
+ });
761
+ const [uploadState, setUploadState] = (0, import_react10.useState)("idle");
762
+ const [uploadProgress, setUploadProgress] = (0, import_react10.useState)(0);
763
+ const [isDragOver, setIsDragOver] = (0, import_react10.useState)(false);
764
+ const fileInputRef = (0, import_react10.useRef)(null);
765
+ const handleRemove = (0, import_react10.useCallback)(() => {
766
+ const pos = getPos();
767
+ if (pos === void 0) return;
768
+ editor.commands.deleteRange({
769
+ from: pos,
770
+ to: pos + node.nodeSize
771
+ });
772
+ }, [editor, getPos, node.nodeSize]);
773
+ const handleFileSelect = (0, import_react10.useCallback)(
774
+ async (file) => {
775
+ if (!fileHandler) return;
776
+ const pos = getPos();
777
+ if (pos === void 0) return;
778
+ setUploadState("uploading");
779
+ setUploadProgress(0);
780
+ try {
781
+ const ref = await fileHandler.upload(file, (percent) => {
782
+ setUploadProgress(percent);
783
+ });
784
+ const currentPos = getPos();
785
+ if (currentPos === void 0) return;
786
+ editor.chain().focus().deleteRange({ from: currentPos, to: currentPos + node.nodeSize }).insertContentAt(currentPos, {
787
+ type: "image",
788
+ attrs: {
789
+ src: ref,
790
+ alt: file.name.replace(/\.[^/.]+$/, ""),
791
+ title: file.name.replace(/\.[^/.]+$/, "")
792
+ }
793
+ }).run();
794
+ } catch (error) {
795
+ console.error("[ImageUpload] Upload failed:", error);
796
+ setUploadState("error");
797
+ setUploadProgress(0);
798
+ }
799
+ },
800
+ [fileHandler, editor, getPos, node.nodeSize]
801
+ );
802
+ const handleInputChange = (0, import_react10.useCallback)(
803
+ (e) => {
804
+ var _a;
805
+ const file = (_a = e.target.files) == null ? void 0 : _a[0];
806
+ if (file) {
807
+ handleFileSelect(file);
808
+ }
809
+ e.target.value = "";
810
+ },
811
+ [handleFileSelect]
812
+ );
813
+ const handleDrop = (0, import_react10.useCallback)(
814
+ (e) => {
815
+ e.preventDefault();
816
+ e.stopPropagation();
817
+ setIsDragOver(false);
818
+ const file = e.dataTransfer.files[0];
819
+ if (file == null ? void 0 : file.type.startsWith("image/")) {
820
+ handleFileSelect(file);
821
+ }
822
+ },
823
+ [handleFileSelect]
824
+ );
825
+ const handleDragOver = (0, import_react10.useCallback)((e) => {
826
+ e.preventDefault();
827
+ e.stopPropagation();
828
+ }, []);
829
+ const handleDragEnter = (0, import_react10.useCallback)((e) => {
830
+ e.preventDefault();
831
+ e.stopPropagation();
832
+ setIsDragOver(true);
833
+ }, []);
834
+ const handleDragLeave = (0, import_react10.useCallback)((e) => {
835
+ e.preventDefault();
836
+ e.stopPropagation();
837
+ if (!e.currentTarget.contains(e.relatedTarget)) {
838
+ setIsDragOver(false);
839
+ }
840
+ }, []);
841
+ const handleClick = (0, import_react10.useCallback)(() => {
842
+ var _a;
843
+ if (uploadState === "idle" || uploadState === "error") {
844
+ (_a = fileInputRef.current) == null ? void 0 : _a.click();
845
+ }
846
+ }, [uploadState]);
847
+ const styles = (0, import_react10.useMemo)(
848
+ () => (0, import_theme3.imagePlaceholder)({
849
+ size: "md",
850
+ variant: isDragOver ? "default" : void 0
851
+ }),
852
+ [isDragOver]
853
+ );
854
+ const errorStyles = (0, import_react10.useMemo)(
855
+ () => (0, import_theme3.imagePlaceholder)({ size: "md", variant: "error" }),
856
+ []
857
+ );
858
+ const uploadingStyles = (0, import_react10.useMemo)(
859
+ () => (0, import_theme3.imagePlaceholder)({ size: "md", variant: "uploading" }),
860
+ []
861
+ );
862
+ const disabledStyles = (0, import_react10.useMemo)(
863
+ () => (0, import_theme3.imagePlaceholder)({ size: "md", variant: "disabled" }),
864
+ []
865
+ );
866
+ if (!fileHandler) {
867
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react9.NodeViewWrapper, { className: "my-4", "data-type": "image-upload", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: disabledStyles.root(), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: disabledStyles.content(), children: [
868
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_icons4.ImageIcon, { className: disabledStyles.icon() }),
869
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: disabledStyles.text(), children: intl.formatMessage(messages3.files_not_supported) }),
870
+ isEditable && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
871
+ import_button3.IconButton,
872
+ {
873
+ size: "sm",
874
+ variant: "ghost",
875
+ onClick: handleRemove,
876
+ "aria-label": intl.formatMessage(messages3.remove),
877
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_icons4.TrashIcon, { className: "size-4" })
878
+ }
879
+ )
880
+ ] }) }) });
881
+ }
882
+ if (uploadState === "uploading") {
883
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react9.NodeViewWrapper, { className: "my-4", "data-type": "image-upload", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: uploadingStyles.root(), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: uploadingStyles.content(), children: [
884
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "relative size-12", children: [
885
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
886
+ "svg",
887
+ {
888
+ className: "size-12 -rotate-90",
889
+ viewBox: "0 0 36 36",
890
+ "aria-hidden": "true",
891
+ children: [
892
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
893
+ "circle",
894
+ {
895
+ cx: "18",
896
+ cy: "18",
897
+ r: "16",
898
+ fill: "none",
899
+ className: "stroke-muted",
900
+ strokeWidth: "2"
901
+ }
902
+ ),
903
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
904
+ "circle",
905
+ {
906
+ cx: "18",
907
+ cy: "18",
908
+ r: "16",
909
+ fill: "none",
910
+ className: "stroke-primary",
911
+ strokeWidth: "2",
912
+ strokeDasharray: 100,
913
+ strokeDashoffset: 100 - uploadProgress,
914
+ strokeLinecap: "round"
915
+ }
916
+ )
917
+ ]
918
+ }
919
+ ),
920
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "absolute inset-0 flex items-center justify-center text-xs font-medium", children: [
921
+ uploadProgress,
922
+ "%"
923
+ ] })
924
+ ] }),
925
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: uploadingStyles.text(), children: intl.formatMessage(messages3.uploading) })
926
+ ] }) }) });
927
+ }
928
+ if (uploadState === "error") {
929
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react9.NodeViewWrapper, { className: "my-4", "data-type": "image-upload", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: errorStyles.root(), onClick: handleClick, children: [
930
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: errorStyles.content(), children: [
931
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_icons4.AlertCircleIcon, { className: errorStyles.icon() }),
932
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: errorStyles.text(), children: intl.formatMessage(messages3.upload_error) }),
933
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: errorStyles.hint(), children: intl.formatMessage(messages3.click_to_retry) })
934
+ ] }),
935
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
936
+ "input",
937
+ {
938
+ ref: fileInputRef,
939
+ type: "file",
940
+ accept: "image/*",
941
+ className: "hidden",
942
+ onChange: handleInputChange
943
+ }
944
+ ),
945
+ isEditable && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
946
+ import_button3.IconButton,
947
+ {
948
+ size: "sm",
949
+ variant: "ghost",
950
+ className: errorStyles.removeButton(),
951
+ onClick: (e) => {
952
+ e.stopPropagation();
953
+ handleRemove();
954
+ },
955
+ "aria-label": intl.formatMessage(messages3.remove),
956
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_icons4.TrashIcon, { className: "size-3.5" })
957
+ }
958
+ )
959
+ ] }) });
960
+ }
961
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react9.NodeViewWrapper, { className: "my-4", "data-type": "image-upload", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
962
+ "div",
963
+ {
964
+ className: `${styles.root()} ${isDragOver ? "border-primary bg-primary/10" : ""}`,
965
+ onClick: handleClick,
966
+ onDrop: handleDrop,
967
+ onDragOver: handleDragOver,
968
+ onDragEnter: handleDragEnter,
969
+ onDragLeave: handleDragLeave,
970
+ children: [
971
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: styles.content(), children: [
972
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_icons4.UploadIcon, { className: styles.icon() }),
973
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: styles.text(), children: intl.formatMessage(messages3.upload_placeholder) }),
974
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: styles.hint(), children: intl.formatMessage(messages3.upload_hint) })
975
+ ] }),
976
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
977
+ "input",
978
+ {
979
+ ref: fileInputRef,
980
+ type: "file",
981
+ accept: "image/*",
982
+ className: "hidden",
983
+ onChange: handleInputChange
984
+ }
985
+ ),
986
+ isEditable && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
987
+ import_button3.IconButton,
988
+ {
989
+ size: "sm",
990
+ variant: "ghost",
991
+ className: styles.removeButton(),
992
+ onClick: (e) => {
993
+ e.stopPropagation();
994
+ handleRemove();
995
+ },
996
+ "aria-label": intl.formatMessage(messages3.remove),
997
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_icons4.TrashIcon, { className: "size-3.5" })
998
+ }
999
+ )
1000
+ ]
1001
+ }
1002
+ ) });
1003
+ }
1004
+
1005
+ // src/extensions/image-upload/index.ts
1006
+ var ImageUploadNode = import_core2.Node.create({
1007
+ name: "imageUpload",
852
1008
  group: "block",
853
1009
  atom: true,
854
1010
  draggable: true,
1011
+ selectable: true,
855
1012
  addOptions() {
856
1013
  return {
857
- allowBase64: true,
1014
+ accept: "image/*",
1015
+ maxSize: 0,
858
1016
  HTMLAttributes: {}
859
1017
  };
860
1018
  },
861
- addAttributes() {
862
- return {
863
- src: {
864
- default: null
865
- },
866
- alt: {
867
- default: null
868
- },
869
- title: {
870
- default: null
871
- },
872
- width: {
873
- default: null
874
- },
875
- height: {
876
- default: null
877
- },
1019
+ addAttributes() {
1020
+ return {
1021
+ // Upload state tracking
878
1022
  uploadState: {
879
1023
  default: null,
880
1024
  rendered: false
@@ -888,49 +1032,65 @@ var ImageNode = import_core2.Node.create({
888
1032
  parseHTML() {
889
1033
  return [
890
1034
  {
891
- tag: "img[src]"
1035
+ tag: 'div[data-type="image-upload"]'
892
1036
  }
893
1037
  ];
894
1038
  },
895
1039
  renderHTML({ HTMLAttributes }) {
896
- return [
897
- "img",
898
- (0, import_core2.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes)
899
- ];
1040
+ return ["div", { ...HTMLAttributes, "data-type": "image-upload" }];
900
1041
  },
901
1042
  addNodeView() {
902
- return (0, import_react8.ReactNodeViewRenderer)(ImageNodeView);
1043
+ return (0, import_react11.ReactNodeViewRenderer)(ImageUploadNodeView);
903
1044
  },
904
1045
  addCommands() {
905
1046
  return {
906
- setImage: (options) => ({ commands }) => {
1047
+ setImageUpload: () => ({ commands }) => {
907
1048
  return commands.insertContent({
908
- type: this.name,
909
- attrs: options
1049
+ type: this.name
910
1050
  });
911
1051
  }
912
1052
  };
1053
+ },
1054
+ addKeyboardShortcuts() {
1055
+ return {
1056
+ Enter: ({ editor }) => {
1057
+ const { selection } = editor.state;
1058
+ const { $from } = selection;
1059
+ const node = $from.nodeAfter;
1060
+ if ((node == null ? void 0 : node.type.name) === "imageUpload" && editor.isActive("imageUpload")) {
1061
+ const nodeEl = editor.view.nodeDOM($from.pos);
1062
+ if (nodeEl instanceof HTMLElement) {
1063
+ const input = nodeEl.querySelector('input[type="file"]');
1064
+ if (input instanceof HTMLElement) {
1065
+ input.click();
1066
+ return true;
1067
+ }
1068
+ }
1069
+ }
1070
+ return false;
1071
+ }
1072
+ };
913
1073
  }
914
1074
  });
915
1075
 
916
1076
  // src/extensions/math/index.ts
917
1077
  var import_core4 = require("@tiptap/core");
918
- var import_react14 = require("@tiptap/react");
1078
+ var import_react17 = require("@tiptap/react");
919
1079
 
920
1080
  // src/extensions/math/math-block-view.tsx
921
- var import_button3 = require("@kopexa/button");
1081
+ var import_button4 = require("@kopexa/button");
922
1082
  var import_dialog2 = require("@kopexa/dialog");
923
- var import_icons4 = require("@kopexa/icons");
1083
+ var import_icons5 = require("@kopexa/icons");
924
1084
  var import_label2 = require("@kopexa/label");
925
- var import_react9 = require("@tiptap/react");
1085
+ var import_react12 = require("@tiptap/react");
926
1086
  var import_katex = __toESM(require("katex"));
927
1087
  var import_katex_min = require("katex/dist/katex.min.css");
928
- var import_react10 = require("react");
929
- var import_react_intl6 = require("react-intl");
1088
+ var import_react13 = require("react");
1089
+ var import_react_intl8 = require("react-intl");
930
1090
 
931
1091
  // src/extensions/math/messages.ts
932
- var import_react_intl5 = require("react-intl");
933
- var messages3 = (0, import_react_intl5.defineMessages)({
1092
+ var import_react_intl7 = require("react-intl");
1093
+ var messages4 = (0, import_react_intl7.defineMessages)({
934
1094
  title: {
935
1095
  id: "editor.math.title",
936
1096
  defaultMessage: "Formula",
@@ -979,28 +1139,28 @@ var messages3 = (0, import_react_intl5.defineMessages)({
979
1139
  });
980
1140
 
981
1141
  // src/extensions/math/math-block-view.tsx
982
- var import_jsx_runtime5 = require("react/jsx-runtime");
1142
+ var import_jsx_runtime6 = require("react/jsx-runtime");
983
1143
  function MathBlockView({ editor, node, getPos }) {
984
- const intl = (0, import_react_intl6.useIntl)();
1144
+ const intl = (0, import_react_intl8.useIntl)();
985
1145
  const attrs = node.attrs;
986
1146
  const { latex = "" } = attrs;
987
- const isEditable = (0, import_react9.useEditorState)({
1147
+ const isEditable = (0, import_react12.useEditorState)({
988
1148
  editor,
989
1149
  selector: ({ editor: e }) => {
990
1150
  var _a;
991
1151
  return (_a = e == null ? void 0 : e.isEditable) != null ? _a : false;
992
1152
  }
993
1153
  });
994
- const [isOpen, setIsOpen] = (0, import_react10.useState)(false);
995
- const [localLatex, setLocalLatex] = (0, import_react10.useState)(latex);
996
- const [error, setError] = (0, import_react10.useState)(null);
997
- (0, import_react10.useEffect)(() => {
1154
+ const [isOpen, setIsOpen] = (0, import_react13.useState)(false);
1155
+ const [localLatex, setLocalLatex] = (0, import_react13.useState)(latex);
1156
+ const [error, setError] = (0, import_react13.useState)(null);
1157
+ (0, import_react13.useEffect)(() => {
998
1158
  if (isOpen) {
999
1159
  setLocalLatex(latex);
1000
1160
  setError(null);
1001
1161
  }
1002
1162
  }, [isOpen, latex]);
1003
- const renderedHtml = (0, import_react10.useMemo)(() => {
1163
+ const renderedHtml = (0, import_react13.useMemo)(() => {
1004
1164
  if (!latex) return null;
1005
1165
  try {
1006
1166
  return import_katex.default.renderToString(latex, {
@@ -1012,7 +1172,7 @@ function MathBlockView({ editor, node, getPos }) {
1012
1172
  return null;
1013
1173
  }
1014
1174
  }, [latex]);
1015
- const previewHtml = (0, import_react10.useMemo)(() => {
1175
+ const previewHtml = (0, import_react13.useMemo)(() => {
1016
1176
  if (!localLatex) return null;
1017
1177
  try {
1018
1178
  setError(null);
@@ -1022,11 +1182,11 @@ function MathBlockView({ editor, node, getPos }) {
1022
1182
  output: "html"
1023
1183
  });
1024
1184
  } catch (_e) {
1025
- setError(intl.formatMessage(messages3.invalid_latex));
1185
+ setError(intl.formatMessage(messages4.invalid_latex));
1026
1186
  return null;
1027
1187
  }
1028
1188
  }, [localLatex, intl]);
1029
- const handleSave = (0, import_react10.useCallback)(() => {
1189
+ const handleSave = (0, import_react13.useCallback)(() => {
1030
1190
  const pos = getPos();
1031
1191
  if (pos === void 0) return;
1032
1192
  editor.view.dispatch(
@@ -1034,12 +1194,12 @@ function MathBlockView({ editor, node, getPos }) {
1034
1194
  );
1035
1195
  setIsOpen(false);
1036
1196
  }, [editor, localLatex, getPos]);
1037
- const handleCancel = (0, import_react10.useCallback)(() => {
1197
+ const handleCancel = (0, import_react13.useCallback)(() => {
1038
1198
  setLocalLatex(latex);
1039
1199
  setError(null);
1040
1200
  setIsOpen(false);
1041
1201
  }, [latex]);
1042
- const handleOpenEditor = (0, import_react10.useCallback)(
1202
+ const handleOpenEditor = (0, import_react13.useCallback)(
1043
1203
  (e) => {
1044
1204
  e.stopPropagation();
1045
1205
  e.preventDefault();
@@ -1050,73 +1210,73 @@ function MathBlockView({ editor, node, getPos }) {
1050
1210
  [isEditable]
1051
1211
  );
1052
1212
  const isEmpty = !latex;
1053
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1054
- import_react9.NodeViewWrapper,
1213
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
1214
+ import_react12.NodeViewWrapper,
1055
1215
  {
1056
1216
  className: "my-4 relative group",
1057
1217
  "data-type": "math-block",
1058
1218
  "data-latex": latex,
1059
1219
  children: [
1060
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1220
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1061
1221
  "button",
1062
1222
  {
1063
1223
  type: "button",
1064
1224
  className: "w-full flex items-center justify-center min-h-16 p-4 rounded-md border border-border bg-muted/30 cursor-pointer hover:bg-muted/50 transition-colors",
1065
1225
  onClick: handleOpenEditor,
1066
- children: isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center gap-2 text-muted-foreground", children: [
1067
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-lg font-serif", children: "\u2211" }),
1068
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-sm", children: intl.formatMessage(messages3.empty_formula) })
1069
- ] }) : renderedHtml ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1226
+ children: isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center gap-2 text-muted-foreground", children: [
1227
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-lg font-serif", children: "\u2211" }),
1228
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-sm", children: intl.formatMessage(messages4.empty_formula) })
1229
+ ] }) : renderedHtml ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1070
1230
  "div",
1071
1231
  {
1072
1232
  className: "katex-display",
1073
1233
  dangerouslySetInnerHTML: { __html: renderedHtml }
1074
1234
  }
1075
- ) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "text-destructive text-sm", children: intl.formatMessage(messages3.invalid_latex) })
1235
+ ) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "text-destructive text-sm", children: intl.formatMessage(messages4.invalid_latex) })
1076
1236
  }
1077
1237
  ),
1078
- isEditable && !isEmpty && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1079
- import_button3.IconButton,
1238
+ isEditable && !isEmpty && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1239
+ import_button4.IconButton,
1080
1240
  {
1081
1241
  size: "sm",
1082
1242
  variant: "ghost",
1083
1243
  className: "absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity",
1084
- "aria-label": intl.formatMessage(messages3.edit),
1244
+ "aria-label": intl.formatMessage(messages4.edit),
1085
1245
  onClick: handleOpenEditor,
1086
- children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_icons4.EditIcon, { className: "size-3.5" })
1246
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons5.EditIcon, { className: "size-3.5" })
1087
1247
  }
1088
1248
  ),
1089
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dialog2.Dialog.Root, { open: isOpen, onOpenChange: setIsOpen, size: "md", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_dialog2.Dialog.Content, { children: [
1090
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dialog2.Dialog.Header, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dialog2.Dialog.Title, { children: intl.formatMessage(messages3.title) }) }),
1091
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dialog2.Dialog.Body, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "space-y-4", children: [
1092
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "space-y-1.5", children: [
1093
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_label2.Label, { className: "text-sm", children: intl.formatMessage(messages3.latex_input) }),
1094
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1249
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dialog2.Dialog.Root, { open: isOpen, onOpenChange: setIsOpen, size: "md", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_dialog2.Dialog.Content, { children: [
1250
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dialog2.Dialog.Header, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dialog2.Dialog.Title, { children: intl.formatMessage(messages4.title) }) }),
1251
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dialog2.Dialog.Body, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "space-y-4", children: [
1252
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "space-y-1.5", children: [
1253
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_label2.Label, { className: "text-sm", children: intl.formatMessage(messages4.latex_input) }),
1254
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1095
1255
  "textarea",
1096
1256
  {
1097
1257
  className: "w-full min-h-24 p-3 rounded-md border border-input bg-background font-mono text-sm resize-y focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
1098
1258
  value: localLatex,
1099
1259
  onChange: (e) => setLocalLatex(e.target.value),
1100
- placeholder: intl.formatMessage(messages3.latex_placeholder),
1260
+ placeholder: intl.formatMessage(messages4.latex_placeholder),
1101
1261
  spellCheck: false
1102
1262
  }
1103
1263
  ),
1104
- error && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-xs text-destructive", children: error })
1264
+ error && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "text-xs text-destructive", children: error })
1105
1265
  ] }),
1106
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "space-y-1.5", children: [
1107
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_label2.Label, { className: "text-sm", children: intl.formatMessage(messages3.preview) }),
1108
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "min-h-16 p-4 rounded-md border border-border bg-muted/30 flex items-center justify-center", children: previewHtml ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1266
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "space-y-1.5", children: [
1267
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_label2.Label, { className: "text-sm", children: intl.formatMessage(messages4.preview) }),
1268
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "min-h-16 p-4 rounded-md border border-border bg-muted/30 flex items-center justify-center", children: previewHtml ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1109
1269
  "div",
1110
1270
  {
1111
1271
  className: "katex-display",
1112
1272
  dangerouslySetInnerHTML: { __html: previewHtml }
1113
1273
  }
1114
- ) : localLatex ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-muted-foreground text-sm", children: intl.formatMessage(messages3.invalid_latex) }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-muted-foreground text-sm", children: intl.formatMessage(messages3.latex_placeholder) }) })
1274
+ ) : localLatex ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-muted-foreground text-sm", children: intl.formatMessage(messages4.invalid_latex) }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-muted-foreground text-sm", children: intl.formatMessage(messages4.latex_placeholder) }) })
1115
1275
  ] })
1116
1276
  ] }) }),
1117
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_dialog2.Dialog.Footer, { children: [
1118
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_button3.Button, { variant: "ghost", onClick: handleCancel, children: intl.formatMessage(messages3.cancel) }),
1119
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_button3.Button, { onClick: handleSave, disabled: !!error && !!localLatex, children: intl.formatMessage(messages3.save) })
1277
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_dialog2.Dialog.Footer, { children: [
1278
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_button4.Button, { variant: "ghost", onClick: handleCancel, children: intl.formatMessage(messages4.cancel) }),
1279
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_button4.Button, { onClick: handleSave, disabled: !!error && !!localLatex, children: intl.formatMessage(messages4.save) })
1120
1280
  ] })
1121
1281
  ] }) })
1122
1282
  ]
@@ -1126,39 +1286,39 @@ function MathBlockView({ editor, node, getPos }) {
1126
1286
 
1127
1287
  // src/extensions/math/inline-math.ts
1128
1288
  var import_core3 = require("@tiptap/core");
1129
- var import_react13 = require("@tiptap/react");
1289
+ var import_react16 = require("@tiptap/react");
1130
1290
 
1131
1291
  // src/extensions/math/inline-math-view.tsx
1132
- var import_button4 = require("@kopexa/button");
1292
+ var import_button5 = require("@kopexa/button");
1133
1293
  var import_dialog3 = require("@kopexa/dialog");
1134
1294
  var import_label3 = require("@kopexa/label");
1135
- var import_react11 = require("@tiptap/react");
1295
+ var import_react14 = require("@tiptap/react");
1136
1296
  var import_katex2 = __toESM(require("katex"));
1137
1297
  var import_katex_min2 = require("katex/dist/katex.min.css");
1138
- var import_react12 = require("react");
1139
- var import_react_intl7 = require("react-intl");
1140
- var import_jsx_runtime6 = require("react/jsx-runtime");
1298
+ var import_react15 = require("react");
1299
+ var import_react_intl9 = require("react-intl");
1300
+ var import_jsx_runtime7 = require("react/jsx-runtime");
1141
1301
  function InlineMathView({ editor, node, getPos }) {
1142
- const intl = (0, import_react_intl7.useIntl)();
1302
+ const intl = (0, import_react_intl9.useIntl)();
1143
1303
  const attrs = node.attrs;
1144
1304
  const { latex = "" } = attrs;
1145
- const isEditable = (0, import_react11.useEditorState)({
1305
+ const isEditable = (0, import_react14.useEditorState)({
1146
1306
  editor,
1147
1307
  selector: ({ editor: e }) => {
1148
1308
  var _a;
1149
1309
  return (_a = e == null ? void 0 : e.isEditable) != null ? _a : false;
1150
1310
  }
1151
1311
  });
1152
- const [isOpen, setIsOpen] = (0, import_react12.useState)(false);
1153
- const [localLatex, setLocalLatex] = (0, import_react12.useState)(latex);
1154
- const [error, setError] = (0, import_react12.useState)(null);
1155
- (0, import_react12.useEffect)(() => {
1312
+ const [isOpen, setIsOpen] = (0, import_react15.useState)(false);
1313
+ const [localLatex, setLocalLatex] = (0, import_react15.useState)(latex);
1314
+ const [error, setError] = (0, import_react15.useState)(null);
1315
+ (0, import_react15.useEffect)(() => {
1156
1316
  if (isOpen) {
1157
1317
  setLocalLatex(latex);
1158
1318
  setError(null);
1159
1319
  }
1160
1320
  }, [isOpen, latex]);
1161
- const renderedHtml = (0, import_react12.useMemo)(() => {
1321
+ const renderedHtml = (0, import_react15.useMemo)(() => {
1162
1322
  if (!latex) return null;
1163
1323
  try {
1164
1324
  return import_katex2.default.renderToString(latex, {
@@ -1170,7 +1330,7 @@ function InlineMathView({ editor, node, getPos }) {
1170
1330
  return null;
1171
1331
  }
1172
1332
  }, [latex]);
1173
- const previewHtml = (0, import_react12.useMemo)(() => {
1333
+ const previewHtml = (0, import_react15.useMemo)(() => {
1174
1334
  if (!localLatex) return null;
1175
1335
  try {
1176
1336
  setError(null);
@@ -1180,11 +1340,11 @@ function InlineMathView({ editor, node, getPos }) {
1180
1340
  output: "html"
1181
1341
  });
1182
1342
  } catch (_e) {
1183
- setError(intl.formatMessage(messages3.invalid_latex));
1343
+ setError(intl.formatMessage(messages4.invalid_latex));
1184
1344
  return null;
1185
1345
  }
1186
1346
  }, [localLatex, intl]);
1187
- const handleSave = (0, import_react12.useCallback)(() => {
1347
+ const handleSave = (0, import_react15.useCallback)(() => {
1188
1348
  const pos = getPos();
1189
1349
  if (pos === void 0) return;
1190
1350
  editor.view.dispatch(
@@ -1192,12 +1352,12 @@ function InlineMathView({ editor, node, getPos }) {
1192
1352
  );
1193
1353
  setIsOpen(false);
1194
1354
  }, [editor, localLatex, getPos]);
1195
- const handleCancel = (0, import_react12.useCallback)(() => {
1355
+ const handleCancel = (0, import_react15.useCallback)(() => {
1196
1356
  setLocalLatex(latex);
1197
1357
  setError(null);
1198
1358
  setIsOpen(false);
1199
1359
  }, [latex]);
1200
- const handleClick = (0, import_react12.useCallback)(
1360
+ const handleClick = (0, import_react15.useCallback)(
1201
1361
  (e) => {
1202
1362
  e.stopPropagation();
1203
1363
  e.preventDefault();
@@ -1208,58 +1368,58 @@ function InlineMathView({ editor, node, getPos }) {
1208
1368
  [isEditable]
1209
1369
  );
1210
1370
  const isEmpty = !latex;
1211
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
1212
- import_react11.NodeViewWrapper,
1371
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1372
+ import_react14.NodeViewWrapper,
1213
1373
  {
1214
1374
  as: "span",
1215
1375
  className: "inline-math-wrapper",
1216
1376
  "data-type": "inline-math",
1217
1377
  "data-latex": latex,
1218
1378
  children: [
1219
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1379
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1220
1380
  "span",
1221
1381
  {
1222
1382
  className: `inline-math cursor-pointer rounded px-0.5 transition-colors ${isEditable ? "hover:bg-primary/10 hover:ring-1 hover:ring-primary/20" : ""} ${isEmpty ? "text-muted-foreground italic" : ""}`,
1223
1383
  onClick: handleClick,
1224
- children: isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-xs", children: "$?$" }) : renderedHtml ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1384
+ children: isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-xs", children: "$?$" }) : renderedHtml ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1225
1385
  "span",
1226
1386
  {
1227
1387
  dangerouslySetInnerHTML: { __html: renderedHtml }
1228
1388
  }
1229
- ) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-destructive text-xs", children: latex })
1389
+ ) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-destructive text-xs", children: latex })
1230
1390
  }
1231
1391
  ),
1232
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dialog3.Dialog.Root, { open: isOpen, onOpenChange: setIsOpen, size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_dialog3.Dialog.Content, { children: [
1233
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dialog3.Dialog.Header, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dialog3.Dialog.Title, { children: intl.formatMessage(messages3.title) }) }),
1234
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dialog3.Dialog.Body, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "space-y-4", children: [
1235
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "space-y-1.5", children: [
1236
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_label3.Label, { className: "text-sm", children: intl.formatMessage(messages3.latex_input) }),
1237
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1392
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_dialog3.Dialog.Root, { open: isOpen, onOpenChange: setIsOpen, size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_dialog3.Dialog.Content, { children: [
1393
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_dialog3.Dialog.Header, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_dialog3.Dialog.Title, { children: intl.formatMessage(messages4.title) }) }),
1394
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_dialog3.Dialog.Body, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-4", children: [
1395
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-1.5", children: [
1396
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_label3.Label, { className: "text-sm", children: intl.formatMessage(messages4.latex_input) }),
1397
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1238
1398
  "input",
1239
1399
  {
1240
1400
  type: "text",
1241
1401
  className: "w-full p-2 rounded-md border border-input bg-background font-mono text-sm focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
1242
1402
  value: localLatex,
1243
1403
  onChange: (e) => setLocalLatex(e.target.value),
1244
- placeholder: intl.formatMessage(messages3.latex_placeholder),
1404
+ placeholder: intl.formatMessage(messages4.latex_placeholder),
1245
1405
  spellCheck: false
1246
1406
  }
1247
1407
  ),
1248
- error && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "text-xs text-destructive", children: error })
1408
+ error && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "text-xs text-destructive", children: error })
1249
1409
  ] }),
1250
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "space-y-1.5", children: [
1251
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_label3.Label, { className: "text-sm", children: intl.formatMessage(messages3.preview) }),
1252
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "min-h-10 p-3 rounded-md border border-border bg-muted/30 flex items-center justify-center", children: previewHtml ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1410
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-1.5", children: [
1411
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_label3.Label, { className: "text-sm", children: intl.formatMessage(messages4.preview) }),
1412
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "min-h-10 p-3 rounded-md border border-border bg-muted/30 flex items-center justify-center", children: previewHtml ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1253
1413
  "span",
1254
1414
  {
1255
1415
  dangerouslySetInnerHTML: { __html: previewHtml }
1256
1416
  }
1257
- ) : localLatex ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-muted-foreground text-sm", children: intl.formatMessage(messages3.invalid_latex) }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-muted-foreground text-sm", children: "$...$" }) })
1417
+ ) : localLatex ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-muted-foreground text-sm", children: intl.formatMessage(messages4.invalid_latex) }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-muted-foreground text-sm", children: "$...$" }) })
1258
1418
  ] })
1259
1419
  ] }) }),
1260
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_dialog3.Dialog.Footer, { children: [
1261
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_button4.Button, { variant: "ghost", onClick: handleCancel, children: intl.formatMessage(messages3.cancel) }),
1262
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_button4.Button, { onClick: handleSave, disabled: !!error && !!localLatex, children: intl.formatMessage(messages3.save) })
1420
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_dialog3.Dialog.Footer, { children: [
1421
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_button5.Button, { variant: "ghost", onClick: handleCancel, children: intl.formatMessage(messages4.cancel) }),
1422
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_button5.Button, { onClick: handleSave, disabled: !!error && !!localLatex, children: intl.formatMessage(messages4.save) })
1263
1423
  ] })
1264
1424
  ] }) })
1265
1425
  ]
@@ -1305,7 +1465,7 @@ var InlineMath = import_core3.Node.create({
1305
1465
  ];
1306
1466
  },
1307
1467
  addNodeView() {
1308
- return (0, import_react13.ReactNodeViewRenderer)(InlineMathView, {
1468
+ return (0, import_react16.ReactNodeViewRenderer)(InlineMathView, {
1309
1469
  as: "span"
1310
1470
  });
1311
1471
  },
@@ -1373,7 +1533,7 @@ var MathBlock = import_core4.Node.create({
1373
1533
  ];
1374
1534
  },
1375
1535
  addNodeView() {
1376
- return (0, import_react14.ReactNodeViewRenderer)(MathBlockView);
1536
+ return (0, import_react17.ReactNodeViewRenderer)(MathBlockView);
1377
1537
  },
1378
1538
  addCommands() {
1379
1539
  return {
@@ -1416,18 +1576,18 @@ var MathBlock = import_core4.Node.create({
1416
1576
 
1417
1577
  // src/extensions/toc/index.ts
1418
1578
  var import_core5 = require("@tiptap/core");
1419
- var import_react18 = require("@tiptap/react");
1579
+ var import_react21 = require("@tiptap/react");
1420
1580
 
1421
1581
  // src/extensions/toc/toc-view.tsx
1422
- var import_icons6 = require("@kopexa/icons");
1423
- var import_theme3 = require("@kopexa/theme");
1424
- var import_react16 = require("@tiptap/react");
1425
- var import_react17 = require("react");
1426
- var import_react_intl10 = require("react-intl");
1582
+ var import_icons7 = require("@kopexa/icons");
1583
+ var import_theme4 = require("@kopexa/theme");
1584
+ var import_react19 = require("@tiptap/react");
1585
+ var import_react20 = require("react");
1586
+ var import_react_intl12 = require("react-intl");
1427
1587
 
1428
1588
  // src/extensions/toc/messages.ts
1429
- var import_react_intl8 = require("react-intl");
1430
- var messages4 = (0, import_react_intl8.defineMessages)({
1589
+ var import_react_intl10 = require("react-intl");
1590
+ var messages5 = (0, import_react_intl10.defineMessages)({
1431
1591
  title: {
1432
1592
  id: "editor.toc.title",
1433
1593
  defaultMessage: "Table of Contents",
@@ -1501,15 +1661,15 @@ var messages4 = (0, import_react_intl8.defineMessages)({
1501
1661
  });
1502
1662
 
1503
1663
  // src/extensions/toc/toc-settings.tsx
1504
- var import_button5 = require("@kopexa/button");
1664
+ var import_button6 = require("@kopexa/button");
1505
1665
  var import_dialog4 = require("@kopexa/dialog");
1506
- var import_icons5 = require("@kopexa/icons");
1666
+ var import_icons6 = require("@kopexa/icons");
1507
1667
  var import_label4 = require("@kopexa/label");
1508
1668
  var import_select2 = require("@kopexa/select");
1509
1669
  var import_switch = require("@kopexa/switch");
1510
- var import_react15 = require("react");
1511
- var import_react_intl9 = require("react-intl");
1512
- var import_jsx_runtime7 = require("react/jsx-runtime");
1670
+ var import_react18 = require("react");
1671
+ var import_react_intl11 = require("react-intl");
1672
+ var import_jsx_runtime8 = require("react/jsx-runtime");
1513
1673
  var HEADING_LEVELS = [
1514
1674
  { value: "1", label: "H1" },
1515
1675
  { value: "2", label: "H2" },
@@ -1519,15 +1679,15 @@ var HEADING_LEVELS = [
1519
1679
  { value: "6", label: "H6" }
1520
1680
  ];
1521
1681
  function TocSettings({ editor, attrs, getPos }) {
1522
- const intl = (0, import_react_intl9.useIntl)();
1523
- const [isOpen, setIsOpen] = (0, import_react15.useState)(false);
1524
- const [localAttrs, setLocalAttrs] = (0, import_react15.useState)(attrs);
1525
- (0, import_react15.useEffect)(() => {
1682
+ const intl = (0, import_react_intl11.useIntl)();
1683
+ const [isOpen, setIsOpen] = (0, import_react18.useState)(false);
1684
+ const [localAttrs, setLocalAttrs] = (0, import_react18.useState)(attrs);
1685
+ (0, import_react18.useEffect)(() => {
1526
1686
  if (isOpen) {
1527
1687
  setLocalAttrs(attrs);
1528
1688
  }
1529
1689
  }, [isOpen, attrs]);
1530
- const handleSave = (0, import_react15.useCallback)(() => {
1690
+ const handleSave = (0, import_react18.useCallback)(() => {
1531
1691
  const pos = getPos();
1532
1692
  if (pos === void 0) return;
1533
1693
  editor.view.dispatch(
@@ -1535,11 +1695,11 @@ function TocSettings({ editor, attrs, getPos }) {
1535
1695
  );
1536
1696
  setIsOpen(false);
1537
1697
  }, [editor, localAttrs, getPos]);
1538
- const handleCancel = (0, import_react15.useCallback)(() => {
1698
+ const handleCancel = (0, import_react18.useCallback)(() => {
1539
1699
  setLocalAttrs(attrs);
1540
1700
  setIsOpen(false);
1541
1701
  }, [attrs]);
1542
- const handleMinLevelChange = (0, import_react15.useCallback)((value) => {
1702
+ const handleMinLevelChange = (0, import_react18.useCallback)((value) => {
1543
1703
  const minLevel = Number.parseInt(String(value), 10);
1544
1704
  setLocalAttrs((prev) => ({
1545
1705
  ...prev,
@@ -1548,7 +1708,7 @@ function TocSettings({ editor, attrs, getPos }) {
1548
1708
  maxLevel: Math.max(prev.maxLevel, minLevel)
1549
1709
  }));
1550
1710
  }, []);
1551
- const handleMaxLevelChange = (0, import_react15.useCallback)((value) => {
1711
+ const handleMaxLevelChange = (0, import_react18.useCallback)((value) => {
1552
1712
  const maxLevel = Number.parseInt(String(value), 10);
1553
1713
  setLocalAttrs((prev) => ({
1554
1714
  ...prev,
@@ -1557,10 +1717,10 @@ function TocSettings({ editor, attrs, getPos }) {
1557
1717
  minLevel: Math.min(prev.minLevel, maxLevel)
1558
1718
  }));
1559
1719
  }, []);
1560
- const handleNumberedChange = (0, import_react15.useCallback)((checked) => {
1720
+ const handleNumberedChange = (0, import_react18.useCallback)((checked) => {
1561
1721
  setLocalAttrs((prev) => ({ ...prev, numbered: checked }));
1562
1722
  }, []);
1563
- const handleStyleChange = (0, import_react15.useCallback)((value) => {
1723
+ const handleStyleChange = (0, import_react18.useCallback)((value) => {
1564
1724
  setLocalAttrs((prev) => ({
1565
1725
  ...prev,
1566
1726
  style: String(value)
@@ -1569,36 +1729,36 @@ function TocSettings({ editor, attrs, getPos }) {
1569
1729
  if (!editor.isEditable) {
1570
1730
  return null;
1571
1731
  }
1572
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
1573
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1574
- import_button5.IconButton,
1732
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
1733
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1734
+ import_button6.IconButton,
1575
1735
  {
1576
1736
  size: "sm",
1577
1737
  variant: "ghost",
1578
- "aria-label": intl.formatMessage(messages4.settings),
1738
+ "aria-label": intl.formatMessage(messages5.settings),
1579
1739
  onClick: (e) => {
1580
1740
  e.stopPropagation();
1581
1741
  e.preventDefault();
1582
1742
  setIsOpen(true);
1583
1743
  },
1584
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_icons5.SettingsIcon, { className: "size-3.5" })
1744
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons6.SettingsIcon, { className: "size-3.5" })
1585
1745
  }
1586
1746
  ),
1587
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_dialog4.Dialog.Root, { open: isOpen, onOpenChange: setIsOpen, size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_dialog4.Dialog.Content, { children: [
1588
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_dialog4.Dialog.Header, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_dialog4.Dialog.Title, { children: intl.formatMessage(messages4.settings) }) }),
1589
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_dialog4.Dialog.Body, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-4", children: [
1590
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "grid grid-cols-2 gap-3", children: [
1591
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-1.5", children: [
1592
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_label4.Label, { className: "text-sm", children: intl.formatMessage(messages4.min_level) }),
1593
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1747
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_dialog4.Dialog.Root, { open: isOpen, onOpenChange: setIsOpen, size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_dialog4.Dialog.Content, { children: [
1748
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_dialog4.Dialog.Header, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_dialog4.Dialog.Title, { children: intl.formatMessage(messages5.settings) }) }),
1749
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_dialog4.Dialog.Body, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "space-y-4", children: [
1750
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "grid grid-cols-2 gap-3", children: [
1751
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "space-y-1.5", children: [
1752
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_label4.Label, { className: "text-sm", children: intl.formatMessage(messages5.min_level) }),
1753
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1594
1754
  import_select2.Select,
1595
1755
  {
1596
1756
  size: "sm",
1597
1757
  value: String(localAttrs.minLevel),
1598
1758
  onValueChange: handleMinLevelChange,
1599
1759
  children: [
1600
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_select2.Select.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_select2.Select.Value, {}) }),
1601
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_select2.Select.Content, { children: HEADING_LEVELS.map((level) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1760
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_select2.Select.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_select2.Select.Value, {}) }),
1761
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_select2.Select.Content, { children: HEADING_LEVELS.map((level) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1602
1762
  import_select2.Select.Item,
1603
1763
  {
1604
1764
  value: level.value,
@@ -1611,17 +1771,17 @@ function TocSettings({ editor, attrs, getPos }) {
1611
1771
  }
1612
1772
  )
1613
1773
  ] }),
1614
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-1.5", children: [
1615
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_label4.Label, { className: "text-sm", children: intl.formatMessage(messages4.max_level) }),
1616
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1774
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "space-y-1.5", children: [
1775
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_label4.Label, { className: "text-sm", children: intl.formatMessage(messages5.max_level) }),
1776
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1617
1777
  import_select2.Select,
1618
1778
  {
1619
1779
  size: "sm",
1620
1780
  value: String(localAttrs.maxLevel),
1621
1781
  onValueChange: handleMaxLevelChange,
1622
1782
  children: [
1623
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_select2.Select.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_select2.Select.Value, {}) }),
1624
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_select2.Select.Content, { children: HEADING_LEVELS.map((level) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1783
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_select2.Select.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_select2.Select.Value, {}) }),
1784
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_select2.Select.Content, { children: HEADING_LEVELS.map((level) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1625
1785
  import_select2.Select.Item,
1626
1786
  {
1627
1787
  value: level.value,
@@ -1635,12 +1795,12 @@ function TocSettings({ editor, attrs, getPos }) {
1635
1795
  )
1636
1796
  ] })
1637
1797
  ] }),
1638
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
1639
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-0.5", children: [
1640
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_label4.Label, { className: "text-sm", children: intl.formatMessage(messages4.numbered) }),
1641
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "text-xs text-muted-foreground", children: intl.formatMessage(messages4.numbered_hint) })
1798
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
1799
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "space-y-0.5", children: [
1800
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_label4.Label, { className: "text-sm", children: intl.formatMessage(messages5.numbered) }),
1801
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-xs text-muted-foreground", children: intl.formatMessage(messages5.numbered_hint) })
1642
1802
  ] }),
1643
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1803
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1644
1804
  import_switch.Switch,
1645
1805
  {
1646
1806
  size: "sm",
@@ -1649,36 +1809,36 @@ function TocSettings({ editor, attrs, getPos }) {
1649
1809
  }
1650
1810
  )
1651
1811
  ] }),
1652
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-1.5", children: [
1653
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_label4.Label, { className: "text-sm", children: intl.formatMessage(messages4.style) }),
1654
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1812
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "space-y-1.5", children: [
1813
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_label4.Label, { className: "text-sm", children: intl.formatMessage(messages5.style) }),
1814
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1655
1815
  import_select2.Select,
1656
1816
  {
1657
1817
  size: "sm",
1658
1818
  value: localAttrs.style,
1659
1819
  onValueChange: handleStyleChange,
1660
1820
  children: [
1661
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_select2.Select.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_select2.Select.Value, {}) }),
1662
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_select2.Select.Content, { children: [
1663
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_select2.Select.Item, { value: "default", children: intl.formatMessage(messages4.style_default) }),
1664
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_select2.Select.Item, { value: "flat", children: intl.formatMessage(messages4.style_flat) }),
1665
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_select2.Select.Item, { value: "compact", children: intl.formatMessage(messages4.style_compact) })
1821
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_select2.Select.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_select2.Select.Value, {}) }),
1822
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_select2.Select.Content, { children: [
1823
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_select2.Select.Item, { value: "default", children: intl.formatMessage(messages5.style_default) }),
1824
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_select2.Select.Item, { value: "flat", children: intl.formatMessage(messages5.style_flat) }),
1825
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_select2.Select.Item, { value: "compact", children: intl.formatMessage(messages5.style_compact) })
1666
1826
  ] })
1667
1827
  ]
1668
1828
  }
1669
1829
  )
1670
1830
  ] })
1671
1831
  ] }) }),
1672
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_dialog4.Dialog.Footer, { children: [
1673
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_button5.Button, { variant: "ghost", onClick: handleCancel, children: intl.formatMessage(messages4.cancel) }),
1674
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_button5.Button, { onClick: handleSave, children: intl.formatMessage(messages4.save) })
1832
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_dialog4.Dialog.Footer, { children: [
1833
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_button6.Button, { variant: "ghost", onClick: handleCancel, children: intl.formatMessage(messages5.cancel) }),
1834
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_button6.Button, { onClick: handleSave, children: intl.formatMessage(messages5.save) })
1675
1835
  ] })
1676
1836
  ] }) })
1677
1837
  ] });
1678
1838
  }
1679
1839
 
1680
1840
  // src/extensions/toc/toc-view.tsx
1681
- var import_jsx_runtime8 = require("react/jsx-runtime");
1841
+ var import_jsx_runtime9 = require("react/jsx-runtime");
1682
1842
  function generateHeadingNumbers(headings, minLevel) {
1683
1843
  const counters = [0, 0, 0, 0, 0, 0];
1684
1844
  return headings.map((heading) => {
@@ -1700,8 +1860,8 @@ function generateHeadingNumbers(headings, minLevel) {
1700
1860
  });
1701
1861
  }
1702
1862
  function TocNodeView({ editor, node, getPos }) {
1703
- const [headings, setHeadings] = (0, import_react17.useState)([]);
1704
- const intl = (0, import_react_intl10.useIntl)();
1863
+ const [headings, setHeadings] = (0, import_react20.useState)([]);
1864
+ const intl = (0, import_react_intl12.useIntl)();
1705
1865
  const attrs = node.attrs;
1706
1866
  const {
1707
1867
  minLevel = 1,
@@ -1709,8 +1869,8 @@ function TocNodeView({ editor, node, getPos }) {
1709
1869
  numbered = false,
1710
1870
  style = "default"
1711
1871
  } = attrs;
1712
- const styles = (0, import_react17.useMemo)(() => (0, import_theme3.toc)({ style }), [style]);
1713
- const updateHeadings = (0, import_react17.useCallback)(() => {
1872
+ const styles = (0, import_react20.useMemo)(() => (0, import_theme4.toc)({ style }), [style]);
1873
+ const updateHeadings = (0, import_react20.useCallback)(() => {
1714
1874
  const items = [];
1715
1875
  const { doc } = editor.state;
1716
1876
  doc.descendants((docNode, pos) => {
@@ -1730,14 +1890,14 @@ function TocNodeView({ editor, node, getPos }) {
1730
1890
  const numberedHeadings = generateHeadingNumbers(items, minLevel);
1731
1891
  setHeadings(numberedHeadings);
1732
1892
  }, [editor, minLevel, maxLevel]);
1733
- (0, import_react17.useEffect)(() => {
1893
+ (0, import_react20.useEffect)(() => {
1734
1894
  updateHeadings();
1735
1895
  editor.on("update", updateHeadings);
1736
1896
  return () => {
1737
1897
  editor.off("update", updateHeadings);
1738
1898
  };
1739
1899
  }, [editor, updateHeadings]);
1740
- const handleClick = (0, import_react17.useCallback)(
1900
+ const handleClick = (0, import_react20.useCallback)(
1741
1901
  (pos, id) => {
1742
1902
  var _a;
1743
1903
  editor.chain().focus().setTextSelection(pos).run();
@@ -1758,13 +1918,13 @@ function TocNodeView({ editor, node, getPos }) {
1758
1918
  const getIndent = (level) => {
1759
1919
  return (level - minLevel) * 16;
1760
1920
  };
1761
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react16.NodeViewWrapper, { className: styles.root(), "data-type": "toc", children: [
1762
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: styles.header(), children: [
1763
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: styles.headerContent(), children: [
1764
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons6.ListIcon, { className: styles.headerIcon() }),
1765
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: styles.headerTitle(), children: intl.formatMessage(messages4.title) })
1921
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_react19.NodeViewWrapper, { className: styles.root(), "data-type": "toc", children: [
1922
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: styles.header(), children: [
1923
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: styles.headerContent(), children: [
1924
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_icons7.ListIcon, { className: styles.headerIcon() }),
1925
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: styles.headerTitle(), children: intl.formatMessage(messages5.title) })
1766
1926
  ] }),
1767
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: styles.headerActions(), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1927
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: styles.headerActions(), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1768
1928
  TocSettings,
1769
1929
  {
1770
1930
  editor,
@@ -1773,7 +1933,7 @@ function TocNodeView({ editor, node, getPos }) {
1773
1933
  }
1774
1934
  ) })
1775
1935
  ] }),
1776
- isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: styles.emptyState(), children: intl.formatMessage(messages4.empty_state) }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("nav", { className: styles.nav(), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("ul", { className: styles.list(), children: headings.map((heading) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1936
+ isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: styles.emptyState(), children: intl.formatMessage(messages5.empty_state) }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("nav", { className: styles.nav(), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("ul", { className: styles.list(), children: headings.map((heading) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1777
1937
  "li",
1778
1938
  {
1779
1939
  className: styles.item(),
@@ -1781,14 +1941,14 @@ function TocNodeView({ editor, node, getPos }) {
1781
1941
  paddingLeft: `${getIndent(heading.level)}px`
1782
1942
  },
1783
1943
  children: [
1784
- numbered && heading.number && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: styles.itemNumber(), children: heading.number }),
1785
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1944
+ numbered && heading.number && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: styles.itemNumber(), children: heading.number }),
1945
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1786
1946
  "button",
1787
1947
  {
1788
1948
  type: "button",
1789
1949
  onClick: () => handleClick(heading.pos, heading.id),
1790
1950
  className: styles.itemButton(),
1791
- children: heading.text || intl.formatMessage(messages4.empty_heading)
1951
+ children: heading.text || intl.formatMessage(messages5.empty_heading)
1792
1952
  }
1793
1953
  )
1794
1954
  ]
@@ -1857,7 +2017,7 @@ var TocNode = import_core5.Node.create({
1857
2017
  ];
1858
2018
  },
1859
2019
  addNodeView() {
1860
- return (0, import_react18.ReactNodeViewRenderer)(TocNodeView);
2020
+ return (0, import_react21.ReactNodeViewRenderer)(TocNodeView);
1861
2021
  },
1862
2022
  addCommands() {
1863
2023
  return {
@@ -1900,14 +2060,14 @@ var import_extension_text_style = require("@tiptap/extension-text-style");
1900
2060
  var import_extension_typography = require("@tiptap/extension-typography");
1901
2061
  var import_extension_unique_id = require("@tiptap/extension-unique-id");
1902
2062
  var import_extensions = require("@tiptap/extensions");
1903
- var import_react22 = require("@tiptap/react");
2063
+ var import_react25 = require("@tiptap/react");
1904
2064
  var import_starter_kit = require("@tiptap/starter-kit");
1905
- var import_react23 = require("react");
2065
+ var import_react26 = require("react");
1906
2066
 
1907
2067
  // src/extensions/link/index.ts
1908
2068
  var import_extension_link = __toESM(require("@tiptap/extension-link"));
1909
2069
  var import_state = require("@tiptap/pm/state");
1910
- var import_react19 = require("@tiptap/react");
2070
+ var import_react22 = require("@tiptap/react");
1911
2071
  var Link = import_extension_link.default.extend({
1912
2072
  inclusive: false,
1913
2073
  parseHTML() {
@@ -1935,7 +2095,7 @@ var Link = import_extension_link.default.extend({
1935
2095
  const { schema, doc, tr } = view.state;
1936
2096
  let range;
1937
2097
  if (schema.marks.link) {
1938
- range = (0, import_react19.getMarkRange)(doc.resolve(pos), schema.marks.link);
2098
+ range = (0, import_react22.getMarkRange)(doc.resolve(pos), schema.marks.link);
1939
2099
  }
1940
2100
  if (!range) {
1941
2101
  return;
@@ -1962,8 +2122,8 @@ var Link = import_extension_link.default.extend({
1962
2122
  // src/extensions/selection/index.ts
1963
2123
  var import_state2 = require("@tiptap/pm/state");
1964
2124
  var import_view = require("@tiptap/pm/view");
1965
- var import_react20 = require("@tiptap/react");
1966
- var Selection = import_react20.Extension.create({
2125
+ var import_react23 = require("@tiptap/react");
2126
+ var Selection = import_react23.Extension.create({
1967
2127
  name: "selection",
1968
2128
  addProseMirrorPlugins() {
1969
2129
  const { editor } = this;
@@ -1978,7 +2138,7 @@ var Selection = import_react20.Extension.create({
1978
2138
  if (editor.isFocused === true || !editor.isEditable) {
1979
2139
  return null;
1980
2140
  }
1981
- if ((0, import_react20.isNodeSelection)(state.selection)) {
2141
+ if ((0, import_react23.isNodeSelection)(state.selection)) {
1982
2142
  return null;
1983
2143
  }
1984
2144
  return import_view.DecorationSet.create(state.doc, [
@@ -1995,7 +2155,7 @@ var Selection = import_react20.Extension.create({
1995
2155
 
1996
2156
  // src/extensions/trailing-node/index.ts
1997
2157
  var import_state3 = require("@tiptap/pm/state");
1998
- var import_react21 = require("@tiptap/react");
2158
+ var import_react24 = require("@tiptap/react");
1999
2159
  function nodeEqualsType({
2000
2160
  types,
2001
2161
  node
@@ -2006,7 +2166,7 @@ function nodeEqualsType({
2006
2166
  }
2007
2167
  return node.type === types;
2008
2168
  }
2009
- var TrailingNode = import_react21.Extension.create({
2169
+ var TrailingNode = import_react24.Extension.create({
2010
2170
  name: "trailingNode",
2011
2171
  addOptions() {
2012
2172
  return {
@@ -2282,7 +2442,19 @@ var useCreateEditor = ({
2282
2442
  }) => {
2283
2443
  const fileHandlerFromContext = useEditorFile();
2284
2444
  const fileHandler = fileHandlerProp != null ? fileHandlerProp : fileHandlerFromContext;
2285
- const editor = (0, import_react22.useEditor)({
2445
+ const extensions = (0, import_react26.useMemo)(
2446
+ () => getExtensions({
2447
+ editable,
2448
+ placeholder,
2449
+ enableControls,
2450
+ controlResolver,
2451
+ fileHandler
2452
+ }),
2453
+ // Only recreate extensions when these values change
2454
+ // Note: fileHandler and controlResolver are object references, so they should be stable
2455
+ [editable, placeholder, enableControls, controlResolver, fileHandler]
2456
+ );
2457
+ const editor = (0, import_react25.useEditor)({
2286
2458
  editorProps: {
2287
2459
  attributes: {
2288
2460
  autocomplete: "off",
@@ -2293,13 +2465,7 @@ var useCreateEditor = ({
2293
2465
  },
2294
2466
  immediatelyRender: false,
2295
2467
  shouldRerenderOnTransaction: false,
2296
- extensions: getExtensions({
2297
- editable,
2298
- placeholder,
2299
- enableControls,
2300
- controlResolver,
2301
- fileHandler
2302
- }),
2468
+ extensions,
2303
2469
  editable,
2304
2470
  onUpdate: ({ editor: editor2 }) => {
2305
2471
  onChange == null ? void 0 : onChange(editor2.getJSON());
@@ -2307,7 +2473,7 @@ var useCreateEditor = ({
2307
2473
  content: safeParseContent(content),
2308
2474
  ...options
2309
2475
  });
2310
- (0, import_react23.useEffect)(() => {
2476
+ (0, import_react26.useEffect)(() => {
2311
2477
  if (editor && editor.isEditable !== editable) {
2312
2478
  editor.setEditable(editable);
2313
2479
  }
@@ -2371,8 +2537,12 @@ function getExtensions({
2371
2537
  CalloutNode,
2372
2538
  MathBlock,
2373
2539
  InlineMath,
2374
- // Image support - always include for display
2375
- ImageNode,
2540
+ // Image support - extended with file reference resolution
2541
+ ImageNode.configure({
2542
+ allowBase64: true
2543
+ }),
2544
+ // Image upload placeholder
2545
+ ImageUploadNode,
2376
2546
  import_extensions.Placeholder.configure({
2377
2547
  placeholder,
2378
2548
  emptyNodeClass: "is-empty with-slash"
@@ -2465,19 +2635,19 @@ async function handleFileUpload(editor, file, fileHandler, pos) {
2465
2635
  }
2466
2636
 
2467
2637
  // src/presets/basic/index.tsx
2468
- var import_theme6 = require("@kopexa/theme");
2469
- var import_react51 = require("@tiptap/react");
2470
- var import_react52 = require("react");
2638
+ var import_theme7 = require("@kopexa/theme");
2639
+ var import_react54 = require("@tiptap/react");
2640
+ var import_react55 = require("react");
2471
2641
 
2472
2642
  // src/context/editor-context.ts
2473
2643
  var import_react_utils = require("@kopexa/react-utils");
2474
2644
  var [EditorUIProvider, useEditorUIContext] = (0, import_react_utils.createContext)();
2475
2645
 
2476
2646
  // src/hooks/use-ui-editor-state.ts
2477
- var import_react24 = require("@tiptap/react");
2647
+ var import_react27 = require("@tiptap/react");
2478
2648
  function useUiEditorState(editor) {
2479
2649
  var _a;
2480
- return (_a = (0, import_react24.useEditorState)({
2650
+ return (_a = (0, import_react27.useEditorState)({
2481
2651
  editor,
2482
2652
  selector: ({ editor: editor2 }) => {
2483
2653
  if (!editor2) return defaultUiState;
@@ -2498,23 +2668,23 @@ var import_toolbar3 = require("@kopexa/toolbar");
2498
2668
  var import_menus = require("@tiptap/react/menus");
2499
2669
 
2500
2670
  // src/ui/link-popover/link-popover.tsx
2501
- var import_button6 = require("@kopexa/button");
2502
- var import_icons8 = require("@kopexa/icons");
2671
+ var import_button7 = require("@kopexa/button");
2672
+ var import_icons9 = require("@kopexa/icons");
2503
2673
  var import_input2 = require("@kopexa/input");
2504
2674
  var import_popover = require("@kopexa/popover");
2505
2675
  var import_toolbar = require("@kopexa/toolbar");
2506
- var import_react27 = require("react");
2676
+ var import_react30 = require("react");
2507
2677
 
2508
2678
  // src/hooks/use-tiptap-editor.ts
2509
- var import_react25 = require("@tiptap/react");
2510
- var import_react26 = require("react");
2679
+ var import_react28 = require("@tiptap/react");
2680
+ var import_react29 = require("react");
2511
2681
  function useTiptapEditor(providedEditor) {
2512
- const { editor: coreEditor } = (0, import_react25.useCurrentEditor)();
2513
- const mainEditor = (0, import_react26.useMemo)(
2682
+ const { editor: coreEditor } = (0, import_react28.useCurrentEditor)();
2683
+ const mainEditor = (0, import_react29.useMemo)(
2514
2684
  () => providedEditor || coreEditor,
2515
2685
  [providedEditor, coreEditor]
2516
2686
  );
2517
- const editorState = (0, import_react25.useEditorState)({
2687
+ const editorState = (0, import_react28.useEditorState)({
2518
2688
  editor: mainEditor,
2519
2689
  selector(context) {
2520
2690
  if (!context.editor) {
@@ -2536,7 +2706,7 @@ function useTiptapEditor(providedEditor) {
2536
2706
 
2537
2707
  // src/ui/link-popover/use-link-popover.ts
2538
2708
  var import_editor_utils = require("@kopexa/editor-utils");
2539
- var import_icons7 = require("@kopexa/icons");
2709
+ var import_icons8 = require("@kopexa/icons");
2540
2710
  var React = __toESM(require("react"));
2541
2711
 
2542
2712
  // src/utils/index.ts
@@ -2755,15 +2925,15 @@ function useLinkPopover(config) {
2755
2925
  canSet,
2756
2926
  isActive,
2757
2927
  label: "Link",
2758
- Icon: import_icons7.LinkIcon,
2928
+ Icon: import_icons8.LinkIcon,
2759
2929
  ...linkHandler
2760
2930
  };
2761
2931
  }
2762
2932
 
2763
2933
  // src/ui/link-popover/link-popover.tsx
2764
- var import_jsx_runtime9 = require("react/jsx-runtime");
2934
+ var import_jsx_runtime10 = require("react/jsx-runtime");
2765
2935
  var LinkButton = ({ className, children, ...props }) => {
2766
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2936
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2767
2937
  import_toolbar.ToolbarButton,
2768
2938
  {
2769
2939
  type: "button",
@@ -2775,7 +2945,7 @@ var LinkButton = ({ className, children, ...props }) => {
2775
2945
  title: "Link",
2776
2946
  isIconOnly: !children,
2777
2947
  ...props,
2778
- children: children || /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_icons8.LinkIcon, {})
2948
+ children: children || /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_icons9.LinkIcon, {})
2779
2949
  }
2780
2950
  );
2781
2951
  };
@@ -2788,8 +2958,8 @@ var LinkMain = ({
2788
2958
  isActive,
2789
2959
  onSave
2790
2960
  }) => {
2791
- const [isEditing, setIsEditing] = (0, import_react27.useState)(!isActive || !url);
2792
- (0, import_react27.useEffect)(() => {
2961
+ const [isEditing, setIsEditing] = (0, import_react30.useState)(!isActive || !url);
2962
+ (0, import_react30.useEffect)(() => {
2793
2963
  setIsEditing(!isActive || !url);
2794
2964
  }, [isActive, url]);
2795
2965
  const handleKeyDown = (event) => {
@@ -2812,8 +2982,8 @@ var LinkMain = ({
2812
2982
  setIsEditing(true);
2813
2983
  };
2814
2984
  if (isEditing) {
2815
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-1 min-w-[280px]", children: [
2816
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2985
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-1 min-w-[280px]", children: [
2986
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2817
2987
  import_input2.Input,
2818
2988
  {
2819
2989
  type: "url",
@@ -2828,8 +2998,8 @@ var LinkMain = ({
2828
2998
  autoFocus: true
2829
2999
  }
2830
3000
  ),
2831
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2832
- import_button6.IconButton,
3001
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3002
+ import_button7.IconButton,
2833
3003
  {
2834
3004
  type: "button",
2835
3005
  size: "sm",
@@ -2837,13 +3007,13 @@ var LinkMain = ({
2837
3007
  onClick: handleSave,
2838
3008
  "aria-label": "Save link",
2839
3009
  disabled: !url,
2840
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_icons8.CheckIcon, { className: "size-4" })
3010
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_icons9.CheckIcon, { className: "size-4" })
2841
3011
  }
2842
3012
  )
2843
3013
  ] });
2844
3014
  }
2845
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-1 min-w-[280px]", children: [
2846
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3015
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-1 min-w-[280px]", children: [
3016
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2847
3017
  "a",
2848
3018
  {
2849
3019
  href: url,
@@ -2857,38 +3027,38 @@ var LinkMain = ({
2857
3027
  children: url
2858
3028
  }
2859
3029
  ),
2860
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-0.5 border-l pl-1 ml-1", children: [
2861
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2862
- import_button6.IconButton,
3030
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-0.5 border-l pl-1 ml-1", children: [
3031
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3032
+ import_button7.IconButton,
2863
3033
  {
2864
3034
  type: "button",
2865
3035
  size: "sm",
2866
3036
  variant: "ghost",
2867
3037
  onClick: openLink,
2868
3038
  "aria-label": "Open link in new tab",
2869
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_icons8.ExternalLinkIcon, { className: "size-4" })
3039
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_icons9.ExternalLinkIcon, { className: "size-4" })
2870
3040
  }
2871
3041
  ),
2872
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2873
- import_button6.IconButton,
3042
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3043
+ import_button7.IconButton,
2874
3044
  {
2875
3045
  type: "button",
2876
3046
  size: "sm",
2877
3047
  variant: "ghost",
2878
3048
  onClick: handleEdit,
2879
3049
  "aria-label": "Edit link",
2880
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_icons8.EditIcon, { className: "size-4" })
3050
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_icons9.EditIcon, { className: "size-4" })
2881
3051
  }
2882
3052
  ),
2883
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2884
- import_button6.IconButton,
3053
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3054
+ import_button7.IconButton,
2885
3055
  {
2886
3056
  type: "button",
2887
3057
  size: "sm",
2888
3058
  variant: "ghost",
2889
3059
  onClick: removeLink,
2890
3060
  "aria-label": "Remove link",
2891
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_icons8.TrashIcon, { className: "size-4" })
3061
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_icons9.TrashIcon, { className: "size-4" })
2892
3062
  }
2893
3063
  )
2894
3064
  ] })
@@ -2905,7 +3075,7 @@ function LinkPopover({
2905
3075
  ...buttonProps
2906
3076
  }) {
2907
3077
  const { editor } = useTiptapEditor(providedEditor);
2908
- const [isOpen, setIsOpen] = (0, import_react27.useState)(false);
3078
+ const [isOpen, setIsOpen] = (0, import_react30.useState)(false);
2909
3079
  const {
2910
3080
  isVisible,
2911
3081
  canSet,
@@ -2921,18 +3091,18 @@ function LinkPopover({
2921
3091
  hideWhenUnavailable,
2922
3092
  onSetLink
2923
3093
  });
2924
- const handleOnOpenChange = (0, import_react27.useCallback)(
3094
+ const handleOnOpenChange = (0, import_react30.useCallback)(
2925
3095
  (nextIsOpen) => {
2926
3096
  setIsOpen(nextIsOpen);
2927
3097
  onOpenChange == null ? void 0 : onOpenChange(nextIsOpen);
2928
3098
  },
2929
3099
  [onOpenChange]
2930
3100
  );
2931
- const handleSetLink = (0, import_react27.useCallback)(() => {
3101
+ const handleSetLink = (0, import_react30.useCallback)(() => {
2932
3102
  setLink();
2933
3103
  setIsOpen(false);
2934
3104
  }, [setLink]);
2935
- const handleClick = (0, import_react27.useCallback)(
3105
+ const handleClick = (0, import_react30.useCallback)(
2936
3106
  (event) => {
2937
3107
  onClick == null ? void 0 : onClick(event);
2938
3108
  if (event.defaultPrevented) return;
@@ -2940,7 +3110,7 @@ function LinkPopover({
2940
3110
  },
2941
3111
  [onClick, isOpen]
2942
3112
  );
2943
- (0, import_react27.useEffect)(() => {
3113
+ (0, import_react30.useEffect)(() => {
2944
3114
  if (autoOpenOnLinkActive && isActive) {
2945
3115
  setIsOpen(true);
2946
3116
  }
@@ -2948,17 +3118,17 @@ function LinkPopover({
2948
3118
  if (!isVisible) {
2949
3119
  return null;
2950
3120
  }
2951
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
3121
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
2952
3122
  import_popover.Popover.Root,
2953
3123
  {
2954
3124
  open: isOpen,
2955
3125
  onOpenChange: handleOnOpenChange,
2956
3126
  spacing: "dense",
2957
3127
  children: [
2958
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3128
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2959
3129
  import_popover.Popover.Trigger,
2960
3130
  {
2961
- render: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3131
+ render: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2962
3132
  LinkButton,
2963
3133
  {
2964
3134
  "data-disabled": !canSet,
@@ -2972,7 +3142,7 @@ function LinkPopover({
2972
3142
  )
2973
3143
  }
2974
3144
  ),
2975
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_popover.Popover.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3145
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_popover.Popover.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2976
3146
  LinkMain,
2977
3147
  {
2978
3148
  url,
@@ -2992,19 +3162,19 @@ LinkButton.displayName = "LinkButton";
2992
3162
 
2993
3163
  // src/ui/mark-button/index.tsx
2994
3164
  var import_editor_utils2 = require("@kopexa/editor-utils");
2995
- var import_icons9 = require("@kopexa/icons");
3165
+ var import_icons10 = require("@kopexa/icons");
2996
3166
  var import_toolbar2 = require("@kopexa/toolbar");
2997
- var import_react28 = require("@tiptap/react");
2998
- var import_react29 = require("react");
2999
- var import_jsx_runtime10 = require("react/jsx-runtime");
3167
+ var import_react31 = require("@tiptap/react");
3168
+ var import_react32 = require("react");
3169
+ var import_jsx_runtime11 = require("react/jsx-runtime");
3000
3170
  var markIcons = {
3001
- bold: import_icons9.BoldIcon,
3002
- italic: import_icons9.ItalicIcon,
3003
- underline: import_icons9.UnderlineIcon,
3004
- strike: import_icons9.StrikeIcon,
3005
- code: import_icons9.CodeIcon,
3006
- superscript: import_icons9.SuperscriptIcon,
3007
- subscript: import_icons9.SubscriptIcon
3171
+ bold: import_icons10.BoldIcon,
3172
+ italic: import_icons10.ItalicIcon,
3173
+ underline: import_icons10.UnderlineIcon,
3174
+ strike: import_icons10.StrikeIcon,
3175
+ code: import_icons10.CodeIcon,
3176
+ superscript: import_icons10.SuperscriptIcon,
3177
+ subscript: import_icons10.SubscriptIcon
3008
3178
  };
3009
3179
  var markShortcutKeys = {
3010
3180
  bold: "mod+b",
@@ -3042,7 +3212,7 @@ function shouldShowMarkButton(params) {
3042
3212
  return false;
3043
3213
  }
3044
3214
  if (hideWhenUnavailable) {
3045
- if ((0, import_react28.isNodeSelection)(editor.state.selection) || !canToggleMark(editor, type)) {
3215
+ if ((0, import_react31.isNodeSelection)(editor.state.selection) || !canToggleMark(editor, type)) {
3046
3216
  return false;
3047
3217
  }
3048
3218
  }
@@ -3087,7 +3257,7 @@ var MarkButton = ({
3087
3257
  shortcutKey,
3088
3258
  formattedName
3089
3259
  } = useMarkState(editor, type, disabled);
3090
- const handleClick = (0, import_react29.useCallback)(
3260
+ const handleClick = (0, import_react32.useCallback)(
3091
3261
  (e) => {
3092
3262
  onClick == null ? void 0 : onClick(e);
3093
3263
  if (!e.defaultPrevented && !isDisabled && editor) {
@@ -3096,7 +3266,7 @@ var MarkButton = ({
3096
3266
  },
3097
3267
  [onClick, isDisabled, editor, type]
3098
3268
  );
3099
- const show = (0, import_react29.useMemo)(() => {
3269
+ const show = (0, import_react32.useMemo)(() => {
3100
3270
  return shouldShowMarkButton({
3101
3271
  editor,
3102
3272
  type,
@@ -3107,7 +3277,7 @@ var MarkButton = ({
3107
3277
  if (!show || !editor || !editor.isEditable) {
3108
3278
  return null;
3109
3279
  }
3110
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3280
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3111
3281
  import_toolbar2.ToolbarButton,
3112
3282
  {
3113
3283
  type: "button",
@@ -3125,18 +3295,18 @@ var MarkButton = ({
3125
3295
  onClick: handleClick,
3126
3296
  isIconOnly: true,
3127
3297
  ...buttonProps,
3128
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Icon, {})
3298
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Icon, {})
3129
3299
  }
3130
3300
  );
3131
3301
  };
3132
3302
 
3133
3303
  // src/ui/bubble-menu/index.tsx
3134
- var import_jsx_runtime11 = require("react/jsx-runtime");
3304
+ var import_jsx_runtime12 = require("react/jsx-runtime");
3135
3305
  function BubbleMenu({ editor }) {
3136
3306
  if (!editor) {
3137
3307
  return null;
3138
3308
  }
3139
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3309
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3140
3310
  import_menus.BubbleMenu,
3141
3311
  {
3142
3312
  editor,
@@ -3154,15 +3324,15 @@ function BubbleMenu({ editor }) {
3154
3324
  offset: 8
3155
3325
  },
3156
3326
  className: "rounded-lg border bg-background shadow-md",
3157
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_toolbar3.Toolbar, { radius: "md", border: "none", className: "p-1", children: [
3158
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_toolbar3.ToolbarGroup, { children: [
3159
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(MarkButton, { type: "bold" }),
3160
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(MarkButton, { type: "italic" }),
3161
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(MarkButton, { type: "strike" }),
3162
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(MarkButton, { type: "code" })
3327
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_toolbar3.Toolbar, { radius: "md", border: "none", className: "p-1", children: [
3328
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_toolbar3.ToolbarGroup, { children: [
3329
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(MarkButton, { type: "bold" }),
3330
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(MarkButton, { type: "italic" }),
3331
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(MarkButton, { type: "strike" }),
3332
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(MarkButton, { type: "code" })
3163
3333
  ] }),
3164
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_toolbar3.ToolbarSeparator, {}),
3165
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_toolbar3.ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(LinkPopover, { autoOpenOnLinkActive: false }) })
3334
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_toolbar3.ToolbarSeparator, {}),
3335
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_toolbar3.ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(LinkPopover, { autoOpenOnLinkActive: false }) })
3166
3336
  ] })
3167
3337
  }
3168
3338
  );
@@ -3174,7 +3344,7 @@ var React3 = __toESM(require("react"));
3174
3344
 
3175
3345
  // src/hooks/use-floating-toolbar-visibility.ts
3176
3346
  var import_state4 = require("@tiptap/pm/state");
3177
- var import_react30 = require("@tiptap/react");
3347
+ var import_react33 = require("@tiptap/react");
3178
3348
  var React2 = __toESM(require("react"));
3179
3349
  var HIDE_FLOATING_META = "hideFloatingToolbar";
3180
3350
  var selectNodeAndHideFloating = (editor, pos) => {
@@ -3272,41 +3442,41 @@ function useScrollToHash(config = {}) {
3272
3442
  }
3273
3443
 
3274
3444
  // src/ui/link-bubble/index.tsx
3275
- var import_button7 = require("@kopexa/button");
3276
- var import_icons10 = require("@kopexa/icons");
3445
+ var import_button8 = require("@kopexa/button");
3446
+ var import_icons11 = require("@kopexa/icons");
3277
3447
  var import_input3 = require("@kopexa/input");
3278
3448
  var import_menus2 = require("@tiptap/react/menus");
3279
- var import_react31 = require("react");
3280
- var import_jsx_runtime12 = require("react/jsx-runtime");
3449
+ var import_react34 = require("react");
3450
+ var import_jsx_runtime13 = require("react/jsx-runtime");
3281
3451
  function LinkBubble({ editor }) {
3282
- const [isEditing, setIsEditing] = (0, import_react31.useState)(false);
3283
- const [url, setUrl] = (0, import_react31.useState)("");
3284
- const getCurrentUrl = (0, import_react31.useCallback)(() => {
3452
+ const [isEditing, setIsEditing] = (0, import_react34.useState)(false);
3453
+ const [url, setUrl] = (0, import_react34.useState)("");
3454
+ const getCurrentUrl = (0, import_react34.useCallback)(() => {
3285
3455
  if (!editor) return "";
3286
3456
  const attrs = editor.getAttributes("link");
3287
3457
  return attrs.href || "";
3288
3458
  }, [editor]);
3289
- (0, import_react31.useEffect)(() => {
3459
+ (0, import_react34.useEffect)(() => {
3290
3460
  const isLinkActive2 = editor == null ? void 0 : editor.isActive("link");
3291
3461
  if (isLinkActive2) {
3292
3462
  setUrl(getCurrentUrl());
3293
3463
  setIsEditing(false);
3294
3464
  }
3295
3465
  }, [editor, getCurrentUrl]);
3296
- const handleOpenLink = (0, import_react31.useCallback)(() => {
3466
+ const handleOpenLink = (0, import_react34.useCallback)(() => {
3297
3467
  const href = getCurrentUrl();
3298
3468
  if (href) {
3299
3469
  window.open(href, "_blank", "noopener,noreferrer");
3300
3470
  }
3301
3471
  }, [getCurrentUrl]);
3302
- const handleRemoveLink = (0, import_react31.useCallback)(() => {
3472
+ const handleRemoveLink = (0, import_react34.useCallback)(() => {
3303
3473
  editor == null ? void 0 : editor.chain().focus().unsetLink().run();
3304
3474
  }, [editor]);
3305
- const handleEdit = (0, import_react31.useCallback)(() => {
3475
+ const handleEdit = (0, import_react34.useCallback)(() => {
3306
3476
  setUrl(getCurrentUrl());
3307
3477
  setIsEditing(true);
3308
3478
  }, [getCurrentUrl]);
3309
- const handleSave = (0, import_react31.useCallback)(() => {
3479
+ const handleSave = (0, import_react34.useCallback)(() => {
3310
3480
  if (url) {
3311
3481
  editor == null ? void 0 : editor.chain().focus().extendMarkRange("link").setLink({ href: url }).run();
3312
3482
  } else {
@@ -3314,7 +3484,7 @@ function LinkBubble({ editor }) {
3314
3484
  }
3315
3485
  setIsEditing(false);
3316
3486
  }, [editor, url]);
3317
- const handleKeyDown = (0, import_react31.useCallback)(
3487
+ const handleKeyDown = (0, import_react34.useCallback)(
3318
3488
  (e) => {
3319
3489
  if (e.key === "Enter") {
3320
3490
  e.preventDefault();
@@ -3330,7 +3500,7 @@ function LinkBubble({ editor }) {
3330
3500
  if (!editor) {
3331
3501
  return null;
3332
3502
  }
3333
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3503
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3334
3504
  import_menus2.BubbleMenu,
3335
3505
  {
3336
3506
  editor,
@@ -3343,8 +3513,8 @@ function LinkBubble({ editor }) {
3343
3513
  offset: 8
3344
3514
  },
3345
3515
  className: "rounded-lg border bg-background shadow-md",
3346
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex items-center gap-1 p-1.5 min-w-[280px]", children: isEditing ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
3347
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3516
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "flex items-center gap-1 p-1.5 min-w-[280px]", children: isEditing ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
3517
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3348
3518
  import_input3.Input,
3349
3519
  {
3350
3520
  type: "url",
@@ -3356,19 +3526,19 @@ function LinkBubble({ editor }) {
3356
3526
  autoFocus: true
3357
3527
  }
3358
3528
  ),
3359
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3360
- import_button7.IconButton,
3529
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3530
+ import_button8.IconButton,
3361
3531
  {
3362
3532
  type: "button",
3363
3533
  size: "sm",
3364
3534
  variant: "ghost",
3365
3535
  onClick: handleSave,
3366
3536
  "aria-label": "Save link",
3367
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_icons10.EditIcon, { className: "size-4" })
3537
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_icons11.EditIcon, { className: "size-4" })
3368
3538
  }
3369
3539
  )
3370
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
3371
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3540
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
3541
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3372
3542
  "a",
3373
3543
  {
3374
3544
  href: getCurrentUrl(),
@@ -3382,38 +3552,38 @@ function LinkBubble({ editor }) {
3382
3552
  children: getCurrentUrl()
3383
3553
  }
3384
3554
  ),
3385
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-0.5 border-l pl-1 ml-1", children: [
3386
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3387
- import_button7.IconButton,
3555
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-0.5 border-l pl-1 ml-1", children: [
3556
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3557
+ import_button8.IconButton,
3388
3558
  {
3389
3559
  type: "button",
3390
3560
  size: "sm",
3391
3561
  variant: "ghost",
3392
3562
  onClick: handleOpenLink,
3393
3563
  "aria-label": "Open link in new tab",
3394
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_icons10.ExternalLinkIcon, { className: "size-4" })
3564
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_icons11.ExternalLinkIcon, { className: "size-4" })
3395
3565
  }
3396
3566
  ),
3397
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3398
- import_button7.IconButton,
3567
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3568
+ import_button8.IconButton,
3399
3569
  {
3400
3570
  type: "button",
3401
3571
  size: "sm",
3402
3572
  variant: "ghost",
3403
3573
  onClick: handleEdit,
3404
3574
  "aria-label": "Edit link",
3405
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_icons10.EditIcon, { className: "size-4" })
3575
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_icons11.EditIcon, { className: "size-4" })
3406
3576
  }
3407
3577
  ),
3408
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3409
- import_button7.IconButton,
3578
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3579
+ import_button8.IconButton,
3410
3580
  {
3411
3581
  type: "button",
3412
3582
  size: "sm",
3413
3583
  variant: "ghost",
3414
3584
  onClick: handleRemoveLink,
3415
3585
  "aria-label": "Remove link",
3416
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_icons10.TrashIcon, { className: "size-4" })
3586
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_icons11.TrashIcon, { className: "size-4" })
3417
3587
  }
3418
3588
  )
3419
3589
  ] })
@@ -3423,30 +3593,30 @@ function LinkBubble({ editor }) {
3423
3593
  }
3424
3594
 
3425
3595
  // src/ui/slash-dropdown-menu/slash-dropdown-menu.tsx
3426
- var import_button8 = require("@kopexa/button");
3596
+ var import_button9 = require("@kopexa/button");
3427
3597
  var import_editor_utils6 = require("@kopexa/editor-utils");
3428
3598
  var import_separator = require("@kopexa/separator");
3429
- var import_theme4 = require("@kopexa/theme");
3599
+ var import_theme5 = require("@kopexa/theme");
3430
3600
  var React8 = __toESM(require("react"));
3431
3601
 
3432
3602
  // src/ui/suggestion-menu/suggestion-menu.tsx
3433
- var import_react33 = require("@floating-ui/react");
3603
+ var import_react36 = require("@floating-ui/react");
3434
3604
  var import_state5 = require("@tiptap/pm/state");
3435
3605
  var import_suggestion = require("@tiptap/suggestion");
3436
3606
  var React6 = __toESM(require("react"));
3437
3607
 
3438
3608
  // src/hooks/use-floating-element.ts
3439
- var import_react32 = require("@floating-ui/react");
3609
+ var import_react35 = require("@floating-ui/react");
3440
3610
  var React4 = __toESM(require("react"));
3441
3611
  function useFloatingElement(show, referencePos, zIndex, options) {
3442
3612
  const { dismissOptions, ...floatingOptions } = options || {};
3443
- const { refs, update, context, floatingStyles } = (0, import_react32.useFloating)({
3613
+ const { refs, update, context, floatingStyles } = (0, import_react35.useFloating)({
3444
3614
  open: show,
3445
3615
  ...floatingOptions
3446
3616
  });
3447
- const { isMounted, styles } = (0, import_react32.useTransitionStyles)(context);
3448
- const dismiss = (0, import_react32.useDismiss)(context, dismissOptions);
3449
- const { getReferenceProps, getFloatingProps } = (0, import_react32.useInteractions)([dismiss]);
3617
+ const { isMounted, styles } = (0, import_react35.useTransitionStyles)(context);
3618
+ const dismiss = (0, import_react35.useDismiss)(context, dismissOptions);
3619
+ const { getReferenceProps, getFloatingProps } = (0, import_react35.useInteractions)([dismiss]);
3450
3620
  React4.useEffect(() => {
3451
3621
  update();
3452
3622
  }, [referencePos, update]);
@@ -3654,7 +3824,7 @@ function filterSuggestionItems(items, query) {
3654
3824
  }
3655
3825
 
3656
3826
  // src/ui/suggestion-menu/suggestion-menu.tsx
3657
- var import_jsx_runtime13 = require("react/jsx-runtime");
3827
+ var import_jsx_runtime14 = require("react/jsx-runtime");
3658
3828
  var SuggestionMenu = ({
3659
3829
  editor: providedEditor,
3660
3830
  floatingOptions,
@@ -3680,13 +3850,13 @@ var SuggestionMenu = ({
3680
3850
  {
3681
3851
  placement: "bottom-start",
3682
3852
  middleware: [
3683
- (0, import_react33.offset)(10),
3684
- (0, import_react33.flip)({
3853
+ (0, import_react36.offset)(10),
3854
+ (0, import_react36.flip)({
3685
3855
  mainAxis: true,
3686
3856
  crossAxis: false
3687
3857
  }),
3688
- (0, import_react33.shift)(),
3689
- (0, import_react33.size)({
3858
+ (0, import_react36.shift)(),
3859
+ (0, import_react36.size)({
3690
3860
  apply({ availableHeight, elements }) {
3691
3861
  if (elements.floating) {
3692
3862
  const maxHeightValue = maxHeight ? Math.min(maxHeight, availableHeight) : availableHeight;
@@ -3825,7 +3995,7 @@ var SuggestionMenu = ({
3825
3995
  if (!isMounted || !show || !editor) {
3826
3996
  return null;
3827
3997
  }
3828
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3998
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3829
3999
  "div",
3830
4000
  {
3831
4001
  ref,
@@ -3847,14 +4017,14 @@ var SuggestionMenu = ({
3847
4017
 
3848
4018
  // src/ui/slash-dropdown-menu/use-slash-dropdown-menu.ts
3849
4019
  var import_editor_utils5 = require("@kopexa/editor-utils");
3850
- var import_icons12 = require("@kopexa/icons");
4020
+ var import_icons13 = require("@kopexa/icons");
3851
4021
  var React7 = __toESM(require("react"));
3852
4022
 
3853
4023
  // src/ui/table-button/use-table.ts
3854
4024
  var import_editor_utils4 = require("@kopexa/editor-utils");
3855
- var import_icons11 = require("@kopexa/icons");
3856
- var import_react34 = require("@tiptap/react");
3857
- var import_react35 = require("react");
4025
+ var import_icons12 = require("@kopexa/icons");
4026
+ var import_react37 = require("@tiptap/react");
4027
+ var import_react38 = require("react");
3858
4028
  function canToggle(editor) {
3859
4029
  if (!editor || !editor.isEditable) return false;
3860
4030
  if (!(0, import_editor_utils4.isNodeInSchema)("table", editor) || (0, import_editor_utils4.isNodeTypeSelected)(editor, ["image"])) {
@@ -3885,7 +4055,7 @@ function shouldShowButton(props) {
3885
4055
  if (!editor || !editor.isEditable) return false;
3886
4056
  if (!(0, import_editor_utils4.isNodeInSchema)("table", editor)) return false;
3887
4057
  if (hideWhenUnavailable) {
3888
- if ((0, import_react34.isNodeSelection)(editor.state.selection) || !canToggle) {
4058
+ if ((0, import_react37.isNodeSelection)(editor.state.selection) || !canToggle) {
3889
4059
  return false;
3890
4060
  }
3891
4061
  }
@@ -3898,10 +4068,10 @@ function useTableBlock(config) {
3898
4068
  onToggled
3899
4069
  } = config || {};
3900
4070
  const { editor } = useTiptapEditor(providedEditor);
3901
- const [isVisible, setIsVisible] = (0, import_react35.useState)(true);
4071
+ const [isVisible, setIsVisible] = (0, import_react38.useState)(true);
3902
4072
  const canToggleState = canToggle(editor);
3903
4073
  const isActive = (editor == null ? void 0 : editor.isActive("table")) || false;
3904
- (0, import_react35.useEffect)(() => {
4074
+ (0, import_react38.useEffect)(() => {
3905
4075
  if (!editor) return;
3906
4076
  const handleSelectionUpdate = () => {
3907
4077
  setIsVisible(shouldShowButton({ editor, hideWhenUnavailable }));
@@ -3912,7 +4082,7 @@ function useTableBlock(config) {
3912
4082
  editor.off("selectionUpdate", handleSelectionUpdate);
3913
4083
  };
3914
4084
  }, [editor, hideWhenUnavailable]);
3915
- const handleToggle = (0, import_react35.useCallback)(() => {
4085
+ const handleToggle = (0, import_react38.useCallback)(() => {
3916
4086
  if (!editor) return false;
3917
4087
  const success = toggleTable(editor);
3918
4088
  if (success) {
@@ -3927,7 +4097,7 @@ function useTableBlock(config) {
3927
4097
  canToggle: canToggleState,
3928
4098
  label: "Table",
3929
4099
  // shortcutKeys: CODE_BLOCK_SHORTCUT_KEY,
3930
- Icon: import_icons11.TableIcon
4100
+ Icon: import_icons12.TableIcon
3931
4101
  };
3932
4102
  }
3933
4103
 
@@ -3938,14 +4108,14 @@ var texts = {
3938
4108
  title: "Continue Writing",
3939
4109
  subtext: "Continue writing from the current position",
3940
4110
  keywords: ["continue", "write", "continue writing", "ai"],
3941
- badge: import_icons12.AiSparklesIcon,
4111
+ badge: import_icons13.AiSparklesIcon,
3942
4112
  group: "AI"
3943
4113
  },
3944
4114
  ai_ask_button: {
3945
4115
  title: "Ask AI",
3946
4116
  subtext: "Ask AI to generate content",
3947
4117
  keywords: ["ai", "ask", "generate"],
3948
- badge: import_icons12.AiSparklesIcon,
4118
+ badge: import_icons13.AiSparklesIcon,
3949
4119
  group: "AI"
3950
4120
  },
3951
4121
  // Style
@@ -3953,63 +4123,63 @@ var texts = {
3953
4123
  title: "Text",
3954
4124
  subtext: "Regular text paragraph",
3955
4125
  keywords: ["p", "paragraph", "text"],
3956
- badge: import_icons12.TypeIcon,
4126
+ badge: import_icons13.TypeIcon,
3957
4127
  group: "Style"
3958
4128
  },
3959
4129
  heading_1: {
3960
4130
  title: "Heading 1",
3961
4131
  subtext: "Top-level heading",
3962
4132
  keywords: ["h", "heading1", "h1"],
3963
- badge: import_icons12.HeadingOneIcon,
4133
+ badge: import_icons13.HeadingOneIcon,
3964
4134
  group: "Style"
3965
4135
  },
3966
4136
  heading_2: {
3967
4137
  title: "Heading 2",
3968
4138
  subtext: "Key section heading",
3969
4139
  keywords: ["h2", "heading2", "subheading"],
3970
- badge: import_icons12.HeadingTwoIcon,
4140
+ badge: import_icons13.HeadingTwoIcon,
3971
4141
  group: "Style"
3972
4142
  },
3973
4143
  heading_3: {
3974
4144
  title: "Heading 3",
3975
4145
  subtext: "Subsection and group heading",
3976
4146
  keywords: ["h3", "heading3", "subheading"],
3977
- badge: import_icons12.HeadingThreeIcon,
4147
+ badge: import_icons13.HeadingThreeIcon,
3978
4148
  group: "Style"
3979
4149
  },
3980
4150
  bullet_list: {
3981
4151
  title: "Bullet List",
3982
4152
  subtext: "List with unordered items",
3983
4153
  keywords: ["ul", "li", "list", "bulletlist", "bullet list"],
3984
- badge: import_icons12.ListIcon,
4154
+ badge: import_icons13.ListIcon,
3985
4155
  group: "Style"
3986
4156
  },
3987
4157
  ordered_list: {
3988
4158
  title: "Numbered List",
3989
4159
  subtext: "List with ordered items",
3990
4160
  keywords: ["ol", "li", "list", "numberedlist", "numbered list"],
3991
- badge: import_icons12.ListOrderedIcon,
4161
+ badge: import_icons13.ListOrderedIcon,
3992
4162
  group: "Style"
3993
4163
  },
3994
4164
  task_list: {
3995
4165
  title: "To-do list",
3996
4166
  subtext: "List with tasks",
3997
4167
  keywords: ["tasklist", "task list", "todo", "checklist"],
3998
- badge: import_icons12.ListTodoIcon,
4168
+ badge: import_icons13.ListTodoIcon,
3999
4169
  group: "Style"
4000
4170
  },
4001
4171
  quote: {
4002
4172
  title: "Blockquote",
4003
4173
  subtext: "Blockquote block",
4004
4174
  keywords: ["quote", "blockquote"],
4005
- badge: import_icons12.BlockquoteIcon,
4175
+ badge: import_icons13.BlockquoteIcon,
4006
4176
  group: "Style"
4007
4177
  },
4008
4178
  code_block: {
4009
4179
  title: "Code Block",
4010
4180
  subtext: "Code block with syntax highlighting",
4011
4181
  keywords: ["code", "pre"],
4012
- badge: import_icons12.CodeBlockIcon,
4182
+ badge: import_icons13.CodeBlockIcon,
4013
4183
  group: "Style"
4014
4184
  },
4015
4185
  // Insert
@@ -4031,49 +4201,49 @@ var texts = {
4031
4201
  title: "Control",
4032
4202
  subtext: "Insert a control block",
4033
4203
  keywords: ["control"],
4034
- badge: import_icons12.ControlsIcon,
4204
+ badge: import_icons13.ControlsIcon,
4035
4205
  group: "Insert"
4036
4206
  },
4037
4207
  divider: {
4038
4208
  title: "Separator",
4039
4209
  subtext: "Horizontal line to separate content",
4040
4210
  keywords: ["hr", "horizontalRule", "line", "separator"],
4041
- badge: import_icons12.MinusIcon,
4211
+ badge: import_icons13.MinusIcon,
4042
4212
  group: "Insert"
4043
4213
  },
4044
4214
  table: {
4045
4215
  title: "Table",
4046
4216
  subtext: "Insert a table",
4047
4217
  keywords: ["table", "grid", "spreadsheet"],
4048
- badge: import_icons12.TableIcon,
4218
+ badge: import_icons13.TableIcon,
4049
4219
  group: "Insert"
4050
4220
  },
4051
4221
  table_of_contents: {
4052
4222
  title: "Table of Contents",
4053
4223
  subtext: "Auto-generated list of headings",
4054
4224
  keywords: ["toc", "table of contents", "index", "navigation", "headings"],
4055
- badge: import_icons12.TableOfContentsIcon,
4225
+ badge: import_icons13.TableOfContentsIcon,
4056
4226
  group: "Insert"
4057
4227
  },
4058
4228
  callout: {
4059
4229
  title: "Callout",
4060
4230
  subtext: "Highlighted block for important information",
4061
4231
  keywords: ["callout", "info", "warning", "alert", "note", "tip"],
4062
- badge: import_icons12.InfoIcon,
4232
+ badge: import_icons13.InfoIcon,
4063
4233
  group: "Insert"
4064
4234
  },
4065
4235
  callout_warning: {
4066
4236
  title: "Warning",
4067
4237
  subtext: "Warning callout block",
4068
4238
  keywords: ["warning", "caution", "attention"],
4069
- badge: import_icons12.AlertIcon,
4239
+ badge: import_icons13.AlertIcon,
4070
4240
  group: "Insert"
4071
4241
  },
4072
4242
  math: {
4073
4243
  title: "Formula",
4074
4244
  subtext: "LaTeX math formula block",
4075
4245
  keywords: ["math", "latex", "formula", "equation", "katex"],
4076
- badge: import_icons12.TypeIcon,
4246
+ badge: import_icons13.TypeIcon,
4077
4247
  group: "Insert"
4078
4248
  },
4079
4249
  // Upload
@@ -4089,7 +4259,7 @@ var texts = {
4089
4259
  "media",
4090
4260
  "url"
4091
4261
  ],
4092
- badge: import_icons12.ImageIcon,
4262
+ badge: import_icons13.ImageIcon,
4093
4263
  group: "Upload"
4094
4264
  }
4095
4265
  };
@@ -4251,9 +4421,9 @@ Continue writing from where the text above ends. Write ONLY ONE SENTENCE. DONT R
4251
4421
  },
4252
4422
  // Upload
4253
4423
  image: {
4254
- check: (editor) => (0, import_editor_utils5.isNodeInSchema)("image", editor),
4424
+ check: (editor) => (0, import_editor_utils5.isNodeInSchema)("imageUpload", editor),
4255
4425
  action: ({ editor }) => {
4256
- editor.chain().focus().setImage({ src: "" }).run();
4426
+ editor.chain().focus().setImageUpload().run();
4257
4427
  }
4258
4428
  }
4259
4429
  };
@@ -4314,11 +4484,11 @@ function useSlashDropdownMenu(config) {
4314
4484
  }
4315
4485
 
4316
4486
  // src/ui/slash-dropdown-menu/slash-dropdown-menu.tsx
4317
- var import_jsx_runtime14 = require("react/jsx-runtime");
4487
+ var import_jsx_runtime15 = require("react/jsx-runtime");
4318
4488
  var SlashDropdownMenu = (props) => {
4319
4489
  const { config, ...restProps } = props;
4320
4490
  const { getSlashMenuItems } = useSlashDropdownMenu(config);
4321
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4491
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4322
4492
  SuggestionMenu,
4323
4493
  {
4324
4494
  char: "/",
@@ -4328,7 +4498,7 @@ var SlashDropdownMenu = (props) => {
4328
4498
  selector: "tiptap-slash-dropdown-menu",
4329
4499
  items: ({ query, editor }) => filterSuggestionItems(getSlashMenuItems(editor), query),
4330
4500
  ...restProps,
4331
- children: (props2) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(List, { ...props2, config })
4501
+ children: (props2) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(List, { ...props2, config })
4332
4502
  }
4333
4503
  );
4334
4504
  };
@@ -4348,13 +4518,13 @@ var Item = (props) => {
4348
4518
  }
4349
4519
  }, [isSelected]);
4350
4520
  const BadgeIcon = item.badge;
4351
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4352
- import_button8.Button,
4521
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4522
+ import_button9.Button,
4353
4523
  {
4354
4524
  ref: itemRef,
4355
4525
  variant: "ghost",
4356
4526
  color: "default",
4357
- startContent: BadgeIcon && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(BadgeIcon, {}),
4527
+ startContent: BadgeIcon && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(BadgeIcon, {}),
4358
4528
  "data-active-state": isSelected ? "on" : "off",
4359
4529
  onClick: onSelect,
4360
4530
  fullWidth: true,
@@ -4369,14 +4539,14 @@ var List = ({
4369
4539
  onSelect,
4370
4540
  config
4371
4541
  }) => {
4372
- const styles = (0, import_theme4.slashDropdownMenu)();
4542
+ const styles = (0, import_theme5.slashDropdownMenu)();
4373
4543
  const renderedItems = React8.useMemo(() => {
4374
4544
  const rendered = [];
4375
4545
  const showGroups = (config == null ? void 0 : config.showGroups) !== false;
4376
4546
  if (!showGroups) {
4377
4547
  items.forEach((item, index) => {
4378
4548
  rendered.push(
4379
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4549
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4380
4550
  Item,
4381
4551
  {
4382
4552
  item,
@@ -4401,7 +4571,7 @@ var List = ({
4401
4571
  Object.entries(groups).forEach(([groupLabel, groupData], groupIndex) => {
4402
4572
  if (groupIndex > 0) {
4403
4573
  rendered.push(
4404
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4574
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4405
4575
  import_separator.Separator,
4406
4576
  {
4407
4577
  orientation: "horizontal"
@@ -4412,7 +4582,7 @@ var List = ({
4412
4582
  }
4413
4583
  const groupItems = groupData.items.map((item, itemIndex) => {
4414
4584
  const originalIndex = groupData.indices[itemIndex];
4415
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4585
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4416
4586
  Item,
4417
4587
  {
4418
4588
  item,
@@ -4424,13 +4594,13 @@ var List = ({
4424
4594
  });
4425
4595
  if (groupLabel) {
4426
4596
  rendered.push(
4427
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
4597
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
4428
4598
  "div",
4429
4599
  {
4430
4600
  className: styles.cardItemGroup(),
4431
4601
  children: [
4432
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: styles.cardGroupLabel(), children: groupLabel }),
4433
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: styles.cardGroup(), children: groupItems })
4602
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: styles.cardGroupLabel(), children: groupLabel }),
4603
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: styles.cardGroup(), children: groupItems })
4434
4604
  ]
4435
4605
  },
4436
4606
  `group-${groupIndex}-${groupLabel}`
@@ -4445,24 +4615,24 @@ var List = ({
4445
4615
  if (!renderedItems.length) {
4446
4616
  return null;
4447
4617
  }
4448
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4618
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4449
4619
  "div",
4450
4620
  {
4451
4621
  className: styles.card(),
4452
4622
  style: {
4453
4623
  maxHeight: "var(--suggestion-menu-max-height)"
4454
4624
  },
4455
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: styles.body(), children: renderedItems })
4625
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: styles.body(), children: renderedItems })
4456
4626
  }
4457
4627
  );
4458
4628
  };
4459
4629
 
4460
4630
  // src/presets/basic/editor-header.tsx
4461
- var import_icons24 = require("@kopexa/icons");
4631
+ var import_icons25 = require("@kopexa/icons");
4462
4632
  var import_popover3 = require("@kopexa/popover");
4463
4633
  var import_toolbar10 = require("@kopexa/toolbar");
4464
4634
  var import_use_is_mobile2 = require("@kopexa/use-is-mobile");
4465
- var import_react50 = require("react");
4635
+ var import_react53 = require("react");
4466
4636
 
4467
4637
  // src/hooks/use-cursor-visibility.ts
4468
4638
  var React10 = __toESM(require("react"));
@@ -4572,7 +4742,7 @@ var React12 = __toESM(require("react"));
4572
4742
 
4573
4743
  // src/ui/blockquote-button/use-blockquote.ts
4574
4744
  var import_editor_utils7 = require("@kopexa/editor-utils");
4575
- var import_icons13 = require("@kopexa/icons");
4745
+ var import_icons14 = require("@kopexa/icons");
4576
4746
  var import_state6 = require("@tiptap/pm/state");
4577
4747
  var React11 = __toESM(require("react"));
4578
4748
  var BLOCKQUOTE_SHORTCUT_KEY = "mod+shift+b";
@@ -4680,12 +4850,12 @@ function useBlockquote(config) {
4680
4850
  canToggle: canToggle3,
4681
4851
  label: "Blockquote",
4682
4852
  shortcutKeys: BLOCKQUOTE_SHORTCUT_KEY,
4683
- Icon: import_icons13.BlockquoteIcon
4853
+ Icon: import_icons14.BlockquoteIcon
4684
4854
  };
4685
4855
  }
4686
4856
 
4687
4857
  // src/ui/blockquote-button/blockquote-button.tsx
4688
- var import_jsx_runtime15 = require("react/jsx-runtime");
4858
+ var import_jsx_runtime16 = require("react/jsx-runtime");
4689
4859
  var BlockquoteButton = ({
4690
4860
  editor: providedEditor,
4691
4861
  text,
@@ -4721,7 +4891,7 @@ var BlockquoteButton = ({
4721
4891
  if (!isVisible) {
4722
4892
  return null;
4723
4893
  }
4724
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4894
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4725
4895
  import_toolbar4.ToolbarButton,
4726
4896
  {
4727
4897
  type: "button",
@@ -4738,22 +4908,22 @@ var BlockquoteButton = ({
4738
4908
  onClick: handleClick,
4739
4909
  isIconOnly: !text && !children,
4740
4910
  ...buttonProps,
4741
- children: children != null ? children : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
4742
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Icon, {}),
4743
- text && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: text })
4911
+ children: children != null ? children : /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
4912
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Icon, {}),
4913
+ text && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: text })
4744
4914
  ] })
4745
4915
  }
4746
4916
  );
4747
4917
  };
4748
4918
 
4749
4919
  // src/ui/codeblock-button/code-block-button.tsx
4750
- var import_icons15 = require("@kopexa/icons");
4920
+ var import_icons16 = require("@kopexa/icons");
4751
4921
  var import_toolbar5 = require("@kopexa/toolbar");
4752
- var import_react36 = require("react");
4922
+ var import_react39 = require("react");
4753
4923
 
4754
4924
  // src/ui/codeblock-button/use-code-block.ts
4755
4925
  var import_editor_utils8 = require("@kopexa/editor-utils");
4756
- var import_icons14 = require("@kopexa/icons");
4926
+ var import_icons15 = require("@kopexa/icons");
4757
4927
  var import_state7 = require("@tiptap/pm/state");
4758
4928
  var React13 = __toESM(require("react"));
4759
4929
  var CODE_BLOCK_SHORTCUT_KEY = "mod+alt+c";
@@ -4861,12 +5031,12 @@ function useCodeBlock(config) {
4861
5031
  canToggle: canToggleState,
4862
5032
  label: "Code Block",
4863
5033
  shortcutKeys: CODE_BLOCK_SHORTCUT_KEY,
4864
- Icon: import_icons14.CodeblockIcon
5034
+ Icon: import_icons15.CodeblockIcon
4865
5035
  };
4866
5036
  }
4867
5037
 
4868
5038
  // src/ui/codeblock-button/code-block-button.tsx
4869
- var import_jsx_runtime16 = require("react/jsx-runtime");
5039
+ var import_jsx_runtime17 = require("react/jsx-runtime");
4870
5040
  var CodeBlockButton = ({
4871
5041
  editor: providedEditor,
4872
5042
  text,
@@ -4883,7 +5053,7 @@ var CodeBlockButton = ({
4883
5053
  hideWhenUnavailable,
4884
5054
  onToggled
4885
5055
  });
4886
- const handleClick = (0, import_react36.useCallback)(
5056
+ const handleClick = (0, import_react39.useCallback)(
4887
5057
  (event) => {
4888
5058
  onClick == null ? void 0 : onClick(event);
4889
5059
  if (event.defaultPrevented) return;
@@ -4894,7 +5064,7 @@ var CodeBlockButton = ({
4894
5064
  if (!isVisible) {
4895
5065
  return null;
4896
5066
  }
4897
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
5067
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
4898
5068
  import_toolbar5.ToolbarButton,
4899
5069
  {
4900
5070
  type: "button",
@@ -4911,26 +5081,26 @@ var CodeBlockButton = ({
4911
5081
  onClick: handleClick,
4912
5082
  isIconOnly: true,
4913
5083
  ...buttonProps,
4914
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_icons15.CodeblockIcon, {})
5084
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_icons16.CodeblockIcon, {})
4915
5085
  }
4916
5086
  );
4917
5087
  };
4918
5088
 
4919
5089
  // src/ui/color-highlight-popover/color-highlight-popover.tsx
4920
- var import_button9 = require("@kopexa/button");
4921
- var import_icons17 = require("@kopexa/icons");
5090
+ var import_button10 = require("@kopexa/button");
5091
+ var import_icons18 = require("@kopexa/icons");
4922
5092
  var import_popover2 = require("@kopexa/popover");
4923
5093
  var import_toolbar7 = require("@kopexa/toolbar");
4924
- var import_react38 = require("react");
5094
+ var import_react41 = require("react");
4925
5095
 
4926
5096
  // src/ui/color-highlight-button/color-highlight-button.tsx
4927
- var import_theme5 = require("@kopexa/theme");
5097
+ var import_theme6 = require("@kopexa/theme");
4928
5098
  var import_toolbar6 = require("@kopexa/toolbar");
4929
- var import_react37 = require("react");
5099
+ var import_react40 = require("react");
4930
5100
 
4931
5101
  // src/ui/color-highlight-button/use-color-highlight.ts
4932
5102
  var import_editor_utils9 = require("@kopexa/editor-utils");
4933
- var import_icons16 = require("@kopexa/icons");
5103
+ var import_icons17 = require("@kopexa/icons");
4934
5104
  var import_use_is_mobile = require("@kopexa/use-is-mobile");
4935
5105
  var React14 = __toESM(require("react"));
4936
5106
  var import_react_hotkeys_hook = require("react-hotkeys-hook");
@@ -5087,12 +5257,12 @@ function useColorHighlight(config) {
5087
5257
  canColorHighlight: canColorHighlightState,
5088
5258
  label: label || `Highlight`,
5089
5259
  shortcutKeys: COLOR_HIGHLIGHT_SHORTCUT_KEY,
5090
- Icon: import_icons16.HighlighterIcon
5260
+ Icon: import_icons17.HighlighterIcon
5091
5261
  };
5092
5262
  }
5093
5263
 
5094
5264
  // src/ui/color-highlight-button/color-highlight-button.tsx
5095
- var import_jsx_runtime17 = require("react/jsx-runtime");
5265
+ var import_jsx_runtime18 = require("react/jsx-runtime");
5096
5266
  var ColorHighlightButton = ({
5097
5267
  editor: providedEditor,
5098
5268
  highlightColor,
@@ -5121,7 +5291,7 @@ var ColorHighlightButton = ({
5121
5291
  hideWhenUnavailable,
5122
5292
  onApplied
5123
5293
  });
5124
- const handleClick = (0, import_react37.useCallback)(
5294
+ const handleClick = (0, import_react40.useCallback)(
5125
5295
  (event) => {
5126
5296
  onClick == null ? void 0 : onClick(event);
5127
5297
  if (event.defaultPrevented) return;
@@ -5129,7 +5299,7 @@ var ColorHighlightButton = ({
5129
5299
  },
5130
5300
  [handleColorHighlight, onClick]
5131
5301
  );
5132
- const buttonStyle = (0, import_react37.useMemo)(
5302
+ const buttonStyle = (0, import_react40.useMemo)(
5133
5303
  () => ({
5134
5304
  ...style,
5135
5305
  "--highlight-color": highlightColor
@@ -5139,8 +5309,8 @@ var ColorHighlightButton = ({
5139
5309
  if (!isVisible) {
5140
5310
  return null;
5141
5311
  }
5142
- const styles = (0, import_theme5.colorHighlightButton)();
5143
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
5312
+ const styles = (0, import_theme6.colorHighlightButton)();
5313
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
5144
5314
  import_toolbar6.ToolbarButton,
5145
5315
  {
5146
5316
  type: "button",
@@ -5159,15 +5329,15 @@ var ColorHighlightButton = ({
5159
5329
  isIconOnly: true,
5160
5330
  ...buttonProps,
5161
5331
  children: [
5162
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
5332
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5163
5333
  "span",
5164
5334
  {
5165
5335
  "data-active-state": isActive ? "on" : "off",
5166
5336
  className: styles.mark()
5167
5337
  }
5168
5338
  ),
5169
- children || /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
5170
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
5339
+ children || /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
5340
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5171
5341
  "span",
5172
5342
  {
5173
5343
  style: { "--highlight-color": highlightColor }
@@ -5181,13 +5351,13 @@ var ColorHighlightButton = ({
5181
5351
  };
5182
5352
 
5183
5353
  // src/ui/color-highlight-popover/color-highlight-popover.tsx
5184
- var import_jsx_runtime18 = require("react/jsx-runtime");
5354
+ var import_jsx_runtime19 = require("react/jsx-runtime");
5185
5355
  var ColorHighlightPopoverButton = ({
5186
5356
  className,
5187
5357
  children,
5188
5358
  ...props
5189
- }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5190
- import_button9.IconButton,
5359
+ }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
5360
+ import_button10.IconButton,
5191
5361
  {
5192
5362
  type: "button",
5193
5363
  className,
@@ -5198,7 +5368,7 @@ var ColorHighlightPopoverButton = ({
5198
5368
  tooltip: "Highlight",
5199
5369
  isIconOnly: !children,
5200
5370
  ...props,
5201
- children: children != null ? children : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_icons17.HighlighterIcon, {})
5371
+ children: children != null ? children : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_icons18.HighlighterIcon, {})
5202
5372
  }
5203
5373
  );
5204
5374
  function ColorHighlightPopoverContent({
@@ -5212,8 +5382,8 @@ function ColorHighlightPopoverContent({
5212
5382
  ])
5213
5383
  }) {
5214
5384
  const { handleRemoveHighlight } = useColorHighlight({ editor });
5215
- const containerRef = (0, import_react38.useRef)(null);
5216
- const menuItems = (0, import_react38.useMemo)(
5385
+ const containerRef = (0, import_react41.useRef)(null);
5386
+ const menuItems = (0, import_react41.useMemo)(
5217
5387
  () => [...colors, { label: "Remove highlight", value: "none" }],
5218
5388
  [colors]
5219
5389
  );
@@ -5231,13 +5401,13 @@ function ColorHighlightPopoverContent({
5231
5401
  },
5232
5402
  autoSelectFirstItem: false
5233
5403
  });
5234
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { ref: containerRef, className: "flex gap-1 items-center", children: [
5235
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5404
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { ref: containerRef, className: "flex gap-1 items-center", children: [
5405
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
5236
5406
  "div",
5237
5407
  {
5238
5408
  className: "flex items-center gap-1 outline-none",
5239
5409
  "data-orientation": "horizontal",
5240
- children: colors.map((color, index) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5410
+ children: colors.map((color, index) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
5241
5411
  ColorHighlightButton,
5242
5412
  {
5243
5413
  editor,
@@ -5250,9 +5420,9 @@ function ColorHighlightPopoverContent({
5250
5420
  ))
5251
5421
  }
5252
5422
  ),
5253
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_toolbar7.ToolbarSeparator, { orientation: "vertical" }),
5254
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "tiptap-button-group", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5255
- import_button9.IconButton,
5423
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_toolbar7.ToolbarSeparator, { orientation: "vertical" }),
5424
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "tiptap-button-group", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
5425
+ import_button10.IconButton,
5256
5426
  {
5257
5427
  onClick: handleRemoveHighlight,
5258
5428
  "aria-label": "Remove highlight",
@@ -5262,7 +5432,7 @@ function ColorHighlightPopoverContent({
5262
5432
  variant: "ghost",
5263
5433
  color: "default",
5264
5434
  "data-highlighted": selectedIndex === colors.length,
5265
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_icons17.BanIcon, {})
5435
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_icons18.BanIcon, {})
5266
5436
  }
5267
5437
  ) })
5268
5438
  ] });
@@ -5281,18 +5451,18 @@ function ColorHighlightPopover({
5281
5451
  ...props
5282
5452
  }) {
5283
5453
  const { editor } = useTiptapEditor(providedEditor);
5284
- const [isOpen, setIsOpen] = (0, import_react38.useState)(false);
5454
+ const [isOpen, setIsOpen] = (0, import_react41.useState)(false);
5285
5455
  const { isVisible, canColorHighlight: canColorHighlight2, isActive, label } = useColorHighlight({
5286
5456
  editor,
5287
5457
  hideWhenUnavailable,
5288
5458
  onApplied
5289
5459
  });
5290
5460
  if (!isVisible) return null;
5291
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_popover2.Popover.Root, { open: isOpen, onOpenChange: setIsOpen, spacing: "dense", children: [
5292
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5461
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_popover2.Popover.Root, { open: isOpen, onOpenChange: setIsOpen, spacing: "dense", children: [
5462
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
5293
5463
  import_popover2.Popover.Trigger,
5294
5464
  {
5295
- render: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5465
+ render: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
5296
5466
  ColorHighlightPopoverButton,
5297
5467
  {
5298
5468
  disabled: !canColorHighlight2,
@@ -5306,26 +5476,26 @@ function ColorHighlightPopover({
5306
5476
  )
5307
5477
  }
5308
5478
  ),
5309
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_popover2.Popover.Content, { "aria-label": "Highlight colors", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ColorHighlightPopoverContent, { editor, colors }) })
5479
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_popover2.Popover.Content, { "aria-label": "Highlight colors", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ColorHighlightPopoverContent, { editor, colors }) })
5310
5480
  ] });
5311
5481
  }
5312
5482
 
5313
5483
  // src/ui/heading-dropdown-menu/index.tsx
5314
- var import_button11 = require("@kopexa/button");
5484
+ var import_button12 = require("@kopexa/button");
5315
5485
  var import_dropdown_menu = require("@kopexa/dropdown-menu");
5316
5486
  var import_editor_utils11 = require("@kopexa/editor-utils");
5317
- var import_icons19 = require("@kopexa/icons");
5318
- var import_react40 = require("@tiptap/react");
5487
+ var import_icons20 = require("@kopexa/icons");
5488
+ var import_react43 = require("@tiptap/react");
5319
5489
  var React16 = __toESM(require("react"));
5320
5490
 
5321
5491
  // src/ui/heading-button/index.tsx
5322
- var import_button10 = require("@kopexa/button");
5492
+ var import_button11 = require("@kopexa/button");
5323
5493
  var import_editor_utils10 = require("@kopexa/editor-utils");
5324
- var import_icons18 = require("@kopexa/icons");
5494
+ var import_icons19 = require("@kopexa/icons");
5325
5495
  var React15 = __toESM(require("react"));
5326
5496
 
5327
5497
  // src/ui/heading-button/utils.ts
5328
- var import_react39 = require("@tiptap/react");
5498
+ var import_react42 = require("@tiptap/react");
5329
5499
  var headingShortcutKeys = {
5330
5500
  1: "Ctrl-Alt-1",
5331
5501
  2: "Ctrl-Alt-2",
@@ -5366,7 +5536,7 @@ function shouldShowHeadingButton(params) {
5366
5536
  return false;
5367
5537
  }
5368
5538
  if (hideWhenUnavailable) {
5369
- if ((0, import_react39.isNodeSelection)(editor.state.selection)) {
5539
+ if ((0, import_react42.isNodeSelection)(editor.state.selection)) {
5370
5540
  return false;
5371
5541
  }
5372
5542
  }
@@ -5377,14 +5547,14 @@ function getFormattedHeadingName(level) {
5377
5547
  }
5378
5548
 
5379
5549
  // src/ui/heading-button/index.tsx
5380
- var import_jsx_runtime19 = require("react/jsx-runtime");
5550
+ var import_jsx_runtime20 = require("react/jsx-runtime");
5381
5551
  var headingIcons = {
5382
- 1: import_icons18.HeadingOneIcon,
5383
- 2: import_icons18.HeadingTwoIcon,
5384
- 3: import_icons18.HeadingThreeIcon,
5385
- 4: import_icons18.HeadingFourIcon,
5386
- 5: import_icons18.HeadingFiveIcon,
5387
- 6: import_icons18.HeadingSixIcon
5552
+ 1: import_icons19.HeadingOneIcon,
5553
+ 2: import_icons19.HeadingTwoIcon,
5554
+ 3: import_icons19.HeadingThreeIcon,
5555
+ 4: import_icons19.HeadingFourIcon,
5556
+ 5: import_icons19.HeadingFiveIcon,
5557
+ 6: import_icons19.HeadingSixIcon
5388
5558
  };
5389
5559
  function useHeadingState(editor, level, disabled = false) {
5390
5560
  const headingInSchema = (0, import_editor_utils10.isNodeInSchema)("heading", editor);
@@ -5443,8 +5613,8 @@ var HeadingButton = ({
5443
5613
  if (!show || !editor || !editor.isEditable) {
5444
5614
  return null;
5445
5615
  }
5446
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
5447
- import_button10.Button,
5616
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
5617
+ import_button11.Button,
5448
5618
  {
5449
5619
  type: "button",
5450
5620
  className: className.trim(),
@@ -5459,7 +5629,7 @@ var HeadingButton = ({
5459
5629
  tooltip: formattedName,
5460
5630
  shortcutKeys: shortcutKey,
5461
5631
  onClick: handleClick,
5462
- startContent: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Icon, {}),
5632
+ startContent: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Icon, {}),
5463
5633
  ...buttonProps,
5464
5634
  ref,
5465
5635
  children: children || text
@@ -5468,7 +5638,7 @@ var HeadingButton = ({
5468
5638
  };
5469
5639
 
5470
5640
  // src/ui/heading-dropdown-menu/index.tsx
5471
- var import_jsx_runtime20 = require("react/jsx-runtime");
5641
+ var import_jsx_runtime21 = require("react/jsx-runtime");
5472
5642
  function HeadingDropdownMenu({
5473
5643
  editor: providedEditor,
5474
5644
  levels = [1, 2, 3, 4, 5, 6],
@@ -5488,13 +5658,13 @@ function HeadingDropdownMenu({
5488
5658
  [onOpenChange]
5489
5659
  );
5490
5660
  const getActiveIcon = React16.useCallback(() => {
5491
- if (!editor) return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_icons19.HeadingIcon, {});
5661
+ if (!editor) return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_icons20.HeadingIcon, {});
5492
5662
  const activeLevel = levels.find(
5493
5663
  (level) => editor.isActive("heading", { level })
5494
5664
  );
5495
- if (!activeLevel) return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_icons19.HeadingIcon, {});
5665
+ if (!activeLevel) return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_icons20.HeadingIcon, {});
5496
5666
  const ActiveIcon = headingIcons[activeLevel];
5497
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ActiveIcon, {});
5667
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ActiveIcon, {});
5498
5668
  }, [editor, levels]);
5499
5669
  const canToggleAnyHeading = React16.useCallback(() => {
5500
5670
  if (!editor) return false;
@@ -5509,7 +5679,7 @@ function HeadingDropdownMenu({
5509
5679
  return false;
5510
5680
  }
5511
5681
  if (hideWhenUnavailable) {
5512
- if ((0, import_react40.isNodeSelection)(editor.state.selection) || !canToggleAnyHeading()) {
5682
+ if ((0, import_react43.isNodeSelection)(editor.state.selection) || !canToggleAnyHeading()) {
5513
5683
  return false;
5514
5684
  }
5515
5685
  }
@@ -5518,9 +5688,9 @@ function HeadingDropdownMenu({
5518
5688
  if (!show || !editor || !editor.isEditable) {
5519
5689
  return null;
5520
5690
  }
5521
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_dropdown_menu.DropdownMenu.Root, { open: isOpen, onOpenChange: handleOnOpenChange, children: [
5522
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_dropdown_menu.DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
5523
- import_button11.Button,
5691
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_dropdown_menu.DropdownMenu.Root, { open: isOpen, onOpenChange: handleOnOpenChange, children: [
5692
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_dropdown_menu.DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
5693
+ import_button12.Button,
5524
5694
  {
5525
5695
  type: "button",
5526
5696
  disabled: isDisabled,
@@ -5532,12 +5702,12 @@ function HeadingDropdownMenu({
5532
5702
  "aria-label": "Format text as heading",
5533
5703
  "aria-pressed": isAnyHeadingActive,
5534
5704
  tooltip: "Heading",
5535
- endContent: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_icons19.ChevronDownIcon, {}),
5705
+ endContent: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_icons20.ChevronDownIcon, {}),
5536
5706
  ...props,
5537
5707
  children: getActiveIcon()
5538
5708
  }
5539
5709
  ) }),
5540
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_dropdown_menu.DropdownMenu.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_dropdown_menu.DropdownMenu.Group, { children: levels.map((level) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_dropdown_menu.DropdownMenu.Item, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
5710
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_dropdown_menu.DropdownMenu.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_dropdown_menu.DropdownMenu.Group, { children: levels.map((level) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_dropdown_menu.DropdownMenu.Item, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
5541
5711
  HeadingButton,
5542
5712
  {
5543
5713
  editor,
@@ -5552,35 +5722,35 @@ function HeadingDropdownMenu({
5552
5722
  }
5553
5723
 
5554
5724
  // src/ui/list-dropdown-menu/index.tsx
5555
- var import_button13 = require("@kopexa/button");
5725
+ var import_button14 = require("@kopexa/button");
5556
5726
  var import_dropdown_menu2 = require("@kopexa/dropdown-menu");
5557
5727
  var import_editor_utils13 = require("@kopexa/editor-utils");
5558
- var import_icons21 = require("@kopexa/icons");
5559
- var import_react43 = require("@tiptap/react");
5560
- var import_react44 = require("react");
5728
+ var import_icons22 = require("@kopexa/icons");
5729
+ var import_react46 = require("@tiptap/react");
5730
+ var import_react47 = require("react");
5561
5731
 
5562
5732
  // src/ui/list-button/index.tsx
5563
- var import_button12 = require("@kopexa/button");
5733
+ var import_button13 = require("@kopexa/button");
5564
5734
  var import_editor_utils12 = require("@kopexa/editor-utils");
5565
- var import_icons20 = require("@kopexa/icons");
5566
- var import_react41 = require("@tiptap/react");
5567
- var import_react42 = require("react");
5568
- var import_jsx_runtime21 = require("react/jsx-runtime");
5735
+ var import_icons21 = require("@kopexa/icons");
5736
+ var import_react44 = require("@tiptap/react");
5737
+ var import_react45 = require("react");
5738
+ var import_jsx_runtime22 = require("react/jsx-runtime");
5569
5739
  var listOptions = [
5570
5740
  {
5571
5741
  label: "Bullet List",
5572
5742
  type: "bulletList",
5573
- icon: import_icons20.ListIcon
5743
+ icon: import_icons21.ListIcon
5574
5744
  },
5575
5745
  {
5576
5746
  label: "Ordered List",
5577
5747
  type: "orderedList",
5578
- icon: import_icons20.ListOrderedIcon
5748
+ icon: import_icons21.ListOrderedIcon
5579
5749
  },
5580
5750
  {
5581
5751
  label: "Task List",
5582
5752
  type: "taskList",
5583
- icon: import_icons20.ListTodoIcon
5753
+ icon: import_icons21.ListTodoIcon
5584
5754
  }
5585
5755
  ];
5586
5756
  var listShortcutKeys = {
@@ -5639,7 +5809,7 @@ function shouldShowListButton(params) {
5639
5809
  return false;
5640
5810
  }
5641
5811
  if (hideWhenUnavailable) {
5642
- if ((0, import_react41.isNodeSelection)(editor.state.selection) || !canToggleList(editor, type)) {
5812
+ if ((0, import_react44.isNodeSelection)(editor.state.selection) || !canToggleList(editor, type)) {
5643
5813
  return false;
5644
5814
  }
5645
5815
  }
@@ -5673,8 +5843,8 @@ var ListButton = ({
5673
5843
  editor,
5674
5844
  type
5675
5845
  );
5676
- const Icon = (listOption == null ? void 0 : listOption.icon) || import_icons20.ListIcon;
5677
- const handleClick = (0, import_react42.useCallback)(
5846
+ const Icon = (listOption == null ? void 0 : listOption.icon) || import_icons21.ListIcon;
5847
+ const handleClick = (0, import_react45.useCallback)(
5678
5848
  (e) => {
5679
5849
  onClick == null ? void 0 : onClick(e);
5680
5850
  if (!e.defaultPrevented && editor) {
@@ -5683,7 +5853,7 @@ var ListButton = ({
5683
5853
  },
5684
5854
  [onClick, editor, type]
5685
5855
  );
5686
- const show = (0, import_react42.useMemo)(() => {
5856
+ const show = (0, import_react45.useMemo)(() => {
5687
5857
  return shouldShowListButton({
5688
5858
  editor,
5689
5859
  type,
@@ -5694,8 +5864,8 @@ var ListButton = ({
5694
5864
  if (!show || !editor || !editor.isEditable) {
5695
5865
  return null;
5696
5866
  }
5697
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
5698
- import_button12.Button,
5867
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
5868
+ import_button13.Button,
5699
5869
  {
5700
5870
  type: "button",
5701
5871
  className: className.trim(),
@@ -5708,7 +5878,7 @@ var ListButton = ({
5708
5878
  tooltip: (listOption == null ? void 0 : listOption.label) || type,
5709
5879
  shortcutKeys: shortcutKey,
5710
5880
  onClick: handleClick,
5711
- startContent: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Icon, {}),
5881
+ startContent: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Icon, {}),
5712
5882
  ...buttonProps,
5713
5883
  ref,
5714
5884
  children: children || text
@@ -5717,7 +5887,7 @@ var ListButton = ({
5717
5887
  };
5718
5888
 
5719
5889
  // src/ui/list-dropdown-menu/index.tsx
5720
- var import_jsx_runtime22 = require("react/jsx-runtime");
5890
+ var import_jsx_runtime23 = require("react/jsx-runtime");
5721
5891
  function canToggleAnyList(editor, listTypes) {
5722
5892
  if (!editor) return false;
5723
5893
  return listTypes.some((type) => canToggleList(editor, type));
@@ -5737,24 +5907,24 @@ function shouldShowListDropdown(params) {
5737
5907
  return false;
5738
5908
  }
5739
5909
  if (hideWhenUnavailable) {
5740
- if ((0, import_react43.isNodeSelection)(editor.state.selection) || !canToggleAny) {
5910
+ if ((0, import_react46.isNodeSelection)(editor.state.selection) || !canToggleAny) {
5741
5911
  return false;
5742
5912
  }
5743
5913
  }
5744
5914
  return true;
5745
5915
  }
5746
5916
  function useListDropdownState(editor, availableTypes) {
5747
- const [isOpen, setIsOpen] = (0, import_react44.useState)(false);
5917
+ const [isOpen, setIsOpen] = (0, import_react47.useState)(false);
5748
5918
  const listInSchema = availableTypes.some(
5749
5919
  (type) => (0, import_editor_utils13.isNodeInSchema)(type, editor)
5750
5920
  );
5751
- const filteredLists = (0, import_react44.useMemo)(
5921
+ const filteredLists = (0, import_react47.useMemo)(
5752
5922
  () => getFilteredListOptions(availableTypes),
5753
5923
  [availableTypes]
5754
5924
  );
5755
5925
  const canToggleAny = canToggleAnyList(editor, availableTypes);
5756
5926
  const isAnyActive = isAnyListActive(editor, availableTypes);
5757
- const handleOpenChange = (0, import_react44.useCallback)(
5927
+ const handleOpenChange = (0, import_react47.useCallback)(
5758
5928
  (open, callback) => {
5759
5929
  setIsOpen(open);
5760
5930
  callback == null ? void 0 : callback(open);
@@ -5772,11 +5942,11 @@ function useListDropdownState(editor, availableTypes) {
5772
5942
  };
5773
5943
  }
5774
5944
  function useActiveListIcon(editor, filteredLists) {
5775
- return (0, import_react44.useCallback)(() => {
5945
+ return (0, import_react47.useCallback)(() => {
5776
5946
  const activeOption = filteredLists.find(
5777
5947
  (option) => isListActive(editor, option.type)
5778
5948
  );
5779
- return activeOption ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(activeOption.icon, {}) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_icons21.ListIcon, {});
5949
+ return activeOption ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(activeOption.icon, {}) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_icons22.ListIcon, {});
5780
5950
  }, [editor, filteredLists]);
5781
5951
  }
5782
5952
  function ListDropdownMenu({
@@ -5796,7 +5966,7 @@ function ListDropdownMenu({
5796
5966
  handleOpenChange
5797
5967
  } = useListDropdownState(editor, types);
5798
5968
  const getActiveIcon = useActiveListIcon(editor, filteredLists);
5799
- const show = (0, import_react44.useMemo)(() => {
5969
+ const show = (0, import_react47.useMemo)(() => {
5800
5970
  return shouldShowListDropdown({
5801
5971
  editor,
5802
5972
  listTypes: types,
@@ -5805,16 +5975,16 @@ function ListDropdownMenu({
5805
5975
  canToggleAny
5806
5976
  });
5807
5977
  }, [editor, types, hideWhenUnavailable, listInSchema, canToggleAny]);
5808
- const handleOnOpenChange = (0, import_react44.useCallback)(
5978
+ const handleOnOpenChange = (0, import_react47.useCallback)(
5809
5979
  (open) => handleOpenChange(open, onOpenChange),
5810
5980
  [handleOpenChange, onOpenChange]
5811
5981
  );
5812
5982
  if (!show || !editor || !editor.isEditable) {
5813
5983
  return null;
5814
5984
  }
5815
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_dropdown_menu2.DropdownMenu.Root, { open: isOpen, onOpenChange: handleOnOpenChange, children: [
5816
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_dropdown_menu2.DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
5817
- import_button13.Button,
5985
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_dropdown_menu2.DropdownMenu.Root, { open: isOpen, onOpenChange: handleOnOpenChange, children: [
5986
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_dropdown_menu2.DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5987
+ import_button14.Button,
5818
5988
  {
5819
5989
  type: "button",
5820
5990
  variant: "ghost",
@@ -5823,12 +5993,12 @@ function ListDropdownMenu({
5823
5993
  tabIndex: -1,
5824
5994
  "aria-label": "List options",
5825
5995
  tooltip: "List",
5826
- endContent: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_icons21.ChevronDownIcon, {}),
5996
+ endContent: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_icons22.ChevronDownIcon, {}),
5827
5997
  ...props,
5828
5998
  children: getActiveIcon()
5829
5999
  }
5830
6000
  ) }),
5831
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_dropdown_menu2.DropdownMenu.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_dropdown_menu2.DropdownMenu.Group, { children: filteredLists.map((option) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_dropdown_menu2.DropdownMenu.Item, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
6001
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_dropdown_menu2.DropdownMenu.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_dropdown_menu2.DropdownMenu.Group, { children: filteredLists.map((option) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_dropdown_menu2.DropdownMenu.Item, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5832
6002
  ListButton,
5833
6003
  {
5834
6004
  editor,
@@ -5845,8 +6015,8 @@ function ListDropdownMenu({
5845
6015
 
5846
6016
  // src/ui/table-button/index.tsx
5847
6017
  var import_toolbar8 = require("@kopexa/toolbar");
5848
- var import_react45 = require("react");
5849
- var import_jsx_runtime23 = require("react/jsx-runtime");
6018
+ var import_react48 = require("react");
6019
+ var import_jsx_runtime24 = require("react/jsx-runtime");
5850
6020
  var TableButton = ({
5851
6021
  editor: providedEditor,
5852
6022
  text,
@@ -5870,7 +6040,7 @@ var TableButton = ({
5870
6040
  hideWhenUnavailable,
5871
6041
  onToggled
5872
6042
  });
5873
- const handleClick = (0, import_react45.useCallback)(
6043
+ const handleClick = (0, import_react48.useCallback)(
5874
6044
  (event) => {
5875
6045
  onClick == null ? void 0 : onClick(event);
5876
6046
  if (event.defaultPrevented) return;
@@ -5881,7 +6051,7 @@ var TableButton = ({
5881
6051
  if (!isVisible) {
5882
6052
  return null;
5883
6053
  }
5884
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
6054
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
5885
6055
  import_toolbar8.ToolbarButton,
5886
6056
  {
5887
6057
  type: "button",
@@ -5897,22 +6067,22 @@ var TableButton = ({
5897
6067
  onClick: handleClick,
5898
6068
  isIconOnly: !text && !children,
5899
6069
  ...buttonProps,
5900
- children: children || /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
5901
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Icon, {}),
5902
- text && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: text })
6070
+ children: children || /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
6071
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Icon, {}),
6072
+ text && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: text })
5903
6073
  ] })
5904
6074
  }
5905
6075
  );
5906
6076
  };
5907
6077
 
5908
6078
  // src/ui/text-align-button/text-align-button.tsx
5909
- var import_button14 = require("@kopexa/button");
5910
- var import_react47 = require("react");
6079
+ var import_button15 = require("@kopexa/button");
6080
+ var import_react50 = require("react");
5911
6081
 
5912
6082
  // src/ui/text-align-button/use-text-align.ts
5913
6083
  var import_editor_utils14 = require("@kopexa/editor-utils");
5914
- var import_icons22 = require("@kopexa/icons");
5915
- var import_react46 = require("react");
6084
+ var import_icons23 = require("@kopexa/icons");
6085
+ var import_react49 = require("react");
5916
6086
  var TEXT_ALIGN_SHORTCUT_KEYS = {
5917
6087
  left: "mod+shift+l",
5918
6088
  center: "mod+shift+e",
@@ -5920,10 +6090,10 @@ var TEXT_ALIGN_SHORTCUT_KEYS = {
5920
6090
  justify: "mod+shift+j"
5921
6091
  };
5922
6092
  var textAlignIcons = {
5923
- left: import_icons22.AlignLeftIcon,
5924
- center: import_icons22.AlignCenterIcon,
5925
- right: import_icons22.AlignRightIcon,
5926
- justify: import_icons22.AlignJustifyIcon
6093
+ left: import_icons23.AlignLeftIcon,
6094
+ center: import_icons23.AlignCenterIcon,
6095
+ right: import_icons23.AlignRightIcon,
6096
+ justify: import_icons23.AlignJustifyIcon
5927
6097
  };
5928
6098
  var textAlignLabels = {
5929
6099
  left: "Align left",
@@ -5970,10 +6140,10 @@ function useTextAlign(config) {
5970
6140
  onAligned
5971
6141
  } = config;
5972
6142
  const { editor } = useTiptapEditor(providedEditor);
5973
- const [isVisible, setIsVisible] = (0, import_react46.useState)(true);
6143
+ const [isVisible, setIsVisible] = (0, import_react49.useState)(true);
5974
6144
  const canAlign = canSetTextAlign(editor, align);
5975
6145
  const isActive = isTextAlignActive(editor, align);
5976
- (0, import_react46.useEffect)(() => {
6146
+ (0, import_react49.useEffect)(() => {
5977
6147
  if (!editor) return;
5978
6148
  const handleSelectionUpdate = () => {
5979
6149
  setIsVisible(shouldShowButton5({ editor, align, hideWhenUnavailable }));
@@ -5984,7 +6154,7 @@ function useTextAlign(config) {
5984
6154
  editor.off("selectionUpdate", handleSelectionUpdate);
5985
6155
  };
5986
6156
  }, [editor, hideWhenUnavailable, align]);
5987
- const handleTextAlign = (0, import_react46.useCallback)(() => {
6157
+ const handleTextAlign = (0, import_react49.useCallback)(() => {
5988
6158
  if (!editor) return false;
5989
6159
  const success = setTextAlign(editor, align);
5990
6160
  if (success) {
@@ -6004,7 +6174,7 @@ function useTextAlign(config) {
6004
6174
  }
6005
6175
 
6006
6176
  // src/ui/text-align-button/text-align-button.tsx
6007
- var import_jsx_runtime24 = require("react/jsx-runtime");
6177
+ var import_jsx_runtime25 = require("react/jsx-runtime");
6008
6178
  var TextAlignButton = ({
6009
6179
  editor: providedEditor,
6010
6180
  align,
@@ -6031,7 +6201,7 @@ var TextAlignButton = ({
6031
6201
  hideWhenUnavailable,
6032
6202
  onAligned
6033
6203
  });
6034
- const handleClick = (0, import_react47.useCallback)(
6204
+ const handleClick = (0, import_react50.useCallback)(
6035
6205
  (e) => {
6036
6206
  onClick == null ? void 0 : onClick(e);
6037
6207
  if (e.defaultPrevented) return;
@@ -6042,8 +6212,8 @@ var TextAlignButton = ({
6042
6212
  if (!isVisible) {
6043
6213
  return null;
6044
6214
  }
6045
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
6046
- import_button14.IconButton,
6215
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
6216
+ import_button15.IconButton,
6047
6217
  {
6048
6218
  type: "button",
6049
6219
  disabled: canAlign,
@@ -6058,19 +6228,19 @@ var TextAlignButton = ({
6058
6228
  shortcutKeys,
6059
6229
  onClick: handleClick,
6060
6230
  ...buttonProps,
6061
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Icon, {})
6231
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Icon, {})
6062
6232
  }
6063
6233
  );
6064
6234
  };
6065
6235
 
6066
6236
  // src/ui/undo-redo-button/undo-redo-button.tsx
6067
6237
  var import_toolbar9 = require("@kopexa/toolbar");
6068
- var import_react49 = require("react");
6238
+ var import_react52 = require("react");
6069
6239
 
6070
6240
  // src/ui/undo-redo-button/use-undo-redo.ts
6071
6241
  var import_editor_utils15 = require("@kopexa/editor-utils");
6072
- var import_icons23 = require("@kopexa/icons");
6073
- var import_react48 = require("react");
6242
+ var import_icons24 = require("@kopexa/icons");
6243
+ var import_react51 = require("react");
6074
6244
  var UNDO_REDO_SHORTCUT_KEYS = {
6075
6245
  undo: "mod+z",
6076
6246
  redo: "mod+shift+z"
@@ -6080,8 +6250,8 @@ var historyActionLabels = {
6080
6250
  redo: "Redo"
6081
6251
  };
6082
6252
  var historyIcons = {
6083
- undo: import_icons23.UndoIcon,
6084
- redo: import_icons23.RedoIcon
6253
+ undo: import_icons24.UndoIcon,
6254
+ redo: import_icons24.RedoIcon
6085
6255
  };
6086
6256
  function canExecuteUndoRedoAction(editor, action) {
6087
6257
  if (!editor || !editor.isEditable) return false;
@@ -6110,9 +6280,9 @@ function useUndoRedo(config) {
6110
6280
  onExecuted
6111
6281
  } = config;
6112
6282
  const { editor } = useTiptapEditor(providedEditor);
6113
- const [isVisible, setIsVisible] = (0, import_react48.useState)(true);
6283
+ const [isVisible, setIsVisible] = (0, import_react51.useState)(true);
6114
6284
  const canExecute = canExecuteUndoRedoAction(editor, action);
6115
- (0, import_react48.useEffect)(() => {
6285
+ (0, import_react51.useEffect)(() => {
6116
6286
  if (!editor) return;
6117
6287
  const handleUpdate = () => {
6118
6288
  setIsVisible(shouldShowButton6({ editor, hideWhenUnavailable, action }));
@@ -6123,7 +6293,7 @@ function useUndoRedo(config) {
6123
6293
  editor.off("transaction", handleUpdate);
6124
6294
  };
6125
6295
  }, [editor, hideWhenUnavailable, action]);
6126
- const handleAction = (0, import_react48.useCallback)(() => {
6296
+ const handleAction = (0, import_react51.useCallback)(() => {
6127
6297
  if (!editor) return false;
6128
6298
  const success = executeUndoRedoAction(editor, action);
6129
6299
  if (success) {
@@ -6142,7 +6312,7 @@ function useUndoRedo(config) {
6142
6312
  }
6143
6313
 
6144
6314
  // src/ui/undo-redo-button/undo-redo-button.tsx
6145
- var import_jsx_runtime25 = require("react/jsx-runtime");
6315
+ var import_jsx_runtime26 = require("react/jsx-runtime");
6146
6316
  var UndoRedoButton = ({
6147
6317
  editor: providedEditor,
6148
6318
  action,
@@ -6161,7 +6331,7 @@ var UndoRedoButton = ({
6161
6331
  hideWhenUnavailable,
6162
6332
  onExecuted
6163
6333
  });
6164
- const handleClick = (0, import_react49.useCallback)(
6334
+ const handleClick = (0, import_react52.useCallback)(
6165
6335
  (event) => {
6166
6336
  onClick == null ? void 0 : onClick(event);
6167
6337
  if (event.defaultPrevented) return;
@@ -6172,7 +6342,7 @@ var UndoRedoButton = ({
6172
6342
  if (!isVisible) {
6173
6343
  return null;
6174
6344
  }
6175
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
6345
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
6176
6346
  import_toolbar9.ToolbarButton,
6177
6347
  {
6178
6348
  type: "button",
@@ -6187,13 +6357,13 @@ var UndoRedoButton = ({
6187
6357
  onClick: handleClick,
6188
6358
  isIconOnly: true,
6189
6359
  ...buttonProps,
6190
- children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Icon, {})
6360
+ children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Icon, {})
6191
6361
  }
6192
6362
  );
6193
6363
  };
6194
6364
 
6195
6365
  // src/presets/basic/editor-header.tsx
6196
- var import_jsx_runtime26 = require("react/jsx-runtime");
6366
+ var import_jsx_runtime27 = require("react/jsx-runtime");
6197
6367
  var EditorHeader = ({
6198
6368
  editor: providedEditor,
6199
6369
  variant
@@ -6203,7 +6373,7 @@ var EditorHeader = ({
6203
6373
  const isMobile = (0, import_use_is_mobile2.useIsMobile)();
6204
6374
  const windowSize = useWindowSize();
6205
6375
  const { styles } = useEditorUIContext();
6206
- const toolbarRef = (0, import_react50.useRef)(null);
6376
+ const toolbarRef = (0, import_react53.useRef)(null);
6207
6377
  const bodyRect = useCursorVisibility({
6208
6378
  editor,
6209
6379
  overlayHeight: (_b = (_a = toolbarRef.current) == null ? void 0 : _a.getBoundingClientRect().height) != null ? _b : 0
@@ -6212,7 +6382,7 @@ var EditorHeader = ({
6212
6382
  return null;
6213
6383
  }
6214
6384
  const ToolbarContent = variant === "comment" ? CommentToolbarContent : variant === "field" ? FieldToolbarContent : MainToolbarContent;
6215
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: styles.toolbarContainer(), "data-slot": "editor-toolbar", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
6385
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: styles.toolbarContainer(), "data-slot": "editor-toolbar", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
6216
6386
  import_toolbar10.Toolbar,
6217
6387
  {
6218
6388
  sticky: true,
@@ -6222,54 +6392,54 @@ var EditorHeader = ({
6222
6392
  bottom: `calc(100% - ${windowSize.height - bodyRect.y}px)`
6223
6393
  } : {},
6224
6394
  className: styles.toolbar(),
6225
- children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ToolbarContent, {})
6395
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ToolbarContent, {})
6226
6396
  }
6227
6397
  ) });
6228
6398
  };
6229
- var MainToolbarContent = () => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
6230
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_toolbar10.ToolbarGroup, { children: [
6231
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(UndoRedoButton, { action: "undo" }),
6232
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(UndoRedoButton, { action: "redo" })
6399
+ var MainToolbarContent = () => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
6400
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_toolbar10.ToolbarGroup, { children: [
6401
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(UndoRedoButton, { action: "undo" }),
6402
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(UndoRedoButton, { action: "redo" })
6233
6403
  ] }),
6234
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_toolbar10.ToolbarSeparator, {}),
6235
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_toolbar10.ToolbarGroup, { children: [
6236
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(HeadingDropdownMenu, { levels: [1, 2, 3, 4] }),
6237
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ListDropdownMenu, { types: ["bulletList", "orderedList", "taskList"] }),
6238
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(BlockquoteButton, {}),
6239
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CodeBlockButton, {})
6404
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_toolbar10.ToolbarSeparator, {}),
6405
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_toolbar10.ToolbarGroup, { children: [
6406
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(HeadingDropdownMenu, { levels: [1, 2, 3, 4] }),
6407
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ListDropdownMenu, { types: ["bulletList", "orderedList", "taskList"] }),
6408
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(BlockquoteButton, {}),
6409
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CodeBlockButton, {})
6240
6410
  ] }),
6241
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_toolbar10.ToolbarSeparator, {}),
6242
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_toolbar10.ToolbarGroup, { children: [
6243
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MarkButton, { type: "bold" }),
6244
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MarkButton, { type: "italic" }),
6245
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MarkButton, { type: "strike" }),
6246
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MarkButton, { type: "code" }),
6247
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MarkButton, { type: "underline" }),
6248
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ColorHighlightPopover, {}),
6249
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(LinkPopover, {})
6411
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_toolbar10.ToolbarSeparator, {}),
6412
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_toolbar10.ToolbarGroup, { children: [
6413
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(MarkButton, { type: "bold" }),
6414
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(MarkButton, { type: "italic" }),
6415
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(MarkButton, { type: "strike" }),
6416
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(MarkButton, { type: "code" }),
6417
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(MarkButton, { type: "underline" }),
6418
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ColorHighlightPopover, {}),
6419
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(LinkPopover, {})
6250
6420
  ] }),
6251
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_toolbar10.ToolbarSeparator, {}),
6252
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_toolbar10.ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TableButton, {}) }),
6253
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MoreOptions, { hideWhenUnavailable: true })
6421
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_toolbar10.ToolbarSeparator, {}),
6422
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_toolbar10.ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TableButton, {}) }),
6423
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(MoreOptions, { hideWhenUnavailable: true })
6254
6424
  ] });
6255
- var CommentToolbarContent = () => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
6256
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_toolbar10.ToolbarGroup, { children: [
6257
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MarkButton, { type: "bold" }),
6258
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MarkButton, { type: "italic" }),
6259
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MarkButton, { type: "strike" }),
6260
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MarkButton, { type: "code" })
6425
+ var CommentToolbarContent = () => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
6426
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_toolbar10.ToolbarGroup, { children: [
6427
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(MarkButton, { type: "bold" }),
6428
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(MarkButton, { type: "italic" }),
6429
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(MarkButton, { type: "strike" }),
6430
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(MarkButton, { type: "code" })
6261
6431
  ] }),
6262
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_toolbar10.ToolbarSeparator, {}),
6263
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_toolbar10.ToolbarGroup, { children: [
6264
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(LinkPopover, {}),
6265
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ListDropdownMenu, { types: ["bulletList", "orderedList"] })
6432
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_toolbar10.ToolbarSeparator, {}),
6433
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_toolbar10.ToolbarGroup, { children: [
6434
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(LinkPopover, {}),
6435
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ListDropdownMenu, { types: ["bulletList", "orderedList"] })
6266
6436
  ] })
6267
6437
  ] });
6268
- var FieldToolbarContent = () => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_toolbar10.ToolbarGroup, { children: [
6269
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MarkButton, { type: "bold" }),
6270
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MarkButton, { type: "italic" }),
6271
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MarkButton, { type: "strike" }),
6272
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(LinkPopover, {})
6438
+ var FieldToolbarContent = () => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_toolbar10.ToolbarGroup, { children: [
6439
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(MarkButton, { type: "bold" }),
6440
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(MarkButton, { type: "italic" }),
6441
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(MarkButton, { type: "strike" }),
6442
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(LinkPopover, {})
6273
6443
  ] });
6274
6444
  function MoreOptions({
6275
6445
  editor: providedEditor,
@@ -6277,8 +6447,8 @@ function MoreOptions({
6277
6447
  ...props
6278
6448
  }) {
6279
6449
  const { editor } = useTiptapEditor(providedEditor);
6280
- const [show, setShow] = (0, import_react50.useState)(false);
6281
- (0, import_react50.useEffect)(() => {
6450
+ const [show, setShow] = (0, import_react53.useState)(false);
6451
+ (0, import_react53.useEffect)(() => {
6282
6452
  if (!editor) return;
6283
6453
  const handleSelectionUpdate = () => {
6284
6454
  setShow(
@@ -6297,13 +6467,13 @@ function MoreOptions({
6297
6467
  if (!show || !editor || !editor.isEditable) {
6298
6468
  return null;
6299
6469
  }
6300
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
6301
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_toolbar10.ToolbarSeparator, {}),
6302
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_toolbar10.ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_popover3.Popover.Root, { spacing: "dense", width: "auto", children: [
6303
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
6470
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
6471
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_toolbar10.ToolbarSeparator, {}),
6472
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_toolbar10.ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_popover3.Popover.Root, { spacing: "dense", width: "auto", children: [
6473
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
6304
6474
  import_popover3.Popover.Trigger,
6305
6475
  {
6306
- render: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
6476
+ render: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
6307
6477
  import_toolbar10.ToolbarButton,
6308
6478
  {
6309
6479
  type: "button",
@@ -6315,29 +6485,29 @@ function MoreOptions({
6315
6485
  title: "More options",
6316
6486
  isIconOnly: true,
6317
6487
  ...props,
6318
- children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_icons24.MoreVerticalIcon, {})
6488
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_icons25.MoreVerticalIcon, {})
6319
6489
  }
6320
6490
  )
6321
6491
  }
6322
6492
  ),
6323
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
6493
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
6324
6494
  import_popover3.Popover.Content,
6325
6495
  {
6326
6496
  side: "top",
6327
6497
  align: "end",
6328
6498
  alignOffset: 4,
6329
6499
  sideOffset: 4,
6330
- children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_toolbar10.Toolbar, { children: [
6331
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_toolbar10.ToolbarGroup, { children: [
6332
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MarkButton, { type: "superscript" }),
6333
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MarkButton, { type: "subscript" })
6500
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_toolbar10.Toolbar, { children: [
6501
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_toolbar10.ToolbarGroup, { children: [
6502
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(MarkButton, { type: "superscript" }),
6503
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(MarkButton, { type: "subscript" })
6334
6504
  ] }),
6335
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_toolbar10.ToolbarSeparator, {}),
6336
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_toolbar10.ToolbarGroup, { children: [
6337
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TextAlignButton, { align: "left" }),
6338
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TextAlignButton, { align: "center" }),
6339
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TextAlignButton, { align: "right" }),
6340
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TextAlignButton, { align: "justify" })
6505
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_toolbar10.ToolbarSeparator, {}),
6506
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_toolbar10.ToolbarGroup, { children: [
6507
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TextAlignButton, { align: "left" }),
6508
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TextAlignButton, { align: "center" }),
6509
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TextAlignButton, { align: "right" }),
6510
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TextAlignButton, { align: "justify" })
6341
6511
  ] })
6342
6512
  ] })
6343
6513
  }
@@ -6369,7 +6539,7 @@ function shouldShowMoreOptions(params) {
6369
6539
  }
6370
6540
 
6371
6541
  // src/presets/basic/index.tsx
6372
- var import_jsx_runtime27 = require("react/jsx-runtime");
6542
+ var import_jsx_runtime28 = require("react/jsx-runtime");
6373
6543
  var BasicEditor = ({
6374
6544
  variant,
6375
6545
  bordered,
@@ -6377,28 +6547,28 @@ var BasicEditor = ({
6377
6547
  ...options
6378
6548
  }) => {
6379
6549
  const editor = useCreateEditor({ content, ...options });
6380
- const styles = (0, import_theme6.editorBasic)({ variant, bordered });
6550
+ const styles = (0, import_theme7.editorBasic)({ variant, bordered });
6381
6551
  if (!editor) {
6382
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(LoadingSpinner, {});
6552
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(LoadingSpinner, {});
6383
6553
  }
6384
6554
  const isBottomToolbar = variant === "field";
6385
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(EditorUIProvider, { value: { styles }, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: styles.root(), "data-slot": "editor", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_react51.EditorContext.Provider, { value: { editor }, children: [
6386
- !isBottomToolbar && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(EditorHeader, { editor, variant }),
6387
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(EditorContentArea, { variant }),
6388
- isBottomToolbar && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(EditorHeader, { editor, variant })
6555
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(EditorUIProvider, { value: { styles }, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: styles.root(), "data-slot": "editor", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_react54.EditorContext.Provider, { value: { editor }, children: [
6556
+ !isBottomToolbar && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(EditorHeader, { editor, variant }),
6557
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(EditorContentArea, { variant }),
6558
+ isBottomToolbar && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(EditorHeader, { editor, variant })
6389
6559
  ] }) }) });
6390
6560
  };
6391
6561
  var EditorContentArea = ({ variant }) => {
6392
- const styles = (0, import_theme6.editorBasic)({ variant });
6393
- const { editor } = (0, import_react52.useContext)(import_react51.EditorContext);
6562
+ const styles = (0, import_theme7.editorBasic)({ variant });
6563
+ const { editor } = (0, import_react55.useContext)(import_react54.EditorContext);
6394
6564
  const { isDragging } = useUiEditorState(editor);
6395
6565
  useScrollToHash();
6396
6566
  if (!editor) {
6397
6567
  return null;
6398
6568
  }
6399
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: styles.wrapper(), children: [
6400
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
6401
- import_react51.EditorContent,
6569
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: styles.wrapper(), children: [
6570
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
6571
+ import_react54.EditorContent,
6402
6572
  {
6403
6573
  editor,
6404
6574
  role: "presentation",
@@ -6406,17 +6576,17 @@ var EditorContentArea = ({ variant }) => {
6406
6576
  style: {
6407
6577
  cursor: isDragging ? "grabbing" : "auto"
6408
6578
  },
6409
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(SlashDropdownMenu, {})
6579
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(SlashDropdownMenu, {})
6410
6580
  }
6411
6581
  ),
6412
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(BubbleMenu, { editor }),
6413
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(LinkBubble, { editor })
6582
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(BubbleMenu, { editor }),
6583
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(LinkBubble, { editor })
6414
6584
  ] });
6415
6585
  };
6416
6586
  function LoadingSpinner({ text = "Connecting..." }) {
6417
- const styles = (0, import_theme6.editorSpinner)();
6418
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: styles.root(), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: styles.content(), children: [
6419
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
6587
+ const styles = (0, import_theme7.editorSpinner)();
6588
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: styles.root(), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: styles.content(), children: [
6589
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
6420
6590
  "svg",
6421
6591
  {
6422
6592
  className: styles.svg(),
@@ -6424,9 +6594,9 @@ function LoadingSpinner({ text = "Connecting..." }) {
6424
6594
  fill: "none",
6425
6595
  viewBox: "0 0 24 24",
6426
6596
  children: [
6427
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("title", { children: "Loading Spinner" }),
6428
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("circle", { className: styles.circle(), cx: "12", cy: "12", r: "10" }),
6429
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
6597
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("title", { children: "Loading Spinner" }),
6598
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("circle", { className: styles.circle(), cx: "12", cy: "12", r: "10" }),
6599
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
6430
6600
  "path",
6431
6601
  {
6432
6602
  className: styles.path(),
@@ -6436,7 +6606,7 @@ function LoadingSpinner({ text = "Connecting..." }) {
6436
6606
  ]
6437
6607
  }
6438
6608
  ),
6439
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: styles.text(), children: text })
6609
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: styles.text(), children: text })
6440
6610
  ] }) });
6441
6611
  }
6442
6612
  // Annotate the CommonJS export names for ESM import in node:
@@ -6445,6 +6615,7 @@ function LoadingSpinner({ text = "Connecting..." }) {
6445
6615
  Editor,
6446
6616
  EditorFileProvider,
6447
6617
  ImageNode,
6618
+ ImageUploadNode,
6448
6619
  InlineMath,
6449
6620
  MathBlock,
6450
6621
  TocNode,