@tnd028/strapi-plugin-tiptap-editor 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/README.md +3 -0
  2. package/dist/_chunks/Alignment-B0f2-LO0.js +135 -0
  3. package/dist/_chunks/Alignment-qMOzO-n2.mjs +133 -0
  4. package/dist/_chunks/Blockquote-9wBGDz3L.mjs +34 -0
  5. package/dist/_chunks/Blockquote-DeGUfK27.js +36 -0
  6. package/dist/_chunks/Bold-C-0g6Ayd.mjs +46 -0
  7. package/dist/_chunks/Bold-ClnPsPHt.js +48 -0
  8. package/dist/_chunks/ColorAndHighlight-BMmtoSpj.js +217 -0
  9. package/dist/_chunks/ColorAndHighlight-t1Ui5tcL.mjs +215 -0
  10. package/dist/_chunks/Emoji-Bm1_vSh5.mjs +263 -0
  11. package/dist/_chunks/Emoji-C-LQZ4Z3.js +265 -0
  12. package/dist/_chunks/Heading-BDJqd1Qw.js +125 -0
  13. package/dist/_chunks/Heading-BycRob5M.mjs +123 -0
  14. package/dist/_chunks/HorizontalRule-CJlDmdma.js +34 -0
  15. package/dist/_chunks/HorizontalRule-CzQCeC3b.mjs +32 -0
  16. package/dist/_chunks/Iframe-DCBWSb0v.mjs +165 -0
  17. package/dist/_chunks/Iframe-Dyn_2cMB.js +167 -0
  18. package/dist/_chunks/ImagePlaceholder-C14kojd5.js +71 -0
  19. package/dist/_chunks/ImagePlaceholder-DtrSuhf_.mjs +69 -0
  20. package/dist/_chunks/Italic-BfpKX0KX.mjs +34 -0
  21. package/dist/_chunks/Italic-DdhVL78v.js +36 -0
  22. package/dist/_chunks/Link-BuYDqSqo.js +61 -0
  23. package/dist/_chunks/Link-DUV5Ybep.mjs +59 -0
  24. package/dist/_chunks/Lists-BKopoFR6.js +107 -0
  25. package/dist/_chunks/Lists-DsKxj3MD.mjs +105 -0
  26. package/dist/_chunks/Redo-1mEX1yOd.js +35 -0
  27. package/dist/_chunks/Redo-Ca3VQxSe.mjs +33 -0
  28. package/dist/_chunks/SearchAndReplace-DmU5DlWv.mjs +347 -0
  29. package/dist/_chunks/SearchAndReplace-DzNdbTWJ.js +349 -0
  30. package/dist/_chunks/Strikethrough-BygxCHak.mjs +121 -0
  31. package/dist/_chunks/Strikethrough-DQfR4OFk.js +123 -0
  32. package/dist/_chunks/Table-BhbZ2Blv.mjs +123 -0
  33. package/dist/_chunks/Table-DLaqBAbz.js +125 -0
  34. package/dist/_chunks/TiptapEditorInput-BDE09h5-.mjs +6802 -0
  35. package/dist/_chunks/TiptapEditorInput-vfLsCt1p.js +6854 -0
  36. package/dist/_chunks/Undo-BuT4OkoE.js +32 -0
  37. package/dist/_chunks/Undo-PL5n4axf.mjs +30 -0
  38. package/dist/_chunks/en-B4KWt_jN.js +4 -0
  39. package/dist/_chunks/en-Byx4XI2L.mjs +4 -0
  40. package/dist/_chunks/index-ku90UbIF.mjs +1397 -0
  41. package/dist/_chunks/index-wYDv8vsJ.js +1398 -0
  42. package/dist/admin/index.js +6 -0
  43. package/dist/admin/index.mjs +6 -0
  44. package/dist/admin/src/components/ContentEditorInput.d.ts +10 -0
  45. package/dist/admin/src/components/GlobalStyling.d.ts +4 -0
  46. package/dist/admin/src/components/Initializer.d.ts +5 -0
  47. package/dist/admin/src/components/MediaLibraryModal.d.ts +27 -0
  48. package/dist/admin/src/components/PluginIcon.d.ts +2 -0
  49. package/dist/admin/src/components/TextEditorInput.d.ts +10 -0
  50. package/dist/admin/src/components/TiptapEditorInput.d.ts +6 -0
  51. package/dist/admin/src/components/editor/BaseEditor.d.ts +22 -0
  52. package/dist/admin/src/components/editor/ContentEditor.d.ts +10 -0
  53. package/dist/admin/src/components/editor/TextEditor.d.ts +10 -0
  54. package/dist/admin/src/components/editor/extensions/Heading.d.ts +2 -0
  55. package/dist/admin/src/components/editor/extensions/Iframe.d.ts +24 -0
  56. package/dist/admin/src/components/editor/extensions/Image.d.ts +3 -0
  57. package/dist/admin/src/components/editor/extensions/ImagePlaceholder.d.ts +15 -0
  58. package/dist/admin/src/components/editor/extensions/custom-component/CustomComponentEditPopover.d.ts +1 -0
  59. package/dist/admin/src/components/editor/extensions/custom-component/CustomComponentExtension.d.ts +3 -0
  60. package/dist/admin/src/components/editor/extensions/custom-component/CustomComponentInsertPopover.d.ts +13 -0
  61. package/dist/admin/src/components/editor/extensions/custom-component/CustomComponentRenderer.d.ts +1 -0
  62. package/dist/admin/src/components/editor/extensions/custom-component/Store.d.ts +20 -0
  63. package/dist/admin/src/components/editor/extensions/custom-component/types.d.ts +33 -0
  64. package/dist/admin/src/components/editor/extensions/fileHandler.d.ts +12 -0
  65. package/dist/admin/src/components/editor/extensions/link.d.ts +1 -0
  66. package/dist/admin/src/components/editor/extensions/noNewLine.d.ts +2 -0
  67. package/dist/admin/src/components/editor/extensions/resetMarksOnEnter.d.ts +2 -0
  68. package/dist/admin/src/components/editor/extensions/searchAndReplace.d.ts +53 -0
  69. package/dist/admin/src/components/editor/partials/EditorProvider.d.ts +13 -0
  70. package/dist/admin/src/components/editor/partials/LinkBubbleMenu.d.ts +5 -0
  71. package/dist/admin/src/components/editor/partials/LinkEditBlock.d.ts +9 -0
  72. package/dist/admin/src/components/editor/partials/LinkPopoverBlock.d.ts +8 -0
  73. package/dist/admin/src/components/editor/partials/ToolbarButton.d.ts +11 -0
  74. package/dist/admin/src/components/editor/partials/ToolbarButtons.d.ts +25 -0
  75. package/dist/admin/src/components/editor/toolbars/Alignment.d.ts +1 -0
  76. package/dist/admin/src/components/editor/toolbars/Blockquote.d.ts +4 -0
  77. package/dist/admin/src/components/editor/toolbars/Bold.d.ts +4 -0
  78. package/dist/admin/src/components/editor/toolbars/BulletList.d.ts +4 -0
  79. package/dist/admin/src/components/editor/toolbars/ColorAndHighlight.d.ts +5 -0
  80. package/dist/admin/src/components/editor/toolbars/Emoji.d.ts +4 -0
  81. package/dist/admin/src/components/editor/toolbars/Heading.d.ts +1 -0
  82. package/dist/admin/src/components/editor/toolbars/HorizontalRule.d.ts +4 -0
  83. package/dist/admin/src/components/editor/toolbars/Iframe.d.ts +3 -0
  84. package/dist/admin/src/components/editor/toolbars/ImagePlaceholder.d.ts +4 -0
  85. package/dist/admin/src/components/editor/toolbars/Italic.d.ts +4 -0
  86. package/dist/admin/src/components/editor/toolbars/Link.d.ts +4 -0
  87. package/dist/admin/src/components/editor/toolbars/Lists.d.ts +1 -0
  88. package/dist/admin/src/components/editor/toolbars/OrderedList.d.ts +4 -0
  89. package/dist/admin/src/components/editor/toolbars/Redo.d.ts +4 -0
  90. package/dist/admin/src/components/editor/toolbars/SearchAndReplace.d.ts +1 -0
  91. package/dist/admin/src/components/editor/toolbars/Strikethrough.d.ts +4 -0
  92. package/dist/admin/src/components/editor/toolbars/Table.d.ts +1 -0
  93. package/dist/admin/src/components/editor/toolbars/Undo.d.ts +4 -0
  94. package/dist/admin/src/components/editor/useEditor.d.ts +18 -0
  95. package/dist/admin/src/components/editor/utils.d.ts +28 -0
  96. package/dist/admin/src/components/ui/button.d.ts +9 -0
  97. package/dist/admin/src/components/ui/dropdown-menu.d.ts +27 -0
  98. package/dist/admin/src/components/ui/input.d.ts +6 -0
  99. package/dist/admin/src/components/ui/label.d.ts +7 -0
  100. package/dist/admin/src/components/ui/separator.d.ts +7 -0
  101. package/dist/admin/src/components/ui/toggle.d.ts +17 -0
  102. package/dist/admin/src/components/ui/tooltip.d.ts +7 -0
  103. package/dist/admin/src/config/index.d.ts +2 -0
  104. package/dist/admin/src/config/pluginConfig.d.ts +20 -0
  105. package/dist/admin/src/config/types.d.ts +109 -0
  106. package/dist/admin/src/errorSlicer.d.ts +4 -0
  107. package/dist/admin/src/exports.d.ts +4 -0
  108. package/dist/admin/src/hooks/useDebounceCallback.d.ts +9 -0
  109. package/dist/admin/src/index.d.ts +25 -0
  110. package/dist/admin/src/pluginId.d.ts +5 -0
  111. package/dist/admin/src/theme/additional.d.ts +1 -0
  112. package/dist/admin/src/theme/colorScheme.d.ts +2 -0
  113. package/dist/admin/src/theme/colors.d.ts +1 -0
  114. package/dist/admin/src/theme/common.d.ts +1 -0
  115. package/dist/admin/src/theme/index.d.ts +2 -0
  116. package/dist/admin/src/types.d.ts +15 -0
  117. package/dist/admin/src/utils/dom.d.ts +7 -0
  118. package/dist/admin/src/utils/getTranslation.d.ts +7 -0
  119. package/dist/admin/src/utils/isImageResponsive.d.ts +8 -0
  120. package/dist/admin/src/utils/localStorage.d.ts +21 -0
  121. package/dist/admin/src/utils/prefixWithBackendUrl.d.ts +6 -0
  122. package/dist/admin/src/utils/utils.d.ts +7 -0
  123. package/dist/server/index.js +15 -0
  124. package/dist/server/index.mjs +16 -0
  125. package/dist/server/src/index.d.ts +7 -0
  126. package/package.json +116 -0
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # strapi-plugin-tiptap-editor
2
+
3
+ Tiptap editor for Strapi 5
@@ -0,0 +1,135 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const lucideReact = require("lucide-react");
5
+ const TiptapEditorInput = require("./TiptapEditorInput-vfLsCt1p.js");
6
+ const styled = require("styled-components");
7
+ const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
8
+ const styled__default = /* @__PURE__ */ _interopDefault(styled);
9
+ const DropdownMenuItemStyled = styled__default.default(TiptapEditorInput.DropdownMenuItem)`
10
+ display: flex;
11
+ align-items: center;
12
+ gap: 2px;
13
+ padding: 6px 8px 6px 4px;
14
+ font-size: 14px;
15
+
16
+ &:hover {
17
+ background-color: ${(props) => props.theme.colors.neutral100};
18
+ }
19
+
20
+ &:focus {
21
+ background-color: ${(props) => props.theme.colors.neutral100};
22
+ }
23
+
24
+ svg {
25
+ width: 16px;
26
+ height: 16px;
27
+ }
28
+ `;
29
+ const CheckIcon = styled__default.default(lucideReact.Check)`
30
+ width: 12px;
31
+ height: 12px;
32
+ color: ${(props) => props.theme.colors.primary500};
33
+ `;
34
+ const IconWrapper = styled__default.default.div`
35
+ display: flex;
36
+ align-items: center;
37
+ justify-content: center;
38
+ width: 16px;
39
+ height: 20px;
40
+ margin-right: 4px;
41
+ `;
42
+ const StyledTooltipContent = styled__default.default(TiptapEditorInput.TooltipContent)`
43
+ background-color: ${(props) => props.theme.colors.neutral800};
44
+ color: ${(props) => props.theme.colors.neutral0};
45
+ padding: 6px 8px;
46
+ border-radius: 4px;
47
+ font-size: 12px;
48
+ z-index: 100;
49
+ `;
50
+ const AlignmentToolbar = () => {
51
+ const { editor } = TiptapEditorInput.useEditorContext();
52
+ const handleAlign = (value) => {
53
+ editor?.chain().focus().setTextAlign(value).run();
54
+ };
55
+ const isDisabled = (editor?.isActive("image") || editor?.isActive("video") || !editor) ?? false;
56
+ const currentTextAlign = () => {
57
+ if (editor?.isActive({ textAlign: "left" })) {
58
+ return "left";
59
+ }
60
+ if (editor?.isActive({ textAlign: "center" })) {
61
+ return "center";
62
+ }
63
+ if (editor?.isActive({ textAlign: "right" })) {
64
+ return "right";
65
+ }
66
+ if (editor?.isActive({ textAlign: "justify" })) {
67
+ return "justify";
68
+ }
69
+ return "left";
70
+ };
71
+ const alignmentOptions = [
72
+ {
73
+ name: "Left Align",
74
+ value: "left",
75
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlignLeft, {})
76
+ },
77
+ {
78
+ name: "Center Align",
79
+ value: "center",
80
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlignCenter, {})
81
+ },
82
+ {
83
+ name: "Right Align",
84
+ value: "right",
85
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlignRight, {})
86
+ },
87
+ {
88
+ name: "Justify Align",
89
+ value: "justify",
90
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlignJustify, {})
91
+ }
92
+ ];
93
+ const findIndex = (value) => {
94
+ return alignmentOptions.findIndex((option) => option.value === value);
95
+ };
96
+ const currentAlignment = currentTextAlign();
97
+ const currentOption = alignmentOptions[findIndex(currentAlignment)];
98
+ return /* @__PURE__ */ jsxRuntime.jsxs(TiptapEditorInput.DropdownMenu, { children: [
99
+ /* @__PURE__ */ jsxRuntime.jsxs(TiptapEditorInput.Tooltip, { children: [
100
+ /* @__PURE__ */ jsxRuntime.jsx(TiptapEditorInput.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(TiptapEditorInput.DropdownMenuTrigger, { disabled: isDisabled, asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
101
+ TiptapEditorInput.ToolbarButton,
102
+ {
103
+ "aria-label": "Text Alignment",
104
+ disabled: isDisabled,
105
+ hasArrow: true,
106
+ children: currentOption.icon && /* @__PURE__ */ jsxRuntime.jsx(currentOption.icon.type, { size: 16 })
107
+ }
108
+ ) }) }),
109
+ /* @__PURE__ */ jsxRuntime.jsx(StyledTooltipContent, { children: "Text Alignment" })
110
+ ] }),
111
+ /* @__PURE__ */ jsxRuntime.jsx(
112
+ TiptapEditorInput.DropdownMenuContent,
113
+ {
114
+ align: "start",
115
+ loop: true,
116
+ onCloseAutoFocus: (e) => {
117
+ e.preventDefault();
118
+ },
119
+ children: /* @__PURE__ */ jsxRuntime.jsx(TiptapEditorInput.DropdownMenuGroup, { children: alignmentOptions.map((option, index) => /* @__PURE__ */ jsxRuntime.jsxs(
120
+ DropdownMenuItemStyled,
121
+ {
122
+ onSelect: () => handleAlign(option.value),
123
+ children: [
124
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { width: 12, height: 12, display: "flex", alignItems: "center", justifyContent: "center" }, children: option.value === currentAlignment && /* @__PURE__ */ jsxRuntime.jsx(CheckIcon, {}) }),
125
+ /* @__PURE__ */ jsxRuntime.jsx(IconWrapper, { children: option.icon }),
126
+ option.name
127
+ ]
128
+ },
129
+ index
130
+ )) })
131
+ }
132
+ )
133
+ ] });
134
+ };
135
+ exports.AlignmentToolbar = AlignmentToolbar;
@@ -0,0 +1,133 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { AlignLeft, AlignCenter, AlignRight, AlignJustify, Check } from "lucide-react";
3
+ import { u as useEditorContext, D as DropdownMenu, e as Tooltip, f as TooltipTrigger, a as DropdownMenuTrigger, T as ToolbarButton, b as DropdownMenuContent, c as DropdownMenuGroup, g as TooltipContent, d as DropdownMenuItem } from "./TiptapEditorInput-BDE09h5-.mjs";
4
+ import styled from "styled-components";
5
+ const DropdownMenuItemStyled = styled(DropdownMenuItem)`
6
+ display: flex;
7
+ align-items: center;
8
+ gap: 2px;
9
+ padding: 6px 8px 6px 4px;
10
+ font-size: 14px;
11
+
12
+ &:hover {
13
+ background-color: ${(props) => props.theme.colors.neutral100};
14
+ }
15
+
16
+ &:focus {
17
+ background-color: ${(props) => props.theme.colors.neutral100};
18
+ }
19
+
20
+ svg {
21
+ width: 16px;
22
+ height: 16px;
23
+ }
24
+ `;
25
+ const CheckIcon = styled(Check)`
26
+ width: 12px;
27
+ height: 12px;
28
+ color: ${(props) => props.theme.colors.primary500};
29
+ `;
30
+ const IconWrapper = styled.div`
31
+ display: flex;
32
+ align-items: center;
33
+ justify-content: center;
34
+ width: 16px;
35
+ height: 20px;
36
+ margin-right: 4px;
37
+ `;
38
+ const StyledTooltipContent = styled(TooltipContent)`
39
+ background-color: ${(props) => props.theme.colors.neutral800};
40
+ color: ${(props) => props.theme.colors.neutral0};
41
+ padding: 6px 8px;
42
+ border-radius: 4px;
43
+ font-size: 12px;
44
+ z-index: 100;
45
+ `;
46
+ const AlignmentToolbar = () => {
47
+ const { editor } = useEditorContext();
48
+ const handleAlign = (value) => {
49
+ editor?.chain().focus().setTextAlign(value).run();
50
+ };
51
+ const isDisabled = (editor?.isActive("image") || editor?.isActive("video") || !editor) ?? false;
52
+ const currentTextAlign = () => {
53
+ if (editor?.isActive({ textAlign: "left" })) {
54
+ return "left";
55
+ }
56
+ if (editor?.isActive({ textAlign: "center" })) {
57
+ return "center";
58
+ }
59
+ if (editor?.isActive({ textAlign: "right" })) {
60
+ return "right";
61
+ }
62
+ if (editor?.isActive({ textAlign: "justify" })) {
63
+ return "justify";
64
+ }
65
+ return "left";
66
+ };
67
+ const alignmentOptions = [
68
+ {
69
+ name: "Left Align",
70
+ value: "left",
71
+ icon: /* @__PURE__ */ jsx(AlignLeft, {})
72
+ },
73
+ {
74
+ name: "Center Align",
75
+ value: "center",
76
+ icon: /* @__PURE__ */ jsx(AlignCenter, {})
77
+ },
78
+ {
79
+ name: "Right Align",
80
+ value: "right",
81
+ icon: /* @__PURE__ */ jsx(AlignRight, {})
82
+ },
83
+ {
84
+ name: "Justify Align",
85
+ value: "justify",
86
+ icon: /* @__PURE__ */ jsx(AlignJustify, {})
87
+ }
88
+ ];
89
+ const findIndex = (value) => {
90
+ return alignmentOptions.findIndex((option) => option.value === value);
91
+ };
92
+ const currentAlignment = currentTextAlign();
93
+ const currentOption = alignmentOptions[findIndex(currentAlignment)];
94
+ return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
95
+ /* @__PURE__ */ jsxs(Tooltip, { children: [
96
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(DropdownMenuTrigger, { disabled: isDisabled, asChild: true, children: /* @__PURE__ */ jsx(
97
+ ToolbarButton,
98
+ {
99
+ "aria-label": "Text Alignment",
100
+ disabled: isDisabled,
101
+ hasArrow: true,
102
+ children: currentOption.icon && /* @__PURE__ */ jsx(currentOption.icon.type, { size: 16 })
103
+ }
104
+ ) }) }),
105
+ /* @__PURE__ */ jsx(StyledTooltipContent, { children: "Text Alignment" })
106
+ ] }),
107
+ /* @__PURE__ */ jsx(
108
+ DropdownMenuContent,
109
+ {
110
+ align: "start",
111
+ loop: true,
112
+ onCloseAutoFocus: (e) => {
113
+ e.preventDefault();
114
+ },
115
+ children: /* @__PURE__ */ jsx(DropdownMenuGroup, { children: alignmentOptions.map((option, index) => /* @__PURE__ */ jsxs(
116
+ DropdownMenuItemStyled,
117
+ {
118
+ onSelect: () => handleAlign(option.value),
119
+ children: [
120
+ /* @__PURE__ */ jsx("div", { style: { width: 12, height: 12, display: "flex", alignItems: "center", justifyContent: "center" }, children: option.value === currentAlignment && /* @__PURE__ */ jsx(CheckIcon, {}) }),
121
+ /* @__PURE__ */ jsx(IconWrapper, { children: option.icon }),
122
+ option.name
123
+ ]
124
+ },
125
+ index
126
+ )) })
127
+ }
128
+ )
129
+ ] });
130
+ };
131
+ export {
132
+ AlignmentToolbar
133
+ };
@@ -0,0 +1,34 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import { TextQuote } from "lucide-react";
4
+ import { u as useEditorContext, T as ToolbarButton } from "./TiptapEditorInput-BDE09h5-.mjs";
5
+ import styled from "styled-components";
6
+ const QuoteIcon = styled(TextQuote)`
7
+ width: 16px;
8
+ height: 16px;
9
+ `;
10
+ const BlockquoteToolbar = forwardRef(
11
+ ({ className, onClick, children, ...props }, ref) => {
12
+ const { editor } = useEditorContext();
13
+ return /* @__PURE__ */ jsx(
14
+ ToolbarButton,
15
+ {
16
+ tooltip: "Blockquote",
17
+ "aria-label": "Insert blockquote",
18
+ isActive: editor?.isActive("blockquote"),
19
+ onClick: (e) => {
20
+ editor?.chain().focus().toggleBlockquote().run();
21
+ onClick?.(e);
22
+ },
23
+ disabled: !editor?.can().chain().focus().toggleBlockquote().run(),
24
+ ref,
25
+ ...props,
26
+ children: children || /* @__PURE__ */ jsx(QuoteIcon, {})
27
+ }
28
+ );
29
+ }
30
+ );
31
+ BlockquoteToolbar.displayName = "BlockquoteToolbar";
32
+ export {
33
+ BlockquoteToolbar
34
+ };
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const React = require("react");
5
+ const lucideReact = require("lucide-react");
6
+ const TiptapEditorInput = require("./TiptapEditorInput-vfLsCt1p.js");
7
+ const styled = require("styled-components");
8
+ const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
9
+ const styled__default = /* @__PURE__ */ _interopDefault(styled);
10
+ const QuoteIcon = styled__default.default(lucideReact.TextQuote)`
11
+ width: 16px;
12
+ height: 16px;
13
+ `;
14
+ const BlockquoteToolbar = React.forwardRef(
15
+ ({ className, onClick, children, ...props }, ref) => {
16
+ const { editor } = TiptapEditorInput.useEditorContext();
17
+ return /* @__PURE__ */ jsxRuntime.jsx(
18
+ TiptapEditorInput.ToolbarButton,
19
+ {
20
+ tooltip: "Blockquote",
21
+ "aria-label": "Insert blockquote",
22
+ isActive: editor?.isActive("blockquote"),
23
+ onClick: (e) => {
24
+ editor?.chain().focus().toggleBlockquote().run();
25
+ onClick?.(e);
26
+ },
27
+ disabled: !editor?.can().chain().focus().toggleBlockquote().run(),
28
+ ref,
29
+ ...props,
30
+ children: children || /* @__PURE__ */ jsxRuntime.jsx(QuoteIcon, {})
31
+ }
32
+ );
33
+ }
34
+ );
35
+ BlockquoteToolbar.displayName = "BlockquoteToolbar";
36
+ exports.BlockquoteToolbar = BlockquoteToolbar;
@@ -0,0 +1,46 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { forwardRef, Fragment } from "react";
3
+ import { BoldIcon } from "lucide-react";
4
+ import { u as useEditorContext, T as ToolbarButton } from "./TiptapEditorInput-BDE09h5-.mjs";
5
+ import styled from "styled-components";
6
+ const BoldIconStyled = styled(BoldIcon)`
7
+ width: 16px;
8
+ height: 16px;
9
+ `;
10
+ const TooltipContent = styled.div`
11
+ display: flex;
12
+ align-items: center;
13
+ gap: 4px;
14
+ `;
15
+ const ShortcutText = styled.span`
16
+ font-size: 11px;
17
+ color: ${(props) => props.theme.colors.neutral600};
18
+ `;
19
+ const BoldToolbar = forwardRef(
20
+ ({ className, onClick, children, ...props }, ref) => {
21
+ const { editor } = useEditorContext();
22
+ return /* @__PURE__ */ jsx(
23
+ ToolbarButton,
24
+ {
25
+ tooltip: /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(TooltipContent, { children: [
26
+ /* @__PURE__ */ jsx("span", { children: "Bold" }),
27
+ /* @__PURE__ */ jsx(ShortcutText, { children: "(cmd + b)" })
28
+ ] }) }),
29
+ "aria-label": "Set bold",
30
+ isActive: editor?.isActive("bold"),
31
+ onClick: (e) => {
32
+ editor?.chain().focus().toggleBold().run();
33
+ onClick?.(e);
34
+ },
35
+ disabled: !editor?.can().chain().focus().toggleBold().run(),
36
+ ref,
37
+ ...props,
38
+ children: children || /* @__PURE__ */ jsx(BoldIconStyled, {})
39
+ }
40
+ );
41
+ }
42
+ );
43
+ BoldToolbar.displayName = "BoldToolbar";
44
+ export {
45
+ BoldToolbar
46
+ };
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const React = require("react");
5
+ const lucideReact = require("lucide-react");
6
+ const TiptapEditorInput = require("./TiptapEditorInput-vfLsCt1p.js");
7
+ const styled = require("styled-components");
8
+ const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
9
+ const styled__default = /* @__PURE__ */ _interopDefault(styled);
10
+ const BoldIconStyled = styled__default.default(lucideReact.BoldIcon)`
11
+ width: 16px;
12
+ height: 16px;
13
+ `;
14
+ const TooltipContent = styled__default.default.div`
15
+ display: flex;
16
+ align-items: center;
17
+ gap: 4px;
18
+ `;
19
+ const ShortcutText = styled__default.default.span`
20
+ font-size: 11px;
21
+ color: ${(props) => props.theme.colors.neutral600};
22
+ `;
23
+ const BoldToolbar = React.forwardRef(
24
+ ({ className, onClick, children, ...props }, ref) => {
25
+ const { editor } = TiptapEditorInput.useEditorContext();
26
+ return /* @__PURE__ */ jsxRuntime.jsx(
27
+ TiptapEditorInput.ToolbarButton,
28
+ {
29
+ tooltip: /* @__PURE__ */ jsxRuntime.jsx(React.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(TooltipContent, { children: [
30
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Bold" }),
31
+ /* @__PURE__ */ jsxRuntime.jsx(ShortcutText, { children: "(cmd + b)" })
32
+ ] }) }),
33
+ "aria-label": "Set bold",
34
+ isActive: editor?.isActive("bold"),
35
+ onClick: (e) => {
36
+ editor?.chain().focus().toggleBold().run();
37
+ onClick?.(e);
38
+ },
39
+ disabled: !editor?.can().chain().focus().toggleBold().run(),
40
+ ref,
41
+ ...props,
42
+ children: children || /* @__PURE__ */ jsxRuntime.jsx(BoldIconStyled, {})
43
+ }
44
+ );
45
+ }
46
+ );
47
+ BoldToolbar.displayName = "BoldToolbar";
48
+ exports.BoldToolbar = BoldToolbar;
@@ -0,0 +1,217 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const designSystem = require("@strapi/design-system");
5
+ const lucideReact = require("lucide-react");
6
+ const React = require("react");
7
+ const styled = require("styled-components");
8
+ const TiptapEditorInput = require("./TiptapEditorInput-vfLsCt1p.js");
9
+ const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
10
+ const styled__default = /* @__PURE__ */ _interopDefault(styled);
11
+ const TEXT_COLORS = [
12
+ { name: "Default", color: "inherit" },
13
+ { name: "Gray", color: "#6B7280" },
14
+ { name: "Brown", color: "#92400E" },
15
+ { name: "Orange", color: "#EA580C" },
16
+ { name: "Yellow", color: "#CA8A04" },
17
+ { name: "Green", color: "#16A34A" },
18
+ { name: "Blue", color: "#2563EB" },
19
+ { name: "Purple", color: "#9333EA" },
20
+ { name: "Pink", color: "#DB2777" },
21
+ { name: "Red", color: "#DC2626" }
22
+ ];
23
+ const HIGHLIGHT_COLORS = [
24
+ { name: "Default", color: "transparent" },
25
+ { name: "Gray", color: "#F3F4F6" },
26
+ { name: "Brown", color: "#FEF3C7" },
27
+ { name: "Orange", color: "#FFEDD5" },
28
+ { name: "Yellow", color: "#FEF9C3" },
29
+ { name: "Green", color: "#DCFCE7" },
30
+ { name: "Blue", color: "#DBEAFE" },
31
+ { name: "Purple", color: "#F3E8FF" },
32
+ { name: "Pink", color: "#FCE7F3" },
33
+ { name: "Red", color: "#FEE2E2" }
34
+ ];
35
+ const ColorGrid = styled__default.default.div`
36
+ display: grid;
37
+ grid-template-columns: repeat(5, 1fr);
38
+ gap: 4px;
39
+ `;
40
+ const CompactColorButton = styled__default.default.button`
41
+ width: 24px;
42
+ height: 24px;
43
+ border-radius: 4px;
44
+ cursor: pointer;
45
+ display: flex;
46
+ align-items: center;
47
+ justify-content: center;
48
+ border: 1px solid ${(props) => props.theme.colors.neutral200};
49
+
50
+ ${(props) => props.$isHighlight ? `background-color: ${props.$color}; color: ${props.theme.colors.neutral800};` : `background-color: transparent; color: ${props.$color === "inherit" ? props.theme.colors.neutral800 : props.$color};`}
51
+
52
+ ${(props) => props.$color === "inherit" && !props.$isHighlight && `
53
+ background: linear-gradient(to bottom right, transparent 48%, #ff0000 48%, #ff0000 52%, transparent 52%);
54
+ border-color: ${props.theme.colors.neutral300};
55
+ color: ${props.theme.colors.neutral800};
56
+ `}
57
+
58
+ ${(props) => props.$color === "transparent" && props.$isHighlight && `
59
+ background: linear-gradient(to bottom right, transparent 48%, #ff0000 48%, #ff0000 52%, transparent 52%);
60
+ background-color: ${props.theme.colors.neutral100};
61
+ `}
62
+
63
+ &:hover {
64
+ border-color: ${(props) => props.theme.colors.primary500};
65
+ box-shadow: 0 2px 4px rgba(0,0,0,0.1);
66
+ }
67
+
68
+ ${(props) => props.$isActive && `
69
+ border-color: ${props.theme.colors.primary600};
70
+ box-shadow: 0 0 0 1px ${props.theme.colors.primary600};
71
+ transform: scale(1.05);
72
+ `}
73
+ `;
74
+ const CheckIcon = styled__default.default(lucideReact.Check)`
75
+ width: 12px;
76
+ height: 12px;
77
+ color: ${(props) => props.theme.colors.neutral800};
78
+ filter: drop-shadow(0 0 1px white);
79
+ `;
80
+ const SectionTitle = styled__default.default.div`
81
+ margin: 6px 0;
82
+ padding: 0 4px;
83
+ font-size: 11px;
84
+ text-transform: uppercase;
85
+ letter-spacing: 0.5px;
86
+ font-weight: 600;
87
+ color: ${(props) => props.theme.colors.neutral600};
88
+ `;
89
+ const ChevronIcon = styled__default.default(lucideReact.ChevronDown)`
90
+ width: 12px;
91
+ height: 12px;
92
+ `;
93
+ const ToolbarContentWrapper = styled__default.default.div`
94
+ display: flex;
95
+ align-items: center;
96
+ gap: 2px;
97
+ padding: 0 2px 0 2px;
98
+ `;
99
+ const ToolbarContent = ({ children, dropdown }) => /* @__PURE__ */ jsxRuntime.jsxs(ToolbarContentWrapper, { children: [
100
+ children,
101
+ dropdown && /* @__PURE__ */ jsxRuntime.jsx(ChevronIcon, {})
102
+ ] });
103
+ const PopoverContent = styled__default.default(designSystem.Popover.Content)`
104
+ background-color: ${(props) => props.theme.colors.neutral0};
105
+ border: 1px solid ${(props) => props.theme.colors.neutral300};
106
+ border-radius: 4px;
107
+ padding: 8px;
108
+ width: 180px;
109
+ box-shadow: ${(props) => props.theme.shadows.popupShadow};
110
+ `;
111
+ const SeparatorStyled = styled__default.default(TiptapEditorInput.Separator)`
112
+ margin: 8px 0;
113
+ `;
114
+ const ColorButtonComponent = ({
115
+ name,
116
+ color,
117
+ isActive,
118
+ onClick,
119
+ isHighlight
120
+ }) => /* @__PURE__ */ jsxRuntime.jsxs(
121
+ CompactColorButton,
122
+ {
123
+ $isActive: isActive,
124
+ $color: color,
125
+ $isHighlight: isHighlight,
126
+ onClick,
127
+ type: "button",
128
+ "aria-label": name,
129
+ children: [
130
+ !isHighlight && color !== "inherit" && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.BaselineIcon, {}),
131
+ isHighlight && isActive && /* @__PURE__ */ jsxRuntime.jsx(CheckIcon, {})
132
+ ]
133
+ }
134
+ );
135
+ const ColorAndHighlightToolbar = () => {
136
+ const { editor } = TiptapEditorInput.useEditorContext();
137
+ const [recentColors, setRecentColors] = React.useState([]);
138
+ const currentColor = editor?.getAttributes("textStyle").color;
139
+ const currentHighlight = editor?.getAttributes("highlight").color;
140
+ const addToRecent = (color, isHighlight) => {
141
+ const isDefault = isHighlight ? color === "transparent" : color === "inherit" || color === "";
142
+ if (isDefault) return;
143
+ setRecentColors((prev) => {
144
+ const existing = prev.filter((c) => !(c.color === color && c.isHighlight === isHighlight));
145
+ return [{ color, isHighlight }, ...existing].slice(0, 5);
146
+ });
147
+ };
148
+ const handleSetColor = (color) => {
149
+ editor?.chain().focus().setColor(color === currentColor ? "" : color).run();
150
+ if (color !== currentColor) {
151
+ addToRecent(color, false);
152
+ }
153
+ };
154
+ const handleSetHighlight = (color) => {
155
+ editor?.chain().focus().setHighlight(color === currentHighlight ? { color: "" } : { color }).run();
156
+ if (color !== currentHighlight) {
157
+ addToRecent(color, true);
158
+ }
159
+ };
160
+ const isDisabled = !editor?.can().chain().setHighlight().run() || !editor?.can().chain().setColor("").run();
161
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Popover.Root, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { position: "relative", height: "100%" }, children: [
162
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Popover.Trigger, { disabled: isDisabled, children: /* @__PURE__ */ jsxRuntime.jsx(
163
+ TiptapEditorInput.ToolbarButton,
164
+ {
165
+ tooltip: "Text Color & Highlight",
166
+ "aria-label": "Set color & highlight",
167
+ style: {
168
+ color: currentColor,
169
+ backgroundColor: currentHighlight
170
+ },
171
+ children: /* @__PURE__ */ jsxRuntime.jsx(ToolbarContent, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.HighlighterIcon, {}) })
172
+ }
173
+ ) }),
174
+ /* @__PURE__ */ jsxRuntime.jsxs(PopoverContent, { align: "start", children: [
175
+ recentColors.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
176
+ /* @__PURE__ */ jsxRuntime.jsx(SectionTitle, { children: "Recently Used" }),
177
+ /* @__PURE__ */ jsxRuntime.jsx(ColorGrid, { children: recentColors.map((recent, index) => /* @__PURE__ */ jsxRuntime.jsx(
178
+ ColorButtonComponent,
179
+ {
180
+ name: recent.color,
181
+ color: recent.color,
182
+ isActive: recent.isHighlight ? currentHighlight === recent.color : currentColor === recent.color,
183
+ onClick: () => recent.isHighlight ? handleSetHighlight(recent.color) : handleSetColor(recent.color),
184
+ isHighlight: recent.isHighlight
185
+ },
186
+ `${recent.color}-${recent.isHighlight}-${index}`
187
+ )) }),
188
+ /* @__PURE__ */ jsxRuntime.jsx(SeparatorStyled, {})
189
+ ] }),
190
+ /* @__PURE__ */ jsxRuntime.jsx(SectionTitle, { children: "Text Color" }),
191
+ /* @__PURE__ */ jsxRuntime.jsx(ColorGrid, { children: TEXT_COLORS.map(({ name, color }) => /* @__PURE__ */ jsxRuntime.jsx(
192
+ ColorButtonComponent,
193
+ {
194
+ name,
195
+ color,
196
+ isActive: currentColor === color,
197
+ onClick: () => handleSetColor(color)
198
+ },
199
+ name
200
+ )) }),
201
+ /* @__PURE__ */ jsxRuntime.jsx(SeparatorStyled, {}),
202
+ /* @__PURE__ */ jsxRuntime.jsx(SectionTitle, { children: "Background" }),
203
+ /* @__PURE__ */ jsxRuntime.jsx(ColorGrid, { children: HIGHLIGHT_COLORS.map(({ name, color }) => /* @__PURE__ */ jsxRuntime.jsx(
204
+ ColorButtonComponent,
205
+ {
206
+ name,
207
+ color,
208
+ isActive: currentHighlight === color,
209
+ onClick: () => handleSetHighlight(color),
210
+ isHighlight: true
211
+ },
212
+ name
213
+ )) })
214
+ ] })
215
+ ] }) });
216
+ };
217
+ exports.ColorAndHighlightToolbar = ColorAndHighlightToolbar;