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