@cyberyozh/text-editor 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/editor.css +46 -20
- package/dist/editor.css.map +1 -1
- package/dist/editor.js +495 -432
- package/dist/editor.js.map +1 -1
- package/dist/editor.mjs +495 -432
- package/dist/editor.mjs.map +1 -1
- package/dist/render.js +62 -29
- package/dist/render.js.map +1 -1
- package/dist/render.mjs +62 -29
- package/dist/render.mjs.map +1 -1
- package/dist/styles/index.css +46 -20
- package/package.json +5 -1
- package/src/editor/commands/items.ts +1 -1
- package/src/editor/components/common-modal/common-modal.css +2 -1
- package/src/editor/context/dialog-command.tsx +0 -2
- package/src/editor/controls/bubble-menu-content.tsx +6 -2
- package/src/editor/controls/commands-list.tsx +7 -0
- package/src/editor/dialogs/add-video-dialog/add-video-dialog.tsx +2 -5
- package/src/editor/editor.tsx +56 -43
- package/src/editor/handlers/dialog-handlers.ts +118 -36
- package/src/extensions/views/components/index.ts +1 -0
- package/src/extensions/views/components/table.tsx +29 -0
- package/src/render/static-renderer-config.tsx +32 -2
- package/src/styles/editor/base.css +7 -5
- package/src/styles/editor/states.css +4 -3
- package/src/styles/editor/typography.css +10 -2
- package/src/styles/editor/variables.css +1 -0
- package/src/styles/extensions/callout.css +5 -2
- package/src/styles/extensions/code-block.css +2 -1
- package/src/styles/extensions/commands-list.css +5 -1
- package/src/styles/extensions/custom-quote.css +5 -0
- package/src/styles/extensions/details.css +4 -4
- package/src/styles/extensions/myth-reality.css +3 -1
- package/src/styles/extensions/prompt.css +4 -1
package/dist/editor.js
CHANGED
|
@@ -785,7 +785,6 @@ var BubbleMenuContent = ({ editor, onLinkClick }) => {
|
|
|
785
785
|
} = (0, import_react4.useEditorState)({
|
|
786
786
|
editor,
|
|
787
787
|
selector: (ctx) => {
|
|
788
|
-
if (!editor) return {};
|
|
789
788
|
return {
|
|
790
789
|
canUndo: ctx.editor.can().undo(),
|
|
791
790
|
canRedo: ctx.editor.can().redo(),
|
|
@@ -825,320 +824,329 @@ var BubbleMenuContent = ({ editor, onLinkClick }) => {
|
|
|
825
824
|
onLinkClick?.(selectedText, linkUrl);
|
|
826
825
|
openDialogCommand("link");
|
|
827
826
|
};
|
|
828
|
-
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
827
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
|
|
828
|
+
"div",
|
|
829
|
+
{
|
|
830
|
+
className: `bubble-menu ${textColor || highlightColor ? "hide-text-selection" : ""}`,
|
|
831
|
+
onMouseDown: (e) => {
|
|
832
|
+
e.preventDefault();
|
|
833
|
+
},
|
|
834
|
+
children: [
|
|
835
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "tiptap-controls-group", children: [
|
|
836
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
837
|
+
"button",
|
|
838
|
+
{
|
|
839
|
+
className: "tiptap-control-button",
|
|
840
|
+
onClick: () => editor.chain().focus().undo().run(),
|
|
841
|
+
disabled: !canUndo,
|
|
842
|
+
title: translations2.history.undo,
|
|
843
|
+
type: "button",
|
|
844
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Undo_default, {})
|
|
845
|
+
}
|
|
846
|
+
),
|
|
847
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
848
|
+
"button",
|
|
849
|
+
{
|
|
850
|
+
className: "tiptap-control-button",
|
|
851
|
+
onClick: () => editor.chain().focus().redo().run(),
|
|
852
|
+
disabled: !canRedo,
|
|
853
|
+
type: "button",
|
|
854
|
+
title: translations2.history.redo,
|
|
855
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Redo_default, {})
|
|
856
|
+
}
|
|
857
|
+
)
|
|
858
|
+
] }),
|
|
859
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "tiptap-controls-group", children: [
|
|
860
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
861
|
+
"button",
|
|
862
|
+
{
|
|
863
|
+
type: "button",
|
|
864
|
+
title: translations2.headings.h2,
|
|
865
|
+
onClick: () => editor.chain().focus().toggleHeading({ level: 2 }).run(),
|
|
866
|
+
className: `tiptap-control-button ${isHeading2 ? "is-active" : ""}`,
|
|
867
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(H2_default, {})
|
|
868
|
+
}
|
|
869
|
+
),
|
|
870
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
871
|
+
"button",
|
|
872
|
+
{
|
|
873
|
+
type: "button",
|
|
874
|
+
title: translations2.headings.h3,
|
|
875
|
+
onClick: () => editor.chain().focus().toggleHeading({ level: 3 }).run(),
|
|
876
|
+
className: `tiptap-control-button ${isHeading3 ? "is-active" : ""}`,
|
|
877
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(H3_default, {})
|
|
878
|
+
}
|
|
879
|
+
),
|
|
880
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
881
|
+
"button",
|
|
882
|
+
{
|
|
883
|
+
type: "button",
|
|
884
|
+
title: translations2.headings.h4,
|
|
885
|
+
onClick: () => editor.chain().focus().toggleHeading({ level: 4 }).run(),
|
|
886
|
+
className: `tiptap-control-button ${isHeading4 ? "is-active" : ""}`,
|
|
887
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(H4_default, {})
|
|
888
|
+
}
|
|
889
|
+
),
|
|
890
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
891
|
+
"button",
|
|
892
|
+
{
|
|
893
|
+
type: "button",
|
|
894
|
+
title: translations2.headings.h5,
|
|
895
|
+
onClick: () => editor.chain().focus().toggleHeading({ level: 5 }).run(),
|
|
896
|
+
className: `tiptap-control-button ${isHeading5 ? "is-active" : ""}`,
|
|
897
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(H5_default, {})
|
|
898
|
+
}
|
|
899
|
+
),
|
|
900
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
901
|
+
"button",
|
|
902
|
+
{
|
|
903
|
+
type: "button",
|
|
904
|
+
title: translations2.headings.h6,
|
|
905
|
+
onClick: () => editor.chain().focus().toggleHeading({ level: 6 }).run(),
|
|
906
|
+
className: `tiptap-control-button ${isHeading6 ? "is-active" : ""}`,
|
|
907
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(H6_default, {})
|
|
908
|
+
}
|
|
909
|
+
)
|
|
910
|
+
] }),
|
|
911
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "tiptap-controls-group", children: [
|
|
912
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
913
|
+
"button",
|
|
914
|
+
{
|
|
915
|
+
onClick: () => editor.chain().focus().toggleBold().run(),
|
|
916
|
+
className: `${isBold ? "is-active" : ""} tiptap-control-button`,
|
|
917
|
+
title: translations2.textFormatting.bold,
|
|
918
|
+
type: "button",
|
|
919
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Bold_default, {})
|
|
920
|
+
}
|
|
921
|
+
),
|
|
922
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
923
|
+
"button",
|
|
924
|
+
{
|
|
925
|
+
onClick: () => editor.chain().focus().toggleItalic().run(),
|
|
926
|
+
className: `${isItalic ? "is-active" : ""} tiptap-control-button`,
|
|
927
|
+
title: translations2.textFormatting.italic,
|
|
928
|
+
type: "button",
|
|
929
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Italic_default, {})
|
|
930
|
+
}
|
|
931
|
+
),
|
|
932
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
933
|
+
"button",
|
|
934
|
+
{
|
|
935
|
+
onClick: () => editor.chain().focus().toggleUnderline().run(),
|
|
936
|
+
className: `${isUnderline ? "is-active" : ""} tiptap-control-button`,
|
|
937
|
+
title: translations2.textFormatting.underline,
|
|
938
|
+
type: "button",
|
|
939
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Underline_default, {})
|
|
940
|
+
}
|
|
941
|
+
),
|
|
942
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
943
|
+
"button",
|
|
944
|
+
{
|
|
945
|
+
onClick: () => editor.chain().focus().toggleStrike().run(),
|
|
946
|
+
className: `${isStrikethrough ? "is-active" : ""} tiptap-control-button`,
|
|
947
|
+
title: translations2.textFormatting.strikethrough,
|
|
948
|
+
type: "button",
|
|
949
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Strikethrough_default, {})
|
|
950
|
+
}
|
|
951
|
+
)
|
|
952
|
+
] }),
|
|
953
|
+
isTable && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "tiptap-controls-group", children: [
|
|
954
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
955
|
+
"button",
|
|
956
|
+
{
|
|
957
|
+
className: "tiptap-control-button",
|
|
958
|
+
type: "button",
|
|
959
|
+
title: translations2.table.mergeCells,
|
|
960
|
+
onClick: () => editor.chain().focus().mergeCells().run(),
|
|
961
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(MergeCells_default, {})
|
|
962
|
+
}
|
|
963
|
+
),
|
|
964
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
965
|
+
"button",
|
|
966
|
+
{
|
|
967
|
+
className: "tiptap-control-button",
|
|
968
|
+
type: "button",
|
|
969
|
+
title: translations2.table.splitCell,
|
|
970
|
+
onClick: () => editor.chain().focus().splitCell().run(),
|
|
971
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(SplitCells_default, {})
|
|
972
|
+
}
|
|
973
|
+
)
|
|
974
|
+
] }),
|
|
975
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "tiptap-controls-group", children: [
|
|
976
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { style: { position: "relative" }, children: [
|
|
977
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
978
|
+
"button",
|
|
979
|
+
{
|
|
980
|
+
onClick: () => {
|
|
981
|
+
textColorInputRef.current?.click();
|
|
982
|
+
},
|
|
983
|
+
className: "tiptap-control-button",
|
|
984
|
+
type: "button",
|
|
985
|
+
title: translations2.textFormatting.textColor,
|
|
986
|
+
style: { color: textColor },
|
|
987
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(TextColor_default, {})
|
|
988
|
+
}
|
|
989
|
+
),
|
|
990
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
991
|
+
"input",
|
|
992
|
+
{
|
|
993
|
+
ref: textColorInputRef,
|
|
994
|
+
type: "color",
|
|
995
|
+
value: textColor,
|
|
996
|
+
onChange: (e) => {
|
|
997
|
+
editor.chain().focus().setColor(e.target.value).run();
|
|
998
|
+
},
|
|
999
|
+
style: {
|
|
1000
|
+
position: "absolute",
|
|
1001
|
+
top: 0,
|
|
1002
|
+
left: 0,
|
|
1003
|
+
width: "100%",
|
|
1004
|
+
height: "100%",
|
|
1005
|
+
opacity: 0,
|
|
1006
|
+
pointerEvents: "none"
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
1009
|
+
)
|
|
1010
|
+
] }),
|
|
1011
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { style: { position: "relative" }, children: [
|
|
1012
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
1013
|
+
"button",
|
|
1014
|
+
{
|
|
1015
|
+
onClick: () => {
|
|
1016
|
+
highlightColorInputRef.current?.click();
|
|
1017
|
+
},
|
|
1018
|
+
className: "tiptap-control-button",
|
|
1019
|
+
type: "button",
|
|
1020
|
+
title: translations2.textFormatting.highlightColor,
|
|
1021
|
+
style: { color: highlightColor },
|
|
1022
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Highlight_default, {})
|
|
1023
|
+
}
|
|
1024
|
+
),
|
|
1025
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
1026
|
+
"input",
|
|
1027
|
+
{
|
|
1028
|
+
ref: highlightColorInputRef,
|
|
1029
|
+
type: "color",
|
|
1030
|
+
value: highlightColor,
|
|
1031
|
+
onChange: (e) => {
|
|
1032
|
+
editor.chain().focus().setHighlight({ color: e.target.value }).run();
|
|
1033
|
+
},
|
|
1034
|
+
style: {
|
|
1035
|
+
position: "absolute",
|
|
1036
|
+
top: 0,
|
|
1037
|
+
left: 0,
|
|
1038
|
+
width: "100%",
|
|
1039
|
+
height: "100%",
|
|
1040
|
+
opacity: 0,
|
|
1041
|
+
pointerEvents: "none"
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
)
|
|
1045
|
+
] })
|
|
1046
|
+
] }),
|
|
1047
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "tiptap-controls-group", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
972
1048
|
"button",
|
|
973
1049
|
{
|
|
974
|
-
onClick: () => {
|
|
975
|
-
textColorInputRef.current?.click();
|
|
976
|
-
},
|
|
977
|
-
className: "tiptap-control-button",
|
|
978
1050
|
type: "button",
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
1051
|
+
onClick: () => editor.chain().focus().toggleCopyable().run(),
|
|
1052
|
+
className: `${isCopyable ? "is-active" : ""} tiptap-control-button`,
|
|
1053
|
+
title: translations2.textFormatting.copyableText,
|
|
1054
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Copyable_default, {})
|
|
982
1055
|
}
|
|
983
|
-
),
|
|
984
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
style: {
|
|
994
|
-
position: "absolute",
|
|
995
|
-
top: 0,
|
|
996
|
-
left: 0,
|
|
997
|
-
width: "100%",
|
|
998
|
-
height: "100%",
|
|
999
|
-
opacity: 0,
|
|
1000
|
-
pointerEvents: "none"
|
|
1056
|
+
) }),
|
|
1057
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "tiptap-controls-group", children: [
|
|
1058
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
1059
|
+
"button",
|
|
1060
|
+
{
|
|
1061
|
+
title: isLink ? translations2.link.editLink : translations2.link.addLinkTitle,
|
|
1062
|
+
onClick: handleLinkClick,
|
|
1063
|
+
className: `${isLink ? "is-active" : ""} tiptap-control-button`,
|
|
1064
|
+
type: "button",
|
|
1065
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Link_default, {})
|
|
1001
1066
|
}
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1067
|
+
),
|
|
1068
|
+
isLink && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
1069
|
+
"button",
|
|
1070
|
+
{
|
|
1071
|
+
onClick: () => editor.chain().focus().unsetLink().run(),
|
|
1072
|
+
className: "tiptap-control-button tiptap-control-button--delete",
|
|
1073
|
+
type: "button",
|
|
1074
|
+
title: translations2.link.removeLinkTitle,
|
|
1075
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(LinkOff_default, {})
|
|
1076
|
+
}
|
|
1077
|
+
)
|
|
1078
|
+
] }),
|
|
1079
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "tiptap-controls-group", children: [
|
|
1080
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
1081
|
+
"button",
|
|
1082
|
+
{
|
|
1083
|
+
onClick: () => editor.chain().focus().setTextAlign("left").run(),
|
|
1084
|
+
className: `${isTextAlignLeft ? "is-active" : ""} tiptap-control-button`,
|
|
1085
|
+
title: translations2.alignment.alignLeft,
|
|
1086
|
+
type: "button",
|
|
1087
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(AlignLeft_default, {})
|
|
1088
|
+
}
|
|
1089
|
+
),
|
|
1090
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
1091
|
+
"button",
|
|
1092
|
+
{
|
|
1093
|
+
onClick: () => editor.chain().focus().setTextAlign("center").run(),
|
|
1094
|
+
className: `${isTextAlignCenter ? "is-active" : ""} tiptap-control-button`,
|
|
1095
|
+
title: translations2.alignment.alignCenter,
|
|
1096
|
+
type: "button",
|
|
1097
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(AlignCenter_default, {})
|
|
1098
|
+
}
|
|
1099
|
+
),
|
|
1100
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
1101
|
+
"button",
|
|
1102
|
+
{
|
|
1103
|
+
onClick: () => editor.chain().focus().setTextAlign("right").run(),
|
|
1104
|
+
className: `${isTextAlignRight ? "is-active" : ""} tiptap-control-button`,
|
|
1105
|
+
title: translations2.alignment.alignRight,
|
|
1106
|
+
type: "button",
|
|
1107
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(AlignRight_default, {})
|
|
1108
|
+
}
|
|
1109
|
+
)
|
|
1110
|
+
] }),
|
|
1111
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "tiptap-controls-group", children: [
|
|
1112
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
1113
|
+
"button",
|
|
1114
|
+
{
|
|
1115
|
+
type: "button",
|
|
1116
|
+
onClick: () => editor.chain().focus().toggleSuperscript().run(),
|
|
1117
|
+
className: `${isSuperscript ? "is-active" : ""} tiptap-control-button`,
|
|
1118
|
+
title: translations2.textFormatting.superscript,
|
|
1119
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Superscript_default, {})
|
|
1120
|
+
}
|
|
1121
|
+
),
|
|
1122
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
1123
|
+
"button",
|
|
1124
|
+
{
|
|
1125
|
+
type: "button",
|
|
1126
|
+
onClick: () => editor.chain().focus().toggleSubscript().run(),
|
|
1127
|
+
className: `${isSubscript ? "is-active" : ""} tiptap-control-button`,
|
|
1128
|
+
title: translations2.textFormatting.subscript,
|
|
1129
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Subscript_default, {})
|
|
1130
|
+
}
|
|
1131
|
+
)
|
|
1132
|
+
] }),
|
|
1133
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "tiptap-controls-group", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
1007
1134
|
"button",
|
|
1008
1135
|
{
|
|
1136
|
+
type: "button",
|
|
1009
1137
|
onClick: () => {
|
|
1010
|
-
|
|
1138
|
+
editor.chain().focus().clearNodes().run();
|
|
1139
|
+
editor.chain().focus().unsetAllMarks().run();
|
|
1011
1140
|
},
|
|
1141
|
+
disabled: !canClearMarks,
|
|
1012
1142
|
className: "tiptap-control-button",
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
style: { color: highlightColor },
|
|
1016
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Highlight_default, {})
|
|
1143
|
+
title: translations2.textFormatting.clearFormatting,
|
|
1144
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(ClearFormatting_default, {})
|
|
1017
1145
|
}
|
|
1018
|
-
)
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
ref: highlightColorInputRef,
|
|
1023
|
-
type: "color",
|
|
1024
|
-
value: highlightColor,
|
|
1025
|
-
onChange: (e) => {
|
|
1026
|
-
editor.chain().focus().setHighlight({ color: e.target.value }).run();
|
|
1027
|
-
},
|
|
1028
|
-
style: {
|
|
1029
|
-
position: "absolute",
|
|
1030
|
-
top: 0,
|
|
1031
|
-
left: 0,
|
|
1032
|
-
width: "100%",
|
|
1033
|
-
height: "100%",
|
|
1034
|
-
opacity: 0,
|
|
1035
|
-
pointerEvents: "none"
|
|
1036
|
-
}
|
|
1037
|
-
}
|
|
1038
|
-
)
|
|
1039
|
-
] })
|
|
1040
|
-
] }),
|
|
1041
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "tiptap-controls-group", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
1042
|
-
"button",
|
|
1043
|
-
{
|
|
1044
|
-
type: "button",
|
|
1045
|
-
onClick: () => editor.chain().focus().toggleCopyable().run(),
|
|
1046
|
-
className: `${isCopyable ? "is-active" : ""} tiptap-control-button`,
|
|
1047
|
-
title: translations2.textFormatting.copyableText,
|
|
1048
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Copyable_default, {})
|
|
1049
|
-
}
|
|
1050
|
-
) }),
|
|
1051
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "tiptap-controls-group", children: [
|
|
1052
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
1053
|
-
"button",
|
|
1054
|
-
{
|
|
1055
|
-
title: isLink ? translations2.link.editLink : translations2.link.addLinkTitle,
|
|
1056
|
-
onClick: handleLinkClick,
|
|
1057
|
-
className: `${isLink ? "is-active" : ""} tiptap-control-button`,
|
|
1058
|
-
type: "button",
|
|
1059
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Link_default, {})
|
|
1060
|
-
}
|
|
1061
|
-
),
|
|
1062
|
-
isLink && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
1063
|
-
"button",
|
|
1064
|
-
{
|
|
1065
|
-
onClick: () => editor.chain().focus().unsetLink().run(),
|
|
1066
|
-
className: "tiptap-control-button tiptap-control-button--delete",
|
|
1067
|
-
type: "button",
|
|
1068
|
-
title: translations2.link.removeLinkTitle,
|
|
1069
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(LinkOff_default, {})
|
|
1070
|
-
}
|
|
1071
|
-
)
|
|
1072
|
-
] }),
|
|
1073
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "tiptap-controls-group", children: [
|
|
1074
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
1075
|
-
"button",
|
|
1076
|
-
{
|
|
1077
|
-
onClick: () => editor.chain().focus().setTextAlign("left").run(),
|
|
1078
|
-
className: `${isTextAlignLeft ? "is-active" : ""} tiptap-control-button`,
|
|
1079
|
-
title: translations2.alignment.alignLeft,
|
|
1080
|
-
type: "button",
|
|
1081
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(AlignLeft_default, {})
|
|
1082
|
-
}
|
|
1083
|
-
),
|
|
1084
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
1085
|
-
"button",
|
|
1086
|
-
{
|
|
1087
|
-
onClick: () => editor.chain().focus().setTextAlign("center").run(),
|
|
1088
|
-
className: `${isTextAlignCenter ? "is-active" : ""} tiptap-control-button`,
|
|
1089
|
-
title: translations2.alignment.alignCenter,
|
|
1090
|
-
type: "button",
|
|
1091
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(AlignCenter_default, {})
|
|
1092
|
-
}
|
|
1093
|
-
),
|
|
1094
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
1095
|
-
"button",
|
|
1096
|
-
{
|
|
1097
|
-
onClick: () => editor.chain().focus().setTextAlign("right").run(),
|
|
1098
|
-
className: `${isTextAlignRight ? "is-active" : ""} tiptap-control-button`,
|
|
1099
|
-
title: translations2.alignment.alignRight,
|
|
1100
|
-
type: "button",
|
|
1101
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(AlignRight_default, {})
|
|
1102
|
-
}
|
|
1103
|
-
)
|
|
1104
|
-
] }),
|
|
1105
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "tiptap-controls-group", children: [
|
|
1106
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
1107
|
-
"button",
|
|
1108
|
-
{
|
|
1109
|
-
type: "button",
|
|
1110
|
-
onClick: () => editor.chain().focus().toggleSuperscript().run(),
|
|
1111
|
-
className: `${isSuperscript ? "is-active" : ""} tiptap-control-button`,
|
|
1112
|
-
title: translations2.textFormatting.superscript,
|
|
1113
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Superscript_default, {})
|
|
1114
|
-
}
|
|
1115
|
-
),
|
|
1116
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
1117
|
-
"button",
|
|
1118
|
-
{
|
|
1119
|
-
type: "button",
|
|
1120
|
-
onClick: () => editor.chain().focus().toggleSubscript().run(),
|
|
1121
|
-
className: `${isSubscript ? "is-active" : ""} tiptap-control-button`,
|
|
1122
|
-
title: translations2.textFormatting.subscript,
|
|
1123
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Subscript_default, {})
|
|
1124
|
-
}
|
|
1125
|
-
)
|
|
1126
|
-
] }),
|
|
1127
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "tiptap-controls-group", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
1128
|
-
"button",
|
|
1129
|
-
{
|
|
1130
|
-
type: "button",
|
|
1131
|
-
onClick: () => {
|
|
1132
|
-
editor.chain().focus().clearNodes().run();
|
|
1133
|
-
editor.chain().focus().unsetAllMarks().run();
|
|
1134
|
-
},
|
|
1135
|
-
disabled: !canClearMarks,
|
|
1136
|
-
className: "tiptap-control-button",
|
|
1137
|
-
title: translations2.textFormatting.clearFormatting,
|
|
1138
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(ClearFormatting_default, {})
|
|
1139
|
-
}
|
|
1140
|
-
) })
|
|
1141
|
-
] });
|
|
1146
|
+
) })
|
|
1147
|
+
]
|
|
1148
|
+
}
|
|
1149
|
+
);
|
|
1142
1150
|
};
|
|
1143
1151
|
|
|
1144
1152
|
// src/editor/controls/drag-handle.tsx
|
|
@@ -1415,7 +1423,9 @@ var CommandsList = (0, import_react7.forwardRef)(({ items, command }, ref) => {
|
|
|
1415
1423
|
if (item) {
|
|
1416
1424
|
if (item.dialogCommand) {
|
|
1417
1425
|
openDialogCommand(item.dialogCommand);
|
|
1426
|
+
command(item);
|
|
1418
1427
|
} else {
|
|
1428
|
+
console.log("open video");
|
|
1419
1429
|
command(item);
|
|
1420
1430
|
}
|
|
1421
1431
|
}
|
|
@@ -1428,6 +1438,10 @@ var CommandsList = (0, import_react7.forwardRef)(({ items, command }, ref) => {
|
|
|
1428
1438
|
{
|
|
1429
1439
|
ref: listRef,
|
|
1430
1440
|
className: "commands-list-container",
|
|
1441
|
+
onMouseDown: (e) => {
|
|
1442
|
+
e.preventDefault();
|
|
1443
|
+
e.stopPropagation();
|
|
1444
|
+
},
|
|
1431
1445
|
children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
|
|
1432
1446
|
"button",
|
|
1433
1447
|
{
|
|
@@ -2478,11 +2492,7 @@ var SUPPORTED_PLATFORMS = {
|
|
|
2478
2492
|
["rutube" /* Rutube */]: "Rutube",
|
|
2479
2493
|
["vk" /* VK */]: "VK"
|
|
2480
2494
|
};
|
|
2481
|
-
var AddVideoDialog = ({
|
|
2482
|
-
open,
|
|
2483
|
-
onClose,
|
|
2484
|
-
onVideoAdd
|
|
2485
|
-
}) => {
|
|
2495
|
+
var AddVideoDialog = ({ open, onClose, onVideoAdd }) => {
|
|
2486
2496
|
const translations2 = useTiptapTranslations();
|
|
2487
2497
|
const [url, setUrl] = (0, import_react16.useState)("");
|
|
2488
2498
|
const [error, setError] = (0, import_react16.useState)("");
|
|
@@ -2565,6 +2575,7 @@ var AddVideoDialog = ({
|
|
|
2565
2575
|
{
|
|
2566
2576
|
ref: urlInputRef,
|
|
2567
2577
|
id: "video-url",
|
|
2578
|
+
autoComplete: "off",
|
|
2568
2579
|
type: "text",
|
|
2569
2580
|
className: "video-dialog-input",
|
|
2570
2581
|
placeholder: translations2.videoUpload.urlPlaceholder,
|
|
@@ -4279,23 +4290,26 @@ var PromptContent = ({ children, isEmpty, placeholder }) => /* @__PURE__ */ (0,
|
|
|
4279
4290
|
}
|
|
4280
4291
|
) });
|
|
4281
4292
|
|
|
4282
|
-
// src/extensions/views/components/
|
|
4293
|
+
// src/extensions/views/components/table.tsx
|
|
4283
4294
|
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
4295
|
+
|
|
4296
|
+
// src/extensions/views/components/video.tsx
|
|
4297
|
+
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
4284
4298
|
var Video = ({ src, children }) => {
|
|
4285
4299
|
const videoInfo = detectVideoHosting(src);
|
|
4286
4300
|
if (!videoInfo?.embedUrl) {
|
|
4287
|
-
return /* @__PURE__ */ (0,
|
|
4288
|
-
/* @__PURE__ */ (0,
|
|
4301
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "video-node", children: [
|
|
4302
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: "video-error", children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { children: "Unsupported or invalid video URL" }) }),
|
|
4289
4303
|
children
|
|
4290
4304
|
] });
|
|
4291
4305
|
}
|
|
4292
|
-
return /* @__PURE__ */ (0,
|
|
4306
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
|
|
4293
4307
|
"div",
|
|
4294
4308
|
{
|
|
4295
4309
|
className: "video-node",
|
|
4296
4310
|
"data-video": "",
|
|
4297
4311
|
children: [
|
|
4298
|
-
/* @__PURE__ */ (0,
|
|
4312
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: "video-player-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
4299
4313
|
"iframe",
|
|
4300
4314
|
{
|
|
4301
4315
|
className: "video-iframe",
|
|
@@ -4314,7 +4328,7 @@ var Video = ({ src, children }) => {
|
|
|
4314
4328
|
// src/editor/controls/emoji-picker.tsx
|
|
4315
4329
|
var import_react18 = require("react");
|
|
4316
4330
|
var import_emoji_picker_react = __toESM(require("emoji-picker-react"));
|
|
4317
|
-
var
|
|
4331
|
+
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
4318
4332
|
var EmojiPickerComponent = ({ isOpen, onClose, onEmojiSelect }) => {
|
|
4319
4333
|
const pickerRef = (0, import_react18.useRef)(null);
|
|
4320
4334
|
const translations2 = useTiptapTranslations();
|
|
@@ -4332,12 +4346,12 @@ var EmojiPickerComponent = ({ isOpen, onClose, onEmojiSelect }) => {
|
|
|
4332
4346
|
};
|
|
4333
4347
|
}, [isOpen, onClose]);
|
|
4334
4348
|
if (!isOpen) return null;
|
|
4335
|
-
return /* @__PURE__ */ (0,
|
|
4349
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
4336
4350
|
"div",
|
|
4337
4351
|
{
|
|
4338
4352
|
ref: pickerRef,
|
|
4339
4353
|
className: "tiptap__emoji-picker-wrapper",
|
|
4340
|
-
children: /* @__PURE__ */ (0,
|
|
4354
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
4341
4355
|
import_emoji_picker_react.default,
|
|
4342
4356
|
{
|
|
4343
4357
|
skinTonesDisabled: true,
|
|
@@ -4362,7 +4376,7 @@ var EmojiPickerComponent = ({ isOpen, onClose, onEmojiSelect }) => {
|
|
|
4362
4376
|
};
|
|
4363
4377
|
|
|
4364
4378
|
// src/extensions/views/node-views/callout.tsx
|
|
4365
|
-
var
|
|
4379
|
+
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
4366
4380
|
var CalloutView = (props) => {
|
|
4367
4381
|
const type = props.node.attrs.type || "info";
|
|
4368
4382
|
const bgColor = props.node.attrs.bgColor;
|
|
@@ -4377,23 +4391,23 @@ var CalloutView = (props) => {
|
|
|
4377
4391
|
props.updateAttributes({ emoji: newEmoji });
|
|
4378
4392
|
setShowEmojiPicker(false);
|
|
4379
4393
|
};
|
|
4380
|
-
return /* @__PURE__ */ (0,
|
|
4394
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react19.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
4381
4395
|
Callout,
|
|
4382
4396
|
{
|
|
4383
4397
|
type,
|
|
4384
4398
|
bgColor,
|
|
4385
4399
|
emoji,
|
|
4386
|
-
iconWrapper: (icon) => /* @__PURE__ */ (0,
|
|
4387
|
-
/* @__PURE__ */ (0,
|
|
4400
|
+
iconWrapper: (icon) => /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "callout-icon-wrapper", children: [
|
|
4401
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
4388
4402
|
"button",
|
|
4389
4403
|
{
|
|
4390
4404
|
className: "callout-icon-button",
|
|
4391
4405
|
onClick: handleIconClick,
|
|
4392
4406
|
type: "button",
|
|
4393
|
-
children: /* @__PURE__ */ (0,
|
|
4407
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: "callout-icon", children: icon })
|
|
4394
4408
|
}
|
|
4395
4409
|
),
|
|
4396
|
-
/* @__PURE__ */ (0,
|
|
4410
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
4397
4411
|
EmojiPickerComponent,
|
|
4398
4412
|
{
|
|
4399
4413
|
isOpen: showEmojiPicker,
|
|
@@ -4402,7 +4416,7 @@ var CalloutView = (props) => {
|
|
|
4402
4416
|
}
|
|
4403
4417
|
)
|
|
4404
4418
|
] }),
|
|
4405
|
-
children: /* @__PURE__ */ (0,
|
|
4419
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react19.NodeViewContent, { as: "div" })
|
|
4406
4420
|
}
|
|
4407
4421
|
) });
|
|
4408
4422
|
};
|
|
@@ -4410,7 +4424,7 @@ var CalloutView = (props) => {
|
|
|
4410
4424
|
// src/extensions/views/node-views/code-block.tsx
|
|
4411
4425
|
var import_react21 = require("react");
|
|
4412
4426
|
var import_react22 = require("@tiptap/react");
|
|
4413
|
-
var
|
|
4427
|
+
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
4414
4428
|
var CodeBlockView = (props) => {
|
|
4415
4429
|
const [selectedLanguage, setSelectedLanguage] = (0, import_react21.useState)(props.node.attrs.language ?? "");
|
|
4416
4430
|
const translations2 = useTiptapTranslations();
|
|
@@ -4418,71 +4432,71 @@ var CodeBlockView = (props) => {
|
|
|
4418
4432
|
props.updateAttributes({ language });
|
|
4419
4433
|
setSelectedLanguage(language);
|
|
4420
4434
|
};
|
|
4421
|
-
return /* @__PURE__ */ (0,
|
|
4435
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_react22.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
4422
4436
|
CodeBlock,
|
|
4423
4437
|
{
|
|
4424
4438
|
language: selectedLanguage,
|
|
4425
4439
|
isEditable: props.editor.isEditable,
|
|
4426
4440
|
onLanguageChange: handleLanguageChange,
|
|
4427
4441
|
translations: translations2,
|
|
4428
|
-
children: /* @__PURE__ */ (0,
|
|
4442
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_react22.NodeViewContent, {})
|
|
4429
4443
|
}
|
|
4430
4444
|
) });
|
|
4431
4445
|
};
|
|
4432
4446
|
|
|
4433
4447
|
// src/extensions/views/node-views/copyable-text.tsx
|
|
4434
4448
|
var import_react23 = require("@tiptap/react");
|
|
4435
|
-
var
|
|
4449
|
+
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
4436
4450
|
var CopyableTextView = () => {
|
|
4437
|
-
return /* @__PURE__ */ (0,
|
|
4451
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(CopyableText2, { children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_react23.MarkViewContent, {}) });
|
|
4438
4452
|
};
|
|
4439
4453
|
|
|
4440
4454
|
// src/extensions/views/node-views/custom-quote.tsx
|
|
4441
4455
|
var import_react24 = require("@tiptap/react");
|
|
4442
|
-
var
|
|
4456
|
+
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
4443
4457
|
var CustomQuoteView = () => {
|
|
4444
|
-
return /* @__PURE__ */ (0,
|
|
4458
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react24.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(CustomQuote, { children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react24.NodeViewContent, {}) }) });
|
|
4445
4459
|
};
|
|
4446
4460
|
var CustomQuoteTextView = (props) => {
|
|
4447
4461
|
const isEmpty = !props.node.content.size;
|
|
4448
4462
|
const translations2 = useTiptapTranslations();
|
|
4449
|
-
return /* @__PURE__ */ (0,
|
|
4463
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react24.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
4450
4464
|
CustomQuoteText,
|
|
4451
4465
|
{
|
|
4452
4466
|
isEmpty,
|
|
4453
4467
|
placeholder: translations2.customQuote.textPlaceholder,
|
|
4454
|
-
children: /* @__PURE__ */ (0,
|
|
4468
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react24.NodeViewContent, { className: isEmpty ? "is-empty" : "" })
|
|
4455
4469
|
}
|
|
4456
4470
|
) });
|
|
4457
4471
|
};
|
|
4458
4472
|
var CustomQuoteAuthorView = (props) => {
|
|
4459
4473
|
const isEmpty = !props.node.content.size;
|
|
4460
4474
|
const translations2 = useTiptapTranslations();
|
|
4461
|
-
return /* @__PURE__ */ (0,
|
|
4475
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react24.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
4462
4476
|
CustomQuoteAuthor,
|
|
4463
4477
|
{
|
|
4464
4478
|
isEmpty,
|
|
4465
4479
|
placeholder: translations2.customQuote.authorPlaceholder,
|
|
4466
|
-
children: /* @__PURE__ */ (0,
|
|
4480
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react24.NodeViewContent, { className: isEmpty ? "is-empty" : "" })
|
|
4467
4481
|
}
|
|
4468
4482
|
) });
|
|
4469
4483
|
};
|
|
4470
4484
|
var CustomQuoteSignView = (props) => {
|
|
4471
4485
|
const isEmpty = !props.node.content.size;
|
|
4472
4486
|
const translations2 = useTiptapTranslations();
|
|
4473
|
-
return /* @__PURE__ */ (0,
|
|
4487
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react24.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
4474
4488
|
CustomQuoteSign,
|
|
4475
4489
|
{
|
|
4476
4490
|
isEmpty,
|
|
4477
4491
|
placeholder: translations2.customQuote.signPlaceholder,
|
|
4478
|
-
children: /* @__PURE__ */ (0,
|
|
4492
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react24.NodeViewContent, { className: isEmpty ? "is-empty" : "" })
|
|
4479
4493
|
}
|
|
4480
4494
|
) });
|
|
4481
4495
|
};
|
|
4482
4496
|
|
|
4483
4497
|
// src/extensions/views/node-views/figure.tsx
|
|
4484
4498
|
var import_react25 = require("@tiptap/react");
|
|
4485
|
-
var
|
|
4499
|
+
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
4486
4500
|
var FigureView = ({ node, getPos, editor }) => {
|
|
4487
4501
|
const { fileId, src, alt, title, caption, width, height } = node.attrs;
|
|
4488
4502
|
const imageExtension = editor.extensionManager.extensions.find((ext) => ext.name === "image");
|
|
@@ -4491,12 +4505,12 @@ var FigureView = ({ node, getPos, editor }) => {
|
|
|
4491
4505
|
const handleEditClick = () => {
|
|
4492
4506
|
onFigureClick?.(node.attrs, getPos());
|
|
4493
4507
|
};
|
|
4494
|
-
return /* @__PURE__ */ (0,
|
|
4508
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
4495
4509
|
import_react25.NodeViewWrapper,
|
|
4496
4510
|
{
|
|
4497
4511
|
className: "figure-node-view",
|
|
4498
4512
|
"data-drag-handle": true,
|
|
4499
|
-
children: /* @__PURE__ */ (0,
|
|
4513
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
4500
4514
|
Figure,
|
|
4501
4515
|
{
|
|
4502
4516
|
fileId,
|
|
@@ -4517,38 +4531,38 @@ var FigureView = ({ node, getPos, editor }) => {
|
|
|
4517
4531
|
|
|
4518
4532
|
// src/extensions/views/node-views/prompt.tsx
|
|
4519
4533
|
var import_react26 = require("@tiptap/react");
|
|
4520
|
-
var
|
|
4534
|
+
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
4521
4535
|
var PromptHeaderView = (props) => {
|
|
4522
4536
|
const isEmpty = !props.node.content.size;
|
|
4523
4537
|
const translations2 = useTiptapTranslations();
|
|
4524
|
-
return /* @__PURE__ */ (0,
|
|
4538
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_react26.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
4525
4539
|
PromptHeader,
|
|
4526
4540
|
{
|
|
4527
4541
|
isEmpty,
|
|
4528
4542
|
placeholder: translations2.prompt.headerPlaceholder,
|
|
4529
|
-
children: /* @__PURE__ */ (0,
|
|
4543
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_react26.NodeViewContent, { className: isEmpty ? "is-empty" : "" })
|
|
4530
4544
|
}
|
|
4531
4545
|
) });
|
|
4532
4546
|
};
|
|
4533
4547
|
var PromptContentView = (props) => {
|
|
4534
4548
|
const isEmpty = !props.node.content.size;
|
|
4535
4549
|
const translations2 = useTiptapTranslations();
|
|
4536
|
-
return /* @__PURE__ */ (0,
|
|
4550
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_react26.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
4537
4551
|
PromptContent,
|
|
4538
4552
|
{
|
|
4539
4553
|
isEmpty,
|
|
4540
4554
|
placeholder: translations2.prompt.contentPlaceholder,
|
|
4541
|
-
children: /* @__PURE__ */ (0,
|
|
4555
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_react26.NodeViewContent, { className: isEmpty ? "is-empty" : "" })
|
|
4542
4556
|
}
|
|
4543
4557
|
) });
|
|
4544
4558
|
};
|
|
4545
4559
|
|
|
4546
4560
|
// src/extensions/views/node-views/video.tsx
|
|
4547
4561
|
var import_react27 = require("@tiptap/react");
|
|
4548
|
-
var
|
|
4562
|
+
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
4549
4563
|
var VideoView = (props) => {
|
|
4550
4564
|
const { src } = props.node.attrs;
|
|
4551
|
-
return /* @__PURE__ */ (0,
|
|
4565
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_react27.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Video, { src, children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
4552
4566
|
import_react27.NodeViewContent,
|
|
4553
4567
|
{
|
|
4554
4568
|
as: "div",
|
|
@@ -5151,7 +5165,7 @@ function getEditorExtensions(options) {
|
|
|
5151
5165
|
}
|
|
5152
5166
|
|
|
5153
5167
|
// src/editor/handlers/dialog-handlers.ts
|
|
5154
|
-
var createHandleImageAdd = (editor, closeDialogCommand) => {
|
|
5168
|
+
var createHandleImageAdd = (editor, closeDialogCommand, savedPos) => {
|
|
5155
5169
|
return (attrs) => {
|
|
5156
5170
|
if (!editor) return;
|
|
5157
5171
|
const { state } = editor;
|
|
@@ -5162,9 +5176,19 @@ var createHandleImageAdd = (editor, closeDialogCommand) => {
|
|
|
5162
5176
|
const node = editor.schema.nodes.image.create({ ...attrs });
|
|
5163
5177
|
tr.replaceWith($from.before(), $from.after(), node);
|
|
5164
5178
|
return true;
|
|
5165
|
-
}).run();
|
|
5179
|
+
}).scrollIntoView().run();
|
|
5166
5180
|
} else {
|
|
5167
|
-
|
|
5181
|
+
const insertPos = savedPos ?? state.selection.from;
|
|
5182
|
+
editor.chain().focus().command(({ tr, state: state2 }) => {
|
|
5183
|
+
const $pos = state2.doc.resolve(insertPos);
|
|
5184
|
+
const figureNode = state2.schema.nodes.figure.create({ ...attrs });
|
|
5185
|
+
if ($pos.parent.type.name === "paragraph" && $pos.parent.textContent === "") {
|
|
5186
|
+
tr.replaceWith($pos.before(), $pos.after(), figureNode);
|
|
5187
|
+
} else {
|
|
5188
|
+
tr.insert(insertPos, figureNode);
|
|
5189
|
+
}
|
|
5190
|
+
return true;
|
|
5191
|
+
}).scrollIntoView().run();
|
|
5168
5192
|
}
|
|
5169
5193
|
closeDialogCommand();
|
|
5170
5194
|
};
|
|
@@ -5176,23 +5200,38 @@ var createHandleImageEdit = (editor, closeDialogCommand, pos) => {
|
|
|
5176
5200
|
closeDialogCommand();
|
|
5177
5201
|
};
|
|
5178
5202
|
};
|
|
5179
|
-
var createHandleVideoAdd = (editor, closeDialogCommand) => {
|
|
5203
|
+
var createHandleVideoAdd = (editor, closeDialogCommand, savedPos) => {
|
|
5180
5204
|
return (url) => {
|
|
5181
5205
|
if (!editor) return;
|
|
5182
5206
|
const { state } = editor;
|
|
5183
5207
|
const { $from } = state.selection;
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5208
|
+
const text = $from.parent.textContent;
|
|
5209
|
+
if (text.lastIndexOf("/") !== -1) {
|
|
5210
|
+
editor.chain().focus().command(({ tr }) => {
|
|
5211
|
+
tr.replaceWith(
|
|
5212
|
+
$from.before(),
|
|
5213
|
+
$from.after(),
|
|
5214
|
+
editor.schema.nodes.video.create({ src: url })
|
|
5215
|
+
);
|
|
5216
|
+
return true;
|
|
5217
|
+
}).scrollIntoView().run();
|
|
5218
|
+
} else {
|
|
5219
|
+
const insertPos = savedPos ?? state.selection.from;
|
|
5220
|
+
editor.chain().focus().command(({ tr, state: state2 }) => {
|
|
5221
|
+
const $pos = state2.doc.resolve(insertPos);
|
|
5222
|
+
const videoNode = state2.schema.nodes.video.create({ src: url });
|
|
5223
|
+
if ($pos.parent.type.name === "paragraph" && $pos.parent.textContent === "") {
|
|
5224
|
+
tr.replaceWith($pos.before(), $pos.after(), videoNode);
|
|
5225
|
+
} else {
|
|
5226
|
+
tr.insert(insertPos, videoNode);
|
|
5227
|
+
}
|
|
5228
|
+
return true;
|
|
5229
|
+
}).scrollIntoView().run();
|
|
5230
|
+
}
|
|
5192
5231
|
closeDialogCommand();
|
|
5193
5232
|
};
|
|
5194
5233
|
};
|
|
5195
|
-
var createHandleLinkAdd = (editor, closeDialogCommand) => {
|
|
5234
|
+
var createHandleLinkAdd = (editor, closeDialogCommand, savedPos) => {
|
|
5196
5235
|
return (title, url) => {
|
|
5197
5236
|
if (!editor) return;
|
|
5198
5237
|
const hasSelection = !editor.state.selection.empty;
|
|
@@ -5204,22 +5243,31 @@ var createHandleLinkAdd = (editor, closeDialogCommand) => {
|
|
|
5204
5243
|
return true;
|
|
5205
5244
|
}).run();
|
|
5206
5245
|
} else {
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5246
|
+
const { state } = editor;
|
|
5247
|
+
const { $from } = state.selection;
|
|
5248
|
+
const text = $from.parent.textContent;
|
|
5249
|
+
const nodeStart = $from.start();
|
|
5250
|
+
const beforeCursor = text.substring(0, $from.pos - nodeStart);
|
|
5251
|
+
const slashIndex = beforeCursor.lastIndexOf("/");
|
|
5252
|
+
if (slashIndex !== -1) {
|
|
5253
|
+
editor.chain().focus().command(({ tr }) => {
|
|
5214
5254
|
tr.delete(nodeStart + slashIndex, $from.pos);
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
}
|
|
5255
|
+
return true;
|
|
5256
|
+
}).extendMarkRange("link").setLink({ href: url }).insertContent(title).scrollIntoView().run();
|
|
5257
|
+
} else {
|
|
5258
|
+
const insertPos = savedPos ?? state.selection.from;
|
|
5259
|
+
editor.chain().focus().command(({ tr }) => {
|
|
5260
|
+
const linkMark = editor.schema.marks.link.create({ href: url });
|
|
5261
|
+
const textNode = editor.schema.text(title, [linkMark]);
|
|
5262
|
+
tr.insert(insertPos, textNode);
|
|
5263
|
+
return true;
|
|
5264
|
+
}).scrollIntoView().run();
|
|
5265
|
+
}
|
|
5218
5266
|
}
|
|
5219
5267
|
closeDialogCommand();
|
|
5220
5268
|
};
|
|
5221
5269
|
};
|
|
5222
|
-
var createHandleKatexAdd = (editor, closeDialogCommand) => {
|
|
5270
|
+
var createHandleKatexAdd = (editor, closeDialogCommand, savedPos) => {
|
|
5223
5271
|
return (latex, pos) => {
|
|
5224
5272
|
if (!editor) return;
|
|
5225
5273
|
if (pos !== void 0) {
|
|
@@ -5238,9 +5286,14 @@ var createHandleKatexAdd = (editor, closeDialogCommand) => {
|
|
|
5238
5286
|
const inlineMathNode = state2.schema.nodes.inlineMath.create({ latex });
|
|
5239
5287
|
tr.replaceRangeWith(deleteFrom, deleteTo, inlineMathNode);
|
|
5240
5288
|
return true;
|
|
5241
|
-
}).run();
|
|
5289
|
+
}).scrollIntoView().run();
|
|
5242
5290
|
} else {
|
|
5243
|
-
|
|
5291
|
+
const insertPos = savedPos ?? state.selection.from;
|
|
5292
|
+
editor.chain().focus().command(({ tr, state: state2 }) => {
|
|
5293
|
+
const inlineMathNode = state2.schema.nodes.inlineMath.create({ latex });
|
|
5294
|
+
tr.insert(insertPos, inlineMathNode);
|
|
5295
|
+
return true;
|
|
5296
|
+
}).scrollIntoView().run();
|
|
5244
5297
|
}
|
|
5245
5298
|
}
|
|
5246
5299
|
closeDialogCommand();
|
|
@@ -5385,7 +5438,7 @@ var getCommandItems = (translations2, hasImageHandlers) => [
|
|
|
5385
5438
|
onClick: (editor) => {
|
|
5386
5439
|
editor.chain().focus().insertContent({
|
|
5387
5440
|
type: "callout",
|
|
5388
|
-
attrs: { type: "", bgColor: "#F7F7F8" },
|
|
5441
|
+
attrs: { type: "", bgColor: "#F7F7F8", emoji: "callout-info" },
|
|
5389
5442
|
content: [
|
|
5390
5443
|
{
|
|
5391
5444
|
type: "paragraph",
|
|
@@ -5551,7 +5604,7 @@ var filterCommandItems = (items, query) => {
|
|
|
5551
5604
|
};
|
|
5552
5605
|
|
|
5553
5606
|
// src/editor/commands/suggestion.tsx
|
|
5554
|
-
var
|
|
5607
|
+
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
5555
5608
|
var component = null;
|
|
5556
5609
|
var closeMenu = () => {
|
|
5557
5610
|
if (component) {
|
|
@@ -5565,7 +5618,7 @@ var mapCommandMenuItemToCommandItem = (item) => {
|
|
|
5565
5618
|
const IconComponent = item.icon;
|
|
5566
5619
|
return {
|
|
5567
5620
|
title: item.title,
|
|
5568
|
-
icon: /* @__PURE__ */ (0,
|
|
5621
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(IconComponent, {}),
|
|
5569
5622
|
command: ({ editor, range }) => {
|
|
5570
5623
|
editor.chain().focus().deleteRange(range).run();
|
|
5571
5624
|
item.onClick(editor);
|
|
@@ -5988,7 +6041,7 @@ function getTranslations(lang) {
|
|
|
5988
6041
|
}
|
|
5989
6042
|
|
|
5990
6043
|
// src/editor/editor.tsx
|
|
5991
|
-
var
|
|
6044
|
+
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
5992
6045
|
function TiptapContent({
|
|
5993
6046
|
content,
|
|
5994
6047
|
handleChange,
|
|
@@ -6003,6 +6056,7 @@ function TiptapContent({
|
|
|
6003
6056
|
null
|
|
6004
6057
|
);
|
|
6005
6058
|
const [editFigureContext, setEditFigureContext] = (0, import_react36.useState)(null);
|
|
6059
|
+
const [savedDialogCursorPos, setSavedDialogCursorPos] = (0, import_react36.useState)(void 0);
|
|
6006
6060
|
const { activeDialog, closeDialogCommand, openDialogCommand } = useDialogCommand();
|
|
6007
6061
|
const translations2 = useTiptapTranslations();
|
|
6008
6062
|
let safeContent;
|
|
@@ -6052,18 +6106,25 @@ function TiptapContent({
|
|
|
6052
6106
|
},
|
|
6053
6107
|
[lang]
|
|
6054
6108
|
);
|
|
6109
|
+
(0, import_react36.useEffect)(() => {
|
|
6110
|
+
if (activeDialog && editor && !editor.isDestroyed) {
|
|
6111
|
+
const pos = editor.state.selection.from;
|
|
6112
|
+
setSavedDialogCursorPos(pos);
|
|
6113
|
+
}
|
|
6114
|
+
}, [activeDialog, editor]);
|
|
6055
6115
|
const handleCloseDialog = () => {
|
|
6056
6116
|
setLinkDialogContext(null);
|
|
6057
6117
|
setKatexDialogContext(null);
|
|
6058
6118
|
setEditFigureContext(null);
|
|
6119
|
+
setSavedDialogCursorPos(void 0);
|
|
6059
6120
|
closeDialogCommand();
|
|
6060
6121
|
};
|
|
6061
|
-
const handleImageAdd = createHandleImageAdd(editor, handleCloseDialog);
|
|
6122
|
+
const handleImageAdd = createHandleImageAdd(editor, handleCloseDialog, savedDialogCursorPos);
|
|
6062
6123
|
const handleImageEdit = createHandleImageEdit(editor, handleCloseDialog, editFigureContext?.pos);
|
|
6063
|
-
const handleVideoAdd = createHandleVideoAdd(editor, handleCloseDialog);
|
|
6064
|
-
const handleLinkAdd = createHandleLinkAdd(editor, handleCloseDialog);
|
|
6124
|
+
const handleVideoAdd = createHandleVideoAdd(editor, handleCloseDialog, savedDialogCursorPos);
|
|
6125
|
+
const handleLinkAdd = createHandleLinkAdd(editor, handleCloseDialog, savedDialogCursorPos);
|
|
6065
6126
|
const handleKatexAdd = (latex) => {
|
|
6066
|
-
const katexHandler = createHandleKatexAdd(editor, handleCloseDialog);
|
|
6127
|
+
const katexHandler = createHandleKatexAdd(editor, handleCloseDialog, savedDialogCursorPos);
|
|
6067
6128
|
katexHandler(latex, katexDialogContext?.pos);
|
|
6068
6129
|
};
|
|
6069
6130
|
(0, import_react36.useEffect)(() => {
|
|
@@ -6072,7 +6133,6 @@ function TiptapContent({
|
|
|
6072
6133
|
emitUpdate: false
|
|
6073
6134
|
});
|
|
6074
6135
|
}, [content, editor]);
|
|
6075
|
-
if (!editor) return null;
|
|
6076
6136
|
const shouldBubbleMenuShow = ({ state }) => {
|
|
6077
6137
|
if (state.selection instanceof import_state5.NodeSelection) {
|
|
6078
6138
|
return false;
|
|
@@ -6085,16 +6145,17 @@ function TiptapContent({
|
|
|
6085
6145
|
}
|
|
6086
6146
|
return true;
|
|
6087
6147
|
};
|
|
6088
|
-
|
|
6089
|
-
|
|
6090
|
-
|
|
6091
|
-
!isDisabled && /* @__PURE__ */ (0,
|
|
6148
|
+
if (!editor) return null;
|
|
6149
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(import_jsx_runtime93.Fragment, { children: [
|
|
6150
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(DragHandle, { editor }),
|
|
6151
|
+
isEditable && !isDisabled && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(TableMenu, { editor }),
|
|
6152
|
+
isEditable && !isDisabled && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
6092
6153
|
import_menus.BubbleMenu,
|
|
6093
6154
|
{
|
|
6094
6155
|
shouldShow: shouldBubbleMenuShow,
|
|
6095
6156
|
editor,
|
|
6096
6157
|
options: { placement: "bottom", offset: 8, flip: true },
|
|
6097
|
-
children: /* @__PURE__ */ (0,
|
|
6158
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
6098
6159
|
BubbleMenuContent,
|
|
6099
6160
|
{
|
|
6100
6161
|
editor,
|
|
@@ -6103,63 +6164,65 @@ function TiptapContent({
|
|
|
6103
6164
|
)
|
|
6104
6165
|
}
|
|
6105
6166
|
),
|
|
6106
|
-
/* @__PURE__ */ (0,
|
|
6167
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
|
|
6107
6168
|
"div",
|
|
6108
6169
|
{
|
|
6109
6170
|
className: `tiptap-content-wrapper ${!!error ? "has-error" : ""} ${isDisabled ? "is-disabled" : ""}`,
|
|
6110
6171
|
children: [
|
|
6111
|
-
/* @__PURE__ */ (0,
|
|
6112
|
-
isEditable && !isDisabled && /* @__PURE__ */ (0,
|
|
6172
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_react37.EditorContent, { editor }),
|
|
6173
|
+
isEditable && !isDisabled && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(CharacterCount, { editor })
|
|
6113
6174
|
]
|
|
6114
6175
|
}
|
|
6115
6176
|
),
|
|
6116
|
-
!!error && /* @__PURE__ */ (0,
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
|
|
6120
|
-
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
|
|
6129
|
-
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
|
|
6137
|
-
|
|
6138
|
-
|
|
6139
|
-
|
|
6140
|
-
|
|
6141
|
-
|
|
6142
|
-
|
|
6143
|
-
|
|
6144
|
-
|
|
6145
|
-
|
|
6146
|
-
|
|
6147
|
-
|
|
6148
|
-
|
|
6149
|
-
|
|
6150
|
-
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
|
|
6155
|
-
|
|
6156
|
-
|
|
6177
|
+
!!error && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("p", { className: "tiptap-error-message", children: error }),
|
|
6178
|
+
isEditable && /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(import_jsx_runtime93.Fragment, { children: [
|
|
6179
|
+
activeDialog === "image" && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
6180
|
+
ImageDialog,
|
|
6181
|
+
{
|
|
6182
|
+
open: true,
|
|
6183
|
+
onClose: handleCloseDialog,
|
|
6184
|
+
onImageAdd: handleImageAdd,
|
|
6185
|
+
onImageEdit: handleImageEdit,
|
|
6186
|
+
uploadHandler: imageHandlers?.upload,
|
|
6187
|
+
getImageById: imageHandlers?.getImage,
|
|
6188
|
+
initialAttrs: editFigureContext?.attrs || void 0,
|
|
6189
|
+
mode: editFigureContext ? "edit" : "add"
|
|
6190
|
+
}
|
|
6191
|
+
),
|
|
6192
|
+
activeDialog === "link" && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
6193
|
+
AddLinkDialog,
|
|
6194
|
+
{
|
|
6195
|
+
open: true,
|
|
6196
|
+
onClose: handleCloseDialog,
|
|
6197
|
+
onLinkAdd: handleLinkAdd,
|
|
6198
|
+
initialTitle: linkDialogContext?.selectedText || "",
|
|
6199
|
+
initialUrl: linkDialogContext?.url || ""
|
|
6200
|
+
}
|
|
6201
|
+
),
|
|
6202
|
+
activeDialog === "video" && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
6203
|
+
AddVideoDialog,
|
|
6204
|
+
{
|
|
6205
|
+
open: true,
|
|
6206
|
+
onClose: handleCloseDialog,
|
|
6207
|
+
onVideoAdd: handleVideoAdd
|
|
6208
|
+
}
|
|
6209
|
+
),
|
|
6210
|
+
activeDialog === "katex" && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
6211
|
+
AddKatexDialog,
|
|
6212
|
+
{
|
|
6213
|
+
open: true,
|
|
6214
|
+
onClose: handleCloseDialog,
|
|
6215
|
+
onKatexAdd: handleKatexAdd,
|
|
6216
|
+
initialContent: katexDialogContext?.latex || ""
|
|
6217
|
+
}
|
|
6218
|
+
)
|
|
6219
|
+
] })
|
|
6157
6220
|
] });
|
|
6158
6221
|
}
|
|
6159
6222
|
var Tiptap = (props) => {
|
|
6160
6223
|
const { lang = "ru" } = props;
|
|
6161
6224
|
const translations2 = getTranslations(lang);
|
|
6162
|
-
return /* @__PURE__ */ (0,
|
|
6225
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(TiptapTranslationsProvider, { translations: translations2, children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(DialogCommandProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(TiptapContent, { ...props }) }) });
|
|
6163
6226
|
};
|
|
6164
6227
|
// Annotate the CommonJS export names for ESM import in node:
|
|
6165
6228
|
0 && (module.exports = {
|