@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.
- package/README.md +3 -0
- package/dist/_chunks/Alignment-B0f2-LO0.js +135 -0
- package/dist/_chunks/Alignment-qMOzO-n2.mjs +133 -0
- package/dist/_chunks/Blockquote-9wBGDz3L.mjs +34 -0
- package/dist/_chunks/Blockquote-DeGUfK27.js +36 -0
- package/dist/_chunks/Bold-C-0g6Ayd.mjs +46 -0
- package/dist/_chunks/Bold-ClnPsPHt.js +48 -0
- package/dist/_chunks/ColorAndHighlight-BMmtoSpj.js +217 -0
- package/dist/_chunks/ColorAndHighlight-t1Ui5tcL.mjs +215 -0
- package/dist/_chunks/Emoji-Bm1_vSh5.mjs +263 -0
- package/dist/_chunks/Emoji-C-LQZ4Z3.js +265 -0
- package/dist/_chunks/Heading-BDJqd1Qw.js +125 -0
- package/dist/_chunks/Heading-BycRob5M.mjs +123 -0
- package/dist/_chunks/HorizontalRule-CJlDmdma.js +34 -0
- package/dist/_chunks/HorizontalRule-CzQCeC3b.mjs +32 -0
- package/dist/_chunks/Iframe-DCBWSb0v.mjs +165 -0
- package/dist/_chunks/Iframe-Dyn_2cMB.js +167 -0
- package/dist/_chunks/ImagePlaceholder-C14kojd5.js +71 -0
- package/dist/_chunks/ImagePlaceholder-DtrSuhf_.mjs +69 -0
- package/dist/_chunks/Italic-BfpKX0KX.mjs +34 -0
- package/dist/_chunks/Italic-DdhVL78v.js +36 -0
- package/dist/_chunks/Link-BuYDqSqo.js +61 -0
- package/dist/_chunks/Link-DUV5Ybep.mjs +59 -0
- package/dist/_chunks/Lists-BKopoFR6.js +107 -0
- package/dist/_chunks/Lists-DsKxj3MD.mjs +105 -0
- package/dist/_chunks/Redo-1mEX1yOd.js +35 -0
- package/dist/_chunks/Redo-Ca3VQxSe.mjs +33 -0
- package/dist/_chunks/SearchAndReplace-DmU5DlWv.mjs +347 -0
- package/dist/_chunks/SearchAndReplace-DzNdbTWJ.js +349 -0
- package/dist/_chunks/Strikethrough-BygxCHak.mjs +121 -0
- package/dist/_chunks/Strikethrough-DQfR4OFk.js +123 -0
- package/dist/_chunks/Table-BhbZ2Blv.mjs +123 -0
- package/dist/_chunks/Table-DLaqBAbz.js +125 -0
- package/dist/_chunks/TiptapEditorInput-BDE09h5-.mjs +6802 -0
- package/dist/_chunks/TiptapEditorInput-vfLsCt1p.js +6854 -0
- package/dist/_chunks/Undo-BuT4OkoE.js +32 -0
- package/dist/_chunks/Undo-PL5n4axf.mjs +30 -0
- package/dist/_chunks/en-B4KWt_jN.js +4 -0
- package/dist/_chunks/en-Byx4XI2L.mjs +4 -0
- package/dist/_chunks/index-ku90UbIF.mjs +1397 -0
- package/dist/_chunks/index-wYDv8vsJ.js +1398 -0
- package/dist/admin/index.js +6 -0
- package/dist/admin/index.mjs +6 -0
- package/dist/admin/src/components/ContentEditorInput.d.ts +10 -0
- package/dist/admin/src/components/GlobalStyling.d.ts +4 -0
- package/dist/admin/src/components/Initializer.d.ts +5 -0
- package/dist/admin/src/components/MediaLibraryModal.d.ts +27 -0
- package/dist/admin/src/components/PluginIcon.d.ts +2 -0
- package/dist/admin/src/components/TextEditorInput.d.ts +10 -0
- package/dist/admin/src/components/TiptapEditorInput.d.ts +6 -0
- package/dist/admin/src/components/editor/BaseEditor.d.ts +22 -0
- package/dist/admin/src/components/editor/ContentEditor.d.ts +10 -0
- package/dist/admin/src/components/editor/TextEditor.d.ts +10 -0
- package/dist/admin/src/components/editor/extensions/Heading.d.ts +2 -0
- package/dist/admin/src/components/editor/extensions/Iframe.d.ts +24 -0
- package/dist/admin/src/components/editor/extensions/Image.d.ts +3 -0
- package/dist/admin/src/components/editor/extensions/ImagePlaceholder.d.ts +15 -0
- package/dist/admin/src/components/editor/extensions/custom-component/CustomComponentEditPopover.d.ts +1 -0
- package/dist/admin/src/components/editor/extensions/custom-component/CustomComponentExtension.d.ts +3 -0
- package/dist/admin/src/components/editor/extensions/custom-component/CustomComponentInsertPopover.d.ts +13 -0
- package/dist/admin/src/components/editor/extensions/custom-component/CustomComponentRenderer.d.ts +1 -0
- package/dist/admin/src/components/editor/extensions/custom-component/Store.d.ts +20 -0
- package/dist/admin/src/components/editor/extensions/custom-component/types.d.ts +33 -0
- package/dist/admin/src/components/editor/extensions/fileHandler.d.ts +12 -0
- package/dist/admin/src/components/editor/extensions/link.d.ts +1 -0
- package/dist/admin/src/components/editor/extensions/noNewLine.d.ts +2 -0
- package/dist/admin/src/components/editor/extensions/resetMarksOnEnter.d.ts +2 -0
- package/dist/admin/src/components/editor/extensions/searchAndReplace.d.ts +53 -0
- package/dist/admin/src/components/editor/partials/EditorProvider.d.ts +13 -0
- package/dist/admin/src/components/editor/partials/LinkBubbleMenu.d.ts +5 -0
- package/dist/admin/src/components/editor/partials/LinkEditBlock.d.ts +9 -0
- package/dist/admin/src/components/editor/partials/LinkPopoverBlock.d.ts +8 -0
- package/dist/admin/src/components/editor/partials/ToolbarButton.d.ts +11 -0
- package/dist/admin/src/components/editor/partials/ToolbarButtons.d.ts +25 -0
- package/dist/admin/src/components/editor/toolbars/Alignment.d.ts +1 -0
- package/dist/admin/src/components/editor/toolbars/Blockquote.d.ts +4 -0
- package/dist/admin/src/components/editor/toolbars/Bold.d.ts +4 -0
- package/dist/admin/src/components/editor/toolbars/BulletList.d.ts +4 -0
- package/dist/admin/src/components/editor/toolbars/ColorAndHighlight.d.ts +5 -0
- package/dist/admin/src/components/editor/toolbars/Emoji.d.ts +4 -0
- package/dist/admin/src/components/editor/toolbars/Heading.d.ts +1 -0
- package/dist/admin/src/components/editor/toolbars/HorizontalRule.d.ts +4 -0
- package/dist/admin/src/components/editor/toolbars/Iframe.d.ts +3 -0
- package/dist/admin/src/components/editor/toolbars/ImagePlaceholder.d.ts +4 -0
- package/dist/admin/src/components/editor/toolbars/Italic.d.ts +4 -0
- package/dist/admin/src/components/editor/toolbars/Link.d.ts +4 -0
- package/dist/admin/src/components/editor/toolbars/Lists.d.ts +1 -0
- package/dist/admin/src/components/editor/toolbars/OrderedList.d.ts +4 -0
- package/dist/admin/src/components/editor/toolbars/Redo.d.ts +4 -0
- package/dist/admin/src/components/editor/toolbars/SearchAndReplace.d.ts +1 -0
- package/dist/admin/src/components/editor/toolbars/Strikethrough.d.ts +4 -0
- package/dist/admin/src/components/editor/toolbars/Table.d.ts +1 -0
- package/dist/admin/src/components/editor/toolbars/Undo.d.ts +4 -0
- package/dist/admin/src/components/editor/useEditor.d.ts +18 -0
- package/dist/admin/src/components/editor/utils.d.ts +28 -0
- package/dist/admin/src/components/ui/button.d.ts +9 -0
- package/dist/admin/src/components/ui/dropdown-menu.d.ts +27 -0
- package/dist/admin/src/components/ui/input.d.ts +6 -0
- package/dist/admin/src/components/ui/label.d.ts +7 -0
- package/dist/admin/src/components/ui/separator.d.ts +7 -0
- package/dist/admin/src/components/ui/toggle.d.ts +17 -0
- package/dist/admin/src/components/ui/tooltip.d.ts +7 -0
- package/dist/admin/src/config/index.d.ts +2 -0
- package/dist/admin/src/config/pluginConfig.d.ts +20 -0
- package/dist/admin/src/config/types.d.ts +109 -0
- package/dist/admin/src/errorSlicer.d.ts +4 -0
- package/dist/admin/src/exports.d.ts +4 -0
- package/dist/admin/src/hooks/useDebounceCallback.d.ts +9 -0
- package/dist/admin/src/index.d.ts +25 -0
- package/dist/admin/src/pluginId.d.ts +5 -0
- package/dist/admin/src/theme/additional.d.ts +1 -0
- package/dist/admin/src/theme/colorScheme.d.ts +2 -0
- package/dist/admin/src/theme/colors.d.ts +1 -0
- package/dist/admin/src/theme/common.d.ts +1 -0
- package/dist/admin/src/theme/index.d.ts +2 -0
- package/dist/admin/src/types.d.ts +15 -0
- package/dist/admin/src/utils/dom.d.ts +7 -0
- package/dist/admin/src/utils/getTranslation.d.ts +7 -0
- package/dist/admin/src/utils/isImageResponsive.d.ts +8 -0
- package/dist/admin/src/utils/localStorage.d.ts +21 -0
- package/dist/admin/src/utils/prefixWithBackendUrl.d.ts +6 -0
- package/dist/admin/src/utils/utils.d.ts +7 -0
- package/dist/server/index.js +15 -0
- package/dist/server/index.mjs +16 -0
- package/dist/server/src/index.d.ts +7 -0
- package/package.json +116 -0
|
@@ -0,0 +1,349 @@
|
|
|
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 designSystem = require("@strapi/design-system");
|
|
8
|
+
const styled = require("styled-components");
|
|
9
|
+
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
10
|
+
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
|
11
|
+
const RepeatIcon = styled__default.default(lucideReact.Repeat)`
|
|
12
|
+
width: 16px;
|
|
13
|
+
height: 16px;
|
|
14
|
+
margin-right: 8px;
|
|
15
|
+
`;
|
|
16
|
+
const ArrowIcon = styled__default.default.div`
|
|
17
|
+
width: 16px;
|
|
18
|
+
height: 16px;
|
|
19
|
+
`;
|
|
20
|
+
const CloseIcon = styled__default.default(lucideReact.X)`
|
|
21
|
+
width: 16px;
|
|
22
|
+
height: 16px;
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
`;
|
|
25
|
+
const PopoverContent = styled__default.default(designSystem.Popover.Content)`
|
|
26
|
+
position: relative;
|
|
27
|
+
display: flex;
|
|
28
|
+
width: 400px;
|
|
29
|
+
padding: 10px 12px;
|
|
30
|
+
`;
|
|
31
|
+
const SearchContainer = styled__default.default.div`
|
|
32
|
+
position: relative;
|
|
33
|
+
display: flex;
|
|
34
|
+
gap: 6px;
|
|
35
|
+
align-items: center;
|
|
36
|
+
`;
|
|
37
|
+
const SearchInput = styled__default.default(TiptapEditorInput.Input)`
|
|
38
|
+
width: 192px;
|
|
39
|
+
`;
|
|
40
|
+
const ResultCount = styled__default.default.span`
|
|
41
|
+
font-size: 14px;
|
|
42
|
+
`;
|
|
43
|
+
const IconButton = styled__default.default(TiptapEditorInput.Button)`
|
|
44
|
+
width: 28px;
|
|
45
|
+
height: 28px;
|
|
46
|
+
`;
|
|
47
|
+
const VerticalSeparator = styled__default.default(TiptapEditorInput.Separator)`
|
|
48
|
+
height: 28px;
|
|
49
|
+
margin: 0 2px;
|
|
50
|
+
`;
|
|
51
|
+
const ReplaceContainer = styled__default.default.div`
|
|
52
|
+
position: relative;
|
|
53
|
+
width: 100%;
|
|
54
|
+
`;
|
|
55
|
+
const CloseButton = styled__default.default(CloseIcon)`
|
|
56
|
+
position: absolute;
|
|
57
|
+
right: 12px;
|
|
58
|
+
top: 12px;
|
|
59
|
+
`;
|
|
60
|
+
const Header = styled__default.default.div`
|
|
61
|
+
display: flex;
|
|
62
|
+
width: 100%;
|
|
63
|
+
align-items: center;
|
|
64
|
+
gap: 12px;
|
|
65
|
+
`;
|
|
66
|
+
const BackButton = styled__default.default(IconButton)`
|
|
67
|
+
border-radius: 50%;
|
|
68
|
+
`;
|
|
69
|
+
const Title = styled__default.default.h2`
|
|
70
|
+
font-size: 14px;
|
|
71
|
+
font-weight: 500;
|
|
72
|
+
`;
|
|
73
|
+
const FormSection = styled__default.default.div`
|
|
74
|
+
margin: 8px 0;
|
|
75
|
+
width: 100%;
|
|
76
|
+
`;
|
|
77
|
+
const InputGroup = styled__default.default.div`
|
|
78
|
+
margin-bottom: 12px;
|
|
79
|
+
`;
|
|
80
|
+
const InputLabel = styled__default.default(TiptapEditorInput.Label)`
|
|
81
|
+
margin-bottom: 4px;
|
|
82
|
+
font-size: 12px;
|
|
83
|
+
color: ${(props) => props.theme.colors.neutral600};
|
|
84
|
+
`;
|
|
85
|
+
const CheckboxContainer = styled__default.default.div`
|
|
86
|
+
margin-top: 12px;
|
|
87
|
+
display: flex;
|
|
88
|
+
align-items: center;
|
|
89
|
+
gap: 8px;
|
|
90
|
+
`;
|
|
91
|
+
const CheckboxLabel = styled__default.default(TiptapEditorInput.Label)`
|
|
92
|
+
font-size: 14px;
|
|
93
|
+
font-weight: 500;
|
|
94
|
+
`;
|
|
95
|
+
const ActionsContainer = styled__default.default.div`
|
|
96
|
+
margin-top: 24px;
|
|
97
|
+
display: flex;
|
|
98
|
+
align-items: center;
|
|
99
|
+
justify-content: space-between;
|
|
100
|
+
`;
|
|
101
|
+
const NavigationButtons = styled__default.default.div`
|
|
102
|
+
display: flex;
|
|
103
|
+
align-items: center;
|
|
104
|
+
gap: 8px;
|
|
105
|
+
`;
|
|
106
|
+
const MainActions = styled__default.default.div`
|
|
107
|
+
display: flex;
|
|
108
|
+
align-items: center;
|
|
109
|
+
gap: 8px;
|
|
110
|
+
`;
|
|
111
|
+
const ActionButton = styled__default.default(TiptapEditorInput.Button)`
|
|
112
|
+
height: 28px;
|
|
113
|
+
padding: 0 12px;
|
|
114
|
+
font-size: 12px;
|
|
115
|
+
`;
|
|
116
|
+
const TriggerButton = styled__default.default(TiptapEditorInput.ToolbarButton)`
|
|
117
|
+
height: 32px;
|
|
118
|
+
width: auto !important;
|
|
119
|
+
padding: 0 12px;
|
|
120
|
+
font-weight: 400;
|
|
121
|
+
display: flex;
|
|
122
|
+
min-width: fit-content;
|
|
123
|
+
align-items: center;
|
|
124
|
+
`;
|
|
125
|
+
function SearchAndReplaceToolbar() {
|
|
126
|
+
const { editor } = TiptapEditorInput.useEditorContext();
|
|
127
|
+
const [open, setOpen] = React.useState(false);
|
|
128
|
+
const [replacing, setReplacing] = React.useState(false);
|
|
129
|
+
const [searchText, setSearchText] = React.useState("");
|
|
130
|
+
const [replaceText, setReplaceText] = React.useState("");
|
|
131
|
+
const [checked, setChecked] = React.useState(false);
|
|
132
|
+
const results = editor?.storage?.searchAndReplace.results;
|
|
133
|
+
const selectedResult = editor?.storage?.searchAndReplace.selectedResult;
|
|
134
|
+
const replace = () => editor?.chain().replace().run();
|
|
135
|
+
const replaceAll = () => editor?.chain().replaceAll().run();
|
|
136
|
+
const selectNext = () => editor?.chain().selectNextResult().run();
|
|
137
|
+
const selectPrevious = () => editor?.chain().selectPreviousResult().run();
|
|
138
|
+
React.useEffect(() => {
|
|
139
|
+
editor?.chain().setSearchTerm(searchText).run();
|
|
140
|
+
}, [searchText, editor]);
|
|
141
|
+
React.useEffect(() => {
|
|
142
|
+
editor?.chain().setReplaceTerm(replaceText).run();
|
|
143
|
+
}, [replaceText, editor]);
|
|
144
|
+
React.useEffect(() => {
|
|
145
|
+
editor?.chain().setCaseSensitive(checked).run();
|
|
146
|
+
}, [checked, editor]);
|
|
147
|
+
React.useEffect(() => {
|
|
148
|
+
if (!open) {
|
|
149
|
+
setReplaceText("");
|
|
150
|
+
setSearchText("");
|
|
151
|
+
setReplacing(false);
|
|
152
|
+
}
|
|
153
|
+
}, [open]);
|
|
154
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Popover.Root, { open, children: [
|
|
155
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Popover.Trigger, { disabled: !editor, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
156
|
+
TriggerButton,
|
|
157
|
+
{
|
|
158
|
+
tooltip: "Search & Replace",
|
|
159
|
+
style: { minWidth: "fit-content" },
|
|
160
|
+
onClick: () => {
|
|
161
|
+
setOpen(!open);
|
|
162
|
+
},
|
|
163
|
+
children: [
|
|
164
|
+
/* @__PURE__ */ jsxRuntime.jsx(RepeatIcon, {}),
|
|
165
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { children: "Search & Replace" })
|
|
166
|
+
]
|
|
167
|
+
}
|
|
168
|
+
) }),
|
|
169
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
170
|
+
PopoverContent,
|
|
171
|
+
{
|
|
172
|
+
align: "end",
|
|
173
|
+
onCloseAutoFocus: (e) => {
|
|
174
|
+
e.preventDefault();
|
|
175
|
+
},
|
|
176
|
+
onEscapeKeyDown: () => {
|
|
177
|
+
setOpen(false);
|
|
178
|
+
},
|
|
179
|
+
children: !replacing ? /* @__PURE__ */ jsxRuntime.jsxs(SearchContainer, { children: [
|
|
180
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
181
|
+
SearchInput,
|
|
182
|
+
{
|
|
183
|
+
value: searchText,
|
|
184
|
+
onChange: (e) => {
|
|
185
|
+
setSearchText(e.target.value);
|
|
186
|
+
},
|
|
187
|
+
placeholder: "Search..."
|
|
188
|
+
}
|
|
189
|
+
),
|
|
190
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ResultCount, { children: [
|
|
191
|
+
results?.length === 0 ? selectedResult : selectedResult + 1,
|
|
192
|
+
"/",
|
|
193
|
+
results?.length
|
|
194
|
+
] }),
|
|
195
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
196
|
+
IconButton,
|
|
197
|
+
{
|
|
198
|
+
onClick: selectPrevious,
|
|
199
|
+
size: "icon",
|
|
200
|
+
variant: "ghost",
|
|
201
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ArrowIcon, { as: lucideReact.ArrowLeft })
|
|
202
|
+
}
|
|
203
|
+
),
|
|
204
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
205
|
+
IconButton,
|
|
206
|
+
{
|
|
207
|
+
onClick: selectNext,
|
|
208
|
+
size: "icon",
|
|
209
|
+
variant: "ghost",
|
|
210
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ArrowIcon, { as: lucideReact.ArrowRight })
|
|
211
|
+
}
|
|
212
|
+
),
|
|
213
|
+
/* @__PURE__ */ jsxRuntime.jsx(VerticalSeparator, { orientation: "vertical" }),
|
|
214
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
215
|
+
IconButton,
|
|
216
|
+
{
|
|
217
|
+
onClick: () => {
|
|
218
|
+
setReplacing(true);
|
|
219
|
+
},
|
|
220
|
+
size: "icon",
|
|
221
|
+
variant: "ghost",
|
|
222
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ArrowIcon, { as: lucideReact.Repeat })
|
|
223
|
+
}
|
|
224
|
+
),
|
|
225
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
226
|
+
IconButton,
|
|
227
|
+
{
|
|
228
|
+
onClick: () => {
|
|
229
|
+
setOpen(false);
|
|
230
|
+
},
|
|
231
|
+
size: "icon",
|
|
232
|
+
variant: "ghost",
|
|
233
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ArrowIcon, { as: lucideReact.X })
|
|
234
|
+
}
|
|
235
|
+
)
|
|
236
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(ReplaceContainer, { children: [
|
|
237
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
238
|
+
CloseButton,
|
|
239
|
+
{
|
|
240
|
+
onClick: () => {
|
|
241
|
+
setOpen(false);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
),
|
|
245
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Header, { children: [
|
|
246
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
247
|
+
BackButton,
|
|
248
|
+
{
|
|
249
|
+
size: "icon",
|
|
250
|
+
variant: "ghost",
|
|
251
|
+
onClick: () => {
|
|
252
|
+
setReplacing(false);
|
|
253
|
+
},
|
|
254
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ArrowIcon, { as: lucideReact.ArrowLeft })
|
|
255
|
+
}
|
|
256
|
+
),
|
|
257
|
+
/* @__PURE__ */ jsxRuntime.jsx(Title, { children: "Search and replace" })
|
|
258
|
+
] }),
|
|
259
|
+
/* @__PURE__ */ jsxRuntime.jsxs(FormSection, { children: [
|
|
260
|
+
/* @__PURE__ */ jsxRuntime.jsxs(InputGroup, { children: [
|
|
261
|
+
/* @__PURE__ */ jsxRuntime.jsx(InputLabel, { children: "Search" }),
|
|
262
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
263
|
+
TiptapEditorInput.Input,
|
|
264
|
+
{
|
|
265
|
+
value: searchText,
|
|
266
|
+
onChange: (e) => {
|
|
267
|
+
setSearchText(e.target.value);
|
|
268
|
+
},
|
|
269
|
+
placeholder: "Search..."
|
|
270
|
+
}
|
|
271
|
+
),
|
|
272
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ResultCount, { children: [
|
|
273
|
+
results?.length === 0 ? selectedResult : selectedResult + 1,
|
|
274
|
+
"/",
|
|
275
|
+
results?.length
|
|
276
|
+
] })
|
|
277
|
+
] }),
|
|
278
|
+
/* @__PURE__ */ jsxRuntime.jsxs(InputGroup, { children: [
|
|
279
|
+
/* @__PURE__ */ jsxRuntime.jsx(InputLabel, { children: "Replace with" }),
|
|
280
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
281
|
+
TiptapEditorInput.Input,
|
|
282
|
+
{
|
|
283
|
+
value: replaceText,
|
|
284
|
+
onChange: (e) => {
|
|
285
|
+
setReplaceText(e.target.value);
|
|
286
|
+
},
|
|
287
|
+
placeholder: "Replace..."
|
|
288
|
+
}
|
|
289
|
+
)
|
|
290
|
+
] }),
|
|
291
|
+
/* @__PURE__ */ jsxRuntime.jsxs(CheckboxContainer, { children: [
|
|
292
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
293
|
+
designSystem.Checkbox,
|
|
294
|
+
{
|
|
295
|
+
checked,
|
|
296
|
+
onCheckedChange: (checked2) => {
|
|
297
|
+
setChecked(checked2);
|
|
298
|
+
},
|
|
299
|
+
id: "match_case"
|
|
300
|
+
}
|
|
301
|
+
),
|
|
302
|
+
/* @__PURE__ */ jsxRuntime.jsx(CheckboxLabel, { htmlFor: "match_case", children: "Match case" })
|
|
303
|
+
] })
|
|
304
|
+
] }),
|
|
305
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ActionsContainer, { children: [
|
|
306
|
+
/* @__PURE__ */ jsxRuntime.jsxs(NavigationButtons, { children: [
|
|
307
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
308
|
+
IconButton,
|
|
309
|
+
{
|
|
310
|
+
onClick: selectPrevious,
|
|
311
|
+
size: "icon",
|
|
312
|
+
variant: "secondary",
|
|
313
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ArrowIcon, { as: lucideReact.ArrowLeft })
|
|
314
|
+
}
|
|
315
|
+
),
|
|
316
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
317
|
+
IconButton,
|
|
318
|
+
{
|
|
319
|
+
onClick: selectNext,
|
|
320
|
+
size: "icon",
|
|
321
|
+
variant: "secondary",
|
|
322
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ArrowIcon, { as: lucideReact.ArrowRight })
|
|
323
|
+
}
|
|
324
|
+
)
|
|
325
|
+
] }),
|
|
326
|
+
/* @__PURE__ */ jsxRuntime.jsxs(MainActions, { children: [
|
|
327
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
328
|
+
ActionButton,
|
|
329
|
+
{
|
|
330
|
+
variant: "secondary",
|
|
331
|
+
onClick: replaceAll,
|
|
332
|
+
children: "Replace All"
|
|
333
|
+
}
|
|
334
|
+
),
|
|
335
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
336
|
+
ActionButton,
|
|
337
|
+
{
|
|
338
|
+
onClick: replace,
|
|
339
|
+
children: "Replace"
|
|
340
|
+
}
|
|
341
|
+
)
|
|
342
|
+
] })
|
|
343
|
+
] })
|
|
344
|
+
] })
|
|
345
|
+
}
|
|
346
|
+
)
|
|
347
|
+
] });
|
|
348
|
+
}
|
|
349
|
+
exports.SearchAndReplaceToolbar = SearchAndReplaceToolbar;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Underline, Strikethrough, Check } from "lucide-react";
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
import styled from "styled-components";
|
|
5
|
+
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";
|
|
6
|
+
const DropdownMenuItemStyled = styled(DropdownMenuItem)`
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
gap: 2px;
|
|
10
|
+
padding: 6px 8px 6px 4px;
|
|
11
|
+
font-size: 14px;
|
|
12
|
+
|
|
13
|
+
&:hover {
|
|
14
|
+
background-color: ${(props) => props.theme.colors.neutral100};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&:focus {
|
|
18
|
+
background-color: ${(props) => props.theme.colors.neutral100};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
svg {
|
|
22
|
+
width: 16px;
|
|
23
|
+
height: 16px;
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
26
|
+
const CheckIcon = styled(Check)`
|
|
27
|
+
width: 12px;
|
|
28
|
+
height: 12px;
|
|
29
|
+
color: ${(props) => props.theme.colors.primary500};
|
|
30
|
+
`;
|
|
31
|
+
const IconWrapper = styled.div`
|
|
32
|
+
display: flex;
|
|
33
|
+
align-items: center;
|
|
34
|
+
justify-content: center;
|
|
35
|
+
width: 16px;
|
|
36
|
+
height: 20px;
|
|
37
|
+
margin-right: 4px;
|
|
38
|
+
`;
|
|
39
|
+
const StyledTooltipContent = styled(TooltipContent)`
|
|
40
|
+
background-color: ${(props) => props.theme.colors.neutral800};
|
|
41
|
+
color: ${(props) => props.theme.colors.neutral0};
|
|
42
|
+
padding: 6px 8px;
|
|
43
|
+
border-radius: 4px;
|
|
44
|
+
font-size: 12px;
|
|
45
|
+
z-index: 100;
|
|
46
|
+
`;
|
|
47
|
+
const StrikeThroughToolbar = forwardRef(
|
|
48
|
+
({ className, children, ...props }, ref) => {
|
|
49
|
+
const { editor } = useEditorContext();
|
|
50
|
+
if (!editor) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
const items = [
|
|
54
|
+
{
|
|
55
|
+
action: () => editor.chain().focus().toggleUnderline().run(),
|
|
56
|
+
isActive: () => editor.isActive("underline"),
|
|
57
|
+
disabled: !editor.can().chain().focus().toggleUnderline().run(),
|
|
58
|
+
title: "Underline",
|
|
59
|
+
icon: /* @__PURE__ */ jsx(Underline, {}),
|
|
60
|
+
shortcut: "mod+u"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
action: () => editor.chain().focus().toggleStrike().run(),
|
|
64
|
+
isActive: () => editor.isActive("strike"),
|
|
65
|
+
disabled: !editor.can().chain().focus().toggleStrike().run(),
|
|
66
|
+
title: "Strikethrough",
|
|
67
|
+
icon: /* @__PURE__ */ jsx(Strikethrough, {}),
|
|
68
|
+
shortcut: "mod+shift+x"
|
|
69
|
+
}
|
|
70
|
+
];
|
|
71
|
+
const isDisabled = items.every((item) => item.disabled);
|
|
72
|
+
const activeItem = items.find((item) => item.isActive());
|
|
73
|
+
activeItem ? activeItem.icon : /* @__PURE__ */ jsx(Strikethrough, {});
|
|
74
|
+
activeItem ? activeItem.title : "Text Decoration";
|
|
75
|
+
return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
76
|
+
/* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
77
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(DropdownMenuTrigger, { disabled: isDisabled, asChild: true, children: /* @__PURE__ */ jsx(
|
|
78
|
+
ToolbarButton,
|
|
79
|
+
{
|
|
80
|
+
"aria-label": "Text Decoration",
|
|
81
|
+
disabled: isDisabled,
|
|
82
|
+
hasArrow: true,
|
|
83
|
+
isActive: !!activeItem,
|
|
84
|
+
ref,
|
|
85
|
+
...props,
|
|
86
|
+
children: /* @__PURE__ */ jsx(IconWrapper, { children: activeItem ? activeItem.icon : /* @__PURE__ */ jsx(Strikethrough, {}) })
|
|
87
|
+
}
|
|
88
|
+
) }) }),
|
|
89
|
+
/* @__PURE__ */ jsx(StyledTooltipContent, { children: "Text Decoration" })
|
|
90
|
+
] }),
|
|
91
|
+
/* @__PURE__ */ jsx(
|
|
92
|
+
DropdownMenuContent,
|
|
93
|
+
{
|
|
94
|
+
align: "start",
|
|
95
|
+
loop: true,
|
|
96
|
+
onCloseAutoFocus: (e) => {
|
|
97
|
+
e.preventDefault();
|
|
98
|
+
},
|
|
99
|
+
children: /* @__PURE__ */ jsx(DropdownMenuGroup, { children: items.map((option, index) => /* @__PURE__ */ jsxs(
|
|
100
|
+
DropdownMenuItemStyled,
|
|
101
|
+
{
|
|
102
|
+
onSelect: () => {
|
|
103
|
+
option.action();
|
|
104
|
+
},
|
|
105
|
+
children: [
|
|
106
|
+
/* @__PURE__ */ jsx("div", { style: { width: 12, height: 12, display: "flex", alignItems: "center", justifyContent: "center" }, children: option.isActive() && /* @__PURE__ */ jsx(CheckIcon, {}) }),
|
|
107
|
+
/* @__PURE__ */ jsx(IconWrapper, { children: option.icon }),
|
|
108
|
+
option.title
|
|
109
|
+
]
|
|
110
|
+
},
|
|
111
|
+
index
|
|
112
|
+
)) })
|
|
113
|
+
}
|
|
114
|
+
)
|
|
115
|
+
] });
|
|
116
|
+
}
|
|
117
|
+
);
|
|
118
|
+
StrikeThroughToolbar.displayName = "StrikeThroughToolbar";
|
|
119
|
+
export {
|
|
120
|
+
StrikeThroughToolbar
|
|
121
|
+
};
|
|
@@ -0,0 +1,123 @@
|
|
|
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 React = require("react");
|
|
6
|
+
const styled = require("styled-components");
|
|
7
|
+
const TiptapEditorInput = require("./TiptapEditorInput-vfLsCt1p.js");
|
|
8
|
+
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
9
|
+
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
|
10
|
+
const DropdownMenuItemStyled = styled__default.default(TiptapEditorInput.DropdownMenuItem)`
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
gap: 2px;
|
|
14
|
+
padding: 6px 8px 6px 4px;
|
|
15
|
+
font-size: 14px;
|
|
16
|
+
|
|
17
|
+
&:hover {
|
|
18
|
+
background-color: ${(props) => props.theme.colors.neutral100};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&:focus {
|
|
22
|
+
background-color: ${(props) => props.theme.colors.neutral100};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
svg {
|
|
26
|
+
width: 16px;
|
|
27
|
+
height: 16px;
|
|
28
|
+
}
|
|
29
|
+
`;
|
|
30
|
+
const CheckIcon = styled__default.default(lucideReact.Check)`
|
|
31
|
+
width: 12px;
|
|
32
|
+
height: 12px;
|
|
33
|
+
color: ${(props) => props.theme.colors.primary500};
|
|
34
|
+
`;
|
|
35
|
+
const IconWrapper = styled__default.default.div`
|
|
36
|
+
display: flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
justify-content: center;
|
|
39
|
+
width: 16px;
|
|
40
|
+
height: 20px;
|
|
41
|
+
margin-right: 4px;
|
|
42
|
+
`;
|
|
43
|
+
const StyledTooltipContent = styled__default.default(TiptapEditorInput.TooltipContent)`
|
|
44
|
+
background-color: ${(props) => props.theme.colors.neutral800};
|
|
45
|
+
color: ${(props) => props.theme.colors.neutral0};
|
|
46
|
+
padding: 6px 8px;
|
|
47
|
+
border-radius: 4px;
|
|
48
|
+
font-size: 12px;
|
|
49
|
+
z-index: 100;
|
|
50
|
+
`;
|
|
51
|
+
const StrikeThroughToolbar = React.forwardRef(
|
|
52
|
+
({ className, children, ...props }, ref) => {
|
|
53
|
+
const { editor } = TiptapEditorInput.useEditorContext();
|
|
54
|
+
if (!editor) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
const items = [
|
|
58
|
+
{
|
|
59
|
+
action: () => editor.chain().focus().toggleUnderline().run(),
|
|
60
|
+
isActive: () => editor.isActive("underline"),
|
|
61
|
+
disabled: !editor.can().chain().focus().toggleUnderline().run(),
|
|
62
|
+
title: "Underline",
|
|
63
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Underline, {}),
|
|
64
|
+
shortcut: "mod+u"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
action: () => editor.chain().focus().toggleStrike().run(),
|
|
68
|
+
isActive: () => editor.isActive("strike"),
|
|
69
|
+
disabled: !editor.can().chain().focus().toggleStrike().run(),
|
|
70
|
+
title: "Strikethrough",
|
|
71
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Strikethrough, {}),
|
|
72
|
+
shortcut: "mod+shift+x"
|
|
73
|
+
}
|
|
74
|
+
];
|
|
75
|
+
const isDisabled = items.every((item) => item.disabled);
|
|
76
|
+
const activeItem = items.find((item) => item.isActive());
|
|
77
|
+
activeItem ? activeItem.icon : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Strikethrough, {});
|
|
78
|
+
activeItem ? activeItem.title : "Text Decoration";
|
|
79
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(TiptapEditorInput.DropdownMenu, { children: [
|
|
80
|
+
/* @__PURE__ */ jsxRuntime.jsxs(TiptapEditorInput.Tooltip, { children: [
|
|
81
|
+
/* @__PURE__ */ jsxRuntime.jsx(TiptapEditorInput.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(TiptapEditorInput.DropdownMenuTrigger, { disabled: isDisabled, asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
82
|
+
TiptapEditorInput.ToolbarButton,
|
|
83
|
+
{
|
|
84
|
+
"aria-label": "Text Decoration",
|
|
85
|
+
disabled: isDisabled,
|
|
86
|
+
hasArrow: true,
|
|
87
|
+
isActive: !!activeItem,
|
|
88
|
+
ref,
|
|
89
|
+
...props,
|
|
90
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(IconWrapper, { children: activeItem ? activeItem.icon : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Strikethrough, {}) })
|
|
91
|
+
}
|
|
92
|
+
) }) }),
|
|
93
|
+
/* @__PURE__ */ jsxRuntime.jsx(StyledTooltipContent, { children: "Text Decoration" })
|
|
94
|
+
] }),
|
|
95
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
96
|
+
TiptapEditorInput.DropdownMenuContent,
|
|
97
|
+
{
|
|
98
|
+
align: "start",
|
|
99
|
+
loop: true,
|
|
100
|
+
onCloseAutoFocus: (e) => {
|
|
101
|
+
e.preventDefault();
|
|
102
|
+
},
|
|
103
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(TiptapEditorInput.DropdownMenuGroup, { children: items.map((option, index) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
104
|
+
DropdownMenuItemStyled,
|
|
105
|
+
{
|
|
106
|
+
onSelect: () => {
|
|
107
|
+
option.action();
|
|
108
|
+
},
|
|
109
|
+
children: [
|
|
110
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { width: 12, height: 12, display: "flex", alignItems: "center", justifyContent: "center" }, children: option.isActive() && /* @__PURE__ */ jsxRuntime.jsx(CheckIcon, {}) }),
|
|
111
|
+
/* @__PURE__ */ jsxRuntime.jsx(IconWrapper, { children: option.icon }),
|
|
112
|
+
option.title
|
|
113
|
+
]
|
|
114
|
+
},
|
|
115
|
+
index
|
|
116
|
+
)) })
|
|
117
|
+
}
|
|
118
|
+
)
|
|
119
|
+
] });
|
|
120
|
+
}
|
|
121
|
+
);
|
|
122
|
+
StrikeThroughToolbar.displayName = "StrikeThroughToolbar";
|
|
123
|
+
exports.StrikeThroughToolbar = StrikeThroughToolbar;
|