@windoc/react 0.2.4 → 0.2.6
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 +1 -2
- package/dist/index.js +339 -377
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +280 -318
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/styles/editor.css +0 -24
package/dist/index.js
CHANGED
|
@@ -77,7 +77,7 @@ __export(index_exports, {
|
|
|
77
77
|
module.exports = __toCommonJS(index_exports);
|
|
78
78
|
|
|
79
79
|
// src/Editor.tsx
|
|
80
|
-
var
|
|
80
|
+
var import_react21 = require("react");
|
|
81
81
|
|
|
82
82
|
// src/EditorContext.tsx
|
|
83
83
|
var import_react = require("react");
|
|
@@ -178,60 +178,13 @@ function RedoTool() {
|
|
|
178
178
|
}
|
|
179
179
|
|
|
180
180
|
// src/toolbar/ColumnTool.tsx
|
|
181
|
-
var import_react4 = require("react");
|
|
182
|
-
|
|
183
|
-
// src/utils/useDropdown.ts
|
|
184
181
|
var import_react3 = require("react");
|
|
185
|
-
function useDropdown() {
|
|
186
|
-
const [isOpen, setIsOpen] = (0, import_react3.useState)(false);
|
|
187
|
-
const [position, setPosition] = (0, import_react3.useState)({ top: 0, left: 0 });
|
|
188
|
-
const triggerRef = (0, import_react3.useRef)(null);
|
|
189
|
-
const open = () => {
|
|
190
|
-
if (triggerRef.current) {
|
|
191
|
-
const rect = triggerRef.current.getBoundingClientRect();
|
|
192
|
-
setPosition({ top: rect.bottom + 2, left: rect.left });
|
|
193
|
-
}
|
|
194
|
-
setIsOpen(true);
|
|
195
|
-
};
|
|
196
|
-
const close = () => setIsOpen(false);
|
|
197
|
-
const toggle = () => isOpen ? close() : open();
|
|
198
|
-
const portalStyle = {
|
|
199
|
-
position: "fixed",
|
|
200
|
-
top: position.top,
|
|
201
|
-
left: position.left,
|
|
202
|
-
zIndex: 9999
|
|
203
|
-
};
|
|
204
|
-
(0, import_react3.useEffect)(() => {
|
|
205
|
-
if (!isOpen) return;
|
|
206
|
-
const handler = (e) => {
|
|
207
|
-
if (triggerRef.current && !triggerRef.current.contains(e.target)) {
|
|
208
|
-
close();
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
document.addEventListener("mousedown", handler);
|
|
212
|
-
return () => document.removeEventListener("mousedown", handler);
|
|
213
|
-
}, [isOpen]);
|
|
214
|
-
return { triggerRef, isOpen, toggle, open, close, portalStyle };
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
// src/utils/DropdownPortal.tsx
|
|
218
|
-
var import_react_dom = require("react-dom");
|
|
219
182
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
220
|
-
function DropdownPortal({ isOpen, style, className, wrapperClassName, children }) {
|
|
221
|
-
if (!isOpen) return null;
|
|
222
|
-
return (0, import_react_dom.createPortal)(
|
|
223
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: `menu-item menu-item-portal${wrapperClassName ? ` ${wrapperClassName}` : ""}`, style, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className, children }) }),
|
|
224
|
-
document.body
|
|
225
|
-
);
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
// src/toolbar/ColumnTool.tsx
|
|
229
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
230
183
|
function ColumnTool() {
|
|
231
184
|
const { editorRef } = useEditor();
|
|
232
|
-
const
|
|
233
|
-
const [currentColumns, setCurrentColumns] = (0,
|
|
234
|
-
const [gap, setGap] = (0,
|
|
185
|
+
const [isOpen, setIsOpen] = (0, import_react3.useState)(false);
|
|
186
|
+
const [currentColumns, setCurrentColumns] = (0, import_react3.useState)(1);
|
|
187
|
+
const [gap, setGap] = (0, import_react3.useState)(20);
|
|
235
188
|
const handleColumn = (col) => {
|
|
236
189
|
editorRef.current?.command.executeColumnCount(col);
|
|
237
190
|
setCurrentColumns(col);
|
|
@@ -241,18 +194,18 @@ function ColumnTool() {
|
|
|
241
194
|
setGap(clampedValue);
|
|
242
195
|
editorRef.current?.command.executeColumnGap(clampedValue);
|
|
243
196
|
};
|
|
244
|
-
return /* @__PURE__ */ (0,
|
|
245
|
-
/* @__PURE__ */ (0,
|
|
246
|
-
/* @__PURE__ */ (0,
|
|
247
|
-
/* @__PURE__ */ (0,
|
|
248
|
-
/* @__PURE__ */ (0,
|
|
249
|
-
/* @__PURE__ */ (0,
|
|
197
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "menu-item__column", onClick: () => setIsOpen(!isOpen), children: [
|
|
198
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "select", title: "Column Layout", children: currentColumns === 1 ? "1 Column" : `${currentColumns} Columns` }),
|
|
199
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "options" + (isOpen ? " visible" : ""), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { onClick: (e) => e.stopPropagation(), children: [
|
|
200
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("ul", { children: [
|
|
201
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("li", { onClick: () => handleColumn(1), children: "1 Column" }),
|
|
202
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("li", { onClick: () => handleColumn(2), children: "2 Columns" })
|
|
250
203
|
] }),
|
|
251
|
-
currentColumns > 1 && /* @__PURE__ */ (0,
|
|
252
|
-
/* @__PURE__ */ (0,
|
|
253
|
-
/* @__PURE__ */ (0,
|
|
254
|
-
/* @__PURE__ */ (0,
|
|
255
|
-
/* @__PURE__ */ (0,
|
|
204
|
+
currentColumns > 1 && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
205
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "option-divider" }),
|
|
206
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "option-row", children: [
|
|
207
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("label", { children: "Gap (px)" }),
|
|
208
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
256
209
|
"input",
|
|
257
210
|
{
|
|
258
211
|
type: "number",
|
|
@@ -270,16 +223,16 @@ function ColumnTool() {
|
|
|
270
223
|
}
|
|
271
224
|
|
|
272
225
|
// src/toolbar/TableTool.tsx
|
|
273
|
-
var
|
|
226
|
+
var import_react4 = require("react");
|
|
274
227
|
var import_lucide_react3 = require("lucide-react");
|
|
275
|
-
var
|
|
228
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
276
229
|
function TableTool() {
|
|
277
230
|
const { editorRef } = useEditor();
|
|
278
|
-
const [visible, setVisible] = (0,
|
|
279
|
-
const [hoverRow, setHoverRow] = (0,
|
|
280
|
-
const [hoverCol, setHoverCol] = (0,
|
|
281
|
-
const containerRef = (0,
|
|
282
|
-
(0,
|
|
231
|
+
const [visible, setVisible] = (0, import_react4.useState)(false);
|
|
232
|
+
const [hoverRow, setHoverRow] = (0, import_react4.useState)(0);
|
|
233
|
+
const [hoverCol, setHoverCol] = (0, import_react4.useState)(0);
|
|
234
|
+
const containerRef = (0, import_react4.useRef)(null);
|
|
235
|
+
(0, import_react4.useEffect)(() => {
|
|
283
236
|
if (!visible) return;
|
|
284
237
|
const handleClickOutside = (e) => {
|
|
285
238
|
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
@@ -299,11 +252,11 @@ function TableTool() {
|
|
|
299
252
|
setHoverRow(0);
|
|
300
253
|
setHoverCol(0);
|
|
301
254
|
};
|
|
302
|
-
return /* @__PURE__ */ (0,
|
|
303
|
-
/* @__PURE__ */ (0,
|
|
304
|
-
visible && /* @__PURE__ */ (0,
|
|
305
|
-
/* @__PURE__ */ (0,
|
|
306
|
-
/* @__PURE__ */ (0,
|
|
255
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { ref: containerRef, className: "menu-item__table", title: "Table", children: [
|
|
256
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react3.Table, { size: 16, onClick: () => setVisible(!visible), style: { cursor: "pointer" } }),
|
|
257
|
+
visible && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "table-dropdown", children: [
|
|
258
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "table-dropdown-header", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: hoverRow > 0 ? `${hoverRow} \xD7 ${hoverCol}` : "Insert Table" }) }),
|
|
259
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "table-dropdown-grid", onClick: handleInsertTable, children: Array.from({ length: 8 }).map((_, rowIdx) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "table-dropdown-row", children: Array.from({ length: 8 }).map((_2, colIdx) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
307
260
|
"div",
|
|
308
261
|
{
|
|
309
262
|
className: `table-dropdown-cell ${rowIdx < hoverRow && colIdx < hoverCol ? "active" : ""}`,
|
|
@@ -319,7 +272,8 @@ function TableTool() {
|
|
|
319
272
|
}
|
|
320
273
|
|
|
321
274
|
// src/toolbar/TitleTool.tsx
|
|
322
|
-
var
|
|
275
|
+
var import_react5 = require("react");
|
|
276
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
323
277
|
var LEVELS = [
|
|
324
278
|
{ level: null, label: "Body" },
|
|
325
279
|
{ level: "first", label: "Heading 1" },
|
|
@@ -331,15 +285,15 @@ var LEVELS = [
|
|
|
331
285
|
];
|
|
332
286
|
function TitleTool() {
|
|
333
287
|
const { editorRef, rangeStyle } = useEditor();
|
|
334
|
-
const
|
|
288
|
+
const [isOpen, setIsOpen] = (0, import_react5.useState)(false);
|
|
335
289
|
const activeLevel = rangeStyle?.level || null;
|
|
336
290
|
const activeLabel = LEVELS.find((l) => l.level === activeLevel)?.label || "Body";
|
|
337
291
|
const handleTitle = (level) => {
|
|
338
292
|
editorRef.current?.command.executeTitle(level);
|
|
339
293
|
};
|
|
340
|
-
return /* @__PURE__ */ (0,
|
|
341
|
-
/* @__PURE__ */ (0,
|
|
342
|
-
/* @__PURE__ */ (0,
|
|
294
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "menu-item__title", onClick: () => setIsOpen(!isOpen), children: [
|
|
295
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "select", title: "Toggle Heading", children: activeLabel }),
|
|
296
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "options" + (isOpen ? " visible" : ""), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("ul", { children: LEVELS.map(({ level, label }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
343
297
|
"li",
|
|
344
298
|
{
|
|
345
299
|
className: activeLevel === level ? "active" : "",
|
|
@@ -353,22 +307,23 @@ function TitleTool() {
|
|
|
353
307
|
}
|
|
354
308
|
|
|
355
309
|
// src/toolbar/FontTool.tsx
|
|
356
|
-
var
|
|
310
|
+
var import_react6 = require("react");
|
|
311
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
357
312
|
var FONTS = [
|
|
358
313
|
{ family: "Arial", label: "Sans Serif" },
|
|
359
314
|
{ family: "Times New Roman", label: "Serif" }
|
|
360
315
|
];
|
|
361
316
|
function FontTool() {
|
|
362
317
|
const { editorRef, rangeStyle } = useEditor();
|
|
363
|
-
const
|
|
318
|
+
const [isOpen, setIsOpen] = (0, import_react6.useState)(false);
|
|
364
319
|
const activeFont = rangeStyle?.font || "Arial";
|
|
365
320
|
const activeLabel = FONTS.find((f) => f.family === activeFont)?.label || activeFont;
|
|
366
321
|
const handleFont = (family) => {
|
|
367
322
|
editorRef.current?.command.executeFont(family);
|
|
368
323
|
};
|
|
369
|
-
return /* @__PURE__ */ (0,
|
|
370
|
-
/* @__PURE__ */ (0,
|
|
371
|
-
/* @__PURE__ */ (0,
|
|
324
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "menu-item__font", onClick: () => setIsOpen(!isOpen), children: [
|
|
325
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "select", title: "Font", children: activeLabel }),
|
|
326
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "options" + (isOpen ? " visible" : ""), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("ul", { children: FONTS.map(({ family, label }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
372
327
|
"li",
|
|
373
328
|
{
|
|
374
329
|
"data-family": family,
|
|
@@ -383,18 +338,19 @@ function FontTool() {
|
|
|
383
338
|
}
|
|
384
339
|
|
|
385
340
|
// src/toolbar/FontSizeTool.tsx
|
|
386
|
-
var
|
|
341
|
+
var import_react7 = require("react");
|
|
342
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
387
343
|
var SIZES = [56, 48, 34, 32, 29, 24, 21, 20, 18, 16, 14, 12, 10, 8];
|
|
388
344
|
function FontSizeTool() {
|
|
389
345
|
const { editorRef, rangeStyle } = useEditor();
|
|
390
|
-
const
|
|
346
|
+
const [isOpen, setIsOpen] = (0, import_react7.useState)(false);
|
|
391
347
|
const activeSize = rangeStyle?.size ?? 16;
|
|
392
348
|
const handleSize = (size) => {
|
|
393
349
|
editorRef.current?.command.executeSize(size);
|
|
394
350
|
};
|
|
395
|
-
return /* @__PURE__ */ (0,
|
|
396
|
-
/* @__PURE__ */ (0,
|
|
397
|
-
/* @__PURE__ */ (0,
|
|
351
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "menu-item__size", onClick: () => setIsOpen(!isOpen), children: [
|
|
352
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "select", title: "Font Size", children: activeSize }),
|
|
353
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "options" + (isOpen ? " visible" : ""), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("ul", { children: SIZES.map((size) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
398
354
|
"li",
|
|
399
355
|
{
|
|
400
356
|
className: activeSize === size ? "active" : "",
|
|
@@ -407,19 +363,20 @@ function FontSizeTool() {
|
|
|
407
363
|
}
|
|
408
364
|
|
|
409
365
|
// src/toolbar/LineHeightTool.tsx
|
|
410
|
-
var
|
|
366
|
+
var import_react8 = require("react");
|
|
367
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
411
368
|
var LINE_HEIGHTS = ["1.0", "1.15", "1.5", "2.0", "2.5"];
|
|
412
369
|
function LineHeightTool() {
|
|
413
370
|
const { editorRef, rangeStyle } = useEditor();
|
|
414
|
-
const
|
|
371
|
+
const [isOpen, setIsOpen] = (0, import_react8.useState)(false);
|
|
415
372
|
const activeMargin = rangeStyle?.rowMargin ?? 1;
|
|
416
373
|
const activeLabel = Number.isInteger(activeMargin) ? `${activeMargin}.0` : String(activeMargin);
|
|
417
374
|
const handleLineHeight = (value) => {
|
|
418
375
|
editorRef.current?.command.executeRowMargin(Number(value));
|
|
419
376
|
};
|
|
420
|
-
return /* @__PURE__ */ (0,
|
|
421
|
-
/* @__PURE__ */ (0,
|
|
422
|
-
/* @__PURE__ */ (0,
|
|
377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "menu-item__line-height", onClick: () => setIsOpen(!isOpen), children: [
|
|
378
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "select", title: "Line Height", children: activeLabel }),
|
|
379
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "options" + (isOpen ? " visible" : ""), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("ul", { children: LINE_HEIGHTS.map((h) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
423
380
|
"li",
|
|
424
381
|
{
|
|
425
382
|
className: String(activeMargin) === h || activeLabel === h ? "active" : "",
|
|
@@ -432,8 +389,9 @@ function LineHeightTool() {
|
|
|
432
389
|
}
|
|
433
390
|
|
|
434
391
|
// src/toolbar/ColorTool.tsx
|
|
392
|
+
var import_react9 = require("react");
|
|
435
393
|
var import_lucide_react4 = require("lucide-react");
|
|
436
|
-
var
|
|
394
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
437
395
|
var COLOR_PALETTE = [
|
|
438
396
|
["#000000", "#434343", "#666666", "#999999", "#b7b7b7", "#cccccc", "#d9d9d9", "#efefef", "#f3f3f3", "#ffffff"],
|
|
439
397
|
["#980000", "#ff0000", "#ff9900", "#ffff00", "#00ff00", "#00ffff", "#4a86e8", "#0000ff", "#9900ff", "#ff00ff"],
|
|
@@ -446,7 +404,7 @@ var COLOR_PALETTE = [
|
|
|
446
404
|
];
|
|
447
405
|
function ColorTool() {
|
|
448
406
|
const { editorRef, rangeStyle } = useEditor();
|
|
449
|
-
const
|
|
407
|
+
const [visible, setVisible] = (0, import_react9.useState)(false);
|
|
450
408
|
const activeColor = rangeStyle?.color || "#000000";
|
|
451
409
|
const handleColor = (color) => {
|
|
452
410
|
editorRef.current?.command.executeColor(color);
|
|
@@ -454,16 +412,16 @@ function ColorTool() {
|
|
|
454
412
|
const handleReset = () => {
|
|
455
413
|
editorRef.current?.command.executeColor(null);
|
|
456
414
|
};
|
|
457
|
-
return /* @__PURE__ */ (0,
|
|
458
|
-
/* @__PURE__ */ (0,
|
|
459
|
-
/* @__PURE__ */ (0,
|
|
460
|
-
/* @__PURE__ */ (0,
|
|
461
|
-
/* @__PURE__ */ (0,
|
|
462
|
-
/* @__PURE__ */ (0,
|
|
463
|
-
/* @__PURE__ */ (0,
|
|
415
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "menu-item__color", title: "Font Color", onClick: () => setVisible(!visible), children: [
|
|
416
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react4.Baseline, { size: 16 }),
|
|
417
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { backgroundColor: activeColor } }),
|
|
418
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("input", { id: "color", type: "color", readOnly: true, tabIndex: -1 }),
|
|
419
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "color-palette-dropdown" + (visible ? " visible" : ""), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { onClick: (e) => e.stopPropagation(), children: [
|
|
420
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("button", { className: "color-palette-reset", onClick: handleReset, children: [
|
|
421
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react4.RotateCcw, { size: 12 }),
|
|
464
422
|
"Reset"
|
|
465
423
|
] }),
|
|
466
|
-
/* @__PURE__ */ (0,
|
|
424
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "color-palette-grid", children: COLOR_PALETTE.map((row, ri) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "color-palette-row", children: row.map((color) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
467
425
|
"div",
|
|
468
426
|
{
|
|
469
427
|
className: `color-palette-swatch${activeColor.toLowerCase() === color.toLowerCase() ? " active" : ""}`,
|
|
@@ -478,8 +436,9 @@ function ColorTool() {
|
|
|
478
436
|
}
|
|
479
437
|
|
|
480
438
|
// src/toolbar/HighlightTool.tsx
|
|
439
|
+
var import_react10 = require("react");
|
|
481
440
|
var import_lucide_react5 = require("lucide-react");
|
|
482
|
-
var
|
|
441
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
483
442
|
var HIGHLIGHT_PALETTE = [
|
|
484
443
|
["#000000", "#434343", "#666666", "#999999", "#b7b7b7", "#cccccc", "#d9d9d9", "#efefef", "#f3f3f3", "#ffffff"],
|
|
485
444
|
["#980000", "#ff0000", "#ff9900", "#ffff00", "#00ff00", "#00ffff", "#4a86e8", "#0000ff", "#9900ff", "#ff00ff"],
|
|
@@ -492,7 +451,7 @@ var HIGHLIGHT_PALETTE = [
|
|
|
492
451
|
];
|
|
493
452
|
function HighlightTool() {
|
|
494
453
|
const { editorRef, rangeStyle } = useEditor();
|
|
495
|
-
const
|
|
454
|
+
const [visible, setVisible] = (0, import_react10.useState)(false);
|
|
496
455
|
const activeColor = rangeStyle?.highlight || "";
|
|
497
456
|
const handleColor = (color) => {
|
|
498
457
|
editorRef.current?.command.executeHighlight(color);
|
|
@@ -500,16 +459,16 @@ function HighlightTool() {
|
|
|
500
459
|
const handleReset = () => {
|
|
501
460
|
editorRef.current?.command.executeHighlight(null);
|
|
502
461
|
};
|
|
503
|
-
return /* @__PURE__ */ (0,
|
|
504
|
-
/* @__PURE__ */ (0,
|
|
505
|
-
/* @__PURE__ */ (0,
|
|
506
|
-
/* @__PURE__ */ (0,
|
|
507
|
-
/* @__PURE__ */ (0,
|
|
508
|
-
/* @__PURE__ */ (0,
|
|
509
|
-
/* @__PURE__ */ (0,
|
|
462
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "menu-item__highlight", title: "Highlight", onClick: () => setVisible(!visible), children: [
|
|
463
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react5.Highlighter, { size: 16 }),
|
|
464
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { backgroundColor: activeColor || "#ffff00" } }),
|
|
465
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("input", { id: "highlight", type: "color", readOnly: true, tabIndex: -1 }),
|
|
466
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "color-palette-dropdown" + (visible ? " visible" : ""), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { onClick: (e) => e.stopPropagation(), children: [
|
|
467
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("button", { className: "color-palette-reset", onClick: handleReset, children: [
|
|
468
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react5.RotateCcw, { size: 12 }),
|
|
510
469
|
"None"
|
|
511
470
|
] }),
|
|
512
|
-
/* @__PURE__ */ (0,
|
|
471
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "color-palette-grid", children: HIGHLIGHT_PALETTE.map((row, ri) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "color-palette-row", children: row.map((color) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
513
472
|
"div",
|
|
514
473
|
{
|
|
515
474
|
className: `color-palette-swatch${activeColor && activeColor.toLowerCase() === color.toLowerCase() ? " active" : ""}`,
|
|
@@ -525,87 +484,89 @@ function HighlightTool() {
|
|
|
525
484
|
|
|
526
485
|
// src/toolbar/BoldTool.tsx
|
|
527
486
|
var import_lucide_react6 = require("lucide-react");
|
|
528
|
-
var
|
|
487
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
529
488
|
function BoldTool() {
|
|
530
489
|
const { editorRef, isApple, rangeStyle } = useEditor();
|
|
531
490
|
const isActive = rangeStyle?.bold === true;
|
|
532
|
-
return /* @__PURE__ */ (0,
|
|
491
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: `menu-item__bold ${isActive ? "active" : ""}`, title: `Bold(${isApple ? "\u2318" : "Ctrl"}+B)`, onClick: () => editorRef.current?.command.executeBold(), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react6.Bold, { size: 16 }) });
|
|
533
492
|
}
|
|
534
493
|
|
|
535
494
|
// src/toolbar/ItalicTool.tsx
|
|
536
495
|
var import_lucide_react7 = require("lucide-react");
|
|
537
|
-
var
|
|
496
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
538
497
|
function ItalicTool() {
|
|
539
498
|
const { editorRef, isApple, rangeStyle } = useEditor();
|
|
540
499
|
const isActive = rangeStyle?.italic === true;
|
|
541
|
-
return /* @__PURE__ */ (0,
|
|
500
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: `menu-item__italic ${isActive ? "active" : ""}`, title: `Italic(${isApple ? "\u2318" : "Ctrl"}+I)`, onClick: () => editorRef.current?.command.executeItalic(), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react7.Italic, { size: 16 }) });
|
|
542
501
|
}
|
|
543
502
|
|
|
544
503
|
// src/toolbar/UnderlineTool.tsx
|
|
504
|
+
var import_react11 = require("react");
|
|
545
505
|
var import_lucide_react8 = require("lucide-react");
|
|
546
|
-
var
|
|
506
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
547
507
|
var STYLES = ["solid", "double", "dashed", "dotted", "wavy"];
|
|
548
508
|
function UnderlineTool() {
|
|
549
509
|
const { editorRef, isApple, rangeStyle } = useEditor();
|
|
550
|
-
const
|
|
510
|
+
const [isOpen, setIsOpen] = (0, import_react11.useState)(false);
|
|
551
511
|
const isActive = rangeStyle?.underline === true;
|
|
552
|
-
return /* @__PURE__ */ (0,
|
|
553
|
-
/* @__PURE__ */ (0,
|
|
554
|
-
/* @__PURE__ */ (0,
|
|
555
|
-
/* @__PURE__ */ (0,
|
|
512
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: `menu-item__underline ${isActive ? "active" : ""}`, title: `Underline(${isApple ? "\u2318" : "Ctrl"}+U)`, children: [
|
|
513
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react8.Underline, { size: 16, onClick: () => editorRef.current?.command.executeUnderline(), style: { cursor: "pointer" } }),
|
|
514
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "select", onClick: () => setIsOpen(!isOpen) }),
|
|
515
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "options" + (isOpen ? " visible" : ""), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("ul", { children: STYLES.map((style) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("li", { "data-decoration-style": style, onClick: () => {
|
|
556
516
|
editorRef.current?.command.executeUnderline({ style });
|
|
557
|
-
}, children: /* @__PURE__ */ (0,
|
|
517
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("i", {}) }, style)) }) })
|
|
558
518
|
] });
|
|
559
519
|
}
|
|
560
520
|
|
|
561
521
|
// src/toolbar/StrikeoutTool.tsx
|
|
562
522
|
var import_lucide_react9 = require("lucide-react");
|
|
563
|
-
var
|
|
523
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
564
524
|
function StrikeoutTool() {
|
|
565
525
|
const { editorRef, rangeStyle } = useEditor();
|
|
566
526
|
const isActive = rangeStyle?.strikeout === true;
|
|
567
|
-
return /* @__PURE__ */ (0,
|
|
527
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: `menu-item__strikeout ${isActive ? "active" : ""}`, title: "Strikethrough", onClick: () => editorRef.current?.command.executeStrikeout(), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react9.Strikethrough, { size: 16 }) });
|
|
568
528
|
}
|
|
569
529
|
|
|
570
530
|
// src/toolbar/LeftAlignTool.tsx
|
|
571
531
|
var import_lucide_react10 = require("lucide-react");
|
|
572
|
-
var
|
|
532
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
573
533
|
function LeftAlignTool() {
|
|
574
534
|
const { editorRef, isApple, rangeStyle } = useEditor();
|
|
575
535
|
const isActive = !rangeStyle?.rowFlex || rangeStyle.rowFlex === "left";
|
|
576
|
-
return /* @__PURE__ */ (0,
|
|
536
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: `menu-item__left ${isActive ? "active" : ""}`, title: `Left align(${isApple ? "\u2318" : "Ctrl"}+L)`, onClick: () => editorRef.current?.command.executeRowFlex("left"), children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react10.AlignLeft, { size: 16 }) });
|
|
577
537
|
}
|
|
578
538
|
|
|
579
539
|
// src/toolbar/CenterAlignTool.tsx
|
|
580
540
|
var import_lucide_react11 = require("lucide-react");
|
|
581
|
-
var
|
|
541
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
582
542
|
function CenterAlignTool() {
|
|
583
543
|
const { editorRef, isApple, rangeStyle } = useEditor();
|
|
584
544
|
const isActive = rangeStyle?.rowFlex === "center";
|
|
585
|
-
return /* @__PURE__ */ (0,
|
|
545
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: `menu-item__center ${isActive ? "active" : ""}`, title: `Center align(${isApple ? "\u2318" : "Ctrl"}+E)`, onClick: () => editorRef.current?.command.executeRowFlex("center"), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react11.AlignCenter, { size: 16 }) });
|
|
586
546
|
}
|
|
587
547
|
|
|
588
548
|
// src/toolbar/RightAlignTool.tsx
|
|
589
549
|
var import_lucide_react12 = require("lucide-react");
|
|
590
|
-
var
|
|
550
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
591
551
|
function RightAlignTool() {
|
|
592
552
|
const { editorRef, isApple, rangeStyle } = useEditor();
|
|
593
553
|
const isActive = rangeStyle?.rowFlex === "right";
|
|
594
|
-
return /* @__PURE__ */ (0,
|
|
554
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: `menu-item__right ${isActive ? "active" : ""}`, title: `Right align(${isApple ? "\u2318" : "Ctrl"}+R)`, onClick: () => editorRef.current?.command.executeRowFlex("right"), children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react12.AlignRight, { size: 16 }) });
|
|
595
555
|
}
|
|
596
556
|
|
|
597
557
|
// src/toolbar/JustifyTool.tsx
|
|
598
558
|
var import_lucide_react13 = require("lucide-react");
|
|
599
|
-
var
|
|
559
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
600
560
|
function JustifyTool() {
|
|
601
561
|
const { editorRef, isApple, rangeStyle } = useEditor();
|
|
602
562
|
const isActive = rangeStyle?.rowFlex === "justify" || rangeStyle?.rowFlex === "alignment";
|
|
603
|
-
return /* @__PURE__ */ (0,
|
|
563
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: `menu-item__justify ${isActive ? "active" : ""}`, title: `Distribute(${isApple ? "\u2318" : "Ctrl"}+Shift+J)`, onClick: () => editorRef.current?.command.executeRowFlex("justify"), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react13.AlignJustify, { size: 16 }) });
|
|
604
564
|
}
|
|
605
565
|
|
|
606
566
|
// src/toolbar/ListTool.tsx
|
|
567
|
+
var import_react12 = require("react");
|
|
607
568
|
var import_lucide_react14 = require("lucide-react");
|
|
608
|
-
var
|
|
569
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
609
570
|
var OL_PRESETS = [
|
|
610
571
|
{ preset: "olDefault", label: "Default", preview: ["1.", "a.", "i."] },
|
|
611
572
|
{ preset: "olParen", label: "Parenthesis", preview: ["1)", "a)", "i)"] },
|
|
@@ -623,22 +584,22 @@ var UL_PRESETS = [
|
|
|
623
584
|
{ preset: "ulCheckArr", label: "Check Arrow", preview: ["\u27A4", "\u25CB", "\u25A0"] }
|
|
624
585
|
];
|
|
625
586
|
function PresetCell({ option, onClick }) {
|
|
626
|
-
return /* @__PURE__ */ (0,
|
|
587
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
627
588
|
"div",
|
|
628
589
|
{
|
|
629
590
|
onClick,
|
|
630
591
|
className: "list-preset-cell",
|
|
631
592
|
title: option.label,
|
|
632
|
-
children: option.preview.map((item, i) => /* @__PURE__ */ (0,
|
|
633
|
-
/* @__PURE__ */ (0,
|
|
634
|
-
/* @__PURE__ */ (0,
|
|
593
|
+
children: option.preview.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "list-preset-line", style: { paddingLeft: `${i * 10}px` }, children: [
|
|
594
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "list-preset-marker", children: item }),
|
|
595
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "list-preset-text" })
|
|
635
596
|
] }, i))
|
|
636
597
|
}
|
|
637
598
|
);
|
|
638
599
|
}
|
|
639
600
|
function ListTool() {
|
|
640
601
|
const { editorRef, isApple, rangeStyle } = useEditor();
|
|
641
|
-
const
|
|
602
|
+
const [isOpen, setIsOpen] = (0, import_react12.useState)(false);
|
|
642
603
|
const isActive = !!rangeStyle?.listType;
|
|
643
604
|
const handleList = (type, style) => {
|
|
644
605
|
editorRef.current?.command.executeList(type, style);
|
|
@@ -655,11 +616,11 @@ function ListTool() {
|
|
|
655
616
|
e.stopPropagation();
|
|
656
617
|
editorRef.current?.command.executeListOutdent();
|
|
657
618
|
};
|
|
658
|
-
return /* @__PURE__ */ (0,
|
|
659
|
-
/* @__PURE__ */ (0,
|
|
660
|
-
/* @__PURE__ */ (0,
|
|
661
|
-
/* @__PURE__ */ (0,
|
|
662
|
-
/* @__PURE__ */ (0,
|
|
619
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: `menu-item__list ${isActive ? "active" : ""}`, title: `List(${isApple ? "\u2318" : "Ctrl"}+Shift+U)`, children: [
|
|
620
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react14.List, { size: 16, onClick: () => setIsOpen(!isOpen), style: { cursor: "pointer" } }),
|
|
621
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "options" + (isOpen ? " visible" : ""), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { style: { padding: "8px", width: "320px" }, children: [
|
|
622
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { style: { display: "flex", gap: "4px", marginBottom: "8px" }, children: [
|
|
623
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
663
624
|
"button",
|
|
664
625
|
{
|
|
665
626
|
onClick: () => handleList("ul", "checkbox"),
|
|
@@ -667,15 +628,15 @@ function ListTool() {
|
|
|
667
628
|
children: "Checkbox"
|
|
668
629
|
}
|
|
669
630
|
),
|
|
670
|
-
/* @__PURE__ */ (0,
|
|
671
|
-
/* @__PURE__ */ (0,
|
|
631
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { onClick: handleIndent, className: "list-quick-btn", title: "Indent (Tab)", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react14.Indent, { size: 14 }) }),
|
|
632
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { onClick: handleOutdent, className: "list-quick-btn", title: "Outdent (Shift+Tab)", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react14.Outdent, { size: 14 }) })
|
|
672
633
|
] }),
|
|
673
|
-
/* @__PURE__ */ (0,
|
|
674
|
-
/* @__PURE__ */ (0,
|
|
675
|
-
/* @__PURE__ */ (0,
|
|
634
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { style: { marginBottom: "8px" }, children: [
|
|
635
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "4px", fontSize: "11px", color: "#667085", marginBottom: "6px", fontWeight: 500 }, children: [
|
|
636
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react14.ListOrdered, { size: 12 }),
|
|
676
637
|
"Ordered List"
|
|
677
638
|
] }),
|
|
678
|
-
/* @__PURE__ */ (0,
|
|
639
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "list-preset-grid", children: OL_PRESETS.map((option) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
679
640
|
PresetCell,
|
|
680
641
|
{
|
|
681
642
|
option,
|
|
@@ -684,12 +645,12 @@ function ListTool() {
|
|
|
684
645
|
option.preset
|
|
685
646
|
)) })
|
|
686
647
|
] }),
|
|
687
|
-
/* @__PURE__ */ (0,
|
|
688
|
-
/* @__PURE__ */ (0,
|
|
689
|
-
/* @__PURE__ */ (0,
|
|
648
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
|
|
649
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "4px", fontSize: "11px", color: "#667085", marginBottom: "6px", fontWeight: 500 }, children: [
|
|
650
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react14.List, { size: 12 }),
|
|
690
651
|
"Unordered List"
|
|
691
652
|
] }),
|
|
692
|
-
/* @__PURE__ */ (0,
|
|
653
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "list-preset-grid", children: UL_PRESETS.map((option) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
693
654
|
PresetCell,
|
|
694
655
|
{
|
|
695
656
|
option,
|
|
@@ -704,7 +665,7 @@ function ListTool() {
|
|
|
704
665
|
|
|
705
666
|
// src/toolbar/ImageTool.tsx
|
|
706
667
|
var import_lucide_react15 = require("lucide-react");
|
|
707
|
-
var
|
|
668
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
708
669
|
function ImageTool() {
|
|
709
670
|
const { editorRef } = useEditor();
|
|
710
671
|
const handleImageUpload = (e) => {
|
|
@@ -725,16 +686,16 @@ function ImageTool() {
|
|
|
725
686
|
};
|
|
726
687
|
e.target.value = "";
|
|
727
688
|
};
|
|
728
|
-
return /* @__PURE__ */ (0,
|
|
729
|
-
/* @__PURE__ */ (0,
|
|
730
|
-
/* @__PURE__ */ (0,
|
|
689
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "menu-item__image", onClick: () => document.getElementById("image")?.click(), children: [
|
|
690
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react15.Image, { size: 16 }),
|
|
691
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("input", { type: "file", id: "image", accept: ".png, .jpg, .jpeg, .svg, .gif", onChange: handleImageUpload })
|
|
731
692
|
] });
|
|
732
693
|
}
|
|
733
694
|
|
|
734
695
|
// src/toolbar/SeparatorTool.tsx
|
|
735
|
-
var
|
|
696
|
+
var import_react13 = require("react");
|
|
736
697
|
var import_lucide_react16 = require("lucide-react");
|
|
737
|
-
var
|
|
698
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
738
699
|
var DASH_STYLES = [
|
|
739
700
|
{ label: "Solid", dashArray: [] },
|
|
740
701
|
{ label: "Dotted", dashArray: [1, 1] },
|
|
@@ -748,22 +709,22 @@ var LINE_WIDTHS = [
|
|
|
748
709
|
];
|
|
749
710
|
function SeparatorTool() {
|
|
750
711
|
const { editorRef } = useEditor();
|
|
751
|
-
const
|
|
752
|
-
const [selectedWidth, setSelectedWidth] = (0,
|
|
712
|
+
const [isOpen, setIsOpen] = (0, import_react13.useState)(false);
|
|
713
|
+
const [selectedWidth, setSelectedWidth] = (0, import_react13.useState)(1);
|
|
753
714
|
const lineColor = "#344054";
|
|
754
715
|
const handleSeparator = (dashArray) => {
|
|
755
716
|
editorRef.current?.command.executeSeparator(dashArray, { lineWidth: selectedWidth });
|
|
756
717
|
};
|
|
757
|
-
return /* @__PURE__ */ (0,
|
|
758
|
-
/* @__PURE__ */ (0,
|
|
759
|
-
/* @__PURE__ */ (0,
|
|
760
|
-
/* @__PURE__ */ (0,
|
|
718
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "menu-item__separator", title: "Separator", children: [
|
|
719
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react16.Minus, { size: 16, onClick: () => setIsOpen(!isOpen), style: { cursor: "pointer" } }),
|
|
720
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "options" + (isOpen ? " visible" : ""), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { padding: "8px 10px 10px", width: "200px" }, children: [
|
|
721
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("ul", { style: { margin: 0, padding: 0, listStyle: "none" }, children: DASH_STYLES.map(({ label, dashArray }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
761
722
|
"li",
|
|
762
723
|
{
|
|
763
724
|
onClick: () => handleSeparator(dashArray),
|
|
764
725
|
style: { display: "flex", alignItems: "center", gap: "10px", padding: "5px 6px", cursor: "pointer", borderRadius: "4px" },
|
|
765
726
|
children: [
|
|
766
|
-
/* @__PURE__ */ (0,
|
|
727
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("svg", { style: { flex: 1, minWidth: 0, overflow: "hidden" }, height: "8", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
767
728
|
"line",
|
|
768
729
|
{
|
|
769
730
|
x1: "0",
|
|
@@ -775,14 +736,14 @@ function SeparatorTool() {
|
|
|
775
736
|
strokeDasharray: dashArray.length ? dashArray.join(",") : "none"
|
|
776
737
|
}
|
|
777
738
|
) }),
|
|
778
|
-
/* @__PURE__ */ (0,
|
|
739
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { style: { fontSize: "11px", color: "#475467", whiteSpace: "nowrap", flexShrink: 0 }, children: label })
|
|
779
740
|
]
|
|
780
741
|
},
|
|
781
742
|
label
|
|
782
743
|
)) }),
|
|
783
|
-
/* @__PURE__ */ (0,
|
|
784
|
-
/* @__PURE__ */ (0,
|
|
785
|
-
/* @__PURE__ */ (0,
|
|
744
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { borderTop: "1px solid #e4e7ec", marginTop: "8px", paddingTop: "8px" }, children: [
|
|
745
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { fontSize: "11px", color: "#667085", marginBottom: "6px", fontWeight: 500 }, children: "Line Width" }),
|
|
746
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { display: "flex", gap: "4px" }, children: LINE_WIDTHS.map(({ label, value }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
786
747
|
"button",
|
|
787
748
|
{
|
|
788
749
|
onClick: (e) => {
|
|
@@ -810,10 +771,11 @@ function SeparatorTool() {
|
|
|
810
771
|
}
|
|
811
772
|
|
|
812
773
|
// src/toolbar/WatermarkTool.tsx
|
|
813
|
-
var
|
|
774
|
+
var import_react14 = require("react");
|
|
775
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
814
776
|
function InsertElementTool() {
|
|
815
777
|
const { editorRef } = useEditor();
|
|
816
|
-
const
|
|
778
|
+
const [isOpen, setIsOpen] = (0, import_react14.useState)(false);
|
|
817
779
|
const handleHeader = () => {
|
|
818
780
|
if (!editorRef.current) return;
|
|
819
781
|
const options = editorRef.current.command.getOptions();
|
|
@@ -823,34 +785,34 @@ function InsertElementTool() {
|
|
|
823
785
|
}
|
|
824
786
|
editorRef.current.command.executeSetZone("header");
|
|
825
787
|
};
|
|
826
|
-
return /* @__PURE__ */ (0,
|
|
827
|
-
/* @__PURE__ */ (0,
|
|
828
|
-
/* @__PURE__ */ (0,
|
|
788
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "menu-item__insert-element", onClick: () => setIsOpen(!isOpen), children: [
|
|
789
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("i", { title: "Insert Element" }),
|
|
790
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "options" + (isOpen ? " visible" : ""), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("ul", { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("li", { onClick: handleHeader, children: "Add Header" }) }) })
|
|
829
791
|
] });
|
|
830
792
|
}
|
|
831
793
|
|
|
832
794
|
// src/toolbar/PageBreakTool.tsx
|
|
833
|
-
var
|
|
795
|
+
var import_react15 = require("react");
|
|
796
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
834
797
|
function PageBreakTool() {
|
|
835
798
|
const { editorRef } = useEditor();
|
|
836
|
-
const
|
|
799
|
+
const [isOpen, setIsOpen] = (0, import_react15.useState)(false);
|
|
837
800
|
const handlePageBreak = () => {
|
|
838
801
|
editorRef.current?.command.executePageBreak();
|
|
839
802
|
};
|
|
840
803
|
const handleColumnBreak = () => {
|
|
841
804
|
editorRef.current?.command.executeColumnBreak();
|
|
842
805
|
};
|
|
843
|
-
return /* @__PURE__ */ (0,
|
|
806
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
844
807
|
"div",
|
|
845
808
|
{
|
|
846
809
|
className: "menu-item__page-break",
|
|
847
|
-
|
|
848
|
-
onClick: toggle,
|
|
810
|
+
onClick: () => setIsOpen(!isOpen),
|
|
849
811
|
children: [
|
|
850
|
-
/* @__PURE__ */ (0,
|
|
851
|
-
/* @__PURE__ */ (0,
|
|
852
|
-
/* @__PURE__ */ (0,
|
|
853
|
-
/* @__PURE__ */ (0,
|
|
812
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("i", { title: "Break" }),
|
|
813
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "options" + (isOpen ? " visible" : ""), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("ul", { children: [
|
|
814
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("li", { onClick: handlePageBreak, children: "Page Break" }),
|
|
815
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("li", { onClick: handleColumnBreak, children: "Column Break" })
|
|
854
816
|
] }) })
|
|
855
817
|
]
|
|
856
818
|
}
|
|
@@ -858,116 +820,116 @@ function PageBreakTool() {
|
|
|
858
820
|
}
|
|
859
821
|
|
|
860
822
|
// src/EditorToolbar.tsx
|
|
861
|
-
var
|
|
823
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
862
824
|
function EditorToolbar() {
|
|
863
|
-
return /* @__PURE__ */ (0,
|
|
864
|
-
/* @__PURE__ */ (0,
|
|
865
|
-
/* @__PURE__ */ (0,
|
|
866
|
-
/* @__PURE__ */ (0,
|
|
825
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "menu", "editor-component": "menu", children: [
|
|
826
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "menu-item", children: [
|
|
827
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(UndoTool, {}),
|
|
828
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(RedoTool, {})
|
|
867
829
|
] }),
|
|
868
|
-
/* @__PURE__ */ (0,
|
|
869
|
-
/* @__PURE__ */ (0,
|
|
870
|
-
/* @__PURE__ */ (0,
|
|
871
|
-
/* @__PURE__ */ (0,
|
|
872
|
-
/* @__PURE__ */ (0,
|
|
873
|
-
/* @__PURE__ */ (0,
|
|
830
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "menu-divider" }),
|
|
831
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "menu-item", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ColumnTool, {}) }),
|
|
832
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "menu-divider" }),
|
|
833
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "menu-item", children: [
|
|
834
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(PageBreakTool, {}),
|
|
835
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(SeparatorTool, {})
|
|
874
836
|
] }),
|
|
875
|
-
/* @__PURE__ */ (0,
|
|
876
|
-
/* @__PURE__ */ (0,
|
|
877
|
-
/* @__PURE__ */ (0,
|
|
878
|
-
/* @__PURE__ */ (0,
|
|
879
|
-
/* @__PURE__ */ (0,
|
|
880
|
-
/* @__PURE__ */ (0,
|
|
881
|
-
/* @__PURE__ */ (0,
|
|
882
|
-
/* @__PURE__ */ (0,
|
|
837
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "menu-divider" }),
|
|
838
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "menu-item", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TableTool, {}) }),
|
|
839
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "menu-divider" }),
|
|
840
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "menu-item", children: [
|
|
841
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TitleTool, {}),
|
|
842
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(FontTool, {}),
|
|
843
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(FontSizeTool, {}),
|
|
844
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(LineHeightTool, {})
|
|
883
845
|
] }),
|
|
884
|
-
/* @__PURE__ */ (0,
|
|
885
|
-
/* @__PURE__ */ (0,
|
|
886
|
-
/* @__PURE__ */ (0,
|
|
887
|
-
/* @__PURE__ */ (0,
|
|
888
|
-
/* @__PURE__ */ (0,
|
|
889
|
-
/* @__PURE__ */ (0,
|
|
890
|
-
/* @__PURE__ */ (0,
|
|
891
|
-
/* @__PURE__ */ (0,
|
|
846
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "menu-divider" }),
|
|
847
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "menu-item", children: [
|
|
848
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ColorTool, {}),
|
|
849
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(HighlightTool, {}),
|
|
850
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(BoldTool, {}),
|
|
851
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ItalicTool, {}),
|
|
852
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(UnderlineTool, {}),
|
|
853
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(StrikeoutTool, {})
|
|
892
854
|
] }),
|
|
893
|
-
/* @__PURE__ */ (0,
|
|
894
|
-
/* @__PURE__ */ (0,
|
|
895
|
-
/* @__PURE__ */ (0,
|
|
896
|
-
/* @__PURE__ */ (0,
|
|
897
|
-
/* @__PURE__ */ (0,
|
|
898
|
-
/* @__PURE__ */ (0,
|
|
855
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "menu-divider" }),
|
|
856
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "menu-item", children: [
|
|
857
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(LeftAlignTool, {}),
|
|
858
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CenterAlignTool, {}),
|
|
859
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(RightAlignTool, {}),
|
|
860
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(JustifyTool, {})
|
|
899
861
|
] }),
|
|
900
|
-
/* @__PURE__ */ (0,
|
|
901
|
-
/* @__PURE__ */ (0,
|
|
902
|
-
/* @__PURE__ */ (0,
|
|
903
|
-
/* @__PURE__ */ (0,
|
|
904
|
-
/* @__PURE__ */ (0,
|
|
862
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "menu-divider" }),
|
|
863
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "menu-item", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ListTool, {}) }),
|
|
864
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "menu-divider" }),
|
|
865
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "menu-item", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageTool, {}) }),
|
|
866
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "menu-item", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(InsertElementTool, {}) })
|
|
905
867
|
] });
|
|
906
868
|
}
|
|
907
869
|
|
|
908
870
|
// src/footer/CatalogToggleTool.tsx
|
|
909
|
-
var
|
|
871
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
910
872
|
function CatalogToggleTool() {
|
|
911
873
|
const { handleToggleCatalogAction } = useFooter();
|
|
912
|
-
return /* @__PURE__ */ (0,
|
|
874
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "catalog-mode", title: "Catalog", onClick: handleToggleCatalogAction, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("i", {}) });
|
|
913
875
|
}
|
|
914
876
|
|
|
915
877
|
// src/footer/PageModeTool.tsx
|
|
916
|
-
var
|
|
917
|
-
var
|
|
878
|
+
var import_react16 = require("react");
|
|
879
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
918
880
|
function PageModeTool() {
|
|
919
881
|
const { editorRef } = useEditor();
|
|
920
|
-
const [visible, setVisible] = (0,
|
|
882
|
+
const [visible, setVisible] = (0, import_react16.useState)(false);
|
|
921
883
|
const handlePageMode = (mode) => {
|
|
922
884
|
editorRef.current?.command.executePageMode(mode);
|
|
923
885
|
setVisible(false);
|
|
924
886
|
};
|
|
925
|
-
return /* @__PURE__ */ (0,
|
|
926
|
-
/* @__PURE__ */ (0,
|
|
927
|
-
/* @__PURE__ */ (0,
|
|
928
|
-
/* @__PURE__ */ (0,
|
|
929
|
-
/* @__PURE__ */ (0,
|
|
887
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "page-mode", onClick: () => setVisible(!visible), children: [
|
|
888
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("i", { title: "Page Mode" }),
|
|
889
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: `options ${visible ? "visible" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("ul", { children: [
|
|
890
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("li", { onClick: () => handlePageMode("paging"), className: "active", children: "Paging" }),
|
|
891
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("li", { onClick: () => handlePageMode("continuity"), children: "Continuity" })
|
|
930
892
|
] }) })
|
|
931
893
|
] });
|
|
932
894
|
}
|
|
933
895
|
|
|
934
896
|
// src/footer/FooterStatus.tsx
|
|
935
|
-
var
|
|
897
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
936
898
|
function FooterStatus() {
|
|
937
899
|
const { pageNoList, pageNo, pageSize, wordCount, rowNo, colNo } = useFooter();
|
|
938
|
-
return /* @__PURE__ */ (0,
|
|
939
|
-
/* @__PURE__ */ (0,
|
|
900
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
901
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { children: [
|
|
940
902
|
"Visible Pages: ",
|
|
941
|
-
/* @__PURE__ */ (0,
|
|
903
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "page-no-list", children: pageNoList })
|
|
942
904
|
] }),
|
|
943
|
-
/* @__PURE__ */ (0,
|
|
944
|
-
/* @__PURE__ */ (0,
|
|
905
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "footer-divider" }),
|
|
906
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { children: [
|
|
945
907
|
"Pages: ",
|
|
946
|
-
/* @__PURE__ */ (0,
|
|
908
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "page-no", children: pageNo }),
|
|
947
909
|
"/",
|
|
948
|
-
/* @__PURE__ */ (0,
|
|
910
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "page-size", children: pageSize })
|
|
949
911
|
] }),
|
|
950
|
-
/* @__PURE__ */ (0,
|
|
951
|
-
/* @__PURE__ */ (0,
|
|
912
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "footer-divider" }),
|
|
913
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { children: [
|
|
952
914
|
"Words: ",
|
|
953
|
-
/* @__PURE__ */ (0,
|
|
915
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "word-count", children: wordCount })
|
|
954
916
|
] }),
|
|
955
|
-
/* @__PURE__ */ (0,
|
|
956
|
-
/* @__PURE__ */ (0,
|
|
917
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "footer-divider" }),
|
|
918
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { children: [
|
|
957
919
|
"Row: ",
|
|
958
|
-
/* @__PURE__ */ (0,
|
|
920
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "row-no", children: rowNo })
|
|
959
921
|
] }),
|
|
960
|
-
/* @__PURE__ */ (0,
|
|
961
|
-
/* @__PURE__ */ (0,
|
|
922
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "footer-divider" }),
|
|
923
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { children: [
|
|
962
924
|
"Column: ",
|
|
963
|
-
/* @__PURE__ */ (0,
|
|
925
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "col-no", children: colNo })
|
|
964
926
|
] })
|
|
965
927
|
] });
|
|
966
928
|
}
|
|
967
929
|
|
|
968
930
|
// src/footer/EditorModeTool.tsx
|
|
969
|
-
var
|
|
970
|
-
var
|
|
931
|
+
var import_react17 = require("react");
|
|
932
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
971
933
|
var MODE_LIST = [
|
|
972
934
|
{ mode: "edit", name: "Edit Mode" },
|
|
973
935
|
{ mode: "clean", name: "Clean Mode" },
|
|
@@ -979,8 +941,8 @@ var MODE_LIST = [
|
|
|
979
941
|
];
|
|
980
942
|
function EditorModeTool() {
|
|
981
943
|
const { editorRef } = useEditor();
|
|
982
|
-
const [editorMode, setEditorMode] = (0,
|
|
983
|
-
const modeIndexRef = (0,
|
|
944
|
+
const [editorMode, setEditorMode] = (0, import_react17.useState)("Edit Mode");
|
|
945
|
+
const modeIndexRef = (0, import_react17.useRef)(0);
|
|
984
946
|
const handleModeChange = () => {
|
|
985
947
|
modeIndexRef.current = modeIndexRef.current === MODE_LIST.length - 1 ? 0 : modeIndexRef.current + 1;
|
|
986
948
|
const { name, mode } = MODE_LIST[modeIndexRef.current];
|
|
@@ -997,37 +959,37 @@ function EditorModeTool() {
|
|
|
997
959
|
}
|
|
998
960
|
});
|
|
999
961
|
};
|
|
1000
|
-
return /* @__PURE__ */ (0,
|
|
962
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "editor-mode", title: "Click to change mode", onClick: handleModeChange, children: editorMode });
|
|
1001
963
|
}
|
|
1002
964
|
|
|
1003
965
|
// src/footer/PageScaleMinusTool.tsx
|
|
1004
|
-
var
|
|
966
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
1005
967
|
function PageScaleMinusTool() {
|
|
1006
968
|
const { editorRef } = useEditor();
|
|
1007
|
-
return /* @__PURE__ */ (0,
|
|
969
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "page-scale-minus", title: "Zoom Out (Ctrl+-)", onClick: () => editorRef.current?.command.executePageScaleMinus(), children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("i", {}) });
|
|
1008
970
|
}
|
|
1009
971
|
|
|
1010
972
|
// src/footer/PageScalePercentageTool.tsx
|
|
1011
|
-
var
|
|
973
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
1012
974
|
function PageScalePercentageTool() {
|
|
1013
975
|
const { editorRef } = useEditor();
|
|
1014
976
|
const { pageScale } = useFooter();
|
|
1015
|
-
return /* @__PURE__ */ (0,
|
|
977
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "page-scale-percentage", title: "Zoom Level", onClick: () => editorRef.current?.command.executePageScaleRecovery(), children: [
|
|
1016
978
|
pageScale,
|
|
1017
979
|
"%"
|
|
1018
980
|
] });
|
|
1019
981
|
}
|
|
1020
982
|
|
|
1021
983
|
// src/footer/PageScaleAddTool.tsx
|
|
1022
|
-
var
|
|
984
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
1023
985
|
function PageScaleAddTool() {
|
|
1024
986
|
const { editorRef } = useEditor();
|
|
1025
|
-
return /* @__PURE__ */ (0,
|
|
987
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "page-scale-add", title: "Zoom In (Ctrl+=)", onClick: () => editorRef.current?.command.executePageScaleAdd(), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("i", {}) });
|
|
1026
988
|
}
|
|
1027
989
|
|
|
1028
990
|
// src/footer/PaperSizeTool.tsx
|
|
1029
|
-
var
|
|
1030
|
-
var
|
|
991
|
+
var import_react18 = require("react");
|
|
992
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
1031
993
|
var SIZES2 = [
|
|
1032
994
|
{ label: "A4", width: 794, height: 1123, active: true },
|
|
1033
995
|
{ label: "A2", width: 1593, height: 2251 },
|
|
@@ -1036,38 +998,38 @@ var SIZES2 = [
|
|
|
1036
998
|
];
|
|
1037
999
|
function PaperSizeTool() {
|
|
1038
1000
|
const { editorRef } = useEditor();
|
|
1039
|
-
const [visible, setVisible] = (0,
|
|
1001
|
+
const [visible, setVisible] = (0, import_react18.useState)(false);
|
|
1040
1002
|
const handlePaperSize = (width, height) => {
|
|
1041
1003
|
editorRef.current?.command.executePaperSize(width, height);
|
|
1042
1004
|
setVisible(false);
|
|
1043
1005
|
};
|
|
1044
|
-
return /* @__PURE__ */ (0,
|
|
1045
|
-
/* @__PURE__ */ (0,
|
|
1046
|
-
/* @__PURE__ */ (0,
|
|
1006
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "paper-size", onClick: () => setVisible(!visible), children: [
|
|
1007
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("i", { title: "Paper Type" }),
|
|
1008
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: `options ${visible ? "visible" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("ul", { children: SIZES2.map(({ label, width, height, active }) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("li", { onClick: () => handlePaperSize(width, height), className: active ? "active" : "", children: label }, label)) }) })
|
|
1047
1009
|
] });
|
|
1048
1010
|
}
|
|
1049
1011
|
|
|
1050
1012
|
// src/footer/PaperDirectionTool.tsx
|
|
1051
|
-
var
|
|
1052
|
-
var
|
|
1013
|
+
var import_react19 = require("react");
|
|
1014
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
1053
1015
|
function PaperDirectionTool() {
|
|
1054
1016
|
const { editorRef } = useEditor();
|
|
1055
|
-
const [visible, setVisible] = (0,
|
|
1017
|
+
const [visible, setVisible] = (0, import_react19.useState)(false);
|
|
1056
1018
|
const handlePaperDirection = (direction) => {
|
|
1057
1019
|
editorRef.current?.command.executePaperDirection(direction);
|
|
1058
1020
|
setVisible(false);
|
|
1059
1021
|
};
|
|
1060
|
-
return /* @__PURE__ */ (0,
|
|
1061
|
-
/* @__PURE__ */ (0,
|
|
1062
|
-
/* @__PURE__ */ (0,
|
|
1063
|
-
/* @__PURE__ */ (0,
|
|
1064
|
-
/* @__PURE__ */ (0,
|
|
1022
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "paper-direction", onClick: () => setVisible(!visible), children: [
|
|
1023
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("i", { title: "Paper Direction" }),
|
|
1024
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: `options ${visible ? "visible" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("ul", { children: [
|
|
1025
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("li", { onClick: () => handlePaperDirection("vertical"), className: "active", children: "Portrait" }),
|
|
1026
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("li", { onClick: () => handlePaperDirection("horizontal"), children: "Landscape" })
|
|
1065
1027
|
] }) })
|
|
1066
1028
|
] });
|
|
1067
1029
|
}
|
|
1068
1030
|
|
|
1069
1031
|
// src/footer/PaperMarginTool.tsx
|
|
1070
|
-
var
|
|
1032
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
1071
1033
|
function PaperMarginTool() {
|
|
1072
1034
|
const { editorRef } = useEditor();
|
|
1073
1035
|
const handlePaperMargin = async () => {
|
|
@@ -1100,11 +1062,11 @@ function PaperMarginTool() {
|
|
|
1100
1062
|
}
|
|
1101
1063
|
});
|
|
1102
1064
|
};
|
|
1103
|
-
return /* @__PURE__ */ (0,
|
|
1065
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "paper-margin", title: "Page Margins", onClick: handlePaperMargin, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("i", {}) });
|
|
1104
1066
|
}
|
|
1105
1067
|
|
|
1106
1068
|
// src/footer/FullscreenTool.tsx
|
|
1107
|
-
var
|
|
1069
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
1108
1070
|
function FullscreenTool() {
|
|
1109
1071
|
const handleFullscreen = () => {
|
|
1110
1072
|
if (!document.fullscreenElement) {
|
|
@@ -1113,11 +1075,11 @@ function FullscreenTool() {
|
|
|
1113
1075
|
document.exitFullscreen();
|
|
1114
1076
|
}
|
|
1115
1077
|
};
|
|
1116
|
-
return /* @__PURE__ */ (0,
|
|
1078
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "fullscreen", title: "Fullscreen", onClick: handleFullscreen, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("i", {}) });
|
|
1117
1079
|
}
|
|
1118
1080
|
|
|
1119
1081
|
// src/footer/EditorOptionTool.tsx
|
|
1120
|
-
var
|
|
1082
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
1121
1083
|
function EditorOptionTool() {
|
|
1122
1084
|
const { editorRef } = useEditor();
|
|
1123
1085
|
const handleEditorOption = async () => {
|
|
@@ -1145,12 +1107,12 @@ function EditorOptionTool() {
|
|
|
1145
1107
|
}
|
|
1146
1108
|
});
|
|
1147
1109
|
};
|
|
1148
|
-
return /* @__PURE__ */ (0,
|
|
1110
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "editor-option", title: "Editor Settings", onClick: handleEditorOption, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("i", {}) });
|
|
1149
1111
|
}
|
|
1150
1112
|
|
|
1151
1113
|
// src/footer/WatermarkFooterTool.tsx
|
|
1152
|
-
var
|
|
1153
|
-
var
|
|
1114
|
+
var import_react20 = require("react");
|
|
1115
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
1154
1116
|
var COLOR_PALETTE2 = [
|
|
1155
1117
|
["#000000", "#434343", "#666666", "#999999", "#b7b7b7", "#cccccc"],
|
|
1156
1118
|
["#980000", "#ff0000", "#ff9900", "#ffff00", "#00ff00", "#00ffff"],
|
|
@@ -1162,21 +1124,21 @@ var FONTS2 = [
|
|
|
1162
1124
|
];
|
|
1163
1125
|
function WatermarkFooterTool() {
|
|
1164
1126
|
const { editorRef } = useEditor();
|
|
1165
|
-
const [visible, setVisible] = (0,
|
|
1166
|
-
const [tab, setTab] = (0,
|
|
1167
|
-
const containerRef = (0,
|
|
1168
|
-
const panelRef = (0,
|
|
1169
|
-
const fileInputRef = (0,
|
|
1170
|
-
const [text, setText] = (0,
|
|
1171
|
-
const [font, setFont] = (0,
|
|
1172
|
-
const [color, setColor] = (0,
|
|
1173
|
-
const [opacity, setOpacity] = (0,
|
|
1174
|
-
const [rotation, setRotation] = (0,
|
|
1175
|
-
const [inFront, setInFront] = (0,
|
|
1176
|
-
const [imageData, setImageData] = (0,
|
|
1177
|
-
const [imgWidth, setImgWidth] = (0,
|
|
1178
|
-
const [imgHeight, setImgHeight] = (0,
|
|
1179
|
-
(0,
|
|
1127
|
+
const [visible, setVisible] = (0, import_react20.useState)(false);
|
|
1128
|
+
const [tab, setTab] = (0, import_react20.useState)("text");
|
|
1129
|
+
const containerRef = (0, import_react20.useRef)(null);
|
|
1130
|
+
const panelRef = (0, import_react20.useRef)(null);
|
|
1131
|
+
const fileInputRef = (0, import_react20.useRef)(null);
|
|
1132
|
+
const [text, setText] = (0, import_react20.useState)("WATERMARK");
|
|
1133
|
+
const [font, setFont] = (0, import_react20.useState)("Arial");
|
|
1134
|
+
const [color, setColor] = (0, import_react20.useState)("#AEB5C0");
|
|
1135
|
+
const [opacity, setOpacity] = (0, import_react20.useState)(30);
|
|
1136
|
+
const [rotation, setRotation] = (0, import_react20.useState)(-45);
|
|
1137
|
+
const [inFront, setInFront] = (0, import_react20.useState)(false);
|
|
1138
|
+
const [imageData, setImageData] = (0, import_react20.useState)("");
|
|
1139
|
+
const [imgWidth, setImgWidth] = (0, import_react20.useState)(200);
|
|
1140
|
+
const [imgHeight, setImgHeight] = (0, import_react20.useState)(200);
|
|
1141
|
+
(0, import_react20.useEffect)(() => {
|
|
1180
1142
|
if (!visible) return;
|
|
1181
1143
|
const handler = (e) => {
|
|
1182
1144
|
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
@@ -1186,7 +1148,7 @@ function WatermarkFooterTool() {
|
|
|
1186
1148
|
document.addEventListener("mousedown", handler);
|
|
1187
1149
|
return () => document.removeEventListener("mousedown", handler);
|
|
1188
1150
|
}, [visible]);
|
|
1189
|
-
(0,
|
|
1151
|
+
(0, import_react20.useEffect)(() => {
|
|
1190
1152
|
if (!visible || !panelRef.current) return;
|
|
1191
1153
|
const el = panelRef.current;
|
|
1192
1154
|
el.style.right = "";
|
|
@@ -1200,7 +1162,7 @@ function WatermarkFooterTool() {
|
|
|
1200
1162
|
el.style.left = `${-rect.left + 4}px`;
|
|
1201
1163
|
}
|
|
1202
1164
|
}, [visible]);
|
|
1203
|
-
const handleFileUpload = (0,
|
|
1165
|
+
const handleFileUpload = (0, import_react20.useCallback)((e) => {
|
|
1204
1166
|
const file = e.target.files?.[0];
|
|
1205
1167
|
if (!file) return;
|
|
1206
1168
|
const reader = new FileReader();
|
|
@@ -1256,26 +1218,26 @@ function WatermarkFooterTool() {
|
|
|
1256
1218
|
editorRef.current?.command.executeDeleteWatermark();
|
|
1257
1219
|
setVisible(false);
|
|
1258
1220
|
};
|
|
1259
|
-
return /* @__PURE__ */ (0,
|
|
1260
|
-
/* @__PURE__ */ (0,
|
|
1261
|
-
visible && /* @__PURE__ */ (0,
|
|
1262
|
-
/* @__PURE__ */ (0,
|
|
1263
|
-
/* @__PURE__ */ (0,
|
|
1264
|
-
/* @__PURE__ */ (0,
|
|
1221
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "watermark-footer", ref: containerRef, onClick: () => setVisible(!visible), children: [
|
|
1222
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("i", { title: "Watermark" }),
|
|
1223
|
+
visible && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "watermark-footer-panel", ref: panelRef, onClick: (e) => e.stopPropagation(), children: [
|
|
1224
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "wm-panel-tabs", children: [
|
|
1225
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("button", { className: `wm-panel-tab ${tab === "text" ? "active" : ""}`, onClick: () => setTab("text"), children: "Text" }),
|
|
1226
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("button", { className: `wm-panel-tab ${tab === "image" ? "active" : ""}`, onClick: () => setTab("image"), children: "Image" })
|
|
1265
1227
|
] }),
|
|
1266
|
-
/* @__PURE__ */ (0,
|
|
1267
|
-
tab === "text" ? /* @__PURE__ */ (0,
|
|
1268
|
-
/* @__PURE__ */ (0,
|
|
1269
|
-
/* @__PURE__ */ (0,
|
|
1270
|
-
/* @__PURE__ */ (0,
|
|
1228
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "wm-panel-body", children: [
|
|
1229
|
+
tab === "text" ? /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
|
|
1230
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "wm-panel-field", children: [
|
|
1231
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("label", { children: "Text" }),
|
|
1232
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("input", { type: "text", value: text, onChange: (e) => setText(e.target.value), placeholder: "Watermark text" })
|
|
1271
1233
|
] }),
|
|
1272
|
-
/* @__PURE__ */ (0,
|
|
1273
|
-
/* @__PURE__ */ (0,
|
|
1274
|
-
/* @__PURE__ */ (0,
|
|
1234
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "wm-panel-field", children: [
|
|
1235
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("label", { children: "Font" }),
|
|
1236
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("select", { value: font, onChange: (e) => setFont(e.target.value), children: FONTS2.map((f) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("option", { value: f.family, children: f.label }, f.family)) })
|
|
1275
1237
|
] }),
|
|
1276
|
-
/* @__PURE__ */ (0,
|
|
1277
|
-
/* @__PURE__ */ (0,
|
|
1278
|
-
/* @__PURE__ */ (0,
|
|
1238
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "wm-panel-field", children: [
|
|
1239
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("label", { children: "Color" }),
|
|
1240
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "wm-panel-colors", children: COLOR_PALETTE2.flat().map((c) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
1279
1241
|
"div",
|
|
1280
1242
|
{
|
|
1281
1243
|
className: `wm-panel-color ${color.toLowerCase() === c.toLowerCase() ? "active" : ""}`,
|
|
@@ -1285,89 +1247,89 @@ function WatermarkFooterTool() {
|
|
|
1285
1247
|
c
|
|
1286
1248
|
)) })
|
|
1287
1249
|
] })
|
|
1288
|
-
] }) : /* @__PURE__ */ (0,
|
|
1289
|
-
/* @__PURE__ */ (0,
|
|
1290
|
-
/* @__PURE__ */ (0,
|
|
1291
|
-
/* @__PURE__ */ (0,
|
|
1292
|
-
/* @__PURE__ */ (0,
|
|
1293
|
-
/* @__PURE__ */ (0,
|
|
1294
|
-
imageData && /* @__PURE__ */ (0,
|
|
1250
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
|
|
1251
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "wm-panel-field", children: [
|
|
1252
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("label", { children: "Image" }),
|
|
1253
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "6px" }, children: [
|
|
1254
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("button", { className: "wm-panel-upload", onClick: () => fileInputRef.current?.click(), children: "Choose File" }),
|
|
1255
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("input", { ref: fileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: handleFileUpload }),
|
|
1256
|
+
imageData && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { style: { fontSize: "11px", color: "#667085" }, children: "Loaded" })
|
|
1295
1257
|
] })
|
|
1296
1258
|
] }),
|
|
1297
|
-
imageData && /* @__PURE__ */ (0,
|
|
1298
|
-
/* @__PURE__ */ (0,
|
|
1299
|
-
/* @__PURE__ */ (0,
|
|
1300
|
-
/* @__PURE__ */ (0,
|
|
1301
|
-
/* @__PURE__ */ (0,
|
|
1259
|
+
imageData && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "wm-panel-field", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "wm-panel-preview", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("img", { src: imageData, alt: "preview", style: { maxWidth: "100%", maxHeight: "48px", objectFit: "contain" } }) }) }),
|
|
1260
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "wm-panel-field-row", children: [
|
|
1261
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "wm-panel-field wm-panel-field-half", children: [
|
|
1262
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("label", { children: "W" }),
|
|
1263
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("input", { type: "number", value: imgWidth, min: 10, onChange: (e) => setImgWidth(Number(e.target.value)) })
|
|
1302
1264
|
] }),
|
|
1303
|
-
/* @__PURE__ */ (0,
|
|
1304
|
-
/* @__PURE__ */ (0,
|
|
1305
|
-
/* @__PURE__ */ (0,
|
|
1265
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "wm-panel-field wm-panel-field-half", children: [
|
|
1266
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("label", { children: "H" }),
|
|
1267
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("input", { type: "number", value: imgHeight, min: 10, onChange: (e) => setImgHeight(Number(e.target.value)) })
|
|
1306
1268
|
] })
|
|
1307
1269
|
] })
|
|
1308
1270
|
] }),
|
|
1309
|
-
/* @__PURE__ */ (0,
|
|
1310
|
-
/* @__PURE__ */ (0,
|
|
1271
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "wm-panel-field", children: [
|
|
1272
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("label", { children: [
|
|
1311
1273
|
"Opacity ",
|
|
1312
|
-
/* @__PURE__ */ (0,
|
|
1274
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("span", { className: "wm-panel-value", children: [
|
|
1313
1275
|
opacity,
|
|
1314
1276
|
"%"
|
|
1315
1277
|
] })
|
|
1316
1278
|
] }),
|
|
1317
|
-
/* @__PURE__ */ (0,
|
|
1279
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("input", { type: "range", min: 0, max: 100, value: opacity, onChange: (e) => setOpacity(Number(e.target.value)), className: "wm-panel-slider" })
|
|
1318
1280
|
] }),
|
|
1319
|
-
/* @__PURE__ */ (0,
|
|
1320
|
-
/* @__PURE__ */ (0,
|
|
1281
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "wm-panel-field", children: [
|
|
1282
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("label", { children: [
|
|
1321
1283
|
"Rotation ",
|
|
1322
|
-
/* @__PURE__ */ (0,
|
|
1284
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("span", { className: "wm-panel-value", children: [
|
|
1323
1285
|
rotation,
|
|
1324
1286
|
"\xB0"
|
|
1325
1287
|
] })
|
|
1326
1288
|
] }),
|
|
1327
|
-
/* @__PURE__ */ (0,
|
|
1289
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("input", { type: "range", min: -90, max: 90, value: rotation, onChange: (e) => setRotation(Number(e.target.value)), className: "wm-panel-slider" })
|
|
1328
1290
|
] }),
|
|
1329
|
-
/* @__PURE__ */ (0,
|
|
1330
|
-
/* @__PURE__ */ (0,
|
|
1331
|
-
/* @__PURE__ */ (0,
|
|
1332
|
-
/* @__PURE__ */ (0,
|
|
1333
|
-
/* @__PURE__ */ (0,
|
|
1291
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "wm-panel-field", children: [
|
|
1292
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("label", { children: "Position" }),
|
|
1293
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "wm-panel-toggle", children: [
|
|
1294
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("button", { className: !inFront ? "active" : "", onClick: () => setInFront(false), children: "Behind" }),
|
|
1295
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("button", { className: inFront ? "active" : "", onClick: () => setInFront(true), children: "In Front" })
|
|
1334
1296
|
] })
|
|
1335
1297
|
] })
|
|
1336
1298
|
] }),
|
|
1337
|
-
/* @__PURE__ */ (0,
|
|
1338
|
-
/* @__PURE__ */ (0,
|
|
1339
|
-
/* @__PURE__ */ (0,
|
|
1299
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "wm-panel-actions", children: [
|
|
1300
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("button", { className: "wm-panel-btn-delete", onClick: handleDelete, children: "Remove" }),
|
|
1301
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("button", { className: "wm-panel-btn-apply", onClick: handleApply, children: "Apply" })
|
|
1340
1302
|
] })
|
|
1341
1303
|
] })
|
|
1342
1304
|
] });
|
|
1343
1305
|
}
|
|
1344
1306
|
|
|
1345
1307
|
// src/EditorFooter.tsx
|
|
1346
|
-
var
|
|
1308
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
1347
1309
|
function EditorFooter() {
|
|
1348
|
-
return /* @__PURE__ */ (0,
|
|
1349
|
-
/* @__PURE__ */ (0,
|
|
1350
|
-
/* @__PURE__ */ (0,
|
|
1351
|
-
/* @__PURE__ */ (0,
|
|
1352
|
-
/* @__PURE__ */ (0,
|
|
1310
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "footer", "editor-component": "footer", children: [
|
|
1311
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { children: [
|
|
1312
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CatalogToggleTool, {}),
|
|
1313
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(PageModeTool, {}),
|
|
1314
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FooterStatus, {})
|
|
1353
1315
|
] }),
|
|
1354
|
-
/* @__PURE__ */ (0,
|
|
1355
|
-
/* @__PURE__ */ (0,
|
|
1356
|
-
/* @__PURE__ */ (0,
|
|
1357
|
-
/* @__PURE__ */ (0,
|
|
1358
|
-
/* @__PURE__ */ (0,
|
|
1359
|
-
/* @__PURE__ */ (0,
|
|
1360
|
-
/* @__PURE__ */ (0,
|
|
1361
|
-
/* @__PURE__ */ (0,
|
|
1362
|
-
/* @__PURE__ */ (0,
|
|
1363
|
-
/* @__PURE__ */ (0,
|
|
1364
|
-
/* @__PURE__ */ (0,
|
|
1316
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(EditorModeTool, {}),
|
|
1317
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { children: [
|
|
1318
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(PageScaleMinusTool, {}),
|
|
1319
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(PageScalePercentageTool, {}),
|
|
1320
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(PageScaleAddTool, {}),
|
|
1321
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(PaperSizeTool, {}),
|
|
1322
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(PaperDirectionTool, {}),
|
|
1323
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(PaperMarginTool, {}),
|
|
1324
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(WatermarkFooterTool, {}),
|
|
1325
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FullscreenTool, {}),
|
|
1326
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(EditorOptionTool, {})
|
|
1365
1327
|
] })
|
|
1366
1328
|
] });
|
|
1367
1329
|
}
|
|
1368
1330
|
|
|
1369
1331
|
// src/Editor.tsx
|
|
1370
|
-
var
|
|
1332
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
1371
1333
|
function Editor({
|
|
1372
1334
|
defaultValue,
|
|
1373
1335
|
options: userOptions,
|
|
@@ -1382,7 +1344,7 @@ function Editor({
|
|
|
1382
1344
|
style,
|
|
1383
1345
|
onDrop: userOnDrop
|
|
1384
1346
|
}) {
|
|
1385
|
-
return /* @__PURE__ */ (0,
|
|
1347
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(FooterProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
1386
1348
|
EditorInner,
|
|
1387
1349
|
{
|
|
1388
1350
|
defaultValue,
|
|
@@ -1414,9 +1376,9 @@ function EditorInner({
|
|
|
1414
1376
|
style,
|
|
1415
1377
|
onDrop: userOnDrop
|
|
1416
1378
|
}) {
|
|
1417
|
-
const containerRef = (0,
|
|
1418
|
-
const editorRef = (0,
|
|
1419
|
-
const [rangeStyle, setRangeStyle] = (0,
|
|
1379
|
+
const containerRef = (0, import_react21.useRef)(null);
|
|
1380
|
+
const editorRef = (0, import_react21.useRef)(null);
|
|
1381
|
+
const [rangeStyle, setRangeStyle] = (0, import_react21.useState)(null);
|
|
1420
1382
|
const {
|
|
1421
1383
|
setPageNoList,
|
|
1422
1384
|
setPageNo,
|
|
@@ -1426,7 +1388,7 @@ function EditorInner({
|
|
|
1426
1388
|
setColNo,
|
|
1427
1389
|
setPageScale
|
|
1428
1390
|
} = useFooter();
|
|
1429
|
-
(0,
|
|
1391
|
+
(0, import_react21.useEffect)(() => {
|
|
1430
1392
|
let instance = null;
|
|
1431
1393
|
const initEditor = async () => {
|
|
1432
1394
|
if (!containerRef.current) return;
|
|
@@ -1562,11 +1524,11 @@ function EditorInner({
|
|
|
1562
1524
|
e.preventDefault();
|
|
1563
1525
|
e.dataTransfer.dropEffect = "copy";
|
|
1564
1526
|
};
|
|
1565
|
-
return /* @__PURE__ */ (0,
|
|
1566
|
-
toolbar && !renderToolbar && /* @__PURE__ */ (0,
|
|
1527
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(EditorProvider, { editorRef, rangeStyle, children: [
|
|
1528
|
+
toolbar && !renderToolbar && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(EditorToolbar, {}),
|
|
1567
1529
|
renderToolbar,
|
|
1568
1530
|
children,
|
|
1569
|
-
/* @__PURE__ */ (0,
|
|
1531
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
1570
1532
|
"div",
|
|
1571
1533
|
{
|
|
1572
1534
|
className: className ?? "editor",
|
|
@@ -1576,7 +1538,7 @@ function EditorInner({
|
|
|
1576
1538
|
onDragOver: handleDragOver
|
|
1577
1539
|
}
|
|
1578
1540
|
),
|
|
1579
|
-
footer && !renderFooter && /* @__PURE__ */ (0,
|
|
1541
|
+
footer && !renderFooter && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(EditorFooter, {}),
|
|
1580
1542
|
renderFooter
|
|
1581
1543
|
] });
|
|
1582
1544
|
}
|