cms-block-editor 1.0.9 → 1.0.12
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 +5 -2
- package/dist/index.css +223 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +7 -2
- package/dist/index.mjs +1015 -684
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -12,8 +12,8 @@ import { TablePlugin as LexicalTablePlugin } from "@lexical/react/LexicalTablePl
|
|
|
12
12
|
import LexicalErrorBoundary from "@lexical/react/LexicalErrorBoundary";
|
|
13
13
|
|
|
14
14
|
// src/plugins/SlashCommandPlugin.tsx
|
|
15
|
-
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
16
|
-
import { useEffect as
|
|
15
|
+
import { useLexicalComposerContext as useLexicalComposerContext2 } from "@lexical/react/LexicalComposerContext";
|
|
16
|
+
import { useEffect as useEffect3, useState as useState4 } from "react";
|
|
17
17
|
import {
|
|
18
18
|
$createParagraphNode,
|
|
19
19
|
$getSelection,
|
|
@@ -24,8 +24,305 @@ import { $createListNode, $createListItemNode } from "@lexical/list";
|
|
|
24
24
|
|
|
25
25
|
// src/blocks/ImageNode.tsx
|
|
26
26
|
import { DecoratorNode } from "lexical";
|
|
27
|
-
import { useCallback, useEffect, useRef, useState } from "react";
|
|
28
|
-
|
|
27
|
+
import { useCallback, useEffect as useEffect2, useRef, useState as useState2 } from "react";
|
|
28
|
+
|
|
29
|
+
// src/plugins/ImageEditorPlugin.tsx
|
|
30
|
+
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
31
|
+
import { useEffect, useState } from "react";
|
|
32
|
+
import { COMMAND_PRIORITY_LOW, createCommand } from "lexical";
|
|
33
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
34
|
+
var OPEN_IMAGE_EDITOR_COMMAND = createCommand();
|
|
35
|
+
function ImageEditorPlugin() {
|
|
36
|
+
const [editor] = useLexicalComposerContext();
|
|
37
|
+
const [editorState, setEditorState] = useState({
|
|
38
|
+
isOpen: false,
|
|
39
|
+
nodeKey: null,
|
|
40
|
+
src: "",
|
|
41
|
+
originalSrc: "",
|
|
42
|
+
crop: { x: 0, y: 0, width: 100, height: 100 },
|
|
43
|
+
filters: {
|
|
44
|
+
brightness: 100,
|
|
45
|
+
contrast: 100,
|
|
46
|
+
saturation: 100,
|
|
47
|
+
blur: 0,
|
|
48
|
+
grayscale: 0,
|
|
49
|
+
sepia: 0,
|
|
50
|
+
hueRotate: 0
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
return editor.registerCommand(
|
|
55
|
+
OPEN_IMAGE_EDITOR_COMMAND,
|
|
56
|
+
({ nodeKey, src }) => {
|
|
57
|
+
setEditorState({
|
|
58
|
+
isOpen: true,
|
|
59
|
+
nodeKey,
|
|
60
|
+
src,
|
|
61
|
+
originalSrc: src,
|
|
62
|
+
crop: { x: 0, y: 0, width: 100, height: 100 },
|
|
63
|
+
filters: {
|
|
64
|
+
brightness: 100,
|
|
65
|
+
contrast: 100,
|
|
66
|
+
saturation: 100,
|
|
67
|
+
blur: 0,
|
|
68
|
+
grayscale: 0,
|
|
69
|
+
sepia: 0,
|
|
70
|
+
hueRotate: 0
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
return true;
|
|
74
|
+
},
|
|
75
|
+
COMMAND_PRIORITY_LOW
|
|
76
|
+
);
|
|
77
|
+
}, [editor]);
|
|
78
|
+
const applyFilters = () => {
|
|
79
|
+
const canvas = document.createElement("canvas");
|
|
80
|
+
const ctx = canvas.getContext("2d");
|
|
81
|
+
const img = new Image();
|
|
82
|
+
img.crossOrigin = "anonymous";
|
|
83
|
+
img.onload = () => {
|
|
84
|
+
const cropWidth = img.width * editorState.crop.width / 100;
|
|
85
|
+
const cropHeight = img.height * editorState.crop.height / 100;
|
|
86
|
+
const cropX = img.width * editorState.crop.x / 100;
|
|
87
|
+
const cropY = img.height * editorState.crop.y / 100;
|
|
88
|
+
canvas.width = cropWidth;
|
|
89
|
+
canvas.height = cropHeight;
|
|
90
|
+
if (ctx) {
|
|
91
|
+
const { brightness, contrast, saturation, blur, grayscale, sepia, hueRotate } = editorState.filters;
|
|
92
|
+
ctx.filter = `
|
|
93
|
+
brightness(${brightness}%)
|
|
94
|
+
contrast(${contrast}%)
|
|
95
|
+
saturate(${saturation}%)
|
|
96
|
+
blur(${blur}px)
|
|
97
|
+
grayscale(${grayscale}%)
|
|
98
|
+
sepia(${sepia}%)
|
|
99
|
+
hue-rotate(${hueRotate}deg)
|
|
100
|
+
`;
|
|
101
|
+
ctx.drawImage(img, cropX, cropY, cropWidth, cropHeight, 0, 0, cropWidth, cropHeight);
|
|
102
|
+
const editedSrc = canvas.toDataURL("image/png");
|
|
103
|
+
editor.update(() => {
|
|
104
|
+
const node = editor.getEditorState()._nodeMap.get(editorState.nodeKey);
|
|
105
|
+
if (node && node instanceof ImageNode) {
|
|
106
|
+
const writable = node.getWritable();
|
|
107
|
+
writable.__src = editedSrc;
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
handleClose();
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
img.src = editorState.originalSrc;
|
|
114
|
+
};
|
|
115
|
+
const handleClose = () => {
|
|
116
|
+
setEditorState((prev) => ({ ...prev, isOpen: false, nodeKey: null }));
|
|
117
|
+
};
|
|
118
|
+
const resetFilters = () => {
|
|
119
|
+
setEditorState((prev) => ({
|
|
120
|
+
...prev,
|
|
121
|
+
filters: {
|
|
122
|
+
brightness: 100,
|
|
123
|
+
contrast: 100,
|
|
124
|
+
saturation: 100,
|
|
125
|
+
blur: 0,
|
|
126
|
+
grayscale: 0,
|
|
127
|
+
sepia: 0,
|
|
128
|
+
hueRotate: 0
|
|
129
|
+
}
|
|
130
|
+
}));
|
|
131
|
+
};
|
|
132
|
+
const applyPreset = (preset) => {
|
|
133
|
+
const presets = {
|
|
134
|
+
vintage: { brightness: 110, contrast: 90, saturation: 80, blur: 0, grayscale: 0, sepia: 40, hueRotate: 0 },
|
|
135
|
+
bw: { brightness: 100, contrast: 110, saturation: 0, blur: 0, grayscale: 100, sepia: 0, hueRotate: 0 },
|
|
136
|
+
warm: { brightness: 105, contrast: 100, saturation: 110, blur: 0, grayscale: 0, sepia: 20, hueRotate: 10 },
|
|
137
|
+
cool: { brightness: 100, contrast: 100, saturation: 110, blur: 0, grayscale: 0, sepia: 0, hueRotate: 180 },
|
|
138
|
+
dramatic: { brightness: 90, contrast: 130, saturation: 120, blur: 0, grayscale: 0, sepia: 0, hueRotate: 0 },
|
|
139
|
+
soft: { brightness: 110, contrast: 85, saturation: 90, blur: 1, grayscale: 0, sepia: 0, hueRotate: 0 }
|
|
140
|
+
};
|
|
141
|
+
if (presets[preset]) {
|
|
142
|
+
setEditorState((prev) => ({ ...prev, filters: presets[preset] }));
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
if (!editorState.isOpen) return null;
|
|
146
|
+
const filterStyle = {
|
|
147
|
+
filter: `
|
|
148
|
+
brightness(${editorState.filters.brightness}%)
|
|
149
|
+
contrast(${editorState.filters.contrast}%)
|
|
150
|
+
saturate(${editorState.filters.saturation}%)
|
|
151
|
+
blur(${editorState.filters.blur}px)
|
|
152
|
+
grayscale(${editorState.filters.grayscale}%)
|
|
153
|
+
sepia(${editorState.filters.sepia}%)
|
|
154
|
+
hue-rotate(${editorState.filters.hueRotate}deg)
|
|
155
|
+
`
|
|
156
|
+
};
|
|
157
|
+
return /* @__PURE__ */ jsxs("div", { className: "cms-image-editor-modal", children: [
|
|
158
|
+
/* @__PURE__ */ jsx("div", { className: "cms-image-editor-overlay", onClick: handleClose }),
|
|
159
|
+
/* @__PURE__ */ jsxs("div", { className: "cms-image-editor-content", children: [
|
|
160
|
+
/* @__PURE__ */ jsxs("div", { className: "cms-image-editor-header", children: [
|
|
161
|
+
/* @__PURE__ */ jsx("h2", { children: "Edit Image" }),
|
|
162
|
+
/* @__PURE__ */ jsx("button", { onClick: handleClose, className: "cms-close-btn", children: "\xD7" })
|
|
163
|
+
] }),
|
|
164
|
+
/* @__PURE__ */ jsxs("div", { className: "cms-image-editor-body", children: [
|
|
165
|
+
/* @__PURE__ */ jsx("div", { className: "cms-image-editor-preview", children: /* @__PURE__ */ jsx("img", { src: editorState.src, alt: "Preview", style: filterStyle }) }),
|
|
166
|
+
/* @__PURE__ */ jsxs("div", { className: "cms-image-editor-controls", children: [
|
|
167
|
+
/* @__PURE__ */ jsxs("div", { className: "cms-editor-section", children: [
|
|
168
|
+
/* @__PURE__ */ jsx("h3", { children: "Presets" }),
|
|
169
|
+
/* @__PURE__ */ jsxs("div", { className: "cms-preset-buttons", children: [
|
|
170
|
+
/* @__PURE__ */ jsx("button", { onClick: () => applyPreset("vintage"), children: "Vintage" }),
|
|
171
|
+
/* @__PURE__ */ jsx("button", { onClick: () => applyPreset("bw"), children: "B&W" }),
|
|
172
|
+
/* @__PURE__ */ jsx("button", { onClick: () => applyPreset("warm"), children: "Warm" }),
|
|
173
|
+
/* @__PURE__ */ jsx("button", { onClick: () => applyPreset("cool"), children: "Cool" }),
|
|
174
|
+
/* @__PURE__ */ jsx("button", { onClick: () => applyPreset("dramatic"), children: "Dramatic" }),
|
|
175
|
+
/* @__PURE__ */ jsx("button", { onClick: () => applyPreset("soft"), children: "Soft" })
|
|
176
|
+
] })
|
|
177
|
+
] }),
|
|
178
|
+
/* @__PURE__ */ jsxs("div", { className: "cms-editor-section", children: [
|
|
179
|
+
/* @__PURE__ */ jsx("h3", { children: "Filters" }),
|
|
180
|
+
/* @__PURE__ */ jsx("div", { className: "cms-filter-control", children: /* @__PURE__ */ jsxs("label", { children: [
|
|
181
|
+
"Brightness: ",
|
|
182
|
+
editorState.filters.brightness,
|
|
183
|
+
"%",
|
|
184
|
+
/* @__PURE__ */ jsx(
|
|
185
|
+
"input",
|
|
186
|
+
{
|
|
187
|
+
type: "range",
|
|
188
|
+
min: "0",
|
|
189
|
+
max: "200",
|
|
190
|
+
value: editorState.filters.brightness,
|
|
191
|
+
onChange: (e) => setEditorState((prev) => ({
|
|
192
|
+
...prev,
|
|
193
|
+
filters: { ...prev.filters, brightness: Number(e.target.value) }
|
|
194
|
+
}))
|
|
195
|
+
}
|
|
196
|
+
)
|
|
197
|
+
] }) }),
|
|
198
|
+
/* @__PURE__ */ jsx("div", { className: "cms-filter-control", children: /* @__PURE__ */ jsxs("label", { children: [
|
|
199
|
+
"Contrast: ",
|
|
200
|
+
editorState.filters.contrast,
|
|
201
|
+
"%",
|
|
202
|
+
/* @__PURE__ */ jsx(
|
|
203
|
+
"input",
|
|
204
|
+
{
|
|
205
|
+
type: "range",
|
|
206
|
+
min: "0",
|
|
207
|
+
max: "200",
|
|
208
|
+
value: editorState.filters.contrast,
|
|
209
|
+
onChange: (e) => setEditorState((prev) => ({
|
|
210
|
+
...prev,
|
|
211
|
+
filters: { ...prev.filters, contrast: Number(e.target.value) }
|
|
212
|
+
}))
|
|
213
|
+
}
|
|
214
|
+
)
|
|
215
|
+
] }) }),
|
|
216
|
+
/* @__PURE__ */ jsx("div", { className: "cms-filter-control", children: /* @__PURE__ */ jsxs("label", { children: [
|
|
217
|
+
"Saturation: ",
|
|
218
|
+
editorState.filters.saturation,
|
|
219
|
+
"%",
|
|
220
|
+
/* @__PURE__ */ jsx(
|
|
221
|
+
"input",
|
|
222
|
+
{
|
|
223
|
+
type: "range",
|
|
224
|
+
min: "0",
|
|
225
|
+
max: "200",
|
|
226
|
+
value: editorState.filters.saturation,
|
|
227
|
+
onChange: (e) => setEditorState((prev) => ({
|
|
228
|
+
...prev,
|
|
229
|
+
filters: { ...prev.filters, saturation: Number(e.target.value) }
|
|
230
|
+
}))
|
|
231
|
+
}
|
|
232
|
+
)
|
|
233
|
+
] }) }),
|
|
234
|
+
/* @__PURE__ */ jsx("div", { className: "cms-filter-control", children: /* @__PURE__ */ jsxs("label", { children: [
|
|
235
|
+
"Blur: ",
|
|
236
|
+
editorState.filters.blur,
|
|
237
|
+
"px",
|
|
238
|
+
/* @__PURE__ */ jsx(
|
|
239
|
+
"input",
|
|
240
|
+
{
|
|
241
|
+
type: "range",
|
|
242
|
+
min: "0",
|
|
243
|
+
max: "10",
|
|
244
|
+
value: editorState.filters.blur,
|
|
245
|
+
onChange: (e) => setEditorState((prev) => ({
|
|
246
|
+
...prev,
|
|
247
|
+
filters: { ...prev.filters, blur: Number(e.target.value) }
|
|
248
|
+
}))
|
|
249
|
+
}
|
|
250
|
+
)
|
|
251
|
+
] }) }),
|
|
252
|
+
/* @__PURE__ */ jsx("div", { className: "cms-filter-control", children: /* @__PURE__ */ jsxs("label", { children: [
|
|
253
|
+
"Grayscale: ",
|
|
254
|
+
editorState.filters.grayscale,
|
|
255
|
+
"%",
|
|
256
|
+
/* @__PURE__ */ jsx(
|
|
257
|
+
"input",
|
|
258
|
+
{
|
|
259
|
+
type: "range",
|
|
260
|
+
min: "0",
|
|
261
|
+
max: "100",
|
|
262
|
+
value: editorState.filters.grayscale,
|
|
263
|
+
onChange: (e) => setEditorState((prev) => ({
|
|
264
|
+
...prev,
|
|
265
|
+
filters: { ...prev.filters, grayscale: Number(e.target.value) }
|
|
266
|
+
}))
|
|
267
|
+
}
|
|
268
|
+
)
|
|
269
|
+
] }) }),
|
|
270
|
+
/* @__PURE__ */ jsx("div", { className: "cms-filter-control", children: /* @__PURE__ */ jsxs("label", { children: [
|
|
271
|
+
"Sepia: ",
|
|
272
|
+
editorState.filters.sepia,
|
|
273
|
+
"%",
|
|
274
|
+
/* @__PURE__ */ jsx(
|
|
275
|
+
"input",
|
|
276
|
+
{
|
|
277
|
+
type: "range",
|
|
278
|
+
min: "0",
|
|
279
|
+
max: "100",
|
|
280
|
+
value: editorState.filters.sepia,
|
|
281
|
+
onChange: (e) => setEditorState((prev) => ({
|
|
282
|
+
...prev,
|
|
283
|
+
filters: { ...prev.filters, sepia: Number(e.target.value) }
|
|
284
|
+
}))
|
|
285
|
+
}
|
|
286
|
+
)
|
|
287
|
+
] }) }),
|
|
288
|
+
/* @__PURE__ */ jsx("div", { className: "cms-filter-control", children: /* @__PURE__ */ jsxs("label", { children: [
|
|
289
|
+
"Hue Rotate: ",
|
|
290
|
+
editorState.filters.hueRotate,
|
|
291
|
+
"\xB0",
|
|
292
|
+
/* @__PURE__ */ jsx(
|
|
293
|
+
"input",
|
|
294
|
+
{
|
|
295
|
+
type: "range",
|
|
296
|
+
min: "0",
|
|
297
|
+
max: "360",
|
|
298
|
+
value: editorState.filters.hueRotate,
|
|
299
|
+
onChange: (e) => setEditorState((prev) => ({
|
|
300
|
+
...prev,
|
|
301
|
+
filters: { ...prev.filters, hueRotate: Number(e.target.value) }
|
|
302
|
+
}))
|
|
303
|
+
}
|
|
304
|
+
)
|
|
305
|
+
] }) })
|
|
306
|
+
] }),
|
|
307
|
+
/* @__PURE__ */ jsxs("div", { className: "cms-editor-section", children: [
|
|
308
|
+
/* @__PURE__ */ jsx("h3", { children: "Crop" }),
|
|
309
|
+
/* @__PURE__ */ jsx("div", { className: "cms-crop-info", children: /* @__PURE__ */ jsx("p", { children: "Click and drag on the image to crop (coming soon)" }) })
|
|
310
|
+
] })
|
|
311
|
+
] })
|
|
312
|
+
] }),
|
|
313
|
+
/* @__PURE__ */ jsxs("div", { className: "cms-image-editor-footer", children: [
|
|
314
|
+
/* @__PURE__ */ jsx("button", { onClick: resetFilters, className: "cms-btn-secondary", children: "Reset" }),
|
|
315
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
316
|
+
/* @__PURE__ */ jsx("button", { onClick: handleClose, className: "cms-btn-secondary", children: "Cancel" }),
|
|
317
|
+
/* @__PURE__ */ jsx("button", { onClick: applyFilters, className: "cms-btn-primary", children: "Apply" })
|
|
318
|
+
] })
|
|
319
|
+
] })
|
|
320
|
+
] })
|
|
321
|
+
] });
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
// src/blocks/ImageNode.tsx
|
|
325
|
+
import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
29
326
|
function ImageComponent({
|
|
30
327
|
src,
|
|
31
328
|
alt,
|
|
@@ -36,14 +333,14 @@ function ImageComponent({
|
|
|
36
333
|
}) {
|
|
37
334
|
const imageRef = useRef(null);
|
|
38
335
|
const wrapperRef = useRef(null);
|
|
39
|
-
const [isResizing, setIsResizing] =
|
|
40
|
-
const [isSelected, setIsSelected] =
|
|
41
|
-
const [isDragging, setIsDragging] =
|
|
42
|
-
const [size, setSize] =
|
|
336
|
+
const [isResizing, setIsResizing] = useState2(false);
|
|
337
|
+
const [isSelected, setIsSelected] = useState2(false);
|
|
338
|
+
const [isDragging, setIsDragging] = useState2(false);
|
|
339
|
+
const [size, setSize] = useState2({
|
|
43
340
|
width: initialWidth || 0,
|
|
44
341
|
height: initialHeight || 0
|
|
45
342
|
});
|
|
46
|
-
|
|
343
|
+
useEffect2(() => {
|
|
47
344
|
if (imageRef.current && (!size.width || !size.height)) {
|
|
48
345
|
const img = imageRef.current;
|
|
49
346
|
const onLoad = () => {
|
|
@@ -152,7 +449,7 @@ function ImageComponent({
|
|
|
152
449
|
document.addEventListener("mousemove", onMouseMove);
|
|
153
450
|
document.addEventListener("mouseup", onMouseUp);
|
|
154
451
|
}, [src, alt, size, nodeKey, editor]);
|
|
155
|
-
return /* @__PURE__ */
|
|
452
|
+
return /* @__PURE__ */ jsxs2(
|
|
156
453
|
"div",
|
|
157
454
|
{
|
|
158
455
|
ref: wrapperRef,
|
|
@@ -168,7 +465,7 @@ function ImageComponent({
|
|
|
168
465
|
cursor: isSelected ? "move" : "pointer"
|
|
169
466
|
},
|
|
170
467
|
children: [
|
|
171
|
-
/* @__PURE__ */
|
|
468
|
+
/* @__PURE__ */ jsx2(
|
|
172
469
|
"img",
|
|
173
470
|
{
|
|
174
471
|
ref: imageRef,
|
|
@@ -185,8 +482,40 @@ function ImageComponent({
|
|
|
185
482
|
}
|
|
186
483
|
}
|
|
187
484
|
),
|
|
188
|
-
isSelected && /* @__PURE__ */
|
|
189
|
-
/* @__PURE__ */
|
|
485
|
+
isSelected && /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
486
|
+
/* @__PURE__ */ jsx2(
|
|
487
|
+
"button",
|
|
488
|
+
{
|
|
489
|
+
onClick: (e) => {
|
|
490
|
+
e.stopPropagation();
|
|
491
|
+
editor.dispatchCommand(OPEN_IMAGE_EDITOR_COMMAND, { nodeKey, src });
|
|
492
|
+
},
|
|
493
|
+
style: {
|
|
494
|
+
position: "absolute",
|
|
495
|
+
top: "8px",
|
|
496
|
+
right: "8px",
|
|
497
|
+
padding: "8px 16px",
|
|
498
|
+
background: "#667eea",
|
|
499
|
+
color: "white",
|
|
500
|
+
border: "none",
|
|
501
|
+
borderRadius: "6px",
|
|
502
|
+
fontSize: "13px",
|
|
503
|
+
fontWeight: "500",
|
|
504
|
+
cursor: "pointer",
|
|
505
|
+
boxShadow: "0 2px 8px rgba(0,0,0,0.2)",
|
|
506
|
+
zIndex: 10,
|
|
507
|
+
transition: "all 0.2s"
|
|
508
|
+
},
|
|
509
|
+
onMouseEnter: (e) => {
|
|
510
|
+
e.currentTarget.style.background = "#5568d3";
|
|
511
|
+
},
|
|
512
|
+
onMouseLeave: (e) => {
|
|
513
|
+
e.currentTarget.style.background = "#667eea";
|
|
514
|
+
},
|
|
515
|
+
children: "\u270F\uFE0F Edit"
|
|
516
|
+
}
|
|
517
|
+
),
|
|
518
|
+
/* @__PURE__ */ jsx2(
|
|
190
519
|
"div",
|
|
191
520
|
{
|
|
192
521
|
className: "image-resize-handle image-resize-handle-nw",
|
|
@@ -205,7 +534,7 @@ function ImageComponent({
|
|
|
205
534
|
}
|
|
206
535
|
}
|
|
207
536
|
),
|
|
208
|
-
/* @__PURE__ */
|
|
537
|
+
/* @__PURE__ */ jsx2(
|
|
209
538
|
"div",
|
|
210
539
|
{
|
|
211
540
|
className: "image-resize-handle image-resize-handle-ne",
|
|
@@ -224,7 +553,7 @@ function ImageComponent({
|
|
|
224
553
|
}
|
|
225
554
|
}
|
|
226
555
|
),
|
|
227
|
-
/* @__PURE__ */
|
|
556
|
+
/* @__PURE__ */ jsx2(
|
|
228
557
|
"div",
|
|
229
558
|
{
|
|
230
559
|
className: "image-resize-handle image-resize-handle-sw",
|
|
@@ -243,7 +572,7 @@ function ImageComponent({
|
|
|
243
572
|
}
|
|
244
573
|
}
|
|
245
574
|
),
|
|
246
|
-
/* @__PURE__ */
|
|
575
|
+
/* @__PURE__ */ jsx2(
|
|
247
576
|
"div",
|
|
248
577
|
{
|
|
249
578
|
className: "image-resize-handle image-resize-handle-se",
|
|
@@ -262,7 +591,7 @@ function ImageComponent({
|
|
|
262
591
|
}
|
|
263
592
|
}
|
|
264
593
|
),
|
|
265
|
-
/* @__PURE__ */
|
|
594
|
+
/* @__PURE__ */ jsx2(
|
|
266
595
|
"div",
|
|
267
596
|
{
|
|
268
597
|
className: "image-resize-handle image-resize-handle-n",
|
|
@@ -281,7 +610,7 @@ function ImageComponent({
|
|
|
281
610
|
}
|
|
282
611
|
}
|
|
283
612
|
),
|
|
284
|
-
/* @__PURE__ */
|
|
613
|
+
/* @__PURE__ */ jsx2(
|
|
285
614
|
"div",
|
|
286
615
|
{
|
|
287
616
|
className: "image-resize-handle image-resize-handle-s",
|
|
@@ -300,7 +629,7 @@ function ImageComponent({
|
|
|
300
629
|
}
|
|
301
630
|
}
|
|
302
631
|
),
|
|
303
|
-
/* @__PURE__ */
|
|
632
|
+
/* @__PURE__ */ jsx2(
|
|
304
633
|
"div",
|
|
305
634
|
{
|
|
306
635
|
className: "image-resize-handle image-resize-handle-e",
|
|
@@ -319,7 +648,7 @@ function ImageComponent({
|
|
|
319
648
|
}
|
|
320
649
|
}
|
|
321
650
|
),
|
|
322
|
-
/* @__PURE__ */
|
|
651
|
+
/* @__PURE__ */ jsx2(
|
|
323
652
|
"div",
|
|
324
653
|
{
|
|
325
654
|
className: "image-resize-handle image-resize-handle-w",
|
|
@@ -370,7 +699,7 @@ var ImageNode = class _ImageNode extends DecoratorNode {
|
|
|
370
699
|
return false;
|
|
371
700
|
}
|
|
372
701
|
decorate(editor) {
|
|
373
|
-
return /* @__PURE__ */
|
|
702
|
+
return /* @__PURE__ */ jsx2(
|
|
374
703
|
ImageComponent,
|
|
375
704
|
{
|
|
376
705
|
src: this.__src,
|
|
@@ -404,8 +733,8 @@ var ImageNode = class _ImageNode extends DecoratorNode {
|
|
|
404
733
|
|
|
405
734
|
// src/blocks/YouTubeNode.tsx
|
|
406
735
|
import { DecoratorNode as DecoratorNode2 } from "lexical";
|
|
407
|
-
import { useCallback as useCallback2, useRef as useRef2, useState as
|
|
408
|
-
import { Fragment as Fragment2, jsx as
|
|
736
|
+
import { useCallback as useCallback2, useRef as useRef2, useState as useState3 } from "react";
|
|
737
|
+
import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
409
738
|
function YouTubeComponent({
|
|
410
739
|
id,
|
|
411
740
|
width: initialWidth,
|
|
@@ -414,10 +743,10 @@ function YouTubeComponent({
|
|
|
414
743
|
editor
|
|
415
744
|
}) {
|
|
416
745
|
const wrapperRef = useRef2(null);
|
|
417
|
-
const [isResizing, setIsResizing] =
|
|
418
|
-
const [isSelected, setIsSelected] =
|
|
419
|
-
const [isDragging, setIsDragging] =
|
|
420
|
-
const [size, setSize] =
|
|
746
|
+
const [isResizing, setIsResizing] = useState3(false);
|
|
747
|
+
const [isSelected, setIsSelected] = useState3(false);
|
|
748
|
+
const [isDragging, setIsDragging] = useState3(false);
|
|
749
|
+
const [size, setSize] = useState3({
|
|
421
750
|
width: initialWidth || 560,
|
|
422
751
|
height: initialHeight || 315
|
|
423
752
|
});
|
|
@@ -513,7 +842,7 @@ function YouTubeComponent({
|
|
|
513
842
|
document.addEventListener("mousemove", onMouseMove);
|
|
514
843
|
document.addEventListener("mouseup", onMouseUp);
|
|
515
844
|
}, [id, size, nodeKey, editor]);
|
|
516
|
-
return /* @__PURE__ */
|
|
845
|
+
return /* @__PURE__ */ jsxs3(
|
|
517
846
|
"div",
|
|
518
847
|
{
|
|
519
848
|
ref: wrapperRef,
|
|
@@ -529,7 +858,7 @@ function YouTubeComponent({
|
|
|
529
858
|
cursor: isSelected ? "move" : "pointer"
|
|
530
859
|
},
|
|
531
860
|
children: [
|
|
532
|
-
/* @__PURE__ */
|
|
861
|
+
/* @__PURE__ */ jsx3(
|
|
533
862
|
"iframe",
|
|
534
863
|
{
|
|
535
864
|
src: `https://www.youtube.com/embed/${id}`,
|
|
@@ -546,8 +875,8 @@ function YouTubeComponent({
|
|
|
546
875
|
}
|
|
547
876
|
}
|
|
548
877
|
),
|
|
549
|
-
isSelected && /* @__PURE__ */
|
|
550
|
-
/* @__PURE__ */
|
|
878
|
+
isSelected && /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
879
|
+
/* @__PURE__ */ jsx3(
|
|
551
880
|
"div",
|
|
552
881
|
{
|
|
553
882
|
className: "youtube-resize-handle youtube-resize-handle-nw",
|
|
@@ -567,7 +896,7 @@ function YouTubeComponent({
|
|
|
567
896
|
}
|
|
568
897
|
}
|
|
569
898
|
),
|
|
570
|
-
/* @__PURE__ */
|
|
899
|
+
/* @__PURE__ */ jsx3(
|
|
571
900
|
"div",
|
|
572
901
|
{
|
|
573
902
|
className: "youtube-resize-handle youtube-resize-handle-ne",
|
|
@@ -587,7 +916,7 @@ function YouTubeComponent({
|
|
|
587
916
|
}
|
|
588
917
|
}
|
|
589
918
|
),
|
|
590
|
-
/* @__PURE__ */
|
|
919
|
+
/* @__PURE__ */ jsx3(
|
|
591
920
|
"div",
|
|
592
921
|
{
|
|
593
922
|
className: "youtube-resize-handle youtube-resize-handle-sw",
|
|
@@ -607,7 +936,7 @@ function YouTubeComponent({
|
|
|
607
936
|
}
|
|
608
937
|
}
|
|
609
938
|
),
|
|
610
|
-
/* @__PURE__ */
|
|
939
|
+
/* @__PURE__ */ jsx3(
|
|
611
940
|
"div",
|
|
612
941
|
{
|
|
613
942
|
className: "youtube-resize-handle youtube-resize-handle-se",
|
|
@@ -627,7 +956,7 @@ function YouTubeComponent({
|
|
|
627
956
|
}
|
|
628
957
|
}
|
|
629
958
|
),
|
|
630
|
-
/* @__PURE__ */
|
|
959
|
+
/* @__PURE__ */ jsx3(
|
|
631
960
|
"div",
|
|
632
961
|
{
|
|
633
962
|
className: "youtube-resize-handle youtube-resize-handle-n",
|
|
@@ -647,7 +976,7 @@ function YouTubeComponent({
|
|
|
647
976
|
}
|
|
648
977
|
}
|
|
649
978
|
),
|
|
650
|
-
/* @__PURE__ */
|
|
979
|
+
/* @__PURE__ */ jsx3(
|
|
651
980
|
"div",
|
|
652
981
|
{
|
|
653
982
|
className: "youtube-resize-handle youtube-resize-handle-s",
|
|
@@ -667,7 +996,7 @@ function YouTubeComponent({
|
|
|
667
996
|
}
|
|
668
997
|
}
|
|
669
998
|
),
|
|
670
|
-
/* @__PURE__ */
|
|
999
|
+
/* @__PURE__ */ jsx3(
|
|
671
1000
|
"div",
|
|
672
1001
|
{
|
|
673
1002
|
className: "youtube-resize-handle youtube-resize-handle-e",
|
|
@@ -687,7 +1016,7 @@ function YouTubeComponent({
|
|
|
687
1016
|
}
|
|
688
1017
|
}
|
|
689
1018
|
),
|
|
690
|
-
/* @__PURE__ */
|
|
1019
|
+
/* @__PURE__ */ jsx3(
|
|
691
1020
|
"div",
|
|
692
1021
|
{
|
|
693
1022
|
className: "youtube-resize-handle youtube-resize-handle-w",
|
|
@@ -738,7 +1067,7 @@ var YouTubeNode = class _YouTubeNode extends DecoratorNode2 {
|
|
|
738
1067
|
return false;
|
|
739
1068
|
}
|
|
740
1069
|
decorate(editor) {
|
|
741
|
-
return /* @__PURE__ */
|
|
1070
|
+
return /* @__PURE__ */ jsx3(
|
|
742
1071
|
YouTubeComponent,
|
|
743
1072
|
{
|
|
744
1073
|
id: this.__id,
|
|
@@ -876,12 +1205,12 @@ function $createColumnNode() {
|
|
|
876
1205
|
}
|
|
877
1206
|
|
|
878
1207
|
// src/plugins/SlashCommandPlugin.tsx
|
|
879
|
-
import { jsx as
|
|
1208
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
880
1209
|
function SlashCommandPlugin() {
|
|
881
|
-
const [editor] =
|
|
882
|
-
const [showMenu, setShowMenu] =
|
|
883
|
-
const [search, setSearch] =
|
|
884
|
-
const [selectedIndex, setSelectedIndex] =
|
|
1210
|
+
const [editor] = useLexicalComposerContext2();
|
|
1211
|
+
const [showMenu, setShowMenu] = useState4(false);
|
|
1212
|
+
const [search, setSearch] = useState4("");
|
|
1213
|
+
const [selectedIndex, setSelectedIndex] = useState4(0);
|
|
885
1214
|
const commands = [
|
|
886
1215
|
{
|
|
887
1216
|
title: "Heading 1",
|
|
@@ -1064,7 +1393,7 @@ function SlashCommandPlugin() {
|
|
|
1064
1393
|
const searchLower = search.toLowerCase();
|
|
1065
1394
|
return cmd.title.toLowerCase().includes(searchLower) || cmd.description.toLowerCase().includes(searchLower) || cmd.keywords.some((kw) => kw.includes(searchLower));
|
|
1066
1395
|
});
|
|
1067
|
-
|
|
1396
|
+
useEffect3(() => {
|
|
1068
1397
|
return editor.registerUpdateListener(({ editorState }) => {
|
|
1069
1398
|
editorState.read(() => {
|
|
1070
1399
|
const selection = $getSelection();
|
|
@@ -1086,7 +1415,7 @@ function SlashCommandPlugin() {
|
|
|
1086
1415
|
});
|
|
1087
1416
|
});
|
|
1088
1417
|
}, [editor, showMenu]);
|
|
1089
|
-
|
|
1418
|
+
useEffect3(() => {
|
|
1090
1419
|
if (!showMenu) return;
|
|
1091
1420
|
const handleKeyDown = (event) => {
|
|
1092
1421
|
if (event.key === "ArrowDown") {
|
|
@@ -1132,17 +1461,17 @@ function SlashCommandPlugin() {
|
|
|
1132
1461
|
if (!showMenu || filteredCommands.length === 0) {
|
|
1133
1462
|
return null;
|
|
1134
1463
|
}
|
|
1135
|
-
return /* @__PURE__ */
|
|
1136
|
-
/* @__PURE__ */
|
|
1137
|
-
filteredCommands.map((cmd, index) => /* @__PURE__ */
|
|
1464
|
+
return /* @__PURE__ */ jsxs4("div", { className: "slash-menu", children: [
|
|
1465
|
+
/* @__PURE__ */ jsx4("div", { className: "slash-menu-title", children: "Commands" }),
|
|
1466
|
+
filteredCommands.map((cmd, index) => /* @__PURE__ */ jsxs4(
|
|
1138
1467
|
"div",
|
|
1139
1468
|
{
|
|
1140
1469
|
className: `slash-menu-item ${index === selectedIndex ? "selected" : ""}`,
|
|
1141
1470
|
onClick: () => executeCommand(cmd),
|
|
1142
1471
|
onMouseEnter: () => setSelectedIndex(index),
|
|
1143
1472
|
children: [
|
|
1144
|
-
/* @__PURE__ */
|
|
1145
|
-
/* @__PURE__ */
|
|
1473
|
+
/* @__PURE__ */ jsx4("div", { className: "slash-menu-item-title", children: cmd.title }),
|
|
1474
|
+
/* @__PURE__ */ jsx4("div", { className: "slash-menu-item-description", children: cmd.description })
|
|
1146
1475
|
]
|
|
1147
1476
|
},
|
|
1148
1477
|
cmd.title
|
|
@@ -1151,7 +1480,7 @@ function SlashCommandPlugin() {
|
|
|
1151
1480
|
}
|
|
1152
1481
|
|
|
1153
1482
|
// src/plugins/ToolbarPlugin.tsx
|
|
1154
|
-
import { useLexicalComposerContext as
|
|
1483
|
+
import { useLexicalComposerContext as useLexicalComposerContext8 } from "@lexical/react/LexicalComposerContext";
|
|
1155
1484
|
import {
|
|
1156
1485
|
$getSelection as $getSelection6,
|
|
1157
1486
|
$isRangeSelection as $isRangeSelection6,
|
|
@@ -1170,12 +1499,12 @@ import {
|
|
|
1170
1499
|
import { $createCodeNode as $createCodeNode2 } from "@lexical/code";
|
|
1171
1500
|
|
|
1172
1501
|
// src/plugins/ColorPickerPlugin.tsx
|
|
1173
|
-
import { useLexicalComposerContext as
|
|
1174
|
-
import { useState as
|
|
1502
|
+
import { useLexicalComposerContext as useLexicalComposerContext3 } from "@lexical/react/LexicalComposerContext";
|
|
1503
|
+
import { useState as useState5, useCallback as useCallback3, useEffect as useEffect4, useRef as useRef3 } from "react";
|
|
1175
1504
|
import { $getSelection as $getSelection2, $isRangeSelection as $isRangeSelection2, $isTextNode } from "lexical";
|
|
1176
1505
|
import { $patchStyleText } from "@lexical/selection";
|
|
1177
1506
|
import { MdFormatColorText, MdFormatColorFill } from "react-icons/md";
|
|
1178
|
-
import { Fragment as Fragment3, jsx as
|
|
1507
|
+
import { Fragment as Fragment3, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1179
1508
|
var PRESET_COLORS = [
|
|
1180
1509
|
"#000000",
|
|
1181
1510
|
"#434343",
|
|
@@ -1259,16 +1588,16 @@ var PRESET_COLORS = [
|
|
|
1259
1588
|
"#4c1130"
|
|
1260
1589
|
];
|
|
1261
1590
|
function ColorPickerPlugin() {
|
|
1262
|
-
const [editor] =
|
|
1263
|
-
const [showTextColorPicker, setShowTextColorPicker] =
|
|
1264
|
-
const [showBgColorPicker, setShowBgColorPicker] =
|
|
1265
|
-
const [currentTextColor, setCurrentTextColor] =
|
|
1266
|
-
const [currentBgColor, setCurrentBgColor] =
|
|
1267
|
-
const [textColorPosition, setTextColorPosition] =
|
|
1268
|
-
const [bgColorPosition, setBgColorPosition] =
|
|
1591
|
+
const [editor] = useLexicalComposerContext3();
|
|
1592
|
+
const [showTextColorPicker, setShowTextColorPicker] = useState5(false);
|
|
1593
|
+
const [showBgColorPicker, setShowBgColorPicker] = useState5(false);
|
|
1594
|
+
const [currentTextColor, setCurrentTextColor] = useState5("#000000");
|
|
1595
|
+
const [currentBgColor, setCurrentBgColor] = useState5("transparent");
|
|
1596
|
+
const [textColorPosition, setTextColorPosition] = useState5({ top: 0, left: 0 });
|
|
1597
|
+
const [bgColorPosition, setBgColorPosition] = useState5({ top: 0, left: 0 });
|
|
1269
1598
|
const textColorRef = useRef3(null);
|
|
1270
1599
|
const bgColorRef = useRef3(null);
|
|
1271
|
-
|
|
1600
|
+
useEffect4(() => {
|
|
1272
1601
|
return editor.registerUpdateListener(({ editorState }) => {
|
|
1273
1602
|
editorState.read(() => {
|
|
1274
1603
|
const selection = $getSelection2();
|
|
@@ -1292,7 +1621,7 @@ function ColorPickerPlugin() {
|
|
|
1292
1621
|
});
|
|
1293
1622
|
});
|
|
1294
1623
|
}, [editor]);
|
|
1295
|
-
|
|
1624
|
+
useEffect4(() => {
|
|
1296
1625
|
const handleClickOutside = (event) => {
|
|
1297
1626
|
if (textColorRef.current && !textColorRef.current.contains(event.target)) {
|
|
1298
1627
|
setShowTextColorPicker(false);
|
|
@@ -1366,18 +1695,18 @@ function ColorPickerPlugin() {
|
|
|
1366
1695
|
setCurrentBgColor("transparent");
|
|
1367
1696
|
setShowBgColorPicker(false);
|
|
1368
1697
|
}, [editor]);
|
|
1369
|
-
return /* @__PURE__ */
|
|
1370
|
-
/* @__PURE__ */
|
|
1371
|
-
/* @__PURE__ */
|
|
1698
|
+
return /* @__PURE__ */ jsxs5(Fragment3, { children: [
|
|
1699
|
+
/* @__PURE__ */ jsxs5("div", { className: "cms-color-picker-plugin", ref: textColorRef, children: [
|
|
1700
|
+
/* @__PURE__ */ jsx5(
|
|
1372
1701
|
"button",
|
|
1373
1702
|
{
|
|
1374
1703
|
className: "cms-toolbar-button",
|
|
1375
1704
|
onClick: toggleTextColorPicker,
|
|
1376
1705
|
title: "Text Color",
|
|
1377
1706
|
type: "button",
|
|
1378
|
-
children: /* @__PURE__ */
|
|
1379
|
-
/* @__PURE__ */
|
|
1380
|
-
/* @__PURE__ */
|
|
1707
|
+
children: /* @__PURE__ */ jsxs5("div", { className: "cms-color-button-wrapper", children: [
|
|
1708
|
+
/* @__PURE__ */ jsx5(MdFormatColorText, { size: 18 }),
|
|
1709
|
+
/* @__PURE__ */ jsx5(
|
|
1381
1710
|
"div",
|
|
1382
1711
|
{
|
|
1383
1712
|
className: "cms-color-indicator",
|
|
@@ -1387,7 +1716,7 @@ function ColorPickerPlugin() {
|
|
|
1387
1716
|
] })
|
|
1388
1717
|
}
|
|
1389
1718
|
),
|
|
1390
|
-
showTextColorPicker && /* @__PURE__ */
|
|
1719
|
+
showTextColorPicker && /* @__PURE__ */ jsxs5(
|
|
1391
1720
|
"div",
|
|
1392
1721
|
{
|
|
1393
1722
|
className: "cms-color-picker-menu",
|
|
@@ -1396,9 +1725,9 @@ function ColorPickerPlugin() {
|
|
|
1396
1725
|
left: `${textColorPosition.left}px`
|
|
1397
1726
|
},
|
|
1398
1727
|
children: [
|
|
1399
|
-
/* @__PURE__ */
|
|
1400
|
-
/* @__PURE__ */
|
|
1401
|
-
/* @__PURE__ */
|
|
1728
|
+
/* @__PURE__ */ jsxs5("div", { className: "cms-color-picker-header", children: [
|
|
1729
|
+
/* @__PURE__ */ jsx5("span", { children: "Text Color" }),
|
|
1730
|
+
/* @__PURE__ */ jsx5(
|
|
1402
1731
|
"button",
|
|
1403
1732
|
{
|
|
1404
1733
|
className: "cms-color-remove-btn",
|
|
@@ -1408,7 +1737,7 @@ function ColorPickerPlugin() {
|
|
|
1408
1737
|
}
|
|
1409
1738
|
)
|
|
1410
1739
|
] }),
|
|
1411
|
-
/* @__PURE__ */
|
|
1740
|
+
/* @__PURE__ */ jsx5("div", { className: "cms-color-grid", children: PRESET_COLORS.map((color) => /* @__PURE__ */ jsx5(
|
|
1412
1741
|
"button",
|
|
1413
1742
|
{
|
|
1414
1743
|
className: `cms-color-swatch ${currentTextColor === color ? "active" : ""}`,
|
|
@@ -1419,9 +1748,9 @@ function ColorPickerPlugin() {
|
|
|
1419
1748
|
},
|
|
1420
1749
|
color
|
|
1421
1750
|
)) }),
|
|
1422
|
-
/* @__PURE__ */
|
|
1751
|
+
/* @__PURE__ */ jsx5("div", { className: "cms-color-custom", children: /* @__PURE__ */ jsxs5("label", { children: [
|
|
1423
1752
|
"Custom:",
|
|
1424
|
-
/* @__PURE__ */
|
|
1753
|
+
/* @__PURE__ */ jsx5(
|
|
1425
1754
|
"input",
|
|
1426
1755
|
{
|
|
1427
1756
|
type: "color",
|
|
@@ -1435,17 +1764,17 @@ function ColorPickerPlugin() {
|
|
|
1435
1764
|
}
|
|
1436
1765
|
)
|
|
1437
1766
|
] }),
|
|
1438
|
-
/* @__PURE__ */
|
|
1439
|
-
/* @__PURE__ */
|
|
1767
|
+
/* @__PURE__ */ jsxs5("div", { className: "cms-color-picker-plugin", ref: bgColorRef, children: [
|
|
1768
|
+
/* @__PURE__ */ jsx5(
|
|
1440
1769
|
"button",
|
|
1441
1770
|
{
|
|
1442
1771
|
className: "cms-toolbar-button",
|
|
1443
1772
|
onClick: toggleBgColorPicker,
|
|
1444
1773
|
title: "Background Color",
|
|
1445
1774
|
type: "button",
|
|
1446
|
-
children: /* @__PURE__ */
|
|
1447
|
-
/* @__PURE__ */
|
|
1448
|
-
/* @__PURE__ */
|
|
1775
|
+
children: /* @__PURE__ */ jsxs5("div", { className: "cms-color-button-wrapper", children: [
|
|
1776
|
+
/* @__PURE__ */ jsx5(MdFormatColorFill, { size: 18 }),
|
|
1777
|
+
/* @__PURE__ */ jsx5(
|
|
1449
1778
|
"div",
|
|
1450
1779
|
{
|
|
1451
1780
|
className: "cms-color-indicator",
|
|
@@ -1455,7 +1784,7 @@ function ColorPickerPlugin() {
|
|
|
1455
1784
|
] })
|
|
1456
1785
|
}
|
|
1457
1786
|
),
|
|
1458
|
-
showBgColorPicker && /* @__PURE__ */
|
|
1787
|
+
showBgColorPicker && /* @__PURE__ */ jsxs5(
|
|
1459
1788
|
"div",
|
|
1460
1789
|
{
|
|
1461
1790
|
className: "cms-color-picker-menu",
|
|
@@ -1464,9 +1793,9 @@ function ColorPickerPlugin() {
|
|
|
1464
1793
|
left: `${bgColorPosition.left}px`
|
|
1465
1794
|
},
|
|
1466
1795
|
children: [
|
|
1467
|
-
/* @__PURE__ */
|
|
1468
|
-
/* @__PURE__ */
|
|
1469
|
-
/* @__PURE__ */
|
|
1796
|
+
/* @__PURE__ */ jsxs5("div", { className: "cms-color-picker-header", children: [
|
|
1797
|
+
/* @__PURE__ */ jsx5("span", { children: "Background Color" }),
|
|
1798
|
+
/* @__PURE__ */ jsx5(
|
|
1470
1799
|
"button",
|
|
1471
1800
|
{
|
|
1472
1801
|
className: "cms-color-remove-btn",
|
|
@@ -1476,7 +1805,7 @@ function ColorPickerPlugin() {
|
|
|
1476
1805
|
}
|
|
1477
1806
|
)
|
|
1478
1807
|
] }),
|
|
1479
|
-
/* @__PURE__ */
|
|
1808
|
+
/* @__PURE__ */ jsx5("div", { className: "cms-color-grid", children: PRESET_COLORS.map((color) => /* @__PURE__ */ jsx5(
|
|
1480
1809
|
"button",
|
|
1481
1810
|
{
|
|
1482
1811
|
className: `cms-color-swatch ${currentBgColor === color ? "active" : ""}`,
|
|
@@ -1487,9 +1816,9 @@ function ColorPickerPlugin() {
|
|
|
1487
1816
|
},
|
|
1488
1817
|
color
|
|
1489
1818
|
)) }),
|
|
1490
|
-
/* @__PURE__ */
|
|
1819
|
+
/* @__PURE__ */ jsx5("div", { className: "cms-color-custom", children: /* @__PURE__ */ jsxs5("label", { children: [
|
|
1491
1820
|
"Custom:",
|
|
1492
|
-
/* @__PURE__ */
|
|
1821
|
+
/* @__PURE__ */ jsx5(
|
|
1493
1822
|
"input",
|
|
1494
1823
|
{
|
|
1495
1824
|
type: "color",
|
|
@@ -1507,29 +1836,29 @@ function ColorPickerPlugin() {
|
|
|
1507
1836
|
}
|
|
1508
1837
|
|
|
1509
1838
|
// src/plugins/SpacingPlugin.tsx
|
|
1510
|
-
import { useLexicalComposerContext as
|
|
1511
|
-
import { useState as
|
|
1839
|
+
import { useLexicalComposerContext as useLexicalComposerContext4 } from "@lexical/react/LexicalComposerContext";
|
|
1840
|
+
import { useState as useState6, useCallback as useCallback4, useEffect as useEffect5, useRef as useRef4 } from "react";
|
|
1512
1841
|
import { $getSelection as $getSelection3, $isRangeSelection as $isRangeSelection3, $isTextNode as $isTextNode2 } from "lexical";
|
|
1513
1842
|
import { $patchStyleText as $patchStyleText2 } from "@lexical/selection";
|
|
1514
1843
|
import { MdSettings } from "react-icons/md";
|
|
1515
1844
|
import { TbBoxPadding, TbBoxMargin } from "react-icons/tb";
|
|
1516
|
-
import { jsx as
|
|
1845
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1517
1846
|
var SPACING_PRESETS = [0, 4, 8, 12, 16, 20, 24, 32, 40, 48];
|
|
1518
1847
|
function SpacingPlugin() {
|
|
1519
|
-
const [editor] =
|
|
1520
|
-
const [showSpacingMenu, setShowSpacingMenu] =
|
|
1521
|
-
const [spacingPosition, setSpacingPosition] =
|
|
1848
|
+
const [editor] = useLexicalComposerContext4();
|
|
1849
|
+
const [showSpacingMenu, setShowSpacingMenu] = useState6(false);
|
|
1850
|
+
const [spacingPosition, setSpacingPosition] = useState6({ top: 0, left: 0 });
|
|
1522
1851
|
const spacingRef = useRef4(null);
|
|
1523
|
-
const [display, setDisplay] =
|
|
1524
|
-
const [paddingTop, setPaddingTop] =
|
|
1525
|
-
const [paddingRight, setPaddingRight] =
|
|
1526
|
-
const [paddingBottom, setPaddingBottom] =
|
|
1527
|
-
const [paddingLeft, setPaddingLeft] =
|
|
1528
|
-
const [marginTop, setMarginTop] =
|
|
1529
|
-
const [marginRight, setMarginRight] =
|
|
1530
|
-
const [marginBottom, setMarginBottom] =
|
|
1531
|
-
const [marginLeft, setMarginLeft] =
|
|
1532
|
-
|
|
1852
|
+
const [display, setDisplay] = useState6("inline");
|
|
1853
|
+
const [paddingTop, setPaddingTop] = useState6(0);
|
|
1854
|
+
const [paddingRight, setPaddingRight] = useState6(0);
|
|
1855
|
+
const [paddingBottom, setPaddingBottom] = useState6(0);
|
|
1856
|
+
const [paddingLeft, setPaddingLeft] = useState6(0);
|
|
1857
|
+
const [marginTop, setMarginTop] = useState6(0);
|
|
1858
|
+
const [marginRight, setMarginRight] = useState6(0);
|
|
1859
|
+
const [marginBottom, setMarginBottom] = useState6(0);
|
|
1860
|
+
const [marginLeft, setMarginLeft] = useState6(0);
|
|
1861
|
+
useEffect5(() => {
|
|
1533
1862
|
return editor.registerUpdateListener(({ editorState }) => {
|
|
1534
1863
|
editorState.read(() => {
|
|
1535
1864
|
const selection = $getSelection3();
|
|
@@ -1565,7 +1894,7 @@ function SpacingPlugin() {
|
|
|
1565
1894
|
});
|
|
1566
1895
|
});
|
|
1567
1896
|
}, [editor]);
|
|
1568
|
-
|
|
1897
|
+
useEffect5(() => {
|
|
1569
1898
|
const handleClickOutside = (event) => {
|
|
1570
1899
|
if (spacingRef.current && !spacingRef.current.contains(event.target)) {
|
|
1571
1900
|
setShowSpacingMenu(false);
|
|
@@ -1659,18 +1988,18 @@ function SpacingPlugin() {
|
|
|
1659
1988
|
}
|
|
1660
1989
|
setShowSpacingMenu(!showSpacingMenu);
|
|
1661
1990
|
}, [showSpacingMenu]);
|
|
1662
|
-
return /* @__PURE__ */
|
|
1663
|
-
/* @__PURE__ */
|
|
1991
|
+
return /* @__PURE__ */ jsxs6("div", { className: "cms-spacing-plugin", ref: spacingRef, children: [
|
|
1992
|
+
/* @__PURE__ */ jsx6(
|
|
1664
1993
|
"button",
|
|
1665
1994
|
{
|
|
1666
1995
|
className: "cms-toolbar-button",
|
|
1667
1996
|
onClick: toggleSpacingMenu,
|
|
1668
1997
|
title: "Spacing & Display",
|
|
1669
1998
|
type: "button",
|
|
1670
|
-
children: /* @__PURE__ */
|
|
1999
|
+
children: /* @__PURE__ */ jsx6(MdSettings, { size: 18 })
|
|
1671
2000
|
}
|
|
1672
2001
|
),
|
|
1673
|
-
showSpacingMenu && /* @__PURE__ */
|
|
2002
|
+
showSpacingMenu && /* @__PURE__ */ jsxs6(
|
|
1674
2003
|
"div",
|
|
1675
2004
|
{
|
|
1676
2005
|
className: "cms-spacing-menu",
|
|
@@ -1679,9 +2008,9 @@ function SpacingPlugin() {
|
|
|
1679
2008
|
left: `${spacingPosition.left}px`
|
|
1680
2009
|
},
|
|
1681
2010
|
children: [
|
|
1682
|
-
/* @__PURE__ */
|
|
1683
|
-
/* @__PURE__ */
|
|
1684
|
-
/* @__PURE__ */
|
|
2011
|
+
/* @__PURE__ */ jsxs6("div", { className: "cms-spacing-header", children: [
|
|
2012
|
+
/* @__PURE__ */ jsx6("span", { children: "Spacing & Display" }),
|
|
2013
|
+
/* @__PURE__ */ jsx6(
|
|
1685
2014
|
"button",
|
|
1686
2015
|
{
|
|
1687
2016
|
className: "cms-spacing-reset-btn",
|
|
@@ -1691,10 +2020,10 @@ function SpacingPlugin() {
|
|
|
1691
2020
|
}
|
|
1692
2021
|
)
|
|
1693
2022
|
] }),
|
|
1694
|
-
/* @__PURE__ */
|
|
1695
|
-
/* @__PURE__ */
|
|
1696
|
-
/* @__PURE__ */
|
|
1697
|
-
/* @__PURE__ */
|
|
2023
|
+
/* @__PURE__ */ jsxs6("div", { className: "cms-spacing-section", children: [
|
|
2024
|
+
/* @__PURE__ */ jsx6("div", { className: "cms-spacing-label", children: "Display Mode" }),
|
|
2025
|
+
/* @__PURE__ */ jsxs6("div", { className: "cms-spacing-display-buttons", children: [
|
|
2026
|
+
/* @__PURE__ */ jsx6(
|
|
1698
2027
|
"button",
|
|
1699
2028
|
{
|
|
1700
2029
|
className: `cms-spacing-display-btn ${display === "inline" ? "active" : ""}`,
|
|
@@ -1703,7 +2032,7 @@ function SpacingPlugin() {
|
|
|
1703
2032
|
children: "Inline"
|
|
1704
2033
|
}
|
|
1705
2034
|
),
|
|
1706
|
-
/* @__PURE__ */
|
|
2035
|
+
/* @__PURE__ */ jsx6(
|
|
1707
2036
|
"button",
|
|
1708
2037
|
{
|
|
1709
2038
|
className: `cms-spacing-display-btn ${display === "inline-block" ? "active" : ""}`,
|
|
@@ -1712,7 +2041,7 @@ function SpacingPlugin() {
|
|
|
1712
2041
|
children: "Inline Block"
|
|
1713
2042
|
}
|
|
1714
2043
|
),
|
|
1715
|
-
/* @__PURE__ */
|
|
2044
|
+
/* @__PURE__ */ jsx6(
|
|
1716
2045
|
"button",
|
|
1717
2046
|
{
|
|
1718
2047
|
className: `cms-spacing-display-btn ${display === "block" ? "active" : ""}`,
|
|
@@ -1723,12 +2052,12 @@ function SpacingPlugin() {
|
|
|
1723
2052
|
)
|
|
1724
2053
|
] })
|
|
1725
2054
|
] }),
|
|
1726
|
-
/* @__PURE__ */
|
|
1727
|
-
/* @__PURE__ */
|
|
1728
|
-
/* @__PURE__ */
|
|
1729
|
-
/* @__PURE__ */
|
|
2055
|
+
/* @__PURE__ */ jsxs6("div", { className: "cms-spacing-section", children: [
|
|
2056
|
+
/* @__PURE__ */ jsxs6("div", { className: "cms-spacing-label", children: [
|
|
2057
|
+
/* @__PURE__ */ jsx6(TbBoxPadding, { size: 16 }),
|
|
2058
|
+
/* @__PURE__ */ jsx6("span", { children: "Padding (px)" })
|
|
1730
2059
|
] }),
|
|
1731
|
-
/* @__PURE__ */
|
|
2060
|
+
/* @__PURE__ */ jsx6("div", { className: "cms-spacing-quick-buttons", children: SPACING_PRESETS.map((value) => /* @__PURE__ */ jsx6(
|
|
1732
2061
|
"button",
|
|
1733
2062
|
{
|
|
1734
2063
|
className: "cms-spacing-quick-btn",
|
|
@@ -1738,10 +2067,10 @@ function SpacingPlugin() {
|
|
|
1738
2067
|
},
|
|
1739
2068
|
`padding-${value}`
|
|
1740
2069
|
)) }),
|
|
1741
|
-
/* @__PURE__ */
|
|
1742
|
-
/* @__PURE__ */
|
|
1743
|
-
/* @__PURE__ */
|
|
1744
|
-
/* @__PURE__ */
|
|
2070
|
+
/* @__PURE__ */ jsxs6("div", { className: "cms-spacing-controls", children: [
|
|
2071
|
+
/* @__PURE__ */ jsxs6("div", { className: "cms-spacing-control", children: [
|
|
2072
|
+
/* @__PURE__ */ jsx6("label", { children: "Top" }),
|
|
2073
|
+
/* @__PURE__ */ jsx6(
|
|
1745
2074
|
"input",
|
|
1746
2075
|
{
|
|
1747
2076
|
type: "number",
|
|
@@ -1752,9 +2081,9 @@ function SpacingPlugin() {
|
|
|
1752
2081
|
}
|
|
1753
2082
|
)
|
|
1754
2083
|
] }),
|
|
1755
|
-
/* @__PURE__ */
|
|
1756
|
-
/* @__PURE__ */
|
|
1757
|
-
/* @__PURE__ */
|
|
2084
|
+
/* @__PURE__ */ jsxs6("div", { className: "cms-spacing-control", children: [
|
|
2085
|
+
/* @__PURE__ */ jsx6("label", { children: "Right" }),
|
|
2086
|
+
/* @__PURE__ */ jsx6(
|
|
1758
2087
|
"input",
|
|
1759
2088
|
{
|
|
1760
2089
|
type: "number",
|
|
@@ -1765,9 +2094,9 @@ function SpacingPlugin() {
|
|
|
1765
2094
|
}
|
|
1766
2095
|
)
|
|
1767
2096
|
] }),
|
|
1768
|
-
/* @__PURE__ */
|
|
1769
|
-
/* @__PURE__ */
|
|
1770
|
-
/* @__PURE__ */
|
|
2097
|
+
/* @__PURE__ */ jsxs6("div", { className: "cms-spacing-control", children: [
|
|
2098
|
+
/* @__PURE__ */ jsx6("label", { children: "Bottom" }),
|
|
2099
|
+
/* @__PURE__ */ jsx6(
|
|
1771
2100
|
"input",
|
|
1772
2101
|
{
|
|
1773
2102
|
type: "number",
|
|
@@ -1778,9 +2107,9 @@ function SpacingPlugin() {
|
|
|
1778
2107
|
}
|
|
1779
2108
|
)
|
|
1780
2109
|
] }),
|
|
1781
|
-
/* @__PURE__ */
|
|
1782
|
-
/* @__PURE__ */
|
|
1783
|
-
/* @__PURE__ */
|
|
2110
|
+
/* @__PURE__ */ jsxs6("div", { className: "cms-spacing-control", children: [
|
|
2111
|
+
/* @__PURE__ */ jsx6("label", { children: "Left" }),
|
|
2112
|
+
/* @__PURE__ */ jsx6(
|
|
1784
2113
|
"input",
|
|
1785
2114
|
{
|
|
1786
2115
|
type: "number",
|
|
@@ -1793,12 +2122,12 @@ function SpacingPlugin() {
|
|
|
1793
2122
|
] })
|
|
1794
2123
|
] })
|
|
1795
2124
|
] }),
|
|
1796
|
-
/* @__PURE__ */
|
|
1797
|
-
/* @__PURE__ */
|
|
1798
|
-
/* @__PURE__ */
|
|
1799
|
-
/* @__PURE__ */
|
|
2125
|
+
/* @__PURE__ */ jsxs6("div", { className: "cms-spacing-section", children: [
|
|
2126
|
+
/* @__PURE__ */ jsxs6("div", { className: "cms-spacing-label", children: [
|
|
2127
|
+
/* @__PURE__ */ jsx6(TbBoxMargin, { size: 16 }),
|
|
2128
|
+
/* @__PURE__ */ jsx6("span", { children: "Margin (px)" })
|
|
1800
2129
|
] }),
|
|
1801
|
-
/* @__PURE__ */
|
|
2130
|
+
/* @__PURE__ */ jsx6("div", { className: "cms-spacing-quick-buttons", children: SPACING_PRESETS.map((value) => /* @__PURE__ */ jsx6(
|
|
1802
2131
|
"button",
|
|
1803
2132
|
{
|
|
1804
2133
|
className: "cms-spacing-quick-btn",
|
|
@@ -1808,10 +2137,10 @@ function SpacingPlugin() {
|
|
|
1808
2137
|
},
|
|
1809
2138
|
`margin-${value}`
|
|
1810
2139
|
)) }),
|
|
1811
|
-
/* @__PURE__ */
|
|
1812
|
-
/* @__PURE__ */
|
|
1813
|
-
/* @__PURE__ */
|
|
1814
|
-
/* @__PURE__ */
|
|
2140
|
+
/* @__PURE__ */ jsxs6("div", { className: "cms-spacing-controls", children: [
|
|
2141
|
+
/* @__PURE__ */ jsxs6("div", { className: "cms-spacing-control", children: [
|
|
2142
|
+
/* @__PURE__ */ jsx6("label", { children: "Top" }),
|
|
2143
|
+
/* @__PURE__ */ jsx6(
|
|
1815
2144
|
"input",
|
|
1816
2145
|
{
|
|
1817
2146
|
type: "number",
|
|
@@ -1822,9 +2151,9 @@ function SpacingPlugin() {
|
|
|
1822
2151
|
}
|
|
1823
2152
|
)
|
|
1824
2153
|
] }),
|
|
1825
|
-
/* @__PURE__ */
|
|
1826
|
-
/* @__PURE__ */
|
|
1827
|
-
/* @__PURE__ */
|
|
2154
|
+
/* @__PURE__ */ jsxs6("div", { className: "cms-spacing-control", children: [
|
|
2155
|
+
/* @__PURE__ */ jsx6("label", { children: "Right" }),
|
|
2156
|
+
/* @__PURE__ */ jsx6(
|
|
1828
2157
|
"input",
|
|
1829
2158
|
{
|
|
1830
2159
|
type: "number",
|
|
@@ -1835,9 +2164,9 @@ function SpacingPlugin() {
|
|
|
1835
2164
|
}
|
|
1836
2165
|
)
|
|
1837
2166
|
] }),
|
|
1838
|
-
/* @__PURE__ */
|
|
1839
|
-
/* @__PURE__ */
|
|
1840
|
-
/* @__PURE__ */
|
|
2167
|
+
/* @__PURE__ */ jsxs6("div", { className: "cms-spacing-control", children: [
|
|
2168
|
+
/* @__PURE__ */ jsx6("label", { children: "Bottom" }),
|
|
2169
|
+
/* @__PURE__ */ jsx6(
|
|
1841
2170
|
"input",
|
|
1842
2171
|
{
|
|
1843
2172
|
type: "number",
|
|
@@ -1848,9 +2177,9 @@ function SpacingPlugin() {
|
|
|
1848
2177
|
}
|
|
1849
2178
|
)
|
|
1850
2179
|
] }),
|
|
1851
|
-
/* @__PURE__ */
|
|
1852
|
-
/* @__PURE__ */
|
|
1853
|
-
/* @__PURE__ */
|
|
2180
|
+
/* @__PURE__ */ jsxs6("div", { className: "cms-spacing-control", children: [
|
|
2181
|
+
/* @__PURE__ */ jsx6("label", { children: "Left" }),
|
|
2182
|
+
/* @__PURE__ */ jsx6(
|
|
1854
2183
|
"input",
|
|
1855
2184
|
{
|
|
1856
2185
|
type: "number",
|
|
@@ -1870,8 +2199,8 @@ function SpacingPlugin() {
|
|
|
1870
2199
|
}
|
|
1871
2200
|
|
|
1872
2201
|
// src/plugins/ExportImportPlugin.tsx
|
|
1873
|
-
import { useLexicalComposerContext as
|
|
1874
|
-
import { useState as
|
|
2202
|
+
import { useLexicalComposerContext as useLexicalComposerContext5 } from "@lexical/react/LexicalComposerContext";
|
|
2203
|
+
import { useState as useState7, useCallback as useCallback5, useRef as useRef5, useEffect as useEffect6 } from "react";
|
|
1875
2204
|
import { MdFileDownload, MdFileUpload } from "react-icons/md";
|
|
1876
2205
|
|
|
1877
2206
|
// src/utils/htmlExport.ts
|
|
@@ -2343,19 +2672,19 @@ async function pasteMarkdownFromClipboard(editor) {
|
|
|
2343
2672
|
}
|
|
2344
2673
|
|
|
2345
2674
|
// src/plugins/ExportImportPlugin.tsx
|
|
2346
|
-
import { Fragment as Fragment4, jsx as
|
|
2675
|
+
import { Fragment as Fragment4, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2347
2676
|
function ExportImportPlugin() {
|
|
2348
|
-
const [editor] =
|
|
2349
|
-
const [showExportMenu, setShowExportMenu] =
|
|
2350
|
-
const [showImportMenu, setShowImportMenu] =
|
|
2351
|
-
const [exportPosition, setExportPosition] =
|
|
2352
|
-
const [importPosition, setImportPosition] =
|
|
2353
|
-
const [notification, setNotification] =
|
|
2677
|
+
const [editor] = useLexicalComposerContext5();
|
|
2678
|
+
const [showExportMenu, setShowExportMenu] = useState7(false);
|
|
2679
|
+
const [showImportMenu, setShowImportMenu] = useState7(false);
|
|
2680
|
+
const [exportPosition, setExportPosition] = useState7({ top: 0, left: 0 });
|
|
2681
|
+
const [importPosition, setImportPosition] = useState7({ top: 0, left: 0 });
|
|
2682
|
+
const [notification, setNotification] = useState7(null);
|
|
2354
2683
|
const exportRef = useRef5(null);
|
|
2355
2684
|
const importRef = useRef5(null);
|
|
2356
2685
|
const fileInputRef = useRef5(null);
|
|
2357
|
-
const [importType, setImportType] =
|
|
2358
|
-
|
|
2686
|
+
const [importType, setImportType] = useState7("html");
|
|
2687
|
+
useEffect6(() => {
|
|
2359
2688
|
const handleClickOutside = (event) => {
|
|
2360
2689
|
if (exportRef.current && !exportRef.current.contains(event.target)) {
|
|
2361
2690
|
setShowExportMenu(false);
|
|
@@ -2367,7 +2696,7 @@ function ExportImportPlugin() {
|
|
|
2367
2696
|
document.addEventListener("mousedown", handleClickOutside);
|
|
2368
2697
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
2369
2698
|
}, []);
|
|
2370
|
-
|
|
2699
|
+
useEffect6(() => {
|
|
2371
2700
|
if (notification) {
|
|
2372
2701
|
const timer = setTimeout(() => setNotification(null), 3e3);
|
|
2373
2702
|
return () => clearTimeout(timer);
|
|
@@ -2483,19 +2812,19 @@ function ExportImportPlugin() {
|
|
|
2483
2812
|
showNotification("Failed to paste Markdown");
|
|
2484
2813
|
}
|
|
2485
2814
|
}, [editor]);
|
|
2486
|
-
return /* @__PURE__ */
|
|
2487
|
-
/* @__PURE__ */
|
|
2488
|
-
/* @__PURE__ */
|
|
2815
|
+
return /* @__PURE__ */ jsxs7(Fragment4, { children: [
|
|
2816
|
+
/* @__PURE__ */ jsxs7("div", { className: "cms-export-import-plugin", ref: exportRef, children: [
|
|
2817
|
+
/* @__PURE__ */ jsx7(
|
|
2489
2818
|
"button",
|
|
2490
2819
|
{
|
|
2491
2820
|
className: "cms-toolbar-button",
|
|
2492
2821
|
onClick: toggleExportMenu,
|
|
2493
2822
|
title: "Export Content",
|
|
2494
2823
|
type: "button",
|
|
2495
|
-
children: /* @__PURE__ */
|
|
2824
|
+
children: /* @__PURE__ */ jsx7(MdFileDownload, { size: 18 })
|
|
2496
2825
|
}
|
|
2497
2826
|
),
|
|
2498
|
-
showExportMenu && /* @__PURE__ */
|
|
2827
|
+
showExportMenu && /* @__PURE__ */ jsxs7(
|
|
2499
2828
|
"div",
|
|
2500
2829
|
{
|
|
2501
2830
|
className: "cms-export-import-menu",
|
|
@@ -2504,79 +2833,79 @@ function ExportImportPlugin() {
|
|
|
2504
2833
|
left: `${exportPosition.left}px`
|
|
2505
2834
|
},
|
|
2506
2835
|
children: [
|
|
2507
|
-
/* @__PURE__ */
|
|
2508
|
-
/* @__PURE__ */
|
|
2836
|
+
/* @__PURE__ */ jsx7("div", { className: "cms-export-import-header", children: "Export Content" }),
|
|
2837
|
+
/* @__PURE__ */ jsxs7(
|
|
2509
2838
|
"button",
|
|
2510
2839
|
{
|
|
2511
2840
|
className: "cms-export-import-item",
|
|
2512
2841
|
onClick: handleExportHTML,
|
|
2513
2842
|
type: "button",
|
|
2514
2843
|
children: [
|
|
2515
|
-
/* @__PURE__ */
|
|
2516
|
-
/* @__PURE__ */
|
|
2517
|
-
/* @__PURE__ */
|
|
2518
|
-
/* @__PURE__ */
|
|
2844
|
+
/* @__PURE__ */ jsx7("span", { className: "cms-export-import-icon", children: "\u{1F4C4}" }),
|
|
2845
|
+
/* @__PURE__ */ jsxs7("div", { children: [
|
|
2846
|
+
/* @__PURE__ */ jsx7("div", { className: "cms-export-import-title", children: "HTML" }),
|
|
2847
|
+
/* @__PURE__ */ jsx7("div", { className: "cms-export-import-desc", children: "Download as HTML file" })
|
|
2519
2848
|
] })
|
|
2520
2849
|
]
|
|
2521
2850
|
}
|
|
2522
2851
|
),
|
|
2523
|
-
/* @__PURE__ */
|
|
2852
|
+
/* @__PURE__ */ jsxs7(
|
|
2524
2853
|
"button",
|
|
2525
2854
|
{
|
|
2526
2855
|
className: "cms-export-import-item",
|
|
2527
2856
|
onClick: handleExportHTMLWithStyles,
|
|
2528
2857
|
type: "button",
|
|
2529
2858
|
children: [
|
|
2530
|
-
/* @__PURE__ */
|
|
2531
|
-
/* @__PURE__ */
|
|
2532
|
-
/* @__PURE__ */
|
|
2533
|
-
/* @__PURE__ */
|
|
2859
|
+
/* @__PURE__ */ jsx7("span", { className: "cms-export-import-icon", children: "\u{1F3A8}" }),
|
|
2860
|
+
/* @__PURE__ */ jsxs7("div", { children: [
|
|
2861
|
+
/* @__PURE__ */ jsx7("div", { className: "cms-export-import-title", children: "HTML + Styles" }),
|
|
2862
|
+
/* @__PURE__ */ jsx7("div", { className: "cms-export-import-desc", children: "Complete HTML document" })
|
|
2534
2863
|
] })
|
|
2535
2864
|
]
|
|
2536
2865
|
}
|
|
2537
2866
|
),
|
|
2538
|
-
/* @__PURE__ */
|
|
2867
|
+
/* @__PURE__ */ jsxs7(
|
|
2539
2868
|
"button",
|
|
2540
2869
|
{
|
|
2541
2870
|
className: "cms-export-import-item",
|
|
2542
2871
|
onClick: handleExportMarkdown,
|
|
2543
2872
|
type: "button",
|
|
2544
2873
|
children: [
|
|
2545
|
-
/* @__PURE__ */
|
|
2546
|
-
/* @__PURE__ */
|
|
2547
|
-
/* @__PURE__ */
|
|
2548
|
-
/* @__PURE__ */
|
|
2874
|
+
/* @__PURE__ */ jsx7("span", { className: "cms-export-import-icon", children: "\u{1F4DD}" }),
|
|
2875
|
+
/* @__PURE__ */ jsxs7("div", { children: [
|
|
2876
|
+
/* @__PURE__ */ jsx7("div", { className: "cms-export-import-title", children: "Markdown" }),
|
|
2877
|
+
/* @__PURE__ */ jsx7("div", { className: "cms-export-import-desc", children: "Download as .md file" })
|
|
2549
2878
|
] })
|
|
2550
2879
|
]
|
|
2551
2880
|
}
|
|
2552
2881
|
),
|
|
2553
|
-
/* @__PURE__ */
|
|
2554
|
-
/* @__PURE__ */
|
|
2882
|
+
/* @__PURE__ */ jsx7("div", { className: "cms-export-import-divider" }),
|
|
2883
|
+
/* @__PURE__ */ jsxs7(
|
|
2555
2884
|
"button",
|
|
2556
2885
|
{
|
|
2557
2886
|
className: "cms-export-import-item",
|
|
2558
2887
|
onClick: handleCopyHTML,
|
|
2559
2888
|
type: "button",
|
|
2560
2889
|
children: [
|
|
2561
|
-
/* @__PURE__ */
|
|
2562
|
-
/* @__PURE__ */
|
|
2563
|
-
/* @__PURE__ */
|
|
2564
|
-
/* @__PURE__ */
|
|
2890
|
+
/* @__PURE__ */ jsx7("span", { className: "cms-export-import-icon", children: "\u{1F4CB}" }),
|
|
2891
|
+
/* @__PURE__ */ jsxs7("div", { children: [
|
|
2892
|
+
/* @__PURE__ */ jsx7("div", { className: "cms-export-import-title", children: "Copy HTML" }),
|
|
2893
|
+
/* @__PURE__ */ jsx7("div", { className: "cms-export-import-desc", children: "Copy to clipboard" })
|
|
2565
2894
|
] })
|
|
2566
2895
|
]
|
|
2567
2896
|
}
|
|
2568
2897
|
),
|
|
2569
|
-
/* @__PURE__ */
|
|
2898
|
+
/* @__PURE__ */ jsxs7(
|
|
2570
2899
|
"button",
|
|
2571
2900
|
{
|
|
2572
2901
|
className: "cms-export-import-item",
|
|
2573
2902
|
onClick: handleCopyMarkdown,
|
|
2574
2903
|
type: "button",
|
|
2575
2904
|
children: [
|
|
2576
|
-
/* @__PURE__ */
|
|
2577
|
-
/* @__PURE__ */
|
|
2578
|
-
/* @__PURE__ */
|
|
2579
|
-
/* @__PURE__ */
|
|
2905
|
+
/* @__PURE__ */ jsx7("span", { className: "cms-export-import-icon", children: "\u{1F4CB}" }),
|
|
2906
|
+
/* @__PURE__ */ jsxs7("div", { children: [
|
|
2907
|
+
/* @__PURE__ */ jsx7("div", { className: "cms-export-import-title", children: "Copy Markdown" }),
|
|
2908
|
+
/* @__PURE__ */ jsx7("div", { className: "cms-export-import-desc", children: "Copy to clipboard" })
|
|
2580
2909
|
] })
|
|
2581
2910
|
]
|
|
2582
2911
|
}
|
|
@@ -2585,18 +2914,18 @@ function ExportImportPlugin() {
|
|
|
2585
2914
|
}
|
|
2586
2915
|
)
|
|
2587
2916
|
] }),
|
|
2588
|
-
/* @__PURE__ */
|
|
2589
|
-
/* @__PURE__ */
|
|
2917
|
+
/* @__PURE__ */ jsxs7("div", { className: "cms-export-import-plugin", ref: importRef, children: [
|
|
2918
|
+
/* @__PURE__ */ jsx7(
|
|
2590
2919
|
"button",
|
|
2591
2920
|
{
|
|
2592
2921
|
className: "cms-toolbar-button",
|
|
2593
2922
|
onClick: toggleImportMenu,
|
|
2594
2923
|
title: "Import Content",
|
|
2595
2924
|
type: "button",
|
|
2596
|
-
children: /* @__PURE__ */
|
|
2925
|
+
children: /* @__PURE__ */ jsx7(MdFileUpload, { size: 18 })
|
|
2597
2926
|
}
|
|
2598
2927
|
),
|
|
2599
|
-
showImportMenu && /* @__PURE__ */
|
|
2928
|
+
showImportMenu && /* @__PURE__ */ jsxs7(
|
|
2600
2929
|
"div",
|
|
2601
2930
|
{
|
|
2602
2931
|
className: "cms-export-import-menu",
|
|
@@ -2605,9 +2934,9 @@ function ExportImportPlugin() {
|
|
|
2605
2934
|
left: `${importPosition.left}px`
|
|
2606
2935
|
},
|
|
2607
2936
|
children: [
|
|
2608
|
-
/* @__PURE__ */
|
|
2609
|
-
/* @__PURE__ */
|
|
2610
|
-
/* @__PURE__ */
|
|
2937
|
+
/* @__PURE__ */ jsx7("div", { className: "cms-export-import-header", children: "Import Content" }),
|
|
2938
|
+
/* @__PURE__ */ jsxs7("div", { className: "cms-import-type-selector", children: [
|
|
2939
|
+
/* @__PURE__ */ jsx7(
|
|
2611
2940
|
"button",
|
|
2612
2941
|
{
|
|
2613
2942
|
className: `cms-import-type-btn ${importType === "html" ? "active" : ""}`,
|
|
@@ -2616,7 +2945,7 @@ function ExportImportPlugin() {
|
|
|
2616
2945
|
children: "HTML"
|
|
2617
2946
|
}
|
|
2618
2947
|
),
|
|
2619
|
-
/* @__PURE__ */
|
|
2948
|
+
/* @__PURE__ */ jsx7(
|
|
2620
2949
|
"button",
|
|
2621
2950
|
{
|
|
2622
2951
|
className: `cms-import-type-btn ${importType === "markdown" ? "active" : ""}`,
|
|
@@ -2626,17 +2955,17 @@ function ExportImportPlugin() {
|
|
|
2626
2955
|
}
|
|
2627
2956
|
)
|
|
2628
2957
|
] }),
|
|
2629
|
-
/* @__PURE__ */
|
|
2958
|
+
/* @__PURE__ */ jsxs7(
|
|
2630
2959
|
"button",
|
|
2631
2960
|
{
|
|
2632
2961
|
className: "cms-export-import-item",
|
|
2633
2962
|
onClick: handleImportFile,
|
|
2634
2963
|
type: "button",
|
|
2635
2964
|
children: [
|
|
2636
|
-
/* @__PURE__ */
|
|
2637
|
-
/* @__PURE__ */
|
|
2638
|
-
/* @__PURE__ */
|
|
2639
|
-
/* @__PURE__ */
|
|
2965
|
+
/* @__PURE__ */ jsx7("span", { className: "cms-export-import-icon", children: "\u{1F4C1}" }),
|
|
2966
|
+
/* @__PURE__ */ jsxs7("div", { children: [
|
|
2967
|
+
/* @__PURE__ */ jsx7("div", { className: "cms-export-import-title", children: "From File" }),
|
|
2968
|
+
/* @__PURE__ */ jsxs7("div", { className: "cms-export-import-desc", children: [
|
|
2640
2969
|
"Upload ",
|
|
2641
2970
|
importType.toUpperCase(),
|
|
2642
2971
|
" file"
|
|
@@ -2645,17 +2974,17 @@ function ExportImportPlugin() {
|
|
|
2645
2974
|
]
|
|
2646
2975
|
}
|
|
2647
2976
|
),
|
|
2648
|
-
/* @__PURE__ */
|
|
2977
|
+
/* @__PURE__ */ jsxs7(
|
|
2649
2978
|
"button",
|
|
2650
2979
|
{
|
|
2651
2980
|
className: "cms-export-import-item",
|
|
2652
2981
|
onClick: importType === "html" ? handlePasteHTML : handlePasteMarkdown,
|
|
2653
2982
|
type: "button",
|
|
2654
2983
|
children: [
|
|
2655
|
-
/* @__PURE__ */
|
|
2656
|
-
/* @__PURE__ */
|
|
2657
|
-
/* @__PURE__ */
|
|
2658
|
-
/* @__PURE__ */
|
|
2984
|
+
/* @__PURE__ */ jsx7("span", { className: "cms-export-import-icon", children: "\u{1F4CB}" }),
|
|
2985
|
+
/* @__PURE__ */ jsxs7("div", { children: [
|
|
2986
|
+
/* @__PURE__ */ jsx7("div", { className: "cms-export-import-title", children: "From Clipboard" }),
|
|
2987
|
+
/* @__PURE__ */ jsxs7("div", { className: "cms-export-import-desc", children: [
|
|
2659
2988
|
"Paste ",
|
|
2660
2989
|
importType.toUpperCase()
|
|
2661
2990
|
] })
|
|
@@ -2666,7 +2995,7 @@ function ExportImportPlugin() {
|
|
|
2666
2995
|
]
|
|
2667
2996
|
}
|
|
2668
2997
|
),
|
|
2669
|
-
/* @__PURE__ */
|
|
2998
|
+
/* @__PURE__ */ jsx7(
|
|
2670
2999
|
"input",
|
|
2671
3000
|
{
|
|
2672
3001
|
ref: fileInputRef,
|
|
@@ -2677,13 +3006,13 @@ function ExportImportPlugin() {
|
|
|
2677
3006
|
}
|
|
2678
3007
|
)
|
|
2679
3008
|
] }),
|
|
2680
|
-
notification && /* @__PURE__ */
|
|
3009
|
+
notification && /* @__PURE__ */ jsx7("div", { className: "cms-export-import-notification", children: notification })
|
|
2681
3010
|
] });
|
|
2682
3011
|
}
|
|
2683
3012
|
|
|
2684
3013
|
// src/plugins/SectionCreatorPlugin.tsx
|
|
2685
|
-
import { useLexicalComposerContext as
|
|
2686
|
-
import { useState as
|
|
3014
|
+
import { useLexicalComposerContext as useLexicalComposerContext6 } from "@lexical/react/LexicalComposerContext";
|
|
3015
|
+
import { useState as useState8, useCallback as useCallback6, useRef as useRef6, useEffect as useEffect7 } from "react";
|
|
2687
3016
|
import { $getSelection as $getSelection4, $isRangeSelection as $isRangeSelection4, $createParagraphNode as $createParagraphNode3 } from "lexical";
|
|
2688
3017
|
|
|
2689
3018
|
// src/blocks/SectionNode.tsx
|
|
@@ -3264,13 +3593,13 @@ var SECTION_TEMPLATES = [
|
|
|
3264
3593
|
// src/plugins/SectionCreatorPlugin.tsx
|
|
3265
3594
|
import { $generateNodesFromDOM as $generateNodesFromDOM2 } from "@lexical/html";
|
|
3266
3595
|
import { MdViewModule } from "react-icons/md";
|
|
3267
|
-
import { jsx as
|
|
3596
|
+
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
3268
3597
|
function SectionCreatorPlugin() {
|
|
3269
|
-
const [editor] =
|
|
3270
|
-
const [showSectionMenu, setShowSectionMenu] =
|
|
3271
|
-
const [sectionPosition, setSectionPosition] =
|
|
3598
|
+
const [editor] = useLexicalComposerContext6();
|
|
3599
|
+
const [showSectionMenu, setShowSectionMenu] = useState8(false);
|
|
3600
|
+
const [sectionPosition, setSectionPosition] = useState8({ top: 0, left: 0 });
|
|
3272
3601
|
const sectionRef = useRef6(null);
|
|
3273
|
-
|
|
3602
|
+
useEffect7(() => {
|
|
3274
3603
|
const handleClickOutside = (event) => {
|
|
3275
3604
|
if (sectionRef.current && !sectionRef.current.contains(event.target)) {
|
|
3276
3605
|
setShowSectionMenu(false);
|
|
@@ -3313,18 +3642,18 @@ function SectionCreatorPlugin() {
|
|
|
3313
3642
|
});
|
|
3314
3643
|
setShowSectionMenu(false);
|
|
3315
3644
|
}, [editor]);
|
|
3316
|
-
return /* @__PURE__ */
|
|
3317
|
-
/* @__PURE__ */
|
|
3645
|
+
return /* @__PURE__ */ jsxs8("div", { className: "cms-section-creator-plugin", ref: sectionRef, children: [
|
|
3646
|
+
/* @__PURE__ */ jsx8(
|
|
3318
3647
|
"button",
|
|
3319
3648
|
{
|
|
3320
3649
|
className: "cms-toolbar-button",
|
|
3321
3650
|
onClick: toggleSectionMenu,
|
|
3322
3651
|
title: "Insert Section",
|
|
3323
3652
|
type: "button",
|
|
3324
|
-
children: /* @__PURE__ */
|
|
3653
|
+
children: /* @__PURE__ */ jsx8(MdViewModule, { size: 18 })
|
|
3325
3654
|
}
|
|
3326
3655
|
),
|
|
3327
|
-
showSectionMenu && /* @__PURE__ */
|
|
3656
|
+
showSectionMenu && /* @__PURE__ */ jsxs8(
|
|
3328
3657
|
"div",
|
|
3329
3658
|
{
|
|
3330
3659
|
className: "cms-section-menu",
|
|
@@ -3333,24 +3662,24 @@ function SectionCreatorPlugin() {
|
|
|
3333
3662
|
left: `${sectionPosition.left}px`
|
|
3334
3663
|
},
|
|
3335
3664
|
children: [
|
|
3336
|
-
/* @__PURE__ */
|
|
3337
|
-
/* @__PURE__ */
|
|
3665
|
+
/* @__PURE__ */ jsx8("div", { className: "cms-section-menu-header", children: /* @__PURE__ */ jsx8("span", { children: "Insert Section" }) }),
|
|
3666
|
+
/* @__PURE__ */ jsx8("div", { className: "cms-section-grid", children: SECTION_TEMPLATES.map((template) => /* @__PURE__ */ jsxs8(
|
|
3338
3667
|
"button",
|
|
3339
3668
|
{
|
|
3340
3669
|
className: "cms-section-card",
|
|
3341
3670
|
onClick: () => insertSection(template),
|
|
3342
3671
|
type: "button",
|
|
3343
3672
|
children: [
|
|
3344
|
-
/* @__PURE__ */
|
|
3345
|
-
/* @__PURE__ */
|
|
3346
|
-
/* @__PURE__ */
|
|
3347
|
-
/* @__PURE__ */
|
|
3673
|
+
/* @__PURE__ */ jsx8("div", { className: "cms-section-card-icon", children: template.icon }),
|
|
3674
|
+
/* @__PURE__ */ jsxs8("div", { className: "cms-section-card-content", children: [
|
|
3675
|
+
/* @__PURE__ */ jsx8("div", { className: "cms-section-card-title", children: template.name }),
|
|
3676
|
+
/* @__PURE__ */ jsx8("div", { className: "cms-section-card-desc", children: template.description })
|
|
3348
3677
|
] })
|
|
3349
3678
|
]
|
|
3350
3679
|
},
|
|
3351
3680
|
template.type
|
|
3352
3681
|
)) }),
|
|
3353
|
-
/* @__PURE__ */
|
|
3682
|
+
/* @__PURE__ */ jsx8("div", { className: "cms-section-menu-footer", children: /* @__PURE__ */ jsx8("p", { children: "\u{1F4A1} Tip: Sections are fully editable after insertion" }) })
|
|
3354
3683
|
]
|
|
3355
3684
|
}
|
|
3356
3685
|
)
|
|
@@ -3358,22 +3687,22 @@ function SectionCreatorPlugin() {
|
|
|
3358
3687
|
}
|
|
3359
3688
|
|
|
3360
3689
|
// src/plugins/TablePlugin.tsx
|
|
3361
|
-
import { useLexicalComposerContext as
|
|
3362
|
-
import { useState as
|
|
3690
|
+
import { useLexicalComposerContext as useLexicalComposerContext7 } from "@lexical/react/LexicalComposerContext";
|
|
3691
|
+
import { useState as useState9, useCallback as useCallback7, useRef as useRef7, useEffect as useEffect8 } from "react";
|
|
3363
3692
|
import { $getSelection as $getSelection5, $isRangeSelection as $isRangeSelection5, $createParagraphNode as $createParagraphNode4 } from "lexical";
|
|
3364
3693
|
import {
|
|
3365
3694
|
$createTableNodeWithDimensions
|
|
3366
3695
|
} from "@lexical/table";
|
|
3367
3696
|
import { MdTableChart } from "react-icons/md";
|
|
3368
|
-
import { Fragment as Fragment5, jsx as
|
|
3697
|
+
import { Fragment as Fragment5, jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3369
3698
|
function TablePlugin() {
|
|
3370
|
-
const [editor] =
|
|
3371
|
-
const [showModal, setShowModal] =
|
|
3372
|
-
const [rows, setRows] =
|
|
3373
|
-
const [columns, setColumns] =
|
|
3374
|
-
const [includeHeaders, setIncludeHeaders] =
|
|
3699
|
+
const [editor] = useLexicalComposerContext7();
|
|
3700
|
+
const [showModal, setShowModal] = useState9(false);
|
|
3701
|
+
const [rows, setRows] = useState9(3);
|
|
3702
|
+
const [columns, setColumns] = useState9(3);
|
|
3703
|
+
const [includeHeaders, setIncludeHeaders] = useState9(true);
|
|
3375
3704
|
const modalRef = useRef7(null);
|
|
3376
|
-
|
|
3705
|
+
useEffect8(() => {
|
|
3377
3706
|
const handleClickOutside = (event) => {
|
|
3378
3707
|
if (modalRef.current && !modalRef.current.contains(event.target)) {
|
|
3379
3708
|
setShowModal(false);
|
|
@@ -3412,31 +3741,31 @@ function TablePlugin() {
|
|
|
3412
3741
|
setShowModal(false);
|
|
3413
3742
|
}
|
|
3414
3743
|
}, [insertTable]);
|
|
3415
|
-
return /* @__PURE__ */
|
|
3416
|
-
/* @__PURE__ */
|
|
3744
|
+
return /* @__PURE__ */ jsxs9("div", { className: "cms-table-plugin", ref: modalRef, children: [
|
|
3745
|
+
/* @__PURE__ */ jsx9(
|
|
3417
3746
|
"button",
|
|
3418
3747
|
{
|
|
3419
3748
|
className: "cms-toolbar-button",
|
|
3420
3749
|
onClick: openModal,
|
|
3421
3750
|
title: "Insert Table",
|
|
3422
3751
|
type: "button",
|
|
3423
|
-
children: /* @__PURE__ */
|
|
3752
|
+
children: /* @__PURE__ */ jsx9(MdTableChart, { size: 18 })
|
|
3424
3753
|
}
|
|
3425
3754
|
),
|
|
3426
|
-
showModal && /* @__PURE__ */
|
|
3427
|
-
/* @__PURE__ */
|
|
3428
|
-
/* @__PURE__ */
|
|
3429
|
-
/* @__PURE__ */
|
|
3430
|
-
/* @__PURE__ */
|
|
3431
|
-
/* @__PURE__ */
|
|
3432
|
-
/* @__PURE__ */
|
|
3755
|
+
showModal && /* @__PURE__ */ jsxs9(Fragment5, { children: [
|
|
3756
|
+
/* @__PURE__ */ jsx9("div", { className: "cms-modal-backdrop", onClick: () => setShowModal(false) }),
|
|
3757
|
+
/* @__PURE__ */ jsxs9("div", { className: "cms-table-modal", children: [
|
|
3758
|
+
/* @__PURE__ */ jsx9("div", { className: "cms-table-modal-header", children: /* @__PURE__ */ jsx9("span", { children: "Insert Table" }) }),
|
|
3759
|
+
/* @__PURE__ */ jsxs9("div", { className: "cms-table-modal-content", children: [
|
|
3760
|
+
/* @__PURE__ */ jsxs9("div", { className: "cms-table-preview", children: [
|
|
3761
|
+
/* @__PURE__ */ jsx9("div", { className: "cms-table-preview-grid", children: Array.from({ length: rows }).map((_, rowIndex) => /* @__PURE__ */ jsx9("div", { className: "cms-table-preview-row", children: Array.from({ length: columns }).map((_2, colIndex) => /* @__PURE__ */ jsx9(
|
|
3433
3762
|
"div",
|
|
3434
3763
|
{
|
|
3435
3764
|
className: `cms-table-preview-cell ${includeHeaders && rowIndex === 0 ? "header" : ""}`
|
|
3436
3765
|
},
|
|
3437
3766
|
colIndex
|
|
3438
3767
|
)) }, rowIndex)) }),
|
|
3439
|
-
/* @__PURE__ */
|
|
3768
|
+
/* @__PURE__ */ jsxs9("div", { className: "cms-table-preview-label", children: [
|
|
3440
3769
|
rows,
|
|
3441
3770
|
" \xD7 ",
|
|
3442
3771
|
columns,
|
|
@@ -3444,10 +3773,10 @@ function TablePlugin() {
|
|
|
3444
3773
|
includeHeaders ? "(with headers)" : ""
|
|
3445
3774
|
] })
|
|
3446
3775
|
] }),
|
|
3447
|
-
/* @__PURE__ */
|
|
3448
|
-
/* @__PURE__ */
|
|
3449
|
-
/* @__PURE__ */
|
|
3450
|
-
/* @__PURE__ */
|
|
3776
|
+
/* @__PURE__ */ jsxs9("div", { className: "cms-form-group", children: [
|
|
3777
|
+
/* @__PURE__ */ jsx9("label", { htmlFor: "table-rows", children: "Rows" }),
|
|
3778
|
+
/* @__PURE__ */ jsxs9("div", { className: "cms-number-input-group", children: [
|
|
3779
|
+
/* @__PURE__ */ jsx9(
|
|
3451
3780
|
"button",
|
|
3452
3781
|
{
|
|
3453
3782
|
onClick: () => setRows(Math.max(1, rows - 1)),
|
|
@@ -3456,7 +3785,7 @@ function TablePlugin() {
|
|
|
3456
3785
|
children: "\u2212"
|
|
3457
3786
|
}
|
|
3458
3787
|
),
|
|
3459
|
-
/* @__PURE__ */
|
|
3788
|
+
/* @__PURE__ */ jsx9(
|
|
3460
3789
|
"input",
|
|
3461
3790
|
{
|
|
3462
3791
|
id: "table-rows",
|
|
@@ -3469,7 +3798,7 @@ function TablePlugin() {
|
|
|
3469
3798
|
className: "cms-number-input"
|
|
3470
3799
|
}
|
|
3471
3800
|
),
|
|
3472
|
-
/* @__PURE__ */
|
|
3801
|
+
/* @__PURE__ */ jsx9(
|
|
3473
3802
|
"button",
|
|
3474
3803
|
{
|
|
3475
3804
|
onClick: () => setRows(Math.min(20, rows + 1)),
|
|
@@ -3480,10 +3809,10 @@ function TablePlugin() {
|
|
|
3480
3809
|
)
|
|
3481
3810
|
] })
|
|
3482
3811
|
] }),
|
|
3483
|
-
/* @__PURE__ */
|
|
3484
|
-
/* @__PURE__ */
|
|
3485
|
-
/* @__PURE__ */
|
|
3486
|
-
/* @__PURE__ */
|
|
3812
|
+
/* @__PURE__ */ jsxs9("div", { className: "cms-form-group", children: [
|
|
3813
|
+
/* @__PURE__ */ jsx9("label", { htmlFor: "table-columns", children: "Columns" }),
|
|
3814
|
+
/* @__PURE__ */ jsxs9("div", { className: "cms-number-input-group", children: [
|
|
3815
|
+
/* @__PURE__ */ jsx9(
|
|
3487
3816
|
"button",
|
|
3488
3817
|
{
|
|
3489
3818
|
onClick: () => setColumns(Math.max(1, columns - 1)),
|
|
@@ -3492,7 +3821,7 @@ function TablePlugin() {
|
|
|
3492
3821
|
children: "\u2212"
|
|
3493
3822
|
}
|
|
3494
3823
|
),
|
|
3495
|
-
/* @__PURE__ */
|
|
3824
|
+
/* @__PURE__ */ jsx9(
|
|
3496
3825
|
"input",
|
|
3497
3826
|
{
|
|
3498
3827
|
id: "table-columns",
|
|
@@ -3505,7 +3834,7 @@ function TablePlugin() {
|
|
|
3505
3834
|
className: "cms-number-input"
|
|
3506
3835
|
}
|
|
3507
3836
|
),
|
|
3508
|
-
/* @__PURE__ */
|
|
3837
|
+
/* @__PURE__ */ jsx9(
|
|
3509
3838
|
"button",
|
|
3510
3839
|
{
|
|
3511
3840
|
onClick: () => setColumns(Math.min(10, columns + 1)),
|
|
@@ -3516,8 +3845,8 @@ function TablePlugin() {
|
|
|
3516
3845
|
)
|
|
3517
3846
|
] })
|
|
3518
3847
|
] }),
|
|
3519
|
-
/* @__PURE__ */
|
|
3520
|
-
/* @__PURE__ */
|
|
3848
|
+
/* @__PURE__ */ jsx9("div", { className: "cms-form-group", children: /* @__PURE__ */ jsxs9("label", { className: "cms-checkbox-label", children: [
|
|
3849
|
+
/* @__PURE__ */ jsx9(
|
|
3521
3850
|
"input",
|
|
3522
3851
|
{
|
|
3523
3852
|
type: "checkbox",
|
|
@@ -3526,12 +3855,12 @@ function TablePlugin() {
|
|
|
3526
3855
|
className: "cms-checkbox"
|
|
3527
3856
|
}
|
|
3528
3857
|
),
|
|
3529
|
-
/* @__PURE__ */
|
|
3858
|
+
/* @__PURE__ */ jsx9("span", { children: "Include header row" })
|
|
3530
3859
|
] }) }),
|
|
3531
|
-
/* @__PURE__ */
|
|
3532
|
-
/* @__PURE__ */
|
|
3533
|
-
/* @__PURE__ */
|
|
3534
|
-
/* @__PURE__ */
|
|
3860
|
+
/* @__PURE__ */ jsxs9("div", { className: "cms-table-presets", children: [
|
|
3861
|
+
/* @__PURE__ */ jsx9("p", { className: "cms-table-presets-title", children: "Quick Presets:" }),
|
|
3862
|
+
/* @__PURE__ */ jsxs9("div", { className: "cms-table-preset-buttons", children: [
|
|
3863
|
+
/* @__PURE__ */ jsx9(
|
|
3535
3864
|
"button",
|
|
3536
3865
|
{
|
|
3537
3866
|
onClick: () => {
|
|
@@ -3544,7 +3873,7 @@ function TablePlugin() {
|
|
|
3544
3873
|
children: "3\xD73"
|
|
3545
3874
|
}
|
|
3546
3875
|
),
|
|
3547
|
-
/* @__PURE__ */
|
|
3876
|
+
/* @__PURE__ */ jsx9(
|
|
3548
3877
|
"button",
|
|
3549
3878
|
{
|
|
3550
3879
|
onClick: () => {
|
|
@@ -3557,7 +3886,7 @@ function TablePlugin() {
|
|
|
3557
3886
|
children: "5\xD73"
|
|
3558
3887
|
}
|
|
3559
3888
|
),
|
|
3560
|
-
/* @__PURE__ */
|
|
3889
|
+
/* @__PURE__ */ jsx9(
|
|
3561
3890
|
"button",
|
|
3562
3891
|
{
|
|
3563
3892
|
onClick: () => {
|
|
@@ -3570,7 +3899,7 @@ function TablePlugin() {
|
|
|
3570
3899
|
children: "4\xD74"
|
|
3571
3900
|
}
|
|
3572
3901
|
),
|
|
3573
|
-
/* @__PURE__ */
|
|
3902
|
+
/* @__PURE__ */ jsx9(
|
|
3574
3903
|
"button",
|
|
3575
3904
|
{
|
|
3576
3905
|
onClick: () => {
|
|
@@ -3585,8 +3914,8 @@ function TablePlugin() {
|
|
|
3585
3914
|
)
|
|
3586
3915
|
] })
|
|
3587
3916
|
] }),
|
|
3588
|
-
/* @__PURE__ */
|
|
3589
|
-
/* @__PURE__ */
|
|
3917
|
+
/* @__PURE__ */ jsxs9("div", { className: "cms-modal-actions", children: [
|
|
3918
|
+
/* @__PURE__ */ jsx9(
|
|
3590
3919
|
"button",
|
|
3591
3920
|
{
|
|
3592
3921
|
onClick: () => setShowModal(false),
|
|
@@ -3595,7 +3924,7 @@ function TablePlugin() {
|
|
|
3595
3924
|
children: "Cancel"
|
|
3596
3925
|
}
|
|
3597
3926
|
),
|
|
3598
|
-
/* @__PURE__ */
|
|
3927
|
+
/* @__PURE__ */ jsx9(
|
|
3599
3928
|
"button",
|
|
3600
3929
|
{
|
|
3601
3930
|
onClick: insertTable,
|
|
@@ -3612,7 +3941,7 @@ function TablePlugin() {
|
|
|
3612
3941
|
}
|
|
3613
3942
|
|
|
3614
3943
|
// src/plugins/ToolbarPlugin.tsx
|
|
3615
|
-
import { useState as
|
|
3944
|
+
import { useState as useState10, useCallback as useCallback8, useEffect as useEffect9 } from "react";
|
|
3616
3945
|
import {
|
|
3617
3946
|
MdUndo,
|
|
3618
3947
|
MdRedo,
|
|
@@ -3641,18 +3970,18 @@ import {
|
|
|
3641
3970
|
LuHeading2,
|
|
3642
3971
|
LuHeading3
|
|
3643
3972
|
} from "react-icons/lu";
|
|
3644
|
-
import { jsx as
|
|
3973
|
+
import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3645
3974
|
function ToolbarPlugin() {
|
|
3646
|
-
const [editor] =
|
|
3647
|
-
const [isBold, setIsBold] =
|
|
3648
|
-
const [isItalic, setIsItalic] =
|
|
3649
|
-
const [isUnderline, setIsUnderline] =
|
|
3650
|
-
const [isStrikethrough, setIsStrikethrough] =
|
|
3651
|
-
const [isCode, setIsCode] =
|
|
3652
|
-
const [blockType, setBlockType] =
|
|
3653
|
-
const [showLayoutMenu, setShowLayoutMenu] =
|
|
3654
|
-
const [layoutMenuPosition, setLayoutMenuPosition] =
|
|
3655
|
-
|
|
3975
|
+
const [editor] = useLexicalComposerContext8();
|
|
3976
|
+
const [isBold, setIsBold] = useState10(false);
|
|
3977
|
+
const [isItalic, setIsItalic] = useState10(false);
|
|
3978
|
+
const [isUnderline, setIsUnderline] = useState10(false);
|
|
3979
|
+
const [isStrikethrough, setIsStrikethrough] = useState10(false);
|
|
3980
|
+
const [isCode, setIsCode] = useState10(false);
|
|
3981
|
+
const [blockType, setBlockType] = useState10("paragraph");
|
|
3982
|
+
const [showLayoutMenu, setShowLayoutMenu] = useState10(false);
|
|
3983
|
+
const [layoutMenuPosition, setLayoutMenuPosition] = useState10({ top: 0, left: 0 });
|
|
3984
|
+
useEffect9(() => {
|
|
3656
3985
|
return editor.registerUpdateListener(({ editorState }) => {
|
|
3657
3986
|
editorState.read(() => {
|
|
3658
3987
|
const selection = $getSelection6();
|
|
@@ -3803,242 +4132,242 @@ function ToolbarPlugin() {
|
|
|
3803
4132
|
const handleRedo = useCallback8(() => {
|
|
3804
4133
|
editor.dispatchCommand(REDO_COMMAND, void 0);
|
|
3805
4134
|
}, [editor]);
|
|
3806
|
-
return /* @__PURE__ */
|
|
3807
|
-
/* @__PURE__ */
|
|
4135
|
+
return /* @__PURE__ */ jsxs10("div", { className: "cms-toolbar", children: [
|
|
4136
|
+
/* @__PURE__ */ jsx10(
|
|
3808
4137
|
"button",
|
|
3809
4138
|
{
|
|
3810
4139
|
className: "cms-toolbar-button",
|
|
3811
4140
|
onClick: handleUndo,
|
|
3812
4141
|
title: "Undo (Cmd+Z)",
|
|
3813
4142
|
type: "button",
|
|
3814
|
-
children: /* @__PURE__ */
|
|
4143
|
+
children: /* @__PURE__ */ jsx10(MdUndo, { size: 18 })
|
|
3815
4144
|
}
|
|
3816
4145
|
),
|
|
3817
|
-
/* @__PURE__ */
|
|
4146
|
+
/* @__PURE__ */ jsx10(
|
|
3818
4147
|
"button",
|
|
3819
4148
|
{
|
|
3820
4149
|
className: "cms-toolbar-button",
|
|
3821
4150
|
onClick: handleRedo,
|
|
3822
4151
|
title: "Redo (Cmd+Shift+Z)",
|
|
3823
4152
|
type: "button",
|
|
3824
|
-
children: /* @__PURE__ */
|
|
4153
|
+
children: /* @__PURE__ */ jsx10(MdRedo, { size: 18 })
|
|
3825
4154
|
}
|
|
3826
4155
|
),
|
|
3827
|
-
/* @__PURE__ */
|
|
3828
|
-
/* @__PURE__ */
|
|
4156
|
+
/* @__PURE__ */ jsx10("div", { className: "cms-toolbar-divider" }),
|
|
4157
|
+
/* @__PURE__ */ jsx10(
|
|
3829
4158
|
"button",
|
|
3830
4159
|
{
|
|
3831
4160
|
className: `cms-toolbar-button ${blockType === "paragraph" ? "active" : ""}`,
|
|
3832
4161
|
onClick: formatParagraph,
|
|
3833
4162
|
title: "Paragraph",
|
|
3834
4163
|
type: "button",
|
|
3835
|
-
children: /* @__PURE__ */
|
|
4164
|
+
children: /* @__PURE__ */ jsx10(BiParagraph, { size: 18 })
|
|
3836
4165
|
}
|
|
3837
4166
|
),
|
|
3838
|
-
/* @__PURE__ */
|
|
4167
|
+
/* @__PURE__ */ jsx10(
|
|
3839
4168
|
"button",
|
|
3840
4169
|
{
|
|
3841
4170
|
className: `cms-toolbar-button ${blockType === "h1" ? "active" : ""}`,
|
|
3842
4171
|
onClick: () => formatHeading("h1"),
|
|
3843
4172
|
title: "Heading 1",
|
|
3844
4173
|
type: "button",
|
|
3845
|
-
children: /* @__PURE__ */
|
|
4174
|
+
children: /* @__PURE__ */ jsx10(LuHeading1, { size: 18 })
|
|
3846
4175
|
}
|
|
3847
4176
|
),
|
|
3848
|
-
/* @__PURE__ */
|
|
4177
|
+
/* @__PURE__ */ jsx10(
|
|
3849
4178
|
"button",
|
|
3850
4179
|
{
|
|
3851
4180
|
className: `cms-toolbar-button ${blockType === "h2" ? "active" : ""}`,
|
|
3852
4181
|
onClick: () => formatHeading("h2"),
|
|
3853
4182
|
title: "Heading 2",
|
|
3854
4183
|
type: "button",
|
|
3855
|
-
children: /* @__PURE__ */
|
|
4184
|
+
children: /* @__PURE__ */ jsx10(LuHeading2, { size: 18 })
|
|
3856
4185
|
}
|
|
3857
4186
|
),
|
|
3858
|
-
/* @__PURE__ */
|
|
4187
|
+
/* @__PURE__ */ jsx10(
|
|
3859
4188
|
"button",
|
|
3860
4189
|
{
|
|
3861
4190
|
className: `cms-toolbar-button ${blockType === "h3" ? "active" : ""}`,
|
|
3862
4191
|
onClick: () => formatHeading("h3"),
|
|
3863
4192
|
title: "Heading 3",
|
|
3864
4193
|
type: "button",
|
|
3865
|
-
children: /* @__PURE__ */
|
|
4194
|
+
children: /* @__PURE__ */ jsx10(LuHeading3, { size: 18 })
|
|
3866
4195
|
}
|
|
3867
4196
|
),
|
|
3868
|
-
/* @__PURE__ */
|
|
3869
|
-
/* @__PURE__ */
|
|
4197
|
+
/* @__PURE__ */ jsx10("div", { className: "cms-toolbar-divider" }),
|
|
4198
|
+
/* @__PURE__ */ jsx10(
|
|
3870
4199
|
"button",
|
|
3871
4200
|
{
|
|
3872
4201
|
className: `cms-toolbar-button ${isBold ? "active" : ""}`,
|
|
3873
4202
|
onClick: formatBold,
|
|
3874
4203
|
title: "Bold (Cmd+B)",
|
|
3875
4204
|
type: "button",
|
|
3876
|
-
children: /* @__PURE__ */
|
|
4205
|
+
children: /* @__PURE__ */ jsx10(MdFormatBold, { size: 18 })
|
|
3877
4206
|
}
|
|
3878
4207
|
),
|
|
3879
|
-
/* @__PURE__ */
|
|
4208
|
+
/* @__PURE__ */ jsx10(
|
|
3880
4209
|
"button",
|
|
3881
4210
|
{
|
|
3882
4211
|
className: `cms-toolbar-button ${isItalic ? "active" : ""}`,
|
|
3883
4212
|
onClick: formatItalic,
|
|
3884
4213
|
title: "Italic (Cmd+I)",
|
|
3885
4214
|
type: "button",
|
|
3886
|
-
children: /* @__PURE__ */
|
|
4215
|
+
children: /* @__PURE__ */ jsx10(MdFormatItalic, { size: 18 })
|
|
3887
4216
|
}
|
|
3888
4217
|
),
|
|
3889
|
-
/* @__PURE__ */
|
|
4218
|
+
/* @__PURE__ */ jsx10(
|
|
3890
4219
|
"button",
|
|
3891
4220
|
{
|
|
3892
4221
|
className: `cms-toolbar-button ${isUnderline ? "active" : ""}`,
|
|
3893
4222
|
onClick: formatUnderline,
|
|
3894
4223
|
title: "Underline (Cmd+U)",
|
|
3895
4224
|
type: "button",
|
|
3896
|
-
children: /* @__PURE__ */
|
|
4225
|
+
children: /* @__PURE__ */ jsx10(MdFormatUnderlined, { size: 18 })
|
|
3897
4226
|
}
|
|
3898
4227
|
),
|
|
3899
|
-
/* @__PURE__ */
|
|
4228
|
+
/* @__PURE__ */ jsx10(
|
|
3900
4229
|
"button",
|
|
3901
4230
|
{
|
|
3902
4231
|
className: `cms-toolbar-button ${isStrikethrough ? "active" : ""}`,
|
|
3903
4232
|
onClick: formatStrikethrough,
|
|
3904
4233
|
title: "Strikethrough",
|
|
3905
4234
|
type: "button",
|
|
3906
|
-
children: /* @__PURE__ */
|
|
4235
|
+
children: /* @__PURE__ */ jsx10(MdFormatStrikethrough, { size: 18 })
|
|
3907
4236
|
}
|
|
3908
4237
|
),
|
|
3909
|
-
/* @__PURE__ */
|
|
4238
|
+
/* @__PURE__ */ jsx10(
|
|
3910
4239
|
"button",
|
|
3911
4240
|
{
|
|
3912
4241
|
className: `cms-toolbar-button ${isCode ? "active" : ""}`,
|
|
3913
4242
|
onClick: formatInlineCode,
|
|
3914
4243
|
title: "Inline Code",
|
|
3915
4244
|
type: "button",
|
|
3916
|
-
children: /* @__PURE__ */
|
|
4245
|
+
children: /* @__PURE__ */ jsx10(MdCode, { size: 18 })
|
|
3917
4246
|
}
|
|
3918
4247
|
),
|
|
3919
|
-
/* @__PURE__ */
|
|
3920
|
-
/* @__PURE__ */
|
|
3921
|
-
/* @__PURE__ */
|
|
3922
|
-
/* @__PURE__ */
|
|
4248
|
+
/* @__PURE__ */ jsx10(ColorPickerPlugin, {}),
|
|
4249
|
+
/* @__PURE__ */ jsx10(SpacingPlugin, {}),
|
|
4250
|
+
/* @__PURE__ */ jsx10("div", { className: "cms-toolbar-divider" }),
|
|
4251
|
+
/* @__PURE__ */ jsx10(
|
|
3923
4252
|
"button",
|
|
3924
4253
|
{
|
|
3925
4254
|
className: "cms-toolbar-button",
|
|
3926
4255
|
onClick: formatBulletList,
|
|
3927
4256
|
title: "Bullet List",
|
|
3928
4257
|
type: "button",
|
|
3929
|
-
children: /* @__PURE__ */
|
|
4258
|
+
children: /* @__PURE__ */ jsx10(MdFormatListBulleted, { size: 18 })
|
|
3930
4259
|
}
|
|
3931
4260
|
),
|
|
3932
|
-
/* @__PURE__ */
|
|
4261
|
+
/* @__PURE__ */ jsx10(
|
|
3933
4262
|
"button",
|
|
3934
4263
|
{
|
|
3935
4264
|
className: "cms-toolbar-button",
|
|
3936
4265
|
onClick: formatNumberedList,
|
|
3937
4266
|
title: "Numbered List",
|
|
3938
4267
|
type: "button",
|
|
3939
|
-
children: /* @__PURE__ */
|
|
4268
|
+
children: /* @__PURE__ */ jsx10(MdFormatListNumbered, { size: 18 })
|
|
3940
4269
|
}
|
|
3941
4270
|
),
|
|
3942
|
-
/* @__PURE__ */
|
|
3943
|
-
/* @__PURE__ */
|
|
4271
|
+
/* @__PURE__ */ jsx10("div", { className: "cms-toolbar-divider" }),
|
|
4272
|
+
/* @__PURE__ */ jsx10(
|
|
3944
4273
|
"button",
|
|
3945
4274
|
{
|
|
3946
4275
|
className: "cms-toolbar-button",
|
|
3947
4276
|
onClick: formatAlignLeft,
|
|
3948
4277
|
title: "Align Left",
|
|
3949
4278
|
type: "button",
|
|
3950
|
-
children: /* @__PURE__ */
|
|
4279
|
+
children: /* @__PURE__ */ jsx10(MdFormatAlignLeft, { size: 18 })
|
|
3951
4280
|
}
|
|
3952
4281
|
),
|
|
3953
|
-
/* @__PURE__ */
|
|
4282
|
+
/* @__PURE__ */ jsx10(
|
|
3954
4283
|
"button",
|
|
3955
4284
|
{
|
|
3956
4285
|
className: "cms-toolbar-button",
|
|
3957
4286
|
onClick: formatAlignCenter,
|
|
3958
4287
|
title: "Align Center",
|
|
3959
4288
|
type: "button",
|
|
3960
|
-
children: /* @__PURE__ */
|
|
4289
|
+
children: /* @__PURE__ */ jsx10(MdFormatAlignCenter, { size: 18 })
|
|
3961
4290
|
}
|
|
3962
4291
|
),
|
|
3963
|
-
/* @__PURE__ */
|
|
4292
|
+
/* @__PURE__ */ jsx10(
|
|
3964
4293
|
"button",
|
|
3965
4294
|
{
|
|
3966
4295
|
className: "cms-toolbar-button",
|
|
3967
4296
|
onClick: formatAlignRight,
|
|
3968
4297
|
title: "Align Right",
|
|
3969
4298
|
type: "button",
|
|
3970
|
-
children: /* @__PURE__ */
|
|
4299
|
+
children: /* @__PURE__ */ jsx10(MdFormatAlignRight, { size: 18 })
|
|
3971
4300
|
}
|
|
3972
4301
|
),
|
|
3973
|
-
/* @__PURE__ */
|
|
4302
|
+
/* @__PURE__ */ jsx10(
|
|
3974
4303
|
"button",
|
|
3975
4304
|
{
|
|
3976
4305
|
className: "cms-toolbar-button",
|
|
3977
4306
|
onClick: formatAlignJustify,
|
|
3978
4307
|
title: "Justify",
|
|
3979
4308
|
type: "button",
|
|
3980
|
-
children: /* @__PURE__ */
|
|
4309
|
+
children: /* @__PURE__ */ jsx10(MdFormatAlignJustify, { size: 18 })
|
|
3981
4310
|
}
|
|
3982
4311
|
),
|
|
3983
|
-
/* @__PURE__ */
|
|
3984
|
-
/* @__PURE__ */
|
|
4312
|
+
/* @__PURE__ */ jsx10("div", { className: "cms-toolbar-divider" }),
|
|
4313
|
+
/* @__PURE__ */ jsx10(
|
|
3985
4314
|
"button",
|
|
3986
4315
|
{
|
|
3987
4316
|
className: `cms-toolbar-button ${blockType === "quote" ? "active" : ""}`,
|
|
3988
4317
|
onClick: formatQuote,
|
|
3989
4318
|
title: "Quote",
|
|
3990
4319
|
type: "button",
|
|
3991
|
-
children: /* @__PURE__ */
|
|
4320
|
+
children: /* @__PURE__ */ jsx10(MdFormatQuote, { size: 18 })
|
|
3992
4321
|
}
|
|
3993
4322
|
),
|
|
3994
|
-
/* @__PURE__ */
|
|
4323
|
+
/* @__PURE__ */ jsx10(
|
|
3995
4324
|
"button",
|
|
3996
4325
|
{
|
|
3997
4326
|
className: `cms-toolbar-button ${blockType === "code" ? "active" : ""}`,
|
|
3998
4327
|
onClick: formatCode,
|
|
3999
4328
|
title: "Code Block",
|
|
4000
4329
|
type: "button",
|
|
4001
|
-
children: /* @__PURE__ */
|
|
4330
|
+
children: /* @__PURE__ */ jsx10(BiCodeBlock, { size: 18 })
|
|
4002
4331
|
}
|
|
4003
4332
|
),
|
|
4004
|
-
/* @__PURE__ */
|
|
4005
|
-
/* @__PURE__ */
|
|
4333
|
+
/* @__PURE__ */ jsx10("div", { className: "cms-toolbar-divider" }),
|
|
4334
|
+
/* @__PURE__ */ jsx10(
|
|
4006
4335
|
"button",
|
|
4007
4336
|
{
|
|
4008
4337
|
className: "cms-toolbar-button",
|
|
4009
4338
|
onClick: insertLink,
|
|
4010
4339
|
title: "Insert Link",
|
|
4011
4340
|
type: "button",
|
|
4012
|
-
children: /* @__PURE__ */
|
|
4341
|
+
children: /* @__PURE__ */ jsx10(MdLink, { size: 18 })
|
|
4013
4342
|
}
|
|
4014
4343
|
),
|
|
4015
|
-
/* @__PURE__ */
|
|
4344
|
+
/* @__PURE__ */ jsx10(
|
|
4016
4345
|
"button",
|
|
4017
4346
|
{
|
|
4018
4347
|
className: "cms-toolbar-button",
|
|
4019
4348
|
onClick: handleImageUpload,
|
|
4020
4349
|
title: "Upload Image",
|
|
4021
4350
|
type: "button",
|
|
4022
|
-
children: /* @__PURE__ */
|
|
4351
|
+
children: /* @__PURE__ */ jsx10(MdImage, { size: 18 })
|
|
4023
4352
|
}
|
|
4024
4353
|
),
|
|
4025
|
-
/* @__PURE__ */
|
|
4026
|
-
/* @__PURE__ */
|
|
4027
|
-
/* @__PURE__ */
|
|
4028
|
-
/* @__PURE__ */
|
|
4029
|
-
/* @__PURE__ */
|
|
4030
|
-
/* @__PURE__ */
|
|
4031
|
-
/* @__PURE__ */
|
|
4354
|
+
/* @__PURE__ */ jsx10("div", { className: "cms-toolbar-divider" }),
|
|
4355
|
+
/* @__PURE__ */ jsx10(ExportImportPlugin, {}),
|
|
4356
|
+
/* @__PURE__ */ jsx10(SectionCreatorPlugin, {}),
|
|
4357
|
+
/* @__PURE__ */ jsx10(TablePlugin, {}),
|
|
4358
|
+
/* @__PURE__ */ jsx10("div", { className: "cms-toolbar-divider" }),
|
|
4359
|
+
/* @__PURE__ */ jsxs10("div", { className: "cms-layout-plugin", children: [
|
|
4360
|
+
/* @__PURE__ */ jsx10(
|
|
4032
4361
|
"button",
|
|
4033
4362
|
{
|
|
4034
4363
|
className: "cms-toolbar-button",
|
|
4035
4364
|
onClick: toggleLayoutMenu,
|
|
4036
4365
|
title: "Insert Layout",
|
|
4037
4366
|
type: "button",
|
|
4038
|
-
children: /* @__PURE__ */
|
|
4367
|
+
children: /* @__PURE__ */ jsx10(MdViewColumn, { size: 18 })
|
|
4039
4368
|
}
|
|
4040
4369
|
),
|
|
4041
|
-
showLayoutMenu && /* @__PURE__ */
|
|
4370
|
+
showLayoutMenu && /* @__PURE__ */ jsxs10(
|
|
4042
4371
|
"div",
|
|
4043
4372
|
{
|
|
4044
4373
|
className: "cms-layout-menu",
|
|
@@ -4047,96 +4376,96 @@ function ToolbarPlugin() {
|
|
|
4047
4376
|
left: `${layoutMenuPosition.left}px`
|
|
4048
4377
|
},
|
|
4049
4378
|
children: [
|
|
4050
|
-
/* @__PURE__ */
|
|
4051
|
-
/* @__PURE__ */
|
|
4052
|
-
/* @__PURE__ */
|
|
4053
|
-
/* @__PURE__ */
|
|
4379
|
+
/* @__PURE__ */ jsx10("div", { className: "cms-layout-menu-title", children: "Choose Layout" }),
|
|
4380
|
+
/* @__PURE__ */ jsxs10("div", { className: "cms-layout-menu-section", children: [
|
|
4381
|
+
/* @__PURE__ */ jsx10("div", { className: "cms-layout-menu-subtitle", children: "Columns (Flex)" }),
|
|
4382
|
+
/* @__PURE__ */ jsxs10(
|
|
4054
4383
|
"button",
|
|
4055
4384
|
{
|
|
4056
4385
|
className: "cms-layout-menu-item",
|
|
4057
4386
|
onClick: () => insertLayout("2-column"),
|
|
4058
4387
|
type: "button",
|
|
4059
4388
|
children: [
|
|
4060
|
-
/* @__PURE__ */
|
|
4061
|
-
/* @__PURE__ */
|
|
4062
|
-
/* @__PURE__ */
|
|
4389
|
+
/* @__PURE__ */ jsxs10("div", { className: "cms-layout-preview cms-layout-preview-2col", children: [
|
|
4390
|
+
/* @__PURE__ */ jsx10("div", { className: "cms-layout-preview-col" }),
|
|
4391
|
+
/* @__PURE__ */ jsx10("div", { className: "cms-layout-preview-col" })
|
|
4063
4392
|
] }),
|
|
4064
|
-
/* @__PURE__ */
|
|
4393
|
+
/* @__PURE__ */ jsx10("span", { children: "2 Columns" })
|
|
4065
4394
|
]
|
|
4066
4395
|
}
|
|
4067
4396
|
),
|
|
4068
|
-
/* @__PURE__ */
|
|
4397
|
+
/* @__PURE__ */ jsxs10(
|
|
4069
4398
|
"button",
|
|
4070
4399
|
{
|
|
4071
4400
|
className: "cms-layout-menu-item",
|
|
4072
4401
|
onClick: () => insertLayout("3-column"),
|
|
4073
4402
|
type: "button",
|
|
4074
4403
|
children: [
|
|
4075
|
-
/* @__PURE__ */
|
|
4076
|
-
/* @__PURE__ */
|
|
4077
|
-
/* @__PURE__ */
|
|
4078
|
-
/* @__PURE__ */
|
|
4404
|
+
/* @__PURE__ */ jsxs10("div", { className: "cms-layout-preview cms-layout-preview-3col", children: [
|
|
4405
|
+
/* @__PURE__ */ jsx10("div", { className: "cms-layout-preview-col" }),
|
|
4406
|
+
/* @__PURE__ */ jsx10("div", { className: "cms-layout-preview-col" }),
|
|
4407
|
+
/* @__PURE__ */ jsx10("div", { className: "cms-layout-preview-col" })
|
|
4079
4408
|
] }),
|
|
4080
|
-
/* @__PURE__ */
|
|
4409
|
+
/* @__PURE__ */ jsx10("span", { children: "3 Columns" })
|
|
4081
4410
|
]
|
|
4082
4411
|
}
|
|
4083
4412
|
),
|
|
4084
|
-
/* @__PURE__ */
|
|
4413
|
+
/* @__PURE__ */ jsxs10(
|
|
4085
4414
|
"button",
|
|
4086
4415
|
{
|
|
4087
4416
|
className: "cms-layout-menu-item",
|
|
4088
4417
|
onClick: () => insertLayout("4-column"),
|
|
4089
4418
|
type: "button",
|
|
4090
4419
|
children: [
|
|
4091
|
-
/* @__PURE__ */
|
|
4092
|
-
/* @__PURE__ */
|
|
4093
|
-
/* @__PURE__ */
|
|
4094
|
-
/* @__PURE__ */
|
|
4095
|
-
/* @__PURE__ */
|
|
4420
|
+
/* @__PURE__ */ jsxs10("div", { className: "cms-layout-preview cms-layout-preview-4col", children: [
|
|
4421
|
+
/* @__PURE__ */ jsx10("div", { className: "cms-layout-preview-col" }),
|
|
4422
|
+
/* @__PURE__ */ jsx10("div", { className: "cms-layout-preview-col" }),
|
|
4423
|
+
/* @__PURE__ */ jsx10("div", { className: "cms-layout-preview-col" }),
|
|
4424
|
+
/* @__PURE__ */ jsx10("div", { className: "cms-layout-preview-col" })
|
|
4096
4425
|
] }),
|
|
4097
|
-
/* @__PURE__ */
|
|
4426
|
+
/* @__PURE__ */ jsx10("span", { children: "4 Columns" })
|
|
4098
4427
|
]
|
|
4099
4428
|
}
|
|
4100
4429
|
)
|
|
4101
4430
|
] }),
|
|
4102
|
-
/* @__PURE__ */
|
|
4103
|
-
/* @__PURE__ */
|
|
4104
|
-
/* @__PURE__ */
|
|
4431
|
+
/* @__PURE__ */ jsxs10("div", { className: "cms-layout-menu-section", children: [
|
|
4432
|
+
/* @__PURE__ */ jsx10("div", { className: "cms-layout-menu-subtitle", children: "Grid" }),
|
|
4433
|
+
/* @__PURE__ */ jsxs10(
|
|
4105
4434
|
"button",
|
|
4106
4435
|
{
|
|
4107
4436
|
className: "cms-layout-menu-item",
|
|
4108
4437
|
onClick: () => insertLayout("grid-2x2"),
|
|
4109
4438
|
type: "button",
|
|
4110
4439
|
children: [
|
|
4111
|
-
/* @__PURE__ */
|
|
4112
|
-
/* @__PURE__ */
|
|
4113
|
-
/* @__PURE__ */
|
|
4114
|
-
/* @__PURE__ */
|
|
4115
|
-
/* @__PURE__ */
|
|
4440
|
+
/* @__PURE__ */ jsxs10("div", { className: "cms-layout-preview cms-layout-preview-grid-2x2", children: [
|
|
4441
|
+
/* @__PURE__ */ jsx10("div", { className: "cms-layout-preview-col" }),
|
|
4442
|
+
/* @__PURE__ */ jsx10("div", { className: "cms-layout-preview-col" }),
|
|
4443
|
+
/* @__PURE__ */ jsx10("div", { className: "cms-layout-preview-col" }),
|
|
4444
|
+
/* @__PURE__ */ jsx10("div", { className: "cms-layout-preview-col" })
|
|
4116
4445
|
] }),
|
|
4117
|
-
/* @__PURE__ */
|
|
4446
|
+
/* @__PURE__ */ jsx10("span", { children: "2\xD72 Grid" })
|
|
4118
4447
|
]
|
|
4119
4448
|
}
|
|
4120
4449
|
),
|
|
4121
|
-
/* @__PURE__ */
|
|
4450
|
+
/* @__PURE__ */ jsxs10(
|
|
4122
4451
|
"button",
|
|
4123
4452
|
{
|
|
4124
4453
|
className: "cms-layout-menu-item",
|
|
4125
4454
|
onClick: () => insertLayout("grid-3x3"),
|
|
4126
4455
|
type: "button",
|
|
4127
4456
|
children: [
|
|
4128
|
-
/* @__PURE__ */
|
|
4129
|
-
/* @__PURE__ */
|
|
4130
|
-
/* @__PURE__ */
|
|
4131
|
-
/* @__PURE__ */
|
|
4132
|
-
/* @__PURE__ */
|
|
4133
|
-
/* @__PURE__ */
|
|
4134
|
-
/* @__PURE__ */
|
|
4135
|
-
/* @__PURE__ */
|
|
4136
|
-
/* @__PURE__ */
|
|
4137
|
-
/* @__PURE__ */
|
|
4457
|
+
/* @__PURE__ */ jsxs10("div", { className: "cms-layout-preview cms-layout-preview-grid-3x3", children: [
|
|
4458
|
+
/* @__PURE__ */ jsx10("div", { className: "cms-layout-preview-col" }),
|
|
4459
|
+
/* @__PURE__ */ jsx10("div", { className: "cms-layout-preview-col" }),
|
|
4460
|
+
/* @__PURE__ */ jsx10("div", { className: "cms-layout-preview-col" }),
|
|
4461
|
+
/* @__PURE__ */ jsx10("div", { className: "cms-layout-preview-col" }),
|
|
4462
|
+
/* @__PURE__ */ jsx10("div", { className: "cms-layout-preview-col" }),
|
|
4463
|
+
/* @__PURE__ */ jsx10("div", { className: "cms-layout-preview-col" }),
|
|
4464
|
+
/* @__PURE__ */ jsx10("div", { className: "cms-layout-preview-col" }),
|
|
4465
|
+
/* @__PURE__ */ jsx10("div", { className: "cms-layout-preview-col" }),
|
|
4466
|
+
/* @__PURE__ */ jsx10("div", { className: "cms-layout-preview-col" })
|
|
4138
4467
|
] }),
|
|
4139
|
-
/* @__PURE__ */
|
|
4468
|
+
/* @__PURE__ */ jsx10("span", { children: "3\xD73 Grid" })
|
|
4140
4469
|
]
|
|
4141
4470
|
}
|
|
4142
4471
|
)
|
|
@@ -4149,22 +4478,22 @@ function ToolbarPlugin() {
|
|
|
4149
4478
|
}
|
|
4150
4479
|
|
|
4151
4480
|
// src/plugins/ImageUploadPlugin.tsx
|
|
4152
|
-
import { useLexicalComposerContext as
|
|
4153
|
-
import { useEffect as
|
|
4154
|
-
import { $getSelection as $getSelection7, $isRangeSelection as $isRangeSelection7, COMMAND_PRIORITY_LOW as
|
|
4481
|
+
import { useLexicalComposerContext as useLexicalComposerContext9 } from "@lexical/react/LexicalComposerContext";
|
|
4482
|
+
import { useEffect as useEffect10 } from "react";
|
|
4483
|
+
import { $getSelection as $getSelection7, $isRangeSelection as $isRangeSelection7, COMMAND_PRIORITY_LOW as COMMAND_PRIORITY_LOW3, DRAGOVER_COMMAND, DROP_COMMAND } from "lexical";
|
|
4155
4484
|
function ImageUploadPlugin({
|
|
4156
4485
|
onImageAdded,
|
|
4157
4486
|
useBase64Url = true
|
|
4158
4487
|
}) {
|
|
4159
|
-
const [editor] =
|
|
4160
|
-
|
|
4488
|
+
const [editor] = useLexicalComposerContext9();
|
|
4489
|
+
useEffect10(() => {
|
|
4161
4490
|
const removeDragOverListener = editor.registerCommand(
|
|
4162
4491
|
DRAGOVER_COMMAND,
|
|
4163
4492
|
(event) => {
|
|
4164
4493
|
event.preventDefault();
|
|
4165
4494
|
return true;
|
|
4166
4495
|
},
|
|
4167
|
-
|
|
4496
|
+
COMMAND_PRIORITY_LOW3
|
|
4168
4497
|
);
|
|
4169
4498
|
const removeDropListener = editor.registerCommand(
|
|
4170
4499
|
DROP_COMMAND,
|
|
@@ -4208,7 +4537,7 @@ function ImageUploadPlugin({
|
|
|
4208
4537
|
}
|
|
4209
4538
|
return false;
|
|
4210
4539
|
},
|
|
4211
|
-
|
|
4540
|
+
COMMAND_PRIORITY_LOW3
|
|
4212
4541
|
);
|
|
4213
4542
|
return () => {
|
|
4214
4543
|
removeDragOverListener();
|
|
@@ -4219,25 +4548,25 @@ function ImageUploadPlugin({
|
|
|
4219
4548
|
}
|
|
4220
4549
|
|
|
4221
4550
|
// src/plugins/LinkPlugin.tsx
|
|
4222
|
-
import { useLexicalComposerContext as
|
|
4223
|
-
import { useEffect as
|
|
4551
|
+
import { useLexicalComposerContext as useLexicalComposerContext10 } from "@lexical/react/LexicalComposerContext";
|
|
4552
|
+
import { useEffect as useEffect11, useState as useState11, useCallback as useCallback9 } from "react";
|
|
4224
4553
|
import {
|
|
4225
4554
|
$getSelection as $getSelection8,
|
|
4226
4555
|
$isRangeSelection as $isRangeSelection8,
|
|
4227
|
-
COMMAND_PRIORITY_LOW as
|
|
4556
|
+
COMMAND_PRIORITY_LOW as COMMAND_PRIORITY_LOW4,
|
|
4228
4557
|
KEY_ESCAPE_COMMAND as KEY_ESCAPE_COMMAND2,
|
|
4229
4558
|
$createTextNode as $createTextNode2
|
|
4230
4559
|
} from "lexical";
|
|
4231
4560
|
import { $createLinkNode as $createLinkNode2, TOGGLE_LINK_COMMAND } from "@lexical/link";
|
|
4232
|
-
import { jsx as
|
|
4561
|
+
import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
4233
4562
|
function LinkPlugin() {
|
|
4234
|
-
const [editor] =
|
|
4235
|
-
const [showModal, setShowModal] =
|
|
4236
|
-
const [linkUrl, setLinkUrl] =
|
|
4237
|
-
const [linkText, setLinkText] =
|
|
4238
|
-
const [linkTitle, setLinkTitle] =
|
|
4239
|
-
const [openInNewTab, setOpenInNewTab] =
|
|
4240
|
-
|
|
4563
|
+
const [editor] = useLexicalComposerContext10();
|
|
4564
|
+
const [showModal, setShowModal] = useState11(false);
|
|
4565
|
+
const [linkUrl, setLinkUrl] = useState11("");
|
|
4566
|
+
const [linkText, setLinkText] = useState11("");
|
|
4567
|
+
const [linkTitle, setLinkTitle] = useState11("");
|
|
4568
|
+
const [openInNewTab, setOpenInNewTab] = useState11(false);
|
|
4569
|
+
useEffect11(() => {
|
|
4241
4570
|
return editor.registerCommand(
|
|
4242
4571
|
KEY_ESCAPE_COMMAND2,
|
|
4243
4572
|
() => {
|
|
@@ -4247,7 +4576,7 @@ function LinkPlugin() {
|
|
|
4247
4576
|
}
|
|
4248
4577
|
return false;
|
|
4249
4578
|
},
|
|
4250
|
-
|
|
4579
|
+
COMMAND_PRIORITY_LOW4
|
|
4251
4580
|
);
|
|
4252
4581
|
}, [editor, showModal]);
|
|
4253
4582
|
const handleInsertLink = useCallback9(() => {
|
|
@@ -4298,17 +4627,17 @@ function LinkPlugin() {
|
|
|
4298
4627
|
setLinkTitle("");
|
|
4299
4628
|
setOpenInNewTab(false);
|
|
4300
4629
|
};
|
|
4301
|
-
|
|
4630
|
+
useEffect11(() => {
|
|
4302
4631
|
window.__insertLink = handleInsertLink;
|
|
4303
4632
|
return () => {
|
|
4304
4633
|
delete window.__insertLink;
|
|
4305
4634
|
};
|
|
4306
4635
|
}, [handleInsertLink]);
|
|
4307
4636
|
if (!showModal) return null;
|
|
4308
|
-
return /* @__PURE__ */
|
|
4309
|
-
/* @__PURE__ */
|
|
4310
|
-
/* @__PURE__ */
|
|
4311
|
-
/* @__PURE__ */
|
|
4637
|
+
return /* @__PURE__ */ jsx11("div", { className: "cms-link-modal-overlay", onClick: handleCancel, children: /* @__PURE__ */ jsxs11("div", { className: "cms-link-modal", onClick: (e) => e.stopPropagation(), children: [
|
|
4638
|
+
/* @__PURE__ */ jsxs11("div", { className: "cms-link-modal-header", children: [
|
|
4639
|
+
/* @__PURE__ */ jsx11("h3", { children: "Insert Link" }),
|
|
4640
|
+
/* @__PURE__ */ jsx11(
|
|
4312
4641
|
"button",
|
|
4313
4642
|
{
|
|
4314
4643
|
className: "cms-link-modal-close",
|
|
@@ -4318,10 +4647,10 @@ function LinkPlugin() {
|
|
|
4318
4647
|
}
|
|
4319
4648
|
)
|
|
4320
4649
|
] }),
|
|
4321
|
-
/* @__PURE__ */
|
|
4322
|
-
/* @__PURE__ */
|
|
4323
|
-
/* @__PURE__ */
|
|
4324
|
-
/* @__PURE__ */
|
|
4650
|
+
/* @__PURE__ */ jsxs11("form", { onSubmit: handleSubmit, className: "cms-link-modal-form", children: [
|
|
4651
|
+
/* @__PURE__ */ jsxs11("div", { className: "cms-link-modal-field", children: [
|
|
4652
|
+
/* @__PURE__ */ jsx11("label", { htmlFor: "link-text", children: "Link Text" }),
|
|
4653
|
+
/* @__PURE__ */ jsx11(
|
|
4325
4654
|
"input",
|
|
4326
4655
|
{
|
|
4327
4656
|
id: "link-text",
|
|
@@ -4333,9 +4662,9 @@ function LinkPlugin() {
|
|
|
4333
4662
|
}
|
|
4334
4663
|
)
|
|
4335
4664
|
] }),
|
|
4336
|
-
/* @__PURE__ */
|
|
4337
|
-
/* @__PURE__ */
|
|
4338
|
-
/* @__PURE__ */
|
|
4665
|
+
/* @__PURE__ */ jsxs11("div", { className: "cms-link-modal-field", children: [
|
|
4666
|
+
/* @__PURE__ */ jsx11("label", { htmlFor: "link-url", children: "URL *" }),
|
|
4667
|
+
/* @__PURE__ */ jsx11(
|
|
4339
4668
|
"input",
|
|
4340
4669
|
{
|
|
4341
4670
|
id: "link-url",
|
|
@@ -4347,9 +4676,9 @@ function LinkPlugin() {
|
|
|
4347
4676
|
}
|
|
4348
4677
|
)
|
|
4349
4678
|
] }),
|
|
4350
|
-
/* @__PURE__ */
|
|
4351
|
-
/* @__PURE__ */
|
|
4352
|
-
/* @__PURE__ */
|
|
4679
|
+
/* @__PURE__ */ jsxs11("div", { className: "cms-link-modal-field", children: [
|
|
4680
|
+
/* @__PURE__ */ jsx11("label", { htmlFor: "link-title", children: "Title (optional)" }),
|
|
4681
|
+
/* @__PURE__ */ jsx11(
|
|
4353
4682
|
"input",
|
|
4354
4683
|
{
|
|
4355
4684
|
id: "link-title",
|
|
@@ -4360,8 +4689,8 @@ function LinkPlugin() {
|
|
|
4360
4689
|
}
|
|
4361
4690
|
)
|
|
4362
4691
|
] }),
|
|
4363
|
-
/* @__PURE__ */
|
|
4364
|
-
/* @__PURE__ */
|
|
4692
|
+
/* @__PURE__ */ jsx11("div", { className: "cms-link-modal-field cms-link-modal-checkbox", children: /* @__PURE__ */ jsxs11("label", { children: [
|
|
4693
|
+
/* @__PURE__ */ jsx11(
|
|
4365
4694
|
"input",
|
|
4366
4695
|
{
|
|
4367
4696
|
type: "checkbox",
|
|
@@ -4369,10 +4698,10 @@ function LinkPlugin() {
|
|
|
4369
4698
|
onChange: (e) => setOpenInNewTab(e.target.checked)
|
|
4370
4699
|
}
|
|
4371
4700
|
),
|
|
4372
|
-
/* @__PURE__ */
|
|
4701
|
+
/* @__PURE__ */ jsx11("span", { children: "Open in new tab" })
|
|
4373
4702
|
] }) }),
|
|
4374
|
-
/* @__PURE__ */
|
|
4375
|
-
/* @__PURE__ */
|
|
4703
|
+
/* @__PURE__ */ jsxs11("div", { className: "cms-link-modal-actions", children: [
|
|
4704
|
+
/* @__PURE__ */ jsx11(
|
|
4376
4705
|
"button",
|
|
4377
4706
|
{
|
|
4378
4707
|
type: "button",
|
|
@@ -4381,7 +4710,7 @@ function LinkPlugin() {
|
|
|
4381
4710
|
children: "Cancel"
|
|
4382
4711
|
}
|
|
4383
4712
|
),
|
|
4384
|
-
/* @__PURE__ */
|
|
4713
|
+
/* @__PURE__ */ jsx11(
|
|
4385
4714
|
"button",
|
|
4386
4715
|
{
|
|
4387
4716
|
type: "submit",
|
|
@@ -4396,14 +4725,14 @@ function LinkPlugin() {
|
|
|
4396
4725
|
}
|
|
4397
4726
|
|
|
4398
4727
|
// src/plugins/SectionEditorPlugin.tsx
|
|
4399
|
-
import { useLexicalComposerContext as
|
|
4400
|
-
import { useState as
|
|
4728
|
+
import { useLexicalComposerContext as useLexicalComposerContext11 } from "@lexical/react/LexicalComposerContext";
|
|
4729
|
+
import { useState as useState12, useCallback as useCallback10, useRef as useRef8, useEffect as useEffect12 } from "react";
|
|
4401
4730
|
import {
|
|
4402
4731
|
$getSelection as $getSelection9,
|
|
4403
4732
|
$isRangeSelection as $isRangeSelection9,
|
|
4404
4733
|
$getNodeByKey,
|
|
4405
4734
|
SELECTION_CHANGE_COMMAND,
|
|
4406
|
-
COMMAND_PRIORITY_LOW as
|
|
4735
|
+
COMMAND_PRIORITY_LOW as COMMAND_PRIORITY_LOW5
|
|
4407
4736
|
} from "lexical";
|
|
4408
4737
|
import { MdSettings as MdSettings2, MdClose } from "react-icons/md";
|
|
4409
4738
|
import {
|
|
@@ -4412,7 +4741,7 @@ import {
|
|
|
4412
4741
|
FaAlignRight,
|
|
4413
4742
|
FaAlignJustify
|
|
4414
4743
|
} from "react-icons/fa";
|
|
4415
|
-
import { Fragment as Fragment6, jsx as
|
|
4744
|
+
import { Fragment as Fragment6, jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
4416
4745
|
var PRESET_COLORS2 = [
|
|
4417
4746
|
"#ffffff",
|
|
4418
4747
|
"#f8f9fa",
|
|
@@ -4446,12 +4775,12 @@ var PRESET_COLORS2 = [
|
|
|
4446
4775
|
"#1dd1a1"
|
|
4447
4776
|
];
|
|
4448
4777
|
function SectionEditorPlugin() {
|
|
4449
|
-
const [editor] =
|
|
4450
|
-
const [selectedSection, setSelectedSection] =
|
|
4451
|
-
const [showEditor, setShowEditor] =
|
|
4452
|
-
const [editorPosition, setEditorPosition] =
|
|
4778
|
+
const [editor] = useLexicalComposerContext11();
|
|
4779
|
+
const [selectedSection, setSelectedSection] = useState12(null);
|
|
4780
|
+
const [showEditor, setShowEditor] = useState12(false);
|
|
4781
|
+
const [editorPosition, setEditorPosition] = useState12({ top: 0, left: 0 });
|
|
4453
4782
|
const editorRef = useRef8(null);
|
|
4454
|
-
|
|
4783
|
+
useEffect12(() => {
|
|
4455
4784
|
return editor.registerCommand(
|
|
4456
4785
|
SELECTION_CHANGE_COMMAND,
|
|
4457
4786
|
() => {
|
|
@@ -4477,10 +4806,10 @@ function SectionEditorPlugin() {
|
|
|
4477
4806
|
});
|
|
4478
4807
|
return false;
|
|
4479
4808
|
},
|
|
4480
|
-
|
|
4809
|
+
COMMAND_PRIORITY_LOW5
|
|
4481
4810
|
);
|
|
4482
4811
|
}, [editor]);
|
|
4483
|
-
|
|
4812
|
+
useEffect12(() => {
|
|
4484
4813
|
const handleClickOutside = (event) => {
|
|
4485
4814
|
if (editorRef.current && !editorRef.current.contains(event.target)) {
|
|
4486
4815
|
setShowEditor(false);
|
|
@@ -4591,8 +4920,8 @@ function SectionEditorPlugin() {
|
|
|
4591
4920
|
const currentMargin = node.getMargin() || "0px";
|
|
4592
4921
|
const currentGridColumns = node.getGridTemplateColumns() || "repeat(3, 1fr)";
|
|
4593
4922
|
const currentGridRows = node.getGridTemplateRows() || "auto";
|
|
4594
|
-
return /* @__PURE__ */
|
|
4595
|
-
/* @__PURE__ */
|
|
4923
|
+
return /* @__PURE__ */ jsxs12("div", { className: "cms-section-editor-plugin", ref: editorRef, children: [
|
|
4924
|
+
/* @__PURE__ */ jsxs12(
|
|
4596
4925
|
"button",
|
|
4597
4926
|
{
|
|
4598
4927
|
className: "cms-toolbar-button cms-section-edit-button",
|
|
@@ -4600,12 +4929,12 @@ function SectionEditorPlugin() {
|
|
|
4600
4929
|
title: "Edit Section",
|
|
4601
4930
|
type: "button",
|
|
4602
4931
|
children: [
|
|
4603
|
-
/* @__PURE__ */
|
|
4604
|
-
/* @__PURE__ */
|
|
4932
|
+
/* @__PURE__ */ jsx12(MdSettings2, { size: 18 }),
|
|
4933
|
+
/* @__PURE__ */ jsx12("span", { className: "cms-section-indicator", children: "Section" })
|
|
4605
4934
|
]
|
|
4606
4935
|
}
|
|
4607
4936
|
),
|
|
4608
|
-
showEditor && /* @__PURE__ */
|
|
4937
|
+
showEditor && /* @__PURE__ */ jsxs12(
|
|
4609
4938
|
"div",
|
|
4610
4939
|
{
|
|
4611
4940
|
className: "cms-section-editor-menu",
|
|
@@ -4614,22 +4943,22 @@ function SectionEditorPlugin() {
|
|
|
4614
4943
|
left: `${editorPosition.left}px`
|
|
4615
4944
|
},
|
|
4616
4945
|
children: [
|
|
4617
|
-
/* @__PURE__ */
|
|
4618
|
-
/* @__PURE__ */
|
|
4619
|
-
/* @__PURE__ */
|
|
4946
|
+
/* @__PURE__ */ jsxs12("div", { className: "cms-section-editor-header", children: [
|
|
4947
|
+
/* @__PURE__ */ jsx12("span", { children: "Section Settings" }),
|
|
4948
|
+
/* @__PURE__ */ jsx12(
|
|
4620
4949
|
"button",
|
|
4621
4950
|
{
|
|
4622
4951
|
className: "cms-close-button",
|
|
4623
4952
|
onClick: () => setShowEditor(false),
|
|
4624
4953
|
type: "button",
|
|
4625
|
-
children: /* @__PURE__ */
|
|
4954
|
+
children: /* @__PURE__ */ jsx12(MdClose, { size: 16 })
|
|
4626
4955
|
}
|
|
4627
4956
|
)
|
|
4628
4957
|
] }),
|
|
4629
|
-
/* @__PURE__ */
|
|
4630
|
-
/* @__PURE__ */
|
|
4631
|
-
/* @__PURE__ */
|
|
4632
|
-
/* @__PURE__ */
|
|
4958
|
+
/* @__PURE__ */ jsxs12("div", { className: "cms-section-editor-content", children: [
|
|
4959
|
+
/* @__PURE__ */ jsxs12("div", { className: "cms-section-editor-group", children: [
|
|
4960
|
+
/* @__PURE__ */ jsx12("label", { children: "Background Color" }),
|
|
4961
|
+
/* @__PURE__ */ jsx12("div", { className: "cms-color-grid", children: PRESET_COLORS2.map((color) => /* @__PURE__ */ jsx12(
|
|
4633
4962
|
"button",
|
|
4634
4963
|
{
|
|
4635
4964
|
className: `cms-color-swatch ${currentBgColor === color ? "active" : ""}`,
|
|
@@ -4640,7 +4969,7 @@ function SectionEditorPlugin() {
|
|
|
4640
4969
|
},
|
|
4641
4970
|
color
|
|
4642
4971
|
)) }),
|
|
4643
|
-
/* @__PURE__ */
|
|
4972
|
+
/* @__PURE__ */ jsx12(
|
|
4644
4973
|
"input",
|
|
4645
4974
|
{
|
|
4646
4975
|
type: "color",
|
|
@@ -4650,9 +4979,9 @@ function SectionEditorPlugin() {
|
|
|
4650
4979
|
}
|
|
4651
4980
|
)
|
|
4652
4981
|
] }),
|
|
4653
|
-
/* @__PURE__ */
|
|
4654
|
-
/* @__PURE__ */
|
|
4655
|
-
/* @__PURE__ */
|
|
4982
|
+
/* @__PURE__ */ jsxs12("div", { className: "cms-section-editor-group", children: [
|
|
4983
|
+
/* @__PURE__ */ jsx12("label", { children: "Background Image" }),
|
|
4984
|
+
/* @__PURE__ */ jsx12(
|
|
4656
4985
|
"input",
|
|
4657
4986
|
{
|
|
4658
4987
|
type: "text",
|
|
@@ -4662,66 +4991,66 @@ function SectionEditorPlugin() {
|
|
|
4662
4991
|
className: "cms-text-input"
|
|
4663
4992
|
}
|
|
4664
4993
|
),
|
|
4665
|
-
currentBgImage && /* @__PURE__ */
|
|
4666
|
-
/* @__PURE__ */
|
|
4667
|
-
/* @__PURE__ */
|
|
4668
|
-
/* @__PURE__ */
|
|
4669
|
-
/* @__PURE__ */
|
|
4994
|
+
currentBgImage && /* @__PURE__ */ jsxs12(Fragment6, { children: [
|
|
4995
|
+
/* @__PURE__ */ jsxs12("div", { className: "cms-bg-controls", children: [
|
|
4996
|
+
/* @__PURE__ */ jsxs12("div", { className: "cms-bg-control-item", children: [
|
|
4997
|
+
/* @__PURE__ */ jsx12("label", { children: "Size" }),
|
|
4998
|
+
/* @__PURE__ */ jsxs12(
|
|
4670
4999
|
"select",
|
|
4671
5000
|
{
|
|
4672
5001
|
value: currentBgSize,
|
|
4673
5002
|
onChange: (e) => setBackgroundSize(e.target.value),
|
|
4674
5003
|
className: "cms-select-small",
|
|
4675
5004
|
children: [
|
|
4676
|
-
/* @__PURE__ */
|
|
4677
|
-
/* @__PURE__ */
|
|
4678
|
-
/* @__PURE__ */
|
|
4679
|
-
/* @__PURE__ */
|
|
5005
|
+
/* @__PURE__ */ jsx12("option", { value: "cover", children: "Cover" }),
|
|
5006
|
+
/* @__PURE__ */ jsx12("option", { value: "contain", children: "Contain" }),
|
|
5007
|
+
/* @__PURE__ */ jsx12("option", { value: "auto", children: "Auto" }),
|
|
5008
|
+
/* @__PURE__ */ jsx12("option", { value: "100% 100%", children: "Stretch" })
|
|
4680
5009
|
]
|
|
4681
5010
|
}
|
|
4682
5011
|
)
|
|
4683
5012
|
] }),
|
|
4684
|
-
/* @__PURE__ */
|
|
4685
|
-
/* @__PURE__ */
|
|
4686
|
-
/* @__PURE__ */
|
|
5013
|
+
/* @__PURE__ */ jsxs12("div", { className: "cms-bg-control-item", children: [
|
|
5014
|
+
/* @__PURE__ */ jsx12("label", { children: "Position" }),
|
|
5015
|
+
/* @__PURE__ */ jsxs12(
|
|
4687
5016
|
"select",
|
|
4688
5017
|
{
|
|
4689
5018
|
value: currentBgPosition,
|
|
4690
5019
|
onChange: (e) => setBackgroundPosition(e.target.value),
|
|
4691
5020
|
className: "cms-select-small",
|
|
4692
5021
|
children: [
|
|
4693
|
-
/* @__PURE__ */
|
|
4694
|
-
/* @__PURE__ */
|
|
4695
|
-
/* @__PURE__ */
|
|
4696
|
-
/* @__PURE__ */
|
|
4697
|
-
/* @__PURE__ */
|
|
4698
|
-
/* @__PURE__ */
|
|
4699
|
-
/* @__PURE__ */
|
|
4700
|
-
/* @__PURE__ */
|
|
4701
|
-
/* @__PURE__ */
|
|
5022
|
+
/* @__PURE__ */ jsx12("option", { value: "center", children: "Center" }),
|
|
5023
|
+
/* @__PURE__ */ jsx12("option", { value: "top", children: "Top" }),
|
|
5024
|
+
/* @__PURE__ */ jsx12("option", { value: "bottom", children: "Bottom" }),
|
|
5025
|
+
/* @__PURE__ */ jsx12("option", { value: "left", children: "Left" }),
|
|
5026
|
+
/* @__PURE__ */ jsx12("option", { value: "right", children: "Right" }),
|
|
5027
|
+
/* @__PURE__ */ jsx12("option", { value: "top left", children: "Top Left" }),
|
|
5028
|
+
/* @__PURE__ */ jsx12("option", { value: "top right", children: "Top Right" }),
|
|
5029
|
+
/* @__PURE__ */ jsx12("option", { value: "bottom left", children: "Bottom Left" }),
|
|
5030
|
+
/* @__PURE__ */ jsx12("option", { value: "bottom right", children: "Bottom Right" })
|
|
4702
5031
|
]
|
|
4703
5032
|
}
|
|
4704
5033
|
)
|
|
4705
5034
|
] }),
|
|
4706
|
-
/* @__PURE__ */
|
|
4707
|
-
/* @__PURE__ */
|
|
4708
|
-
/* @__PURE__ */
|
|
5035
|
+
/* @__PURE__ */ jsxs12("div", { className: "cms-bg-control-item", children: [
|
|
5036
|
+
/* @__PURE__ */ jsx12("label", { children: "Repeat" }),
|
|
5037
|
+
/* @__PURE__ */ jsxs12(
|
|
4709
5038
|
"select",
|
|
4710
5039
|
{
|
|
4711
5040
|
value: currentBgRepeat,
|
|
4712
5041
|
onChange: (e) => setBackgroundRepeat(e.target.value),
|
|
4713
5042
|
className: "cms-select-small",
|
|
4714
5043
|
children: [
|
|
4715
|
-
/* @__PURE__ */
|
|
4716
|
-
/* @__PURE__ */
|
|
4717
|
-
/* @__PURE__ */
|
|
4718
|
-
/* @__PURE__ */
|
|
5044
|
+
/* @__PURE__ */ jsx12("option", { value: "no-repeat", children: "No Repeat" }),
|
|
5045
|
+
/* @__PURE__ */ jsx12("option", { value: "repeat", children: "Repeat" }),
|
|
5046
|
+
/* @__PURE__ */ jsx12("option", { value: "repeat-x", children: "Repeat X" }),
|
|
5047
|
+
/* @__PURE__ */ jsx12("option", { value: "repeat-y", children: "Repeat Y" })
|
|
4719
5048
|
]
|
|
4720
5049
|
}
|
|
4721
5050
|
)
|
|
4722
5051
|
] })
|
|
4723
5052
|
] }),
|
|
4724
|
-
/* @__PURE__ */
|
|
5053
|
+
/* @__PURE__ */ jsx12(
|
|
4725
5054
|
"button",
|
|
4726
5055
|
{
|
|
4727
5056
|
onClick: removeBackgroundImage,
|
|
@@ -4732,10 +5061,10 @@ function SectionEditorPlugin() {
|
|
|
4732
5061
|
)
|
|
4733
5062
|
] })
|
|
4734
5063
|
] }),
|
|
4735
|
-
currentBgImage && /* @__PURE__ */
|
|
4736
|
-
/* @__PURE__ */
|
|
4737
|
-
/* @__PURE__ */
|
|
4738
|
-
/* @__PURE__ */
|
|
5064
|
+
currentBgImage && /* @__PURE__ */ jsxs12("div", { className: "cms-section-editor-group", children: [
|
|
5065
|
+
/* @__PURE__ */ jsx12("label", { children: "Gradient Overlay" }),
|
|
5066
|
+
/* @__PURE__ */ jsxs12("div", { className: "cms-gradient-presets", children: [
|
|
5067
|
+
/* @__PURE__ */ jsx12(
|
|
4739
5068
|
"button",
|
|
4740
5069
|
{
|
|
4741
5070
|
onClick: () => setGradientOverlay(""),
|
|
@@ -4744,7 +5073,7 @@ function SectionEditorPlugin() {
|
|
|
4744
5073
|
children: "None"
|
|
4745
5074
|
}
|
|
4746
5075
|
),
|
|
4747
|
-
/* @__PURE__ */
|
|
5076
|
+
/* @__PURE__ */ jsx12(
|
|
4748
5077
|
"button",
|
|
4749
5078
|
{
|
|
4750
5079
|
onClick: () => setGradientOverlay("linear-gradient(rgba(0,0,0,0.3), rgba(0,0,0,0.7))"),
|
|
@@ -4754,7 +5083,7 @@ function SectionEditorPlugin() {
|
|
|
4754
5083
|
type: "button"
|
|
4755
5084
|
}
|
|
4756
5085
|
),
|
|
4757
|
-
/* @__PURE__ */
|
|
5086
|
+
/* @__PURE__ */ jsx12(
|
|
4758
5087
|
"button",
|
|
4759
5088
|
{
|
|
4760
5089
|
onClick: () => setGradientOverlay("linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5))"),
|
|
@@ -4764,7 +5093,7 @@ function SectionEditorPlugin() {
|
|
|
4764
5093
|
type: "button"
|
|
4765
5094
|
}
|
|
4766
5095
|
),
|
|
4767
|
-
/* @__PURE__ */
|
|
5096
|
+
/* @__PURE__ */ jsx12(
|
|
4768
5097
|
"button",
|
|
4769
5098
|
{
|
|
4770
5099
|
onClick: () => setGradientOverlay("linear-gradient(rgba(102,126,234,0.8), rgba(118,75,162,0.8))"),
|
|
@@ -4774,7 +5103,7 @@ function SectionEditorPlugin() {
|
|
|
4774
5103
|
type: "button"
|
|
4775
5104
|
}
|
|
4776
5105
|
),
|
|
4777
|
-
/* @__PURE__ */
|
|
5106
|
+
/* @__PURE__ */ jsx12(
|
|
4778
5107
|
"button",
|
|
4779
5108
|
{
|
|
4780
5109
|
onClick: () => setGradientOverlay("linear-gradient(rgba(250,112,154,0.8), rgba(254,225,64,0.8))"),
|
|
@@ -4784,7 +5113,7 @@ function SectionEditorPlugin() {
|
|
|
4784
5113
|
type: "button"
|
|
4785
5114
|
}
|
|
4786
5115
|
),
|
|
4787
|
-
/* @__PURE__ */
|
|
5116
|
+
/* @__PURE__ */ jsx12(
|
|
4788
5117
|
"button",
|
|
4789
5118
|
{
|
|
4790
5119
|
onClick: () => setGradientOverlay("linear-gradient(rgba(67,233,123,0.8), rgba(56,249,215,0.8))"),
|
|
@@ -4795,7 +5124,7 @@ function SectionEditorPlugin() {
|
|
|
4795
5124
|
}
|
|
4796
5125
|
)
|
|
4797
5126
|
] }),
|
|
4798
|
-
/* @__PURE__ */
|
|
5127
|
+
/* @__PURE__ */ jsx12(
|
|
4799
5128
|
"input",
|
|
4800
5129
|
{
|
|
4801
5130
|
type: "text",
|
|
@@ -4806,13 +5135,13 @@ function SectionEditorPlugin() {
|
|
|
4806
5135
|
}
|
|
4807
5136
|
)
|
|
4808
5137
|
] }),
|
|
4809
|
-
/* @__PURE__ */
|
|
4810
|
-
/* @__PURE__ */
|
|
5138
|
+
/* @__PURE__ */ jsxs12("div", { className: "cms-section-editor-group", children: [
|
|
5139
|
+
/* @__PURE__ */ jsxs12("label", { children: [
|
|
4811
5140
|
"Opacity: ",
|
|
4812
5141
|
Math.round((currentOpacity || 1) * 100),
|
|
4813
5142
|
"%"
|
|
4814
5143
|
] }),
|
|
4815
|
-
/* @__PURE__ */
|
|
5144
|
+
/* @__PURE__ */ jsx12(
|
|
4816
5145
|
"input",
|
|
4817
5146
|
{
|
|
4818
5147
|
type: "range",
|
|
@@ -4824,62 +5153,62 @@ function SectionEditorPlugin() {
|
|
|
4824
5153
|
className: "cms-range-input"
|
|
4825
5154
|
}
|
|
4826
5155
|
),
|
|
4827
|
-
/* @__PURE__ */
|
|
4828
|
-
/* @__PURE__ */
|
|
4829
|
-
/* @__PURE__ */
|
|
4830
|
-
/* @__PURE__ */
|
|
4831
|
-
/* @__PURE__ */
|
|
5156
|
+
/* @__PURE__ */ jsxs12("div", { className: "cms-preset-buttons", children: [
|
|
5157
|
+
/* @__PURE__ */ jsx12("button", { onClick: () => setOpacity(0.25), type: "button", children: "25%" }),
|
|
5158
|
+
/* @__PURE__ */ jsx12("button", { onClick: () => setOpacity(0.5), type: "button", children: "50%" }),
|
|
5159
|
+
/* @__PURE__ */ jsx12("button", { onClick: () => setOpacity(0.75), type: "button", children: "75%" }),
|
|
5160
|
+
/* @__PURE__ */ jsx12("button", { onClick: () => setOpacity(1), type: "button", children: "100%" })
|
|
4832
5161
|
] })
|
|
4833
5162
|
] }),
|
|
4834
|
-
/* @__PURE__ */
|
|
4835
|
-
/* @__PURE__ */
|
|
4836
|
-
/* @__PURE__ */
|
|
4837
|
-
/* @__PURE__ */
|
|
5163
|
+
/* @__PURE__ */ jsxs12("div", { className: "cms-section-editor-group", children: [
|
|
5164
|
+
/* @__PURE__ */ jsx12("label", { children: "Text Alignment" }),
|
|
5165
|
+
/* @__PURE__ */ jsxs12("div", { className: "cms-button-group", children: [
|
|
5166
|
+
/* @__PURE__ */ jsx12(
|
|
4838
5167
|
"button",
|
|
4839
5168
|
{
|
|
4840
5169
|
className: `cms-icon-button ${currentTextAlign === "left" ? "active" : ""}`,
|
|
4841
5170
|
onClick: () => setTextAlign("left"),
|
|
4842
5171
|
title: "Align Left",
|
|
4843
5172
|
type: "button",
|
|
4844
|
-
children: /* @__PURE__ */
|
|
5173
|
+
children: /* @__PURE__ */ jsx12(FaAlignLeft, {})
|
|
4845
5174
|
}
|
|
4846
5175
|
),
|
|
4847
|
-
/* @__PURE__ */
|
|
5176
|
+
/* @__PURE__ */ jsx12(
|
|
4848
5177
|
"button",
|
|
4849
5178
|
{
|
|
4850
5179
|
className: `cms-icon-button ${currentTextAlign === "center" ? "active" : ""}`,
|
|
4851
5180
|
onClick: () => setTextAlign("center"),
|
|
4852
5181
|
title: "Align Center",
|
|
4853
5182
|
type: "button",
|
|
4854
|
-
children: /* @__PURE__ */
|
|
5183
|
+
children: /* @__PURE__ */ jsx12(FaAlignCenter, {})
|
|
4855
5184
|
}
|
|
4856
5185
|
),
|
|
4857
|
-
/* @__PURE__ */
|
|
5186
|
+
/* @__PURE__ */ jsx12(
|
|
4858
5187
|
"button",
|
|
4859
5188
|
{
|
|
4860
5189
|
className: `cms-icon-button ${currentTextAlign === "right" ? "active" : ""}`,
|
|
4861
5190
|
onClick: () => setTextAlign("right"),
|
|
4862
5191
|
title: "Align Right",
|
|
4863
5192
|
type: "button",
|
|
4864
|
-
children: /* @__PURE__ */
|
|
5193
|
+
children: /* @__PURE__ */ jsx12(FaAlignRight, {})
|
|
4865
5194
|
}
|
|
4866
5195
|
),
|
|
4867
|
-
/* @__PURE__ */
|
|
5196
|
+
/* @__PURE__ */ jsx12(
|
|
4868
5197
|
"button",
|
|
4869
5198
|
{
|
|
4870
5199
|
className: `cms-icon-button ${currentTextAlign === "justify" ? "active" : ""}`,
|
|
4871
5200
|
onClick: () => setTextAlign("justify"),
|
|
4872
5201
|
title: "Justify",
|
|
4873
5202
|
type: "button",
|
|
4874
|
-
children: /* @__PURE__ */
|
|
5203
|
+
children: /* @__PURE__ */ jsx12(FaAlignJustify, {})
|
|
4875
5204
|
}
|
|
4876
5205
|
)
|
|
4877
5206
|
] })
|
|
4878
5207
|
] }),
|
|
4879
|
-
/* @__PURE__ */
|
|
4880
|
-
/* @__PURE__ */
|
|
4881
|
-
/* @__PURE__ */
|
|
4882
|
-
/* @__PURE__ */
|
|
5208
|
+
/* @__PURE__ */ jsxs12("div", { className: "cms-section-editor-group", children: [
|
|
5209
|
+
/* @__PURE__ */ jsx12("label", { children: "Layout Type" }),
|
|
5210
|
+
/* @__PURE__ */ jsxs12("div", { className: "cms-button-group", children: [
|
|
5211
|
+
/* @__PURE__ */ jsx12(
|
|
4883
5212
|
"button",
|
|
4884
5213
|
{
|
|
4885
5214
|
className: `cms-layout-button ${currentLayout === "block" ? "active" : ""}`,
|
|
@@ -4888,7 +5217,7 @@ function SectionEditorPlugin() {
|
|
|
4888
5217
|
children: "Block"
|
|
4889
5218
|
}
|
|
4890
5219
|
),
|
|
4891
|
-
/* @__PURE__ */
|
|
5220
|
+
/* @__PURE__ */ jsx12(
|
|
4892
5221
|
"button",
|
|
4893
5222
|
{
|
|
4894
5223
|
className: `cms-layout-button ${currentLayout === "flex" ? "active" : ""}`,
|
|
@@ -4897,7 +5226,7 @@ function SectionEditorPlugin() {
|
|
|
4897
5226
|
children: "Flex"
|
|
4898
5227
|
}
|
|
4899
5228
|
),
|
|
4900
|
-
/* @__PURE__ */
|
|
5229
|
+
/* @__PURE__ */ jsx12(
|
|
4901
5230
|
"button",
|
|
4902
5231
|
{
|
|
4903
5232
|
className: `cms-layout-button ${currentLayout === "grid" ? "active" : ""}`,
|
|
@@ -4908,81 +5237,81 @@ function SectionEditorPlugin() {
|
|
|
4908
5237
|
)
|
|
4909
5238
|
] })
|
|
4910
5239
|
] }),
|
|
4911
|
-
currentLayout === "flex" && /* @__PURE__ */
|
|
4912
|
-
/* @__PURE__ */
|
|
4913
|
-
/* @__PURE__ */
|
|
4914
|
-
/* @__PURE__ */
|
|
5240
|
+
currentLayout === "flex" && /* @__PURE__ */ jsxs12(Fragment6, { children: [
|
|
5241
|
+
/* @__PURE__ */ jsxs12("div", { className: "cms-section-editor-group", children: [
|
|
5242
|
+
/* @__PURE__ */ jsx12("label", { children: "Flex Direction" }),
|
|
5243
|
+
/* @__PURE__ */ jsxs12(
|
|
4915
5244
|
"select",
|
|
4916
5245
|
{
|
|
4917
5246
|
value: currentFlexDirection,
|
|
4918
5247
|
onChange: (e) => setFlexDirection(e.target.value),
|
|
4919
5248
|
className: "cms-select",
|
|
4920
5249
|
children: [
|
|
4921
|
-
/* @__PURE__ */
|
|
4922
|
-
/* @__PURE__ */
|
|
4923
|
-
/* @__PURE__ */
|
|
4924
|
-
/* @__PURE__ */
|
|
5250
|
+
/* @__PURE__ */ jsx12("option", { value: "row", children: "Row" }),
|
|
5251
|
+
/* @__PURE__ */ jsx12("option", { value: "column", children: "Column" }),
|
|
5252
|
+
/* @__PURE__ */ jsx12("option", { value: "row-reverse", children: "Row Reverse" }),
|
|
5253
|
+
/* @__PURE__ */ jsx12("option", { value: "column-reverse", children: "Column Reverse" })
|
|
4925
5254
|
]
|
|
4926
5255
|
}
|
|
4927
5256
|
)
|
|
4928
5257
|
] }),
|
|
4929
|
-
/* @__PURE__ */
|
|
4930
|
-
/* @__PURE__ */
|
|
4931
|
-
/* @__PURE__ */
|
|
5258
|
+
/* @__PURE__ */ jsxs12("div", { className: "cms-section-editor-group", children: [
|
|
5259
|
+
/* @__PURE__ */ jsx12("label", { children: "Flex Wrap" }),
|
|
5260
|
+
/* @__PURE__ */ jsxs12(
|
|
4932
5261
|
"select",
|
|
4933
5262
|
{
|
|
4934
5263
|
value: currentFlexWrap,
|
|
4935
5264
|
onChange: (e) => setFlexWrap(e.target.value),
|
|
4936
5265
|
className: "cms-select",
|
|
4937
5266
|
children: [
|
|
4938
|
-
/* @__PURE__ */
|
|
4939
|
-
/* @__PURE__ */
|
|
4940
|
-
/* @__PURE__ */
|
|
5267
|
+
/* @__PURE__ */ jsx12("option", { value: "nowrap", children: "No Wrap" }),
|
|
5268
|
+
/* @__PURE__ */ jsx12("option", { value: "wrap", children: "Wrap" }),
|
|
5269
|
+
/* @__PURE__ */ jsx12("option", { value: "wrap-reverse", children: "Wrap Reverse" })
|
|
4941
5270
|
]
|
|
4942
5271
|
}
|
|
4943
5272
|
)
|
|
4944
5273
|
] }),
|
|
4945
|
-
/* @__PURE__ */
|
|
4946
|
-
/* @__PURE__ */
|
|
4947
|
-
/* @__PURE__ */
|
|
5274
|
+
/* @__PURE__ */ jsxs12("div", { className: "cms-section-editor-group", children: [
|
|
5275
|
+
/* @__PURE__ */ jsx12("label", { children: "Align Items" }),
|
|
5276
|
+
/* @__PURE__ */ jsxs12(
|
|
4948
5277
|
"select",
|
|
4949
5278
|
{
|
|
4950
5279
|
value: currentAlignItems,
|
|
4951
5280
|
onChange: (e) => setAlignItems(e.target.value),
|
|
4952
5281
|
className: "cms-select",
|
|
4953
5282
|
children: [
|
|
4954
|
-
/* @__PURE__ */
|
|
4955
|
-
/* @__PURE__ */
|
|
4956
|
-
/* @__PURE__ */
|
|
4957
|
-
/* @__PURE__ */
|
|
5283
|
+
/* @__PURE__ */ jsx12("option", { value: "flex-start", children: "Start" }),
|
|
5284
|
+
/* @__PURE__ */ jsx12("option", { value: "center", children: "Center" }),
|
|
5285
|
+
/* @__PURE__ */ jsx12("option", { value: "flex-end", children: "End" }),
|
|
5286
|
+
/* @__PURE__ */ jsx12("option", { value: "stretch", children: "Stretch" })
|
|
4958
5287
|
]
|
|
4959
5288
|
}
|
|
4960
5289
|
)
|
|
4961
5290
|
] }),
|
|
4962
|
-
/* @__PURE__ */
|
|
4963
|
-
/* @__PURE__ */
|
|
4964
|
-
/* @__PURE__ */
|
|
5291
|
+
/* @__PURE__ */ jsxs12("div", { className: "cms-section-editor-group", children: [
|
|
5292
|
+
/* @__PURE__ */ jsx12("label", { children: "Justify Content" }),
|
|
5293
|
+
/* @__PURE__ */ jsxs12(
|
|
4965
5294
|
"select",
|
|
4966
5295
|
{
|
|
4967
5296
|
value: currentJustifyContent,
|
|
4968
5297
|
onChange: (e) => setJustifyContent(e.target.value),
|
|
4969
5298
|
className: "cms-select",
|
|
4970
5299
|
children: [
|
|
4971
|
-
/* @__PURE__ */
|
|
4972
|
-
/* @__PURE__ */
|
|
4973
|
-
/* @__PURE__ */
|
|
4974
|
-
/* @__PURE__ */
|
|
4975
|
-
/* @__PURE__ */
|
|
4976
|
-
/* @__PURE__ */
|
|
5300
|
+
/* @__PURE__ */ jsx12("option", { value: "flex-start", children: "Start" }),
|
|
5301
|
+
/* @__PURE__ */ jsx12("option", { value: "center", children: "Center" }),
|
|
5302
|
+
/* @__PURE__ */ jsx12("option", { value: "flex-end", children: "End" }),
|
|
5303
|
+
/* @__PURE__ */ jsx12("option", { value: "space-between", children: "Space Between" }),
|
|
5304
|
+
/* @__PURE__ */ jsx12("option", { value: "space-around", children: "Space Around" }),
|
|
5305
|
+
/* @__PURE__ */ jsx12("option", { value: "space-evenly", children: "Space Evenly" })
|
|
4977
5306
|
]
|
|
4978
5307
|
}
|
|
4979
5308
|
)
|
|
4980
5309
|
] })
|
|
4981
5310
|
] }),
|
|
4982
|
-
currentLayout === "grid" && /* @__PURE__ */
|
|
4983
|
-
/* @__PURE__ */
|
|
4984
|
-
/* @__PURE__ */
|
|
4985
|
-
/* @__PURE__ */
|
|
5311
|
+
currentLayout === "grid" && /* @__PURE__ */ jsxs12(Fragment6, { children: [
|
|
5312
|
+
/* @__PURE__ */ jsxs12("div", { className: "cms-section-editor-group", children: [
|
|
5313
|
+
/* @__PURE__ */ jsx12("label", { children: "Grid Columns" }),
|
|
5314
|
+
/* @__PURE__ */ jsx12(
|
|
4986
5315
|
"input",
|
|
4987
5316
|
{
|
|
4988
5317
|
type: "text",
|
|
@@ -4992,16 +5321,16 @@ function SectionEditorPlugin() {
|
|
|
4992
5321
|
className: "cms-text-input"
|
|
4993
5322
|
}
|
|
4994
5323
|
),
|
|
4995
|
-
/* @__PURE__ */
|
|
4996
|
-
/* @__PURE__ */
|
|
4997
|
-
/* @__PURE__ */
|
|
4998
|
-
/* @__PURE__ */
|
|
4999
|
-
/* @__PURE__ */
|
|
5324
|
+
/* @__PURE__ */ jsxs12("div", { className: "cms-preset-buttons", children: [
|
|
5325
|
+
/* @__PURE__ */ jsx12("button", { onClick: () => setGridColumns("1fr"), type: "button", children: "1 Col" }),
|
|
5326
|
+
/* @__PURE__ */ jsx12("button", { onClick: () => setGridColumns("repeat(2, 1fr)"), type: "button", children: "2 Cols" }),
|
|
5327
|
+
/* @__PURE__ */ jsx12("button", { onClick: () => setGridColumns("repeat(3, 1fr)"), type: "button", children: "3 Cols" }),
|
|
5328
|
+
/* @__PURE__ */ jsx12("button", { onClick: () => setGridColumns("repeat(4, 1fr)"), type: "button", children: "4 Cols" })
|
|
5000
5329
|
] })
|
|
5001
5330
|
] }),
|
|
5002
|
-
/* @__PURE__ */
|
|
5003
|
-
/* @__PURE__ */
|
|
5004
|
-
/* @__PURE__ */
|
|
5331
|
+
/* @__PURE__ */ jsxs12("div", { className: "cms-section-editor-group", children: [
|
|
5332
|
+
/* @__PURE__ */ jsx12("label", { children: "Grid Rows" }),
|
|
5333
|
+
/* @__PURE__ */ jsx12(
|
|
5005
5334
|
"input",
|
|
5006
5335
|
{
|
|
5007
5336
|
type: "text",
|
|
@@ -5013,12 +5342,12 @@ function SectionEditorPlugin() {
|
|
|
5013
5342
|
)
|
|
5014
5343
|
] })
|
|
5015
5344
|
] }),
|
|
5016
|
-
(currentLayout === "flex" || currentLayout === "grid") && /* @__PURE__ */
|
|
5017
|
-
/* @__PURE__ */
|
|
5345
|
+
(currentLayout === "flex" || currentLayout === "grid") && /* @__PURE__ */ jsxs12("div", { className: "cms-section-editor-group", children: [
|
|
5346
|
+
/* @__PURE__ */ jsxs12("label", { children: [
|
|
5018
5347
|
"Gap: ",
|
|
5019
5348
|
currentGap
|
|
5020
5349
|
] }),
|
|
5021
|
-
/* @__PURE__ */
|
|
5350
|
+
/* @__PURE__ */ jsx12(
|
|
5022
5351
|
"input",
|
|
5023
5352
|
{
|
|
5024
5353
|
type: "range",
|
|
@@ -5029,17 +5358,17 @@ function SectionEditorPlugin() {
|
|
|
5029
5358
|
className: "cms-range-input"
|
|
5030
5359
|
}
|
|
5031
5360
|
),
|
|
5032
|
-
/* @__PURE__ */
|
|
5033
|
-
/* @__PURE__ */
|
|
5034
|
-
/* @__PURE__ */
|
|
5035
|
-
/* @__PURE__ */
|
|
5036
|
-
/* @__PURE__ */
|
|
5037
|
-
/* @__PURE__ */
|
|
5361
|
+
/* @__PURE__ */ jsxs12("div", { className: "cms-preset-buttons", children: [
|
|
5362
|
+
/* @__PURE__ */ jsx12("button", { onClick: () => setGap("0px"), type: "button", children: "0" }),
|
|
5363
|
+
/* @__PURE__ */ jsx12("button", { onClick: () => setGap("8px"), type: "button", children: "8" }),
|
|
5364
|
+
/* @__PURE__ */ jsx12("button", { onClick: () => setGap("16px"), type: "button", children: "16" }),
|
|
5365
|
+
/* @__PURE__ */ jsx12("button", { onClick: () => setGap("24px"), type: "button", children: "24" }),
|
|
5366
|
+
/* @__PURE__ */ jsx12("button", { onClick: () => setGap("32px"), type: "button", children: "32" })
|
|
5038
5367
|
] })
|
|
5039
5368
|
] }),
|
|
5040
|
-
/* @__PURE__ */
|
|
5041
|
-
/* @__PURE__ */
|
|
5042
|
-
/* @__PURE__ */
|
|
5369
|
+
/* @__PURE__ */ jsxs12("div", { className: "cms-section-editor-group", children: [
|
|
5370
|
+
/* @__PURE__ */ jsx12("label", { children: "Padding" }),
|
|
5371
|
+
/* @__PURE__ */ jsx12(
|
|
5043
5372
|
"input",
|
|
5044
5373
|
{
|
|
5045
5374
|
type: "text",
|
|
@@ -5049,17 +5378,17 @@ function SectionEditorPlugin() {
|
|
|
5049
5378
|
className: "cms-text-input"
|
|
5050
5379
|
}
|
|
5051
5380
|
),
|
|
5052
|
-
/* @__PURE__ */
|
|
5053
|
-
/* @__PURE__ */
|
|
5054
|
-
/* @__PURE__ */
|
|
5055
|
-
/* @__PURE__ */
|
|
5056
|
-
/* @__PURE__ */
|
|
5057
|
-
/* @__PURE__ */
|
|
5381
|
+
/* @__PURE__ */ jsxs12("div", { className: "cms-preset-buttons", children: [
|
|
5382
|
+
/* @__PURE__ */ jsx12("button", { onClick: () => setPadding("0px"), type: "button", children: "0" }),
|
|
5383
|
+
/* @__PURE__ */ jsx12("button", { onClick: () => setPadding("20px"), type: "button", children: "20" }),
|
|
5384
|
+
/* @__PURE__ */ jsx12("button", { onClick: () => setPadding("40px"), type: "button", children: "40" }),
|
|
5385
|
+
/* @__PURE__ */ jsx12("button", { onClick: () => setPadding("60px"), type: "button", children: "60" }),
|
|
5386
|
+
/* @__PURE__ */ jsx12("button", { onClick: () => setPadding("80px"), type: "button", children: "80" })
|
|
5058
5387
|
] })
|
|
5059
5388
|
] }),
|
|
5060
|
-
/* @__PURE__ */
|
|
5061
|
-
/* @__PURE__ */
|
|
5062
|
-
/* @__PURE__ */
|
|
5389
|
+
/* @__PURE__ */ jsxs12("div", { className: "cms-section-editor-group", children: [
|
|
5390
|
+
/* @__PURE__ */ jsx12("label", { children: "Margin" }),
|
|
5391
|
+
/* @__PURE__ */ jsx12(
|
|
5063
5392
|
"input",
|
|
5064
5393
|
{
|
|
5065
5394
|
type: "text",
|
|
@@ -5069,11 +5398,11 @@ function SectionEditorPlugin() {
|
|
|
5069
5398
|
className: "cms-text-input"
|
|
5070
5399
|
}
|
|
5071
5400
|
),
|
|
5072
|
-
/* @__PURE__ */
|
|
5073
|
-
/* @__PURE__ */
|
|
5074
|
-
/* @__PURE__ */
|
|
5075
|
-
/* @__PURE__ */
|
|
5076
|
-
/* @__PURE__ */
|
|
5401
|
+
/* @__PURE__ */ jsxs12("div", { className: "cms-preset-buttons", children: [
|
|
5402
|
+
/* @__PURE__ */ jsx12("button", { onClick: () => setMargin("0px"), type: "button", children: "0" }),
|
|
5403
|
+
/* @__PURE__ */ jsx12("button", { onClick: () => setMargin("20px 0"), type: "button", children: "20 V" }),
|
|
5404
|
+
/* @__PURE__ */ jsx12("button", { onClick: () => setMargin("40px 0"), type: "button", children: "40 V" }),
|
|
5405
|
+
/* @__PURE__ */ jsx12("button", { onClick: () => setMargin("0 auto"), type: "button", children: "Center" })
|
|
5077
5406
|
] })
|
|
5078
5407
|
] })
|
|
5079
5408
|
] })
|
|
@@ -5084,14 +5413,14 @@ function SectionEditorPlugin() {
|
|
|
5084
5413
|
}
|
|
5085
5414
|
|
|
5086
5415
|
// src/plugins/EmbedPlugin.tsx
|
|
5087
|
-
import { useLexicalComposerContext as
|
|
5088
|
-
import { useState as
|
|
5416
|
+
import { useLexicalComposerContext as useLexicalComposerContext12 } from "@lexical/react/LexicalComposerContext";
|
|
5417
|
+
import { useState as useState14, useCallback as useCallback12, useRef as useRef10, useEffect as useEffect14 } from "react";
|
|
5089
5418
|
import { $getSelection as $getSelection10, $isRangeSelection as $isRangeSelection10, $createParagraphNode as $createParagraphNode6 } from "lexical";
|
|
5090
5419
|
|
|
5091
5420
|
// src/blocks/EmbedNode.tsx
|
|
5092
5421
|
import { DecoratorNode as DecoratorNode3 } from "lexical";
|
|
5093
|
-
import { useCallback as useCallback11, useEffect as
|
|
5094
|
-
import { Fragment as Fragment7, jsx as
|
|
5422
|
+
import { useCallback as useCallback11, useEffect as useEffect13, useRef as useRef9, useState as useState13 } from "react";
|
|
5423
|
+
import { Fragment as Fragment7, jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
5095
5424
|
function detectEmbedType(url) {
|
|
5096
5425
|
if (url.includes("youtube.com") || url.includes("youtu.be")) return "youtube";
|
|
5097
5426
|
if (url.includes("facebook.com") || url.includes("fb.watch")) return "facebook";
|
|
@@ -5152,23 +5481,23 @@ function EmbedComponent({
|
|
|
5152
5481
|
editor
|
|
5153
5482
|
}) {
|
|
5154
5483
|
const wrapperRef = useRef9(null);
|
|
5155
|
-
const [isResizing, setIsResizing] =
|
|
5156
|
-
const [isSelected, setIsSelected] =
|
|
5157
|
-
const [embedHtml, setEmbedHtml] =
|
|
5484
|
+
const [isResizing, setIsResizing] = useState13(false);
|
|
5485
|
+
const [isSelected, setIsSelected] = useState13(false);
|
|
5486
|
+
const [embedHtml, setEmbedHtml] = useState13("");
|
|
5158
5487
|
const width = initialWidth || (type === "spotify" ? 300 : 560);
|
|
5159
5488
|
const height = initialHeight || (type === "spotify" ? 380 : 315);
|
|
5160
|
-
const [size, setSize] =
|
|
5489
|
+
const [size, setSize] = useState13({
|
|
5161
5490
|
width,
|
|
5162
5491
|
height
|
|
5163
5492
|
});
|
|
5164
|
-
|
|
5493
|
+
useEffect13(() => {
|
|
5165
5494
|
setSize({
|
|
5166
5495
|
width: initialWidth || (type === "spotify" ? 300 : 560),
|
|
5167
5496
|
height: initialHeight || (type === "spotify" ? 380 : 315)
|
|
5168
5497
|
});
|
|
5169
5498
|
}, [initialWidth, initialHeight, type]);
|
|
5170
5499
|
const embedUrl = getEmbedUrl(url, type);
|
|
5171
|
-
|
|
5500
|
+
useEffect13(() => {
|
|
5172
5501
|
if (type === "instagram" || type === "twitter" || type === "tiktok") {
|
|
5173
5502
|
loadOEmbed(url, type);
|
|
5174
5503
|
}
|
|
@@ -5249,7 +5578,7 @@ function EmbedComponent({
|
|
|
5249
5578
|
}, [size, editor, nodeKey]);
|
|
5250
5579
|
const renderEmbed = () => {
|
|
5251
5580
|
if (embedHtml && (type === "instagram" || type === "twitter" || type === "tiktok")) {
|
|
5252
|
-
return /* @__PURE__ */
|
|
5581
|
+
return /* @__PURE__ */ jsx13(
|
|
5253
5582
|
"div",
|
|
5254
5583
|
{
|
|
5255
5584
|
dangerouslySetInnerHTML: { __html: embedHtml },
|
|
@@ -5258,7 +5587,7 @@ function EmbedComponent({
|
|
|
5258
5587
|
);
|
|
5259
5588
|
}
|
|
5260
5589
|
if (type === "youtube" || type === "vimeo" || type === "facebook" || type === "spotify" || type === "soundcloud") {
|
|
5261
|
-
return /* @__PURE__ */
|
|
5590
|
+
return /* @__PURE__ */ jsx13(
|
|
5262
5591
|
"iframe",
|
|
5263
5592
|
{
|
|
5264
5593
|
src: embedUrl,
|
|
@@ -5274,14 +5603,14 @@ function EmbedComponent({
|
|
|
5274
5603
|
}
|
|
5275
5604
|
);
|
|
5276
5605
|
}
|
|
5277
|
-
return /* @__PURE__ */
|
|
5606
|
+
return /* @__PURE__ */ jsxs13("div", { style: {
|
|
5278
5607
|
padding: "20px",
|
|
5279
5608
|
background: "#f8f9fa",
|
|
5280
5609
|
borderRadius: "8px",
|
|
5281
5610
|
textAlign: "center"
|
|
5282
5611
|
}, children: [
|
|
5283
|
-
/* @__PURE__ */
|
|
5284
|
-
/* @__PURE__ */
|
|
5612
|
+
/* @__PURE__ */ jsx13("p", { style: { margin: "0 0 10px 0", color: "#6c757d" }, children: "Embedded Content" }),
|
|
5613
|
+
/* @__PURE__ */ jsx13(
|
|
5285
5614
|
"a",
|
|
5286
5615
|
{
|
|
5287
5616
|
href: url,
|
|
@@ -5293,7 +5622,7 @@ function EmbedComponent({
|
|
|
5293
5622
|
)
|
|
5294
5623
|
] });
|
|
5295
5624
|
};
|
|
5296
|
-
return /* @__PURE__ */
|
|
5625
|
+
return /* @__PURE__ */ jsxs13(
|
|
5297
5626
|
"div",
|
|
5298
5627
|
{
|
|
5299
5628
|
ref: wrapperRef,
|
|
@@ -5313,8 +5642,8 @@ function EmbedComponent({
|
|
|
5313
5642
|
},
|
|
5314
5643
|
children: [
|
|
5315
5644
|
renderEmbed(),
|
|
5316
|
-
isSelected && (type === "youtube" || type === "vimeo" || type === "facebook" || type === "spotify" || type === "soundcloud") && /* @__PURE__ */
|
|
5317
|
-
/* @__PURE__ */
|
|
5645
|
+
isSelected && (type === "youtube" || type === "vimeo" || type === "facebook" || type === "spotify" || type === "soundcloud") && /* @__PURE__ */ jsxs13(Fragment7, { children: [
|
|
5646
|
+
/* @__PURE__ */ jsx13(
|
|
5318
5647
|
"div",
|
|
5319
5648
|
{
|
|
5320
5649
|
className: "embed-resize-handle embed-resize-handle-se",
|
|
@@ -5334,7 +5663,7 @@ function EmbedComponent({
|
|
|
5334
5663
|
}
|
|
5335
5664
|
}
|
|
5336
5665
|
),
|
|
5337
|
-
/* @__PURE__ */
|
|
5666
|
+
/* @__PURE__ */ jsx13(
|
|
5338
5667
|
"div",
|
|
5339
5668
|
{
|
|
5340
5669
|
className: "embed-resize-handle embed-resize-handle-ne",
|
|
@@ -5386,7 +5715,7 @@ var EmbedNode = class _EmbedNode extends DecoratorNode3 {
|
|
|
5386
5715
|
return false;
|
|
5387
5716
|
}
|
|
5388
5717
|
decorate(editor) {
|
|
5389
|
-
return /* @__PURE__ */
|
|
5718
|
+
return /* @__PURE__ */ jsx13(
|
|
5390
5719
|
EmbedComponent,
|
|
5391
5720
|
{
|
|
5392
5721
|
url: this.__url,
|
|
@@ -5423,13 +5752,13 @@ function $createEmbedNode(url, type, width, height) {
|
|
|
5423
5752
|
|
|
5424
5753
|
// src/plugins/EmbedPlugin.tsx
|
|
5425
5754
|
import { MdVideoLibrary } from "react-icons/md";
|
|
5426
|
-
import { Fragment as Fragment8, jsx as
|
|
5755
|
+
import { Fragment as Fragment8, jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
5427
5756
|
function EmbedPlugin() {
|
|
5428
|
-
const [editor] =
|
|
5429
|
-
const [showModal, setShowModal] =
|
|
5430
|
-
const [embedUrl, setEmbedUrl] =
|
|
5757
|
+
const [editor] = useLexicalComposerContext12();
|
|
5758
|
+
const [showModal, setShowModal] = useState14(false);
|
|
5759
|
+
const [embedUrl, setEmbedUrl] = useState14("");
|
|
5431
5760
|
const modalRef = useRef10(null);
|
|
5432
|
-
|
|
5761
|
+
useEffect14(() => {
|
|
5433
5762
|
const handleClickOutside = (event) => {
|
|
5434
5763
|
if (modalRef.current && !modalRef.current.contains(event.target)) {
|
|
5435
5764
|
setShowModal(false);
|
|
@@ -5465,38 +5794,38 @@ function EmbedPlugin() {
|
|
|
5465
5794
|
setShowModal(false);
|
|
5466
5795
|
}
|
|
5467
5796
|
}, [insertEmbed]);
|
|
5468
|
-
return /* @__PURE__ */
|
|
5469
|
-
/* @__PURE__ */
|
|
5797
|
+
return /* @__PURE__ */ jsxs14("div", { className: "cms-embed-plugin", ref: modalRef, children: [
|
|
5798
|
+
/* @__PURE__ */ jsx14(
|
|
5470
5799
|
"button",
|
|
5471
5800
|
{
|
|
5472
5801
|
className: "cms-toolbar-button",
|
|
5473
5802
|
onClick: openModal,
|
|
5474
5803
|
title: "Insert Embed (YouTube, Facebook, Instagram, etc.)",
|
|
5475
5804
|
type: "button",
|
|
5476
|
-
children: /* @__PURE__ */
|
|
5805
|
+
children: /* @__PURE__ */ jsx14(MdVideoLibrary, { size: 18 })
|
|
5477
5806
|
}
|
|
5478
5807
|
),
|
|
5479
|
-
showModal && /* @__PURE__ */
|
|
5480
|
-
/* @__PURE__ */
|
|
5481
|
-
/* @__PURE__ */
|
|
5482
|
-
/* @__PURE__ */
|
|
5483
|
-
/* @__PURE__ */
|
|
5484
|
-
/* @__PURE__ */
|
|
5485
|
-
/* @__PURE__ */
|
|
5486
|
-
/* @__PURE__ */
|
|
5487
|
-
/* @__PURE__ */
|
|
5488
|
-
/* @__PURE__ */
|
|
5489
|
-
/* @__PURE__ */
|
|
5490
|
-
/* @__PURE__ */
|
|
5491
|
-
/* @__PURE__ */
|
|
5492
|
-
/* @__PURE__ */
|
|
5493
|
-
/* @__PURE__ */
|
|
5494
|
-
/* @__PURE__ */
|
|
5808
|
+
showModal && /* @__PURE__ */ jsxs14(Fragment8, { children: [
|
|
5809
|
+
/* @__PURE__ */ jsx14("div", { className: "cms-modal-backdrop", onClick: () => setShowModal(false) }),
|
|
5810
|
+
/* @__PURE__ */ jsxs14("div", { className: "cms-embed-modal", children: [
|
|
5811
|
+
/* @__PURE__ */ jsx14("div", { className: "cms-embed-modal-header", children: /* @__PURE__ */ jsx14("span", { children: "Insert Embed" }) }),
|
|
5812
|
+
/* @__PURE__ */ jsxs14("div", { className: "cms-embed-modal-content", children: [
|
|
5813
|
+
/* @__PURE__ */ jsxs14("div", { className: "cms-embed-info", children: [
|
|
5814
|
+
/* @__PURE__ */ jsx14("p", { children: "Paste a link from:" }),
|
|
5815
|
+
/* @__PURE__ */ jsxs14("div", { className: "cms-embed-platforms", children: [
|
|
5816
|
+
/* @__PURE__ */ jsx14("span", { className: "cms-embed-platform", children: "YouTube" }),
|
|
5817
|
+
/* @__PURE__ */ jsx14("span", { className: "cms-embed-platform", children: "Facebook" }),
|
|
5818
|
+
/* @__PURE__ */ jsx14("span", { className: "cms-embed-platform", children: "Instagram" }),
|
|
5819
|
+
/* @__PURE__ */ jsx14("span", { className: "cms-embed-platform", children: "Twitter/X" }),
|
|
5820
|
+
/* @__PURE__ */ jsx14("span", { className: "cms-embed-platform", children: "TikTok" }),
|
|
5821
|
+
/* @__PURE__ */ jsx14("span", { className: "cms-embed-platform", children: "Vimeo" }),
|
|
5822
|
+
/* @__PURE__ */ jsx14("span", { className: "cms-embed-platform", children: "Spotify" }),
|
|
5823
|
+
/* @__PURE__ */ jsx14("span", { className: "cms-embed-platform", children: "SoundCloud" })
|
|
5495
5824
|
] })
|
|
5496
5825
|
] }),
|
|
5497
|
-
/* @__PURE__ */
|
|
5498
|
-
/* @__PURE__ */
|
|
5499
|
-
/* @__PURE__ */
|
|
5826
|
+
/* @__PURE__ */ jsxs14("div", { className: "cms-form-group", children: [
|
|
5827
|
+
/* @__PURE__ */ jsx14("label", { htmlFor: "embed-url", children: "URL" }),
|
|
5828
|
+
/* @__PURE__ */ jsx14(
|
|
5500
5829
|
"input",
|
|
5501
5830
|
{
|
|
5502
5831
|
id: "embed-url",
|
|
@@ -5510,20 +5839,20 @@ function EmbedPlugin() {
|
|
|
5510
5839
|
}
|
|
5511
5840
|
)
|
|
5512
5841
|
] }),
|
|
5513
|
-
/* @__PURE__ */
|
|
5514
|
-
/* @__PURE__ */
|
|
5515
|
-
/* @__PURE__ */
|
|
5516
|
-
/* @__PURE__ */
|
|
5517
|
-
/* @__PURE__ */
|
|
5518
|
-
/* @__PURE__ */
|
|
5519
|
-
/* @__PURE__ */
|
|
5520
|
-
/* @__PURE__ */
|
|
5521
|
-
/* @__PURE__ */
|
|
5522
|
-
/* @__PURE__ */
|
|
5842
|
+
/* @__PURE__ */ jsxs14("div", { className: "cms-embed-examples", children: [
|
|
5843
|
+
/* @__PURE__ */ jsx14("p", { className: "cms-embed-examples-title", children: "Example URLs:" }),
|
|
5844
|
+
/* @__PURE__ */ jsxs14("ul", { className: "cms-embed-examples-list", children: [
|
|
5845
|
+
/* @__PURE__ */ jsx14("li", { children: "https://www.youtube.com/watch?v=dQw4w9WgXcQ" }),
|
|
5846
|
+
/* @__PURE__ */ jsx14("li", { children: "https://www.facebook.com/username/posts/123456" }),
|
|
5847
|
+
/* @__PURE__ */ jsx14("li", { children: "https://www.instagram.com/p/ABC123/" }),
|
|
5848
|
+
/* @__PURE__ */ jsx14("li", { children: "https://twitter.com/username/status/123456" }),
|
|
5849
|
+
/* @__PURE__ */ jsx14("li", { children: "https://www.tiktok.com/@username/video/123456" }),
|
|
5850
|
+
/* @__PURE__ */ jsx14("li", { children: "https://vimeo.com/123456789" }),
|
|
5851
|
+
/* @__PURE__ */ jsx14("li", { children: "https://open.spotify.com/track/123456" })
|
|
5523
5852
|
] })
|
|
5524
5853
|
] }),
|
|
5525
|
-
/* @__PURE__ */
|
|
5526
|
-
/* @__PURE__ */
|
|
5854
|
+
/* @__PURE__ */ jsxs14("div", { className: "cms-modal-actions", children: [
|
|
5855
|
+
/* @__PURE__ */ jsx14(
|
|
5527
5856
|
"button",
|
|
5528
5857
|
{
|
|
5529
5858
|
onClick: () => setShowModal(false),
|
|
@@ -5532,7 +5861,7 @@ function EmbedPlugin() {
|
|
|
5532
5861
|
children: "Cancel"
|
|
5533
5862
|
}
|
|
5534
5863
|
),
|
|
5535
|
-
/* @__PURE__ */
|
|
5864
|
+
/* @__PURE__ */ jsx14(
|
|
5536
5865
|
"button",
|
|
5537
5866
|
{
|
|
5538
5867
|
onClick: insertEmbed,
|
|
@@ -5550,33 +5879,34 @@ function EmbedPlugin() {
|
|
|
5550
5879
|
}
|
|
5551
5880
|
|
|
5552
5881
|
// src/core/EditorShell.tsx
|
|
5553
|
-
import { jsx as
|
|
5882
|
+
import { jsx as jsx15, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
5554
5883
|
function EditorShell({
|
|
5555
5884
|
onChange,
|
|
5556
5885
|
onImageAdded,
|
|
5557
5886
|
useBase64Url
|
|
5558
5887
|
}) {
|
|
5559
|
-
return /* @__PURE__ */
|
|
5560
|
-
/* @__PURE__ */
|
|
5561
|
-
/* @__PURE__ */
|
|
5888
|
+
return /* @__PURE__ */ jsxs15("div", { className: "cms-editor-shell", children: [
|
|
5889
|
+
/* @__PURE__ */ jsx15(ToolbarPlugin, {}),
|
|
5890
|
+
/* @__PURE__ */ jsx15(
|
|
5562
5891
|
RichTextPlugin,
|
|
5563
5892
|
{
|
|
5564
|
-
contentEditable: /* @__PURE__ */
|
|
5565
|
-
placeholder: /* @__PURE__ */
|
|
5893
|
+
contentEditable: /* @__PURE__ */ jsx15(ContentEditable, { className: "cms-editor-content" }),
|
|
5894
|
+
placeholder: /* @__PURE__ */ jsx15("div", { className: "cms-editor-placeholder", children: "Start typing or press / for commands..." }),
|
|
5566
5895
|
ErrorBoundary: LexicalErrorBoundary
|
|
5567
5896
|
}
|
|
5568
5897
|
),
|
|
5569
|
-
/* @__PURE__ */
|
|
5570
|
-
/* @__PURE__ */
|
|
5571
|
-
/* @__PURE__ */
|
|
5572
|
-
/* @__PURE__ */
|
|
5573
|
-
/* @__PURE__ */
|
|
5574
|
-
/* @__PURE__ */
|
|
5575
|
-
/* @__PURE__ */
|
|
5576
|
-
/* @__PURE__ */
|
|
5577
|
-
/* @__PURE__ */
|
|
5578
|
-
/* @__PURE__ */
|
|
5579
|
-
|
|
5898
|
+
/* @__PURE__ */ jsx15(HistoryPlugin, {}),
|
|
5899
|
+
/* @__PURE__ */ jsx15(ListPlugin, {}),
|
|
5900
|
+
/* @__PURE__ */ jsx15(LexicalLinkPlugin, {}),
|
|
5901
|
+
/* @__PURE__ */ jsx15(LexicalTablePlugin, {}),
|
|
5902
|
+
/* @__PURE__ */ jsx15(SlashCommandPlugin, {}),
|
|
5903
|
+
/* @__PURE__ */ jsx15(ImageUploadPlugin, { onImageAdded, useBase64Url }),
|
|
5904
|
+
/* @__PURE__ */ jsx15(ImageEditorPlugin, {}),
|
|
5905
|
+
/* @__PURE__ */ jsx15(LinkPlugin, {}),
|
|
5906
|
+
/* @__PURE__ */ jsx15(SectionEditorPlugin, {}),
|
|
5907
|
+
/* @__PURE__ */ jsx15(EmbedPlugin, {}),
|
|
5908
|
+
/* @__PURE__ */ jsx15(TablePlugin, {}),
|
|
5909
|
+
onChange && /* @__PURE__ */ jsx15(
|
|
5580
5910
|
OnChangePlugin,
|
|
5581
5911
|
{
|
|
5582
5912
|
onChange: (editorState) => {
|
|
@@ -5635,14 +5965,14 @@ function createEditorConfig(value) {
|
|
|
5635
5965
|
}
|
|
5636
5966
|
|
|
5637
5967
|
// src/core/CMSBlockEditor.tsx
|
|
5638
|
-
import { jsx as
|
|
5968
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
5639
5969
|
function CMSBlockEditor({
|
|
5640
5970
|
value,
|
|
5641
5971
|
onChange,
|
|
5642
5972
|
onImageAdded,
|
|
5643
5973
|
useBase64Url = true
|
|
5644
5974
|
}) {
|
|
5645
|
-
return /* @__PURE__ */
|
|
5975
|
+
return /* @__PURE__ */ jsx16(LexicalComposer, { initialConfig: createEditorConfig(value), children: /* @__PURE__ */ jsx16(
|
|
5646
5976
|
EditorShell,
|
|
5647
5977
|
{
|
|
5648
5978
|
onChange,
|
|
@@ -5657,12 +5987,12 @@ import { LexicalComposer as LexicalComposer2 } from "@lexical/react/LexicalCompo
|
|
|
5657
5987
|
import { RichTextPlugin as RichTextPlugin2 } from "@lexical/react/LexicalRichTextPlugin";
|
|
5658
5988
|
import { ContentEditable as ContentEditable2 } from "@lexical/react/LexicalContentEditable";
|
|
5659
5989
|
import LexicalErrorBoundary2 from "@lexical/react/LexicalErrorBoundary";
|
|
5660
|
-
import { useEffect as
|
|
5661
|
-
import { useLexicalComposerContext as
|
|
5662
|
-
import { jsx as
|
|
5990
|
+
import { useEffect as useEffect15 } from "react";
|
|
5991
|
+
import { useLexicalComposerContext as useLexicalComposerContext13 } from "@lexical/react/LexicalComposerContext";
|
|
5992
|
+
import { jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
5663
5993
|
function ReadOnlyPlugin() {
|
|
5664
|
-
const [editor] =
|
|
5665
|
-
|
|
5994
|
+
const [editor] = useLexicalComposerContext13();
|
|
5995
|
+
useEffect15(() => {
|
|
5666
5996
|
editor.setEditable(false);
|
|
5667
5997
|
}, [editor]);
|
|
5668
5998
|
return null;
|
|
@@ -5672,21 +6002,22 @@ function CMSRenderer({ content, className = "" }) {
|
|
|
5672
6002
|
...createEditorConfig(content),
|
|
5673
6003
|
editable: false
|
|
5674
6004
|
};
|
|
5675
|
-
return /* @__PURE__ */
|
|
5676
|
-
/* @__PURE__ */
|
|
6005
|
+
return /* @__PURE__ */ jsx17(LexicalComposer2, { initialConfig: config, children: /* @__PURE__ */ jsxs16("div", { className: `cms-renderer ${className}`, children: [
|
|
6006
|
+
/* @__PURE__ */ jsx17(
|
|
5677
6007
|
RichTextPlugin2,
|
|
5678
6008
|
{
|
|
5679
|
-
contentEditable: /* @__PURE__ */
|
|
6009
|
+
contentEditable: /* @__PURE__ */ jsx17(ContentEditable2, { className: "cms-renderer-content" }),
|
|
5680
6010
|
placeholder: null,
|
|
5681
6011
|
ErrorBoundary: LexicalErrorBoundary2
|
|
5682
6012
|
}
|
|
5683
6013
|
),
|
|
5684
|
-
/* @__PURE__ */
|
|
6014
|
+
/* @__PURE__ */ jsx17(ReadOnlyPlugin, {})
|
|
5685
6015
|
] }) });
|
|
5686
6016
|
}
|
|
5687
6017
|
export {
|
|
5688
6018
|
CMSBlockEditor,
|
|
5689
6019
|
CMSRenderer,
|
|
6020
|
+
OPEN_IMAGE_EDITOR_COMMAND,
|
|
5690
6021
|
appendHTML,
|
|
5691
6022
|
copyMarkdownToClipboard,
|
|
5692
6023
|
downloadHTML,
|