@cyberyozh/text-editor 0.1.6 → 0.1.8
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 +483 -456
- package/dist/editor.js.map +1 -1
- package/dist/editor.mjs +481 -454
- package/dist/editor.mjs.map +1 -1
- package/dist/render.js +68 -29
- package/dist/render.js.map +1 -1
- package/dist/render.mjs +68 -29
- package/dist/render.mjs.map +1 -1
- package/dist/styles/index.css +46 -20
- package/package.json +5 -3
- 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/dialogs/image-dialog/image-dialog.tsx +0 -1
- package/src/editor/editor.tsx +68 -44
- package/src/editor/handlers/dialog-handlers.ts +74 -62
- package/src/editor/handlers/index.ts +1 -2
- package/src/extensions/views/components/index.ts +1 -0
- package/src/extensions/views/components/table.tsx +48 -0
- package/src/render/static-renderer-config.tsx +16 -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/src/editor/handlers/create-image-upload-handler.ts +0 -24
package/dist/editor.js
CHANGED
|
@@ -36,7 +36,7 @@ module.exports = __toCommonJS(editor_exports);
|
|
|
36
36
|
|
|
37
37
|
// src/editor/editor.tsx
|
|
38
38
|
var import_react36 = require("react");
|
|
39
|
-
var
|
|
39
|
+
var import_state6 = require("@tiptap/pm/state");
|
|
40
40
|
var import_model = require("@tiptap/pm/model");
|
|
41
41
|
var import_react37 = require("@tiptap/react");
|
|
42
42
|
var import_menus = require("@tiptap/react/menus");
|
|
@@ -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, {})
|
|
1017
|
-
}
|
|
1018
|
-
),
|
|
1019
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
1020
|
-
"input",
|
|
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
|
-
}
|
|
1143
|
+
title: translations2.textFormatting.clearFormatting,
|
|
1144
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(ClearFormatting_default, {})
|
|
1037
1145
|
}
|
|
1038
|
-
)
|
|
1039
|
-
]
|
|
1040
|
-
|
|
1041
|
-
|
|
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,48 +5165,56 @@ function getEditorExtensions(options) {
|
|
|
5151
5165
|
}
|
|
5152
5166
|
|
|
5153
5167
|
// src/editor/handlers/dialog-handlers.ts
|
|
5154
|
-
var
|
|
5168
|
+
var import_state5 = require("@tiptap/pm/state");
|
|
5169
|
+
var createHandleImageAdd = (editor, closeDialogCommand, savedPos) => {
|
|
5155
5170
|
return (attrs) => {
|
|
5156
5171
|
if (!editor) return;
|
|
5157
5172
|
const { state } = editor;
|
|
5158
|
-
const
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
|
|
5163
|
-
tr.replaceWith($
|
|
5164
|
-
|
|
5165
|
-
}
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
|
|
5173
|
+
const insertPos = savedPos ?? state.selection.from;
|
|
5174
|
+
editor.chain().focus().command(({ tr, state: state2 }) => {
|
|
5175
|
+
const $pos = state2.doc.resolve(insertPos);
|
|
5176
|
+
const imageNode = state2.schema.nodes.image.create({ ...attrs });
|
|
5177
|
+
if ($pos.parent.type.name === "paragraph" && $pos.parent.textContent === "") {
|
|
5178
|
+
tr.replaceWith($pos.before(), $pos.after(), imageNode);
|
|
5179
|
+
tr.setSelection(import_state5.TextSelection.near(tr.doc.resolve($pos.before())));
|
|
5180
|
+
} else {
|
|
5181
|
+
tr.insert(insertPos, imageNode);
|
|
5182
|
+
tr.setSelection(import_state5.TextSelection.near(tr.doc.resolve(insertPos)));
|
|
5183
|
+
}
|
|
5184
|
+
return true;
|
|
5185
|
+
}).run();
|
|
5169
5186
|
closeDialogCommand();
|
|
5170
5187
|
};
|
|
5171
5188
|
};
|
|
5172
5189
|
var createHandleImageEdit = (editor, closeDialogCommand, pos) => {
|
|
5173
5190
|
return (attrs) => {
|
|
5191
|
+
console.log("\u{1F440} ~ createHandleImageEdit ~ attrs:", attrs);
|
|
5174
5192
|
if (!editor || pos === void 0) return;
|
|
5175
5193
|
editor.chain().focus().setNodeSelection(pos).updateFigure(attrs).run();
|
|
5176
5194
|
closeDialogCommand();
|
|
5177
5195
|
};
|
|
5178
5196
|
};
|
|
5179
|
-
var createHandleVideoAdd = (editor, closeDialogCommand) => {
|
|
5197
|
+
var createHandleVideoAdd = (editor, closeDialogCommand, savedPos) => {
|
|
5180
5198
|
return (url) => {
|
|
5181
5199
|
if (!editor) return;
|
|
5182
5200
|
const { state } = editor;
|
|
5183
|
-
const
|
|
5184
|
-
editor.chain().focus().command(({ tr }) => {
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5201
|
+
const insertPos = savedPos ?? state.selection.from;
|
|
5202
|
+
editor.chain().focus().command(({ tr, state: state2 }) => {
|
|
5203
|
+
const $pos = state2.doc.resolve(insertPos);
|
|
5204
|
+
const videoNode = state2.schema.nodes.video.create({ src: url });
|
|
5205
|
+
if ($pos.parent.type.name === "paragraph" && $pos.parent.textContent === "") {
|
|
5206
|
+
tr.replaceWith($pos.before(), $pos.after(), videoNode);
|
|
5207
|
+
tr.setSelection(import_state5.TextSelection.near(tr.doc.resolve($pos.before())));
|
|
5208
|
+
} else {
|
|
5209
|
+
tr.insert(insertPos, videoNode);
|
|
5210
|
+
tr.setSelection(import_state5.TextSelection.near(tr.doc.resolve(insertPos)));
|
|
5211
|
+
}
|
|
5190
5212
|
return true;
|
|
5191
5213
|
}).run();
|
|
5192
5214
|
closeDialogCommand();
|
|
5193
5215
|
};
|
|
5194
5216
|
};
|
|
5195
|
-
var createHandleLinkAdd = (editor, closeDialogCommand) => {
|
|
5217
|
+
var createHandleLinkAdd = (editor, closeDialogCommand, savedPos) => {
|
|
5196
5218
|
return (title, url) => {
|
|
5197
5219
|
if (!editor) return;
|
|
5198
5220
|
const hasSelection = !editor.state.selection.empty;
|
|
@@ -5204,44 +5226,33 @@ var createHandleLinkAdd = (editor, closeDialogCommand) => {
|
|
|
5204
5226
|
return true;
|
|
5205
5227
|
}).run();
|
|
5206
5228
|
} else {
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
const
|
|
5211
|
-
const
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
tr.delete(nodeStart + slashIndex, $from.pos);
|
|
5215
|
-
}
|
|
5229
|
+
const { state } = editor;
|
|
5230
|
+
const insertPos = savedPos ?? state.selection.from;
|
|
5231
|
+
editor.chain().focus().command(({ tr }) => {
|
|
5232
|
+
const linkMark = editor.schema.marks.link.create({ href: url });
|
|
5233
|
+
const textNode = editor.schema.text(title, [linkMark]);
|
|
5234
|
+
tr.insert(insertPos, textNode);
|
|
5235
|
+
tr.setSelection(import_state5.TextSelection.create(tr.doc, insertPos, insertPos + title.length));
|
|
5216
5236
|
return true;
|
|
5217
|
-
}).
|
|
5237
|
+
}).run();
|
|
5218
5238
|
}
|
|
5219
5239
|
closeDialogCommand();
|
|
5220
5240
|
};
|
|
5221
5241
|
};
|
|
5222
|
-
var createHandleKatexAdd = (editor, closeDialogCommand) => {
|
|
5242
|
+
var createHandleKatexAdd = (editor, closeDialogCommand, savedPos) => {
|
|
5223
5243
|
return (latex, pos) => {
|
|
5224
5244
|
if (!editor) return;
|
|
5225
5245
|
if (pos !== void 0) {
|
|
5226
5246
|
editor.chain().setNodeSelection(pos).updateInlineMath({ latex }).focus().run();
|
|
5227
5247
|
} else {
|
|
5228
5248
|
const { state } = editor;
|
|
5229
|
-
const
|
|
5230
|
-
|
|
5231
|
-
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
|
|
5236
|
-
const deleteTo = $from.pos;
|
|
5237
|
-
editor.chain().focus().command(({ tr, state: state2 }) => {
|
|
5238
|
-
const inlineMathNode = state2.schema.nodes.inlineMath.create({ latex });
|
|
5239
|
-
tr.replaceRangeWith(deleteFrom, deleteTo, inlineMathNode);
|
|
5240
|
-
return true;
|
|
5241
|
-
}).run();
|
|
5242
|
-
} else {
|
|
5243
|
-
editor.chain().insertInlineMath({ latex }).focus().run();
|
|
5244
|
-
}
|
|
5249
|
+
const insertPos = savedPos ?? state.selection.from;
|
|
5250
|
+
editor.chain().focus().command(({ tr, state: state2 }) => {
|
|
5251
|
+
const inlineMathNode = state2.schema.nodes.inlineMath.create({ latex });
|
|
5252
|
+
tr.insert(insertPos, inlineMathNode);
|
|
5253
|
+
tr.setSelection(import_state5.TextSelection.near(tr.doc.resolve(insertPos)));
|
|
5254
|
+
return true;
|
|
5255
|
+
}).run();
|
|
5245
5256
|
}
|
|
5246
5257
|
closeDialogCommand();
|
|
5247
5258
|
};
|
|
@@ -5385,7 +5396,7 @@ var getCommandItems = (translations2, hasImageHandlers) => [
|
|
|
5385
5396
|
onClick: (editor) => {
|
|
5386
5397
|
editor.chain().focus().insertContent({
|
|
5387
5398
|
type: "callout",
|
|
5388
|
-
attrs: { type: "", bgColor: "#F7F7F8" },
|
|
5399
|
+
attrs: { type: "", bgColor: "#F7F7F8", emoji: "callout-info" },
|
|
5389
5400
|
content: [
|
|
5390
5401
|
{
|
|
5391
5402
|
type: "paragraph",
|
|
@@ -5551,7 +5562,7 @@ var filterCommandItems = (items, query) => {
|
|
|
5551
5562
|
};
|
|
5552
5563
|
|
|
5553
5564
|
// src/editor/commands/suggestion.tsx
|
|
5554
|
-
var
|
|
5565
|
+
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
5555
5566
|
var component = null;
|
|
5556
5567
|
var closeMenu = () => {
|
|
5557
5568
|
if (component) {
|
|
@@ -5565,7 +5576,7 @@ var mapCommandMenuItemToCommandItem = (item) => {
|
|
|
5565
5576
|
const IconComponent = item.icon;
|
|
5566
5577
|
return {
|
|
5567
5578
|
title: item.title,
|
|
5568
|
-
icon: /* @__PURE__ */ (0,
|
|
5579
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(IconComponent, {}),
|
|
5569
5580
|
command: ({ editor, range }) => {
|
|
5570
5581
|
editor.chain().focus().deleteRange(range).run();
|
|
5571
5582
|
item.onClick(editor);
|
|
@@ -5988,7 +5999,7 @@ function getTranslations(lang) {
|
|
|
5988
5999
|
}
|
|
5989
6000
|
|
|
5990
6001
|
// src/editor/editor.tsx
|
|
5991
|
-
var
|
|
6002
|
+
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
5992
6003
|
function TiptapContent({
|
|
5993
6004
|
content,
|
|
5994
6005
|
handleChange,
|
|
@@ -6003,6 +6014,7 @@ function TiptapContent({
|
|
|
6003
6014
|
null
|
|
6004
6015
|
);
|
|
6005
6016
|
const [editFigureContext, setEditFigureContext] = (0, import_react36.useState)(null);
|
|
6017
|
+
const [savedDialogCursorPos, setSavedDialogCursorPos] = (0, import_react36.useState)(void 0);
|
|
6006
6018
|
const { activeDialog, closeDialogCommand, openDialogCommand } = useDialogCommand();
|
|
6007
6019
|
const translations2 = useTiptapTranslations();
|
|
6008
6020
|
let safeContent;
|
|
@@ -6052,18 +6064,31 @@ function TiptapContent({
|
|
|
6052
6064
|
},
|
|
6053
6065
|
[lang]
|
|
6054
6066
|
);
|
|
6067
|
+
(0, import_react36.useEffect)(() => {
|
|
6068
|
+
if (activeDialog && editor && !editor.isDestroyed) {
|
|
6069
|
+
const pos = editor.state.selection.from;
|
|
6070
|
+
setSavedDialogCursorPos(pos);
|
|
6071
|
+
}
|
|
6072
|
+
}, [activeDialog, editor]);
|
|
6055
6073
|
const handleCloseDialog = () => {
|
|
6056
6074
|
setLinkDialogContext(null);
|
|
6057
6075
|
setKatexDialogContext(null);
|
|
6058
6076
|
setEditFigureContext(null);
|
|
6077
|
+
setSavedDialogCursorPos(void 0);
|
|
6059
6078
|
closeDialogCommand();
|
|
6060
6079
|
};
|
|
6061
|
-
const handleImageAdd =
|
|
6080
|
+
const handleImageAdd = (attrs) => {
|
|
6081
|
+
createHandleImageAdd(editor, handleCloseDialog, savedDialogCursorPos)(attrs);
|
|
6082
|
+
};
|
|
6062
6083
|
const handleImageEdit = createHandleImageEdit(editor, handleCloseDialog, editFigureContext?.pos);
|
|
6063
|
-
const handleVideoAdd =
|
|
6064
|
-
|
|
6084
|
+
const handleVideoAdd = (url) => {
|
|
6085
|
+
createHandleVideoAdd(editor, handleCloseDialog, savedDialogCursorPos)(url);
|
|
6086
|
+
};
|
|
6087
|
+
const handleLinkAdd = (title, url) => {
|
|
6088
|
+
createHandleLinkAdd(editor, handleCloseDialog, savedDialogCursorPos)(title, url);
|
|
6089
|
+
};
|
|
6065
6090
|
const handleKatexAdd = (latex) => {
|
|
6066
|
-
const katexHandler = createHandleKatexAdd(editor, handleCloseDialog);
|
|
6091
|
+
const katexHandler = createHandleKatexAdd(editor, handleCloseDialog, savedDialogCursorPos);
|
|
6067
6092
|
katexHandler(latex, katexDialogContext?.pos);
|
|
6068
6093
|
};
|
|
6069
6094
|
(0, import_react36.useEffect)(() => {
|
|
@@ -6072,9 +6097,8 @@ function TiptapContent({
|
|
|
6072
6097
|
emitUpdate: false
|
|
6073
6098
|
});
|
|
6074
6099
|
}, [content, editor]);
|
|
6075
|
-
if (!editor) return null;
|
|
6076
6100
|
const shouldBubbleMenuShow = ({ state }) => {
|
|
6077
|
-
if (state.selection instanceof
|
|
6101
|
+
if (state.selection instanceof import_state6.NodeSelection) {
|
|
6078
6102
|
return false;
|
|
6079
6103
|
}
|
|
6080
6104
|
if (state.selection.empty) {
|
|
@@ -6085,16 +6109,17 @@ function TiptapContent({
|
|
|
6085
6109
|
}
|
|
6086
6110
|
return true;
|
|
6087
6111
|
};
|
|
6088
|
-
|
|
6089
|
-
|
|
6090
|
-
|
|
6091
|
-
!isDisabled && /* @__PURE__ */ (0,
|
|
6112
|
+
if (!editor) return null;
|
|
6113
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(import_jsx_runtime93.Fragment, { children: [
|
|
6114
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(DragHandle, { editor }),
|
|
6115
|
+
isEditable && !isDisabled && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(TableMenu, { editor }),
|
|
6116
|
+
isEditable && !isDisabled && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
6092
6117
|
import_menus.BubbleMenu,
|
|
6093
6118
|
{
|
|
6094
6119
|
shouldShow: shouldBubbleMenuShow,
|
|
6095
6120
|
editor,
|
|
6096
6121
|
options: { placement: "bottom", offset: 8, flip: true },
|
|
6097
|
-
children: /* @__PURE__ */ (0,
|
|
6122
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
6098
6123
|
BubbleMenuContent,
|
|
6099
6124
|
{
|
|
6100
6125
|
editor,
|
|
@@ -6103,63 +6128,65 @@ function TiptapContent({
|
|
|
6103
6128
|
)
|
|
6104
6129
|
}
|
|
6105
6130
|
),
|
|
6106
|
-
/* @__PURE__ */ (0,
|
|
6131
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
|
|
6107
6132
|
"div",
|
|
6108
6133
|
{
|
|
6109
6134
|
className: `tiptap-content-wrapper ${!!error ? "has-error" : ""} ${isDisabled ? "is-disabled" : ""}`,
|
|
6110
6135
|
children: [
|
|
6111
|
-
/* @__PURE__ */ (0,
|
|
6112
|
-
isEditable && !isDisabled && /* @__PURE__ */ (0,
|
|
6136
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_react37.EditorContent, { editor }),
|
|
6137
|
+
isEditable && !isDisabled && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(CharacterCount, { editor })
|
|
6113
6138
|
]
|
|
6114
6139
|
}
|
|
6115
6140
|
),
|
|
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
|
-
|
|
6141
|
+
!!error && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("p", { className: "tiptap-error-message", children: error }),
|
|
6142
|
+
isEditable && /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(import_jsx_runtime93.Fragment, { children: [
|
|
6143
|
+
activeDialog === "image" && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
6144
|
+
ImageDialog,
|
|
6145
|
+
{
|
|
6146
|
+
open: true,
|
|
6147
|
+
onClose: handleCloseDialog,
|
|
6148
|
+
onImageAdd: handleImageAdd,
|
|
6149
|
+
onImageEdit: handleImageEdit,
|
|
6150
|
+
uploadHandler: imageHandlers?.upload,
|
|
6151
|
+
getImageById: imageHandlers?.getImage,
|
|
6152
|
+
initialAttrs: editFigureContext?.attrs || void 0,
|
|
6153
|
+
mode: editFigureContext ? "edit" : "add"
|
|
6154
|
+
}
|
|
6155
|
+
),
|
|
6156
|
+
activeDialog === "link" && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
6157
|
+
AddLinkDialog,
|
|
6158
|
+
{
|
|
6159
|
+
open: true,
|
|
6160
|
+
onClose: handleCloseDialog,
|
|
6161
|
+
onLinkAdd: handleLinkAdd,
|
|
6162
|
+
initialTitle: linkDialogContext?.selectedText || "",
|
|
6163
|
+
initialUrl: linkDialogContext?.url || ""
|
|
6164
|
+
}
|
|
6165
|
+
),
|
|
6166
|
+
activeDialog === "video" && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
6167
|
+
AddVideoDialog,
|
|
6168
|
+
{
|
|
6169
|
+
open: true,
|
|
6170
|
+
onClose: handleCloseDialog,
|
|
6171
|
+
onVideoAdd: handleVideoAdd
|
|
6172
|
+
}
|
|
6173
|
+
),
|
|
6174
|
+
activeDialog === "katex" && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
6175
|
+
AddKatexDialog,
|
|
6176
|
+
{
|
|
6177
|
+
open: true,
|
|
6178
|
+
onClose: handleCloseDialog,
|
|
6179
|
+
onKatexAdd: handleKatexAdd,
|
|
6180
|
+
initialContent: katexDialogContext?.latex || ""
|
|
6181
|
+
}
|
|
6182
|
+
)
|
|
6183
|
+
] })
|
|
6157
6184
|
] });
|
|
6158
6185
|
}
|
|
6159
6186
|
var Tiptap = (props) => {
|
|
6160
6187
|
const { lang = "ru" } = props;
|
|
6161
6188
|
const translations2 = getTranslations(lang);
|
|
6162
|
-
return /* @__PURE__ */ (0,
|
|
6189
|
+
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
6190
|
};
|
|
6164
6191
|
// Annotate the CommonJS export names for ESM import in node:
|
|
6165
6192
|
0 && (module.exports = {
|