@windoc/react 0.3.2 → 0.3.4

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/dist/index.mjs CHANGED
@@ -37,23 +37,29 @@ function FooterProvider({
37
37
  const [rowNo, setRowNo] = useState2(0);
38
38
  const [colNo, setColNo] = useState2(0);
39
39
  const [pageScale, setPageScale] = useState2(100);
40
- return /* @__PURE__ */ jsx2(FooterContext.Provider, { value: {
41
- pageNoList,
42
- pageNo,
43
- pageSize,
44
- wordCount,
45
- rowNo,
46
- colNo,
47
- pageScale,
48
- setPageNoList,
49
- setPageNo,
50
- setPageSize,
51
- setWordCount,
52
- setRowNo,
53
- setColNo,
54
- setPageScale,
55
- handleToggleCatalogAction
56
- }, children });
40
+ return /* @__PURE__ */ jsx2(
41
+ FooterContext.Provider,
42
+ {
43
+ value: {
44
+ pageNoList,
45
+ pageNo,
46
+ pageSize,
47
+ wordCount,
48
+ rowNo,
49
+ colNo,
50
+ pageScale,
51
+ setPageNoList,
52
+ setPageNo,
53
+ setPageSize,
54
+ setWordCount,
55
+ setRowNo,
56
+ setColNo,
57
+ setPageScale,
58
+ handleToggleCatalogAction
59
+ },
60
+ children
61
+ }
62
+ );
57
63
  }
58
64
  function useFooter() {
59
65
  const ctx = useContext2(FooterContext);
@@ -116,32 +122,39 @@ function ColumnTool() {
116
122
  setGap(clampedValue);
117
123
  editorRef.current?.command.executeColumnGap(clampedValue);
118
124
  };
119
- return /* @__PURE__ */ jsxs("div", { className: "menu-item__column", onClick: () => optionsRef.current?.classList.toggle("visible"), children: [
120
- /* @__PURE__ */ jsx5("span", { className: "select", title: "Column Layout", children: currentColumns === 1 ? "1 Column" : `${currentColumns} Columns` }),
121
- /* @__PURE__ */ jsx5("div", { className: "options", ref: optionsRef, children: /* @__PURE__ */ jsxs("div", { onClick: (e) => e.stopPropagation(), children: [
122
- /* @__PURE__ */ jsxs("ul", { children: [
123
- /* @__PURE__ */ jsx5("li", { onClick: () => handleColumn(1), children: "1 Column" }),
124
- /* @__PURE__ */ jsx5("li", { onClick: () => handleColumn(2), children: "2 Columns" })
125
- ] }),
126
- currentColumns > 1 && /* @__PURE__ */ jsxs(Fragment, { children: [
127
- /* @__PURE__ */ jsx5("div", { className: "option-divider" }),
128
- /* @__PURE__ */ jsxs("div", { className: "option-row", children: [
129
- /* @__PURE__ */ jsx5("label", { children: "Gap (px)" }),
130
- /* @__PURE__ */ jsx5(
131
- "input",
132
- {
133
- type: "number",
134
- min: 0,
135
- max: 100,
136
- value: gap,
137
- onChange: (e) => handleGapChange(Number(e.target.value)),
138
- onClick: (e) => e.stopPropagation()
139
- }
140
- )
141
- ] })
142
- ] })
143
- ] }) })
144
- ] });
125
+ return /* @__PURE__ */ jsxs(
126
+ "div",
127
+ {
128
+ className: "menu-item__column",
129
+ onClick: () => optionsRef.current?.classList.toggle("visible"),
130
+ children: [
131
+ /* @__PURE__ */ jsx5("span", { className: "select", title: "Column Layout", children: currentColumns === 1 ? "1 Column" : `${currentColumns} Columns` }),
132
+ /* @__PURE__ */ jsx5("div", { className: "options", ref: optionsRef, children: /* @__PURE__ */ jsxs("div", { onClick: (e) => e.stopPropagation(), children: [
133
+ /* @__PURE__ */ jsxs("ul", { children: [
134
+ /* @__PURE__ */ jsx5("li", { onClick: () => handleColumn(1), children: "1 Column" }),
135
+ /* @__PURE__ */ jsx5("li", { onClick: () => handleColumn(2), children: "2 Columns" })
136
+ ] }),
137
+ currentColumns > 1 && /* @__PURE__ */ jsxs(Fragment, { children: [
138
+ /* @__PURE__ */ jsx5("div", { className: "option-divider" }),
139
+ /* @__PURE__ */ jsxs("div", { className: "option-row", children: [
140
+ /* @__PURE__ */ jsx5("label", { children: "Gap (px)" }),
141
+ /* @__PURE__ */ jsx5(
142
+ "input",
143
+ {
144
+ type: "number",
145
+ min: 0,
146
+ max: 100,
147
+ value: gap,
148
+ onChange: (e) => handleGapChange(Number(e.target.value)),
149
+ onClick: (e) => e.stopPropagation()
150
+ }
151
+ )
152
+ ] })
153
+ ] })
154
+ ] }) })
155
+ ]
156
+ }
157
+ );
145
158
  }
146
159
 
147
160
  // src/toolbar/TableTool.tsx
@@ -175,7 +188,14 @@ function TableTool() {
175
188
  setHoverCol(0);
176
189
  };
177
190
  return /* @__PURE__ */ jsxs2("div", { ref: containerRef, className: "menu-item__table", title: "Table", children: [
178
- /* @__PURE__ */ jsx6(Table, { size: 16, onClick: () => setVisible(!visible), style: { cursor: "pointer" } }),
191
+ /* @__PURE__ */ jsx6(
192
+ Table,
193
+ {
194
+ size: 16,
195
+ onClick: () => setVisible(!visible),
196
+ style: { cursor: "pointer" }
197
+ }
198
+ ),
179
199
  visible && /* @__PURE__ */ jsxs2("div", { className: "table-dropdown", children: [
180
200
  /* @__PURE__ */ jsx6("div", { className: "table-dropdown-header", children: /* @__PURE__ */ jsx6("span", { children: hoverRow > 0 ? `${hoverRow} \xD7 ${hoverCol}` : "Insert Table" }) }),
181
201
  /* @__PURE__ */ jsx6("div", { className: "table-dropdown-grid", onClick: handleInsertTable, children: Array.from({ length: 8 }).map((_, rowIdx) => /* @__PURE__ */ jsx6("div", { className: "table-dropdown-row", children: Array.from({ length: 8 }).map((_2, colIdx) => /* @__PURE__ */ jsx6(
@@ -213,19 +233,26 @@ function TitleTool() {
213
233
  const handleTitle = (level) => {
214
234
  editorRef.current?.command.executeTitle(level);
215
235
  };
216
- return /* @__PURE__ */ jsxs3("div", { className: "menu-item__title", onClick: () => optionsRef.current?.classList.toggle("visible"), children: [
217
- /* @__PURE__ */ jsx7("span", { className: "select", title: "Toggle Heading", children: activeLabel }),
218
- /* @__PURE__ */ jsx7("div", { className: "options", ref: optionsRef, children: /* @__PURE__ */ jsx7("ul", { children: LEVELS.map(({ level, label }) => /* @__PURE__ */ jsx7(
219
- "li",
220
- {
221
- className: activeLevel === level ? "active" : "",
222
- ...level ? { "data-level": level } : {},
223
- onClick: () => handleTitle(level),
224
- children: label
225
- },
226
- label
227
- )) }) })
228
- ] });
236
+ return /* @__PURE__ */ jsxs3(
237
+ "div",
238
+ {
239
+ className: "menu-item__title",
240
+ onClick: () => optionsRef.current?.classList.toggle("visible"),
241
+ children: [
242
+ /* @__PURE__ */ jsx7("span", { className: "select", title: "Toggle Heading", children: activeLabel }),
243
+ /* @__PURE__ */ jsx7("div", { className: "options", ref: optionsRef, children: /* @__PURE__ */ jsx7("ul", { children: LEVELS.map(({ level, label }) => /* @__PURE__ */ jsx7(
244
+ "li",
245
+ {
246
+ className: activeLevel === level ? "active" : "",
247
+ ...level ? { "data-level": level } : {},
248
+ onClick: () => handleTitle(level),
249
+ children: label
250
+ },
251
+ label
252
+ )) }) })
253
+ ]
254
+ }
255
+ );
229
256
  }
230
257
 
231
258
  // src/toolbar/FontTool.tsx
@@ -249,20 +276,27 @@ function FontTool() {
249
276
  const handleFont = (family) => {
250
277
  editorRef.current?.command.executeFont(family);
251
278
  };
252
- return /* @__PURE__ */ jsxs4("div", { className: "menu-item__font", onClick: () => optionsRef.current?.classList.toggle("visible"), children: [
253
- /* @__PURE__ */ jsx8("span", { className: "select", title: "Font", children: activeLabel }),
254
- /* @__PURE__ */ jsx8("div", { className: "options", ref: optionsRef, children: /* @__PURE__ */ jsx8("ul", { children: FONTS.map(({ family, label }) => /* @__PURE__ */ jsx8(
255
- "li",
256
- {
257
- "data-family": family,
258
- className: activeFont === family ? "active" : "",
259
- style: { fontFamily: family },
260
- onClick: () => handleFont(family),
261
- children: label
262
- },
263
- family
264
- )) }) })
265
- ] });
279
+ return /* @__PURE__ */ jsxs4(
280
+ "div",
281
+ {
282
+ className: "menu-item__font",
283
+ onClick: () => optionsRef.current?.classList.toggle("visible"),
284
+ children: [
285
+ /* @__PURE__ */ jsx8("span", { className: "select", title: "Font", children: activeLabel }),
286
+ /* @__PURE__ */ jsx8("div", { className: "options", ref: optionsRef, children: /* @__PURE__ */ jsx8("ul", { children: FONTS.map(({ family, label }) => /* @__PURE__ */ jsx8(
287
+ "li",
288
+ {
289
+ "data-family": family,
290
+ className: activeFont === family ? "active" : "",
291
+ style: { fontFamily: family },
292
+ onClick: () => handleFont(family),
293
+ children: label
294
+ },
295
+ family
296
+ )) }) })
297
+ ]
298
+ }
299
+ );
266
300
  }
267
301
 
268
302
  // src/toolbar/FontSizeTool.tsx
@@ -276,18 +310,25 @@ function FontSizeTool() {
276
310
  const handleSize = (size) => {
277
311
  editorRef.current?.command.executeSize(size);
278
312
  };
279
- return /* @__PURE__ */ jsxs5("div", { className: "menu-item__size", onClick: () => optionsRef.current?.classList.toggle("visible"), children: [
280
- /* @__PURE__ */ jsx9("span", { className: "select", title: "Font Size", children: activeSize }),
281
- /* @__PURE__ */ jsx9("div", { className: "options", ref: optionsRef, children: /* @__PURE__ */ jsx9("ul", { children: SIZES.map((size) => /* @__PURE__ */ jsx9(
282
- "li",
283
- {
284
- className: activeSize === size ? "active" : "",
285
- onClick: () => handleSize(size),
286
- children: size
287
- },
288
- size
289
- )) }) })
290
- ] });
313
+ return /* @__PURE__ */ jsxs5(
314
+ "div",
315
+ {
316
+ className: "menu-item__size",
317
+ onClick: () => optionsRef.current?.classList.toggle("visible"),
318
+ children: [
319
+ /* @__PURE__ */ jsx9("span", { className: "select", title: "Font Size", children: activeSize }),
320
+ /* @__PURE__ */ jsx9("div", { className: "options", ref: optionsRef, children: /* @__PURE__ */ jsx9("ul", { children: SIZES.map((size) => /* @__PURE__ */ jsx9(
321
+ "li",
322
+ {
323
+ className: activeSize === size ? "active" : "",
324
+ onClick: () => handleSize(size),
325
+ children: size
326
+ },
327
+ size
328
+ )) }) })
329
+ ]
330
+ }
331
+ );
291
332
  }
292
333
 
293
334
  // src/toolbar/LineHeightTool.tsx
@@ -302,18 +343,25 @@ function LineHeightTool() {
302
343
  const handleLineHeight = (value) => {
303
344
  editorRef.current?.command.executeRowMargin(Number(value));
304
345
  };
305
- return /* @__PURE__ */ jsxs6("div", { className: "menu-item__line-height", onClick: () => optionsRef.current?.classList.toggle("visible"), children: [
306
- /* @__PURE__ */ jsx10("span", { className: "select", title: "Line Height", children: activeLabel }),
307
- /* @__PURE__ */ jsx10("div", { className: "options", ref: optionsRef, children: /* @__PURE__ */ jsx10("ul", { children: LINE_HEIGHTS.map((h) => /* @__PURE__ */ jsx10(
308
- "li",
309
- {
310
- className: String(activeMargin) === h || activeLabel === h ? "active" : "",
311
- onClick: () => handleLineHeight(h),
312
- children: h
313
- },
314
- h
315
- )) }) })
316
- ] });
346
+ return /* @__PURE__ */ jsxs6(
347
+ "div",
348
+ {
349
+ className: "menu-item__line-height",
350
+ onClick: () => optionsRef.current?.classList.toggle("visible"),
351
+ children: [
352
+ /* @__PURE__ */ jsx10("span", { className: "select", title: "Line Height", children: activeLabel }),
353
+ /* @__PURE__ */ jsx10("div", { className: "options", ref: optionsRef, children: /* @__PURE__ */ jsx10("ul", { children: LINE_HEIGHTS.map((h) => /* @__PURE__ */ jsx10(
354
+ "li",
355
+ {
356
+ className: String(activeMargin) === h || activeLabel === h ? "active" : "",
357
+ onClick: () => handleLineHeight(h),
358
+ children: h
359
+ },
360
+ h
361
+ )) }) })
362
+ ]
363
+ }
364
+ );
317
365
  }
318
366
 
319
367
  // src/toolbar/ColorTool.tsx
@@ -321,14 +369,102 @@ import { useRef as useRef7 } from "react";
321
369
  import { Baseline, RotateCcw } from "lucide-react";
322
370
  import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
323
371
  var COLOR_PALETTE = [
324
- ["#000000", "#434343", "#666666", "#999999", "#b7b7b7", "#cccccc", "#d9d9d9", "#efefef", "#f3f3f3", "#ffffff"],
325
- ["#980000", "#ff0000", "#ff9900", "#ffff00", "#00ff00", "#00ffff", "#4a86e8", "#0000ff", "#9900ff", "#ff00ff"],
326
- ["#e6b8af", "#f4cccc", "#fce5cd", "#fff2cc", "#d9ead3", "#d0e0e3", "#c9daf8", "#cfe2f3", "#d9d2e9", "#ead1dc"],
327
- ["#dd7e6b", "#ea9999", "#f9cb9c", "#ffe599", "#b6d7a8", "#a2c4c9", "#a4c2f4", "#9fc5e8", "#b4a7d6", "#d5a6bd"],
328
- ["#cc4125", "#e06666", "#f6b26b", "#ffd966", "#93c47d", "#76a5af", "#6d9eeb", "#6fa8dc", "#8e7cc3", "#c27ba0"],
329
- ["#a61c00", "#cc0000", "#e69138", "#f1c232", "#6aa84f", "#45818e", "#3c78d8", "#3d85c6", "#674ea7", "#a64d79"],
330
- ["#85200c", "#990000", "#b45f06", "#bf9000", "#38761d", "#134f5c", "#1155cc", "#0b5394", "#351c75", "#741b47"],
331
- ["#5b0f00", "#660000", "#783f04", "#7f6000", "#274e13", "#0c343d", "#1c4587", "#073763", "#20124d", "#4c1130"]
372
+ [
373
+ "#000000",
374
+ "#434343",
375
+ "#666666",
376
+ "#999999",
377
+ "#b7b7b7",
378
+ "#cccccc",
379
+ "#d9d9d9",
380
+ "#efefef",
381
+ "#f3f3f3",
382
+ "#ffffff"
383
+ ],
384
+ [
385
+ "#980000",
386
+ "#ff0000",
387
+ "#ff9900",
388
+ "#ffff00",
389
+ "#00ff00",
390
+ "#00ffff",
391
+ "#4a86e8",
392
+ "#0000ff",
393
+ "#9900ff",
394
+ "#ff00ff"
395
+ ],
396
+ [
397
+ "#e6b8af",
398
+ "#f4cccc",
399
+ "#fce5cd",
400
+ "#fff2cc",
401
+ "#d9ead3",
402
+ "#d0e0e3",
403
+ "#c9daf8",
404
+ "#cfe2f3",
405
+ "#d9d2e9",
406
+ "#ead1dc"
407
+ ],
408
+ [
409
+ "#dd7e6b",
410
+ "#ea9999",
411
+ "#f9cb9c",
412
+ "#ffe599",
413
+ "#b6d7a8",
414
+ "#a2c4c9",
415
+ "#a4c2f4",
416
+ "#9fc5e8",
417
+ "#b4a7d6",
418
+ "#d5a6bd"
419
+ ],
420
+ [
421
+ "#cc4125",
422
+ "#e06666",
423
+ "#f6b26b",
424
+ "#ffd966",
425
+ "#93c47d",
426
+ "#76a5af",
427
+ "#6d9eeb",
428
+ "#6fa8dc",
429
+ "#8e7cc3",
430
+ "#c27ba0"
431
+ ],
432
+ [
433
+ "#a61c00",
434
+ "#cc0000",
435
+ "#e69138",
436
+ "#f1c232",
437
+ "#6aa84f",
438
+ "#45818e",
439
+ "#3c78d8",
440
+ "#3d85c6",
441
+ "#674ea7",
442
+ "#a64d79"
443
+ ],
444
+ [
445
+ "#85200c",
446
+ "#990000",
447
+ "#b45f06",
448
+ "#bf9000",
449
+ "#38761d",
450
+ "#134f5c",
451
+ "#1155cc",
452
+ "#0b5394",
453
+ "#351c75",
454
+ "#741b47"
455
+ ],
456
+ [
457
+ "#5b0f00",
458
+ "#660000",
459
+ "#783f04",
460
+ "#7f6000",
461
+ "#274e13",
462
+ "#0c343d",
463
+ "#1c4587",
464
+ "#073763",
465
+ "#20124d",
466
+ "#4c1130"
467
+ ]
332
468
  ];
333
469
  function ColorTool() {
334
470
  const { editorRef, rangeStyle } = useEditor();
@@ -340,27 +476,35 @@ function ColorTool() {
340
476
  const handleReset = () => {
341
477
  editorRef.current?.command.executeColor(null);
342
478
  };
343
- return /* @__PURE__ */ jsxs7("div", { className: "menu-item__color", title: "Font Color", onClick: () => dropdownRef.current?.classList.toggle("visible"), children: [
344
- /* @__PURE__ */ jsx11(Baseline, { size: 16 }),
345
- /* @__PURE__ */ jsx11("span", { style: { backgroundColor: activeColor } }),
346
- /* @__PURE__ */ jsx11("input", { id: "color", type: "color", readOnly: true, tabIndex: -1 }),
347
- /* @__PURE__ */ jsx11("div", { className: "color-palette-dropdown", ref: dropdownRef, children: /* @__PURE__ */ jsxs7("div", { onClick: (e) => e.stopPropagation(), children: [
348
- /* @__PURE__ */ jsxs7("button", { className: "color-palette-reset", onClick: handleReset, children: [
349
- /* @__PURE__ */ jsx11(RotateCcw, { size: 12 }),
350
- "Reset"
351
- ] }),
352
- /* @__PURE__ */ jsx11("div", { className: "color-palette-grid", children: COLOR_PALETTE.map((row, ri) => /* @__PURE__ */ jsx11("div", { className: "color-palette-row", children: row.map((color) => /* @__PURE__ */ jsx11(
353
- "div",
354
- {
355
- className: `color-palette-swatch${activeColor.toLowerCase() === color.toLowerCase() ? " active" : ""}`,
356
- style: { backgroundColor: color },
357
- onClick: () => handleColor(color),
358
- title: color
359
- },
360
- color
361
- )) }, ri)) })
362
- ] }) })
363
- ] });
479
+ return /* @__PURE__ */ jsxs7(
480
+ "div",
481
+ {
482
+ className: "menu-item__color",
483
+ title: "Font Color",
484
+ onClick: () => dropdownRef.current?.classList.toggle("visible"),
485
+ children: [
486
+ /* @__PURE__ */ jsx11(Baseline, { size: 16 }),
487
+ /* @__PURE__ */ jsx11("span", { style: { backgroundColor: activeColor } }),
488
+ /* @__PURE__ */ jsx11("input", { id: "color", type: "color", readOnly: true, tabIndex: -1 }),
489
+ /* @__PURE__ */ jsx11("div", { className: "color-palette-dropdown", ref: dropdownRef, children: /* @__PURE__ */ jsxs7("div", { onClick: (e) => e.stopPropagation(), children: [
490
+ /* @__PURE__ */ jsxs7("button", { className: "color-palette-reset", onClick: handleReset, children: [
491
+ /* @__PURE__ */ jsx11(RotateCcw, { size: 12 }),
492
+ "Reset"
493
+ ] }),
494
+ /* @__PURE__ */ jsx11("div", { className: "color-palette-grid", children: COLOR_PALETTE.map((row, ri) => /* @__PURE__ */ jsx11("div", { className: "color-palette-row", children: row.map((color) => /* @__PURE__ */ jsx11(
495
+ "div",
496
+ {
497
+ className: `color-palette-swatch${activeColor.toLowerCase() === color.toLowerCase() ? " active" : ""}`,
498
+ style: { backgroundColor: color },
499
+ onClick: () => handleColor(color),
500
+ title: color
501
+ },
502
+ color
503
+ )) }, ri)) })
504
+ ] }) })
505
+ ]
506
+ }
507
+ );
364
508
  }
365
509
 
366
510
  // src/toolbar/HighlightTool.tsx
@@ -368,14 +512,102 @@ import { useRef as useRef8 } from "react";
368
512
  import { Highlighter, RotateCcw as RotateCcw2 } from "lucide-react";
369
513
  import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
370
514
  var HIGHLIGHT_PALETTE = [
371
- ["#000000", "#434343", "#666666", "#999999", "#b7b7b7", "#cccccc", "#d9d9d9", "#efefef", "#f3f3f3", "#ffffff"],
372
- ["#980000", "#ff0000", "#ff9900", "#ffff00", "#00ff00", "#00ffff", "#4a86e8", "#0000ff", "#9900ff", "#ff00ff"],
373
- ["#e6b8af", "#f4cccc", "#fce5cd", "#fff2cc", "#d9ead3", "#d0e0e3", "#c9daf8", "#cfe2f3", "#d9d2e9", "#ead1dc"],
374
- ["#dd7e6b", "#ea9999", "#f9cb9c", "#ffe599", "#b6d7a8", "#a2c4c9", "#a4c2f4", "#9fc5e8", "#b4a7d6", "#d5a6bd"],
375
- ["#cc4125", "#e06666", "#f6b26b", "#ffd966", "#93c47d", "#76a5af", "#6d9eeb", "#6fa8dc", "#8e7cc3", "#c27ba0"],
376
- ["#a61c00", "#cc0000", "#e69138", "#f1c232", "#6aa84f", "#45818e", "#3c78d8", "#3d85c6", "#674ea7", "#a64d79"],
377
- ["#85200c", "#990000", "#b45f06", "#bf9000", "#38761d", "#134f5c", "#1155cc", "#0b5394", "#351c75", "#741b47"],
378
- ["#5b0f00", "#660000", "#783f04", "#7f6000", "#274e13", "#0c343d", "#1c4587", "#073763", "#20124d", "#4c1130"]
515
+ [
516
+ "#000000",
517
+ "#434343",
518
+ "#666666",
519
+ "#999999",
520
+ "#b7b7b7",
521
+ "#cccccc",
522
+ "#d9d9d9",
523
+ "#efefef",
524
+ "#f3f3f3",
525
+ "#ffffff"
526
+ ],
527
+ [
528
+ "#980000",
529
+ "#ff0000",
530
+ "#ff9900",
531
+ "#ffff00",
532
+ "#00ff00",
533
+ "#00ffff",
534
+ "#4a86e8",
535
+ "#0000ff",
536
+ "#9900ff",
537
+ "#ff00ff"
538
+ ],
539
+ [
540
+ "#e6b8af",
541
+ "#f4cccc",
542
+ "#fce5cd",
543
+ "#fff2cc",
544
+ "#d9ead3",
545
+ "#d0e0e3",
546
+ "#c9daf8",
547
+ "#cfe2f3",
548
+ "#d9d2e9",
549
+ "#ead1dc"
550
+ ],
551
+ [
552
+ "#dd7e6b",
553
+ "#ea9999",
554
+ "#f9cb9c",
555
+ "#ffe599",
556
+ "#b6d7a8",
557
+ "#a2c4c9",
558
+ "#a4c2f4",
559
+ "#9fc5e8",
560
+ "#b4a7d6",
561
+ "#d5a6bd"
562
+ ],
563
+ [
564
+ "#cc4125",
565
+ "#e06666",
566
+ "#f6b26b",
567
+ "#ffd966",
568
+ "#93c47d",
569
+ "#76a5af",
570
+ "#6d9eeb",
571
+ "#6fa8dc",
572
+ "#8e7cc3",
573
+ "#c27ba0"
574
+ ],
575
+ [
576
+ "#a61c00",
577
+ "#cc0000",
578
+ "#e69138",
579
+ "#f1c232",
580
+ "#6aa84f",
581
+ "#45818e",
582
+ "#3c78d8",
583
+ "#3d85c6",
584
+ "#674ea7",
585
+ "#a64d79"
586
+ ],
587
+ [
588
+ "#85200c",
589
+ "#990000",
590
+ "#b45f06",
591
+ "#bf9000",
592
+ "#38761d",
593
+ "#134f5c",
594
+ "#1155cc",
595
+ "#0b5394",
596
+ "#351c75",
597
+ "#741b47"
598
+ ],
599
+ [
600
+ "#5b0f00",
601
+ "#660000",
602
+ "#783f04",
603
+ "#7f6000",
604
+ "#274e13",
605
+ "#0c343d",
606
+ "#1c4587",
607
+ "#073763",
608
+ "#20124d",
609
+ "#4c1130"
610
+ ]
379
611
  ];
380
612
  function HighlightTool() {
381
613
  const { editorRef, rangeStyle } = useEditor();
@@ -387,27 +619,35 @@ function HighlightTool() {
387
619
  const handleReset = () => {
388
620
  editorRef.current?.command.executeHighlight(null);
389
621
  };
390
- return /* @__PURE__ */ jsxs8("div", { className: "menu-item__highlight", title: "Highlight", onClick: () => dropdownRef.current?.classList.toggle("visible"), children: [
391
- /* @__PURE__ */ jsx12(Highlighter, { size: 16 }),
392
- /* @__PURE__ */ jsx12("span", { style: { backgroundColor: activeColor || "#ffff00" } }),
393
- /* @__PURE__ */ jsx12("input", { id: "highlight", type: "color", readOnly: true, tabIndex: -1 }),
394
- /* @__PURE__ */ jsx12("div", { className: "color-palette-dropdown", ref: dropdownRef, children: /* @__PURE__ */ jsxs8("div", { onClick: (e) => e.stopPropagation(), children: [
395
- /* @__PURE__ */ jsxs8("button", { className: "color-palette-reset", onClick: handleReset, children: [
396
- /* @__PURE__ */ jsx12(RotateCcw2, { size: 12 }),
397
- "None"
398
- ] }),
399
- /* @__PURE__ */ jsx12("div", { className: "color-palette-grid", children: HIGHLIGHT_PALETTE.map((row, ri) => /* @__PURE__ */ jsx12("div", { className: "color-palette-row", children: row.map((color) => /* @__PURE__ */ jsx12(
400
- "div",
401
- {
402
- className: `color-palette-swatch${activeColor && activeColor.toLowerCase() === color.toLowerCase() ? " active" : ""}`,
403
- style: { backgroundColor: color },
404
- onClick: () => handleColor(color),
405
- title: color
406
- },
407
- color
408
- )) }, ri)) })
409
- ] }) })
410
- ] });
622
+ return /* @__PURE__ */ jsxs8(
623
+ "div",
624
+ {
625
+ className: "menu-item__highlight",
626
+ title: "Highlight",
627
+ onClick: () => dropdownRef.current?.classList.toggle("visible"),
628
+ children: [
629
+ /* @__PURE__ */ jsx12(Highlighter, { size: 16 }),
630
+ /* @__PURE__ */ jsx12("span", { style: { backgroundColor: activeColor || "#ffff00" } }),
631
+ /* @__PURE__ */ jsx12("input", { id: "highlight", type: "color", readOnly: true, tabIndex: -1 }),
632
+ /* @__PURE__ */ jsx12("div", { className: "color-palette-dropdown", ref: dropdownRef, children: /* @__PURE__ */ jsxs8("div", { onClick: (e) => e.stopPropagation(), children: [
633
+ /* @__PURE__ */ jsxs8("button", { className: "color-palette-reset", onClick: handleReset, children: [
634
+ /* @__PURE__ */ jsx12(RotateCcw2, { size: 12 }),
635
+ "None"
636
+ ] }),
637
+ /* @__PURE__ */ jsx12("div", { className: "color-palette-grid", children: HIGHLIGHT_PALETTE.map((row, ri) => /* @__PURE__ */ jsx12("div", { className: "color-palette-row", children: row.map((color) => /* @__PURE__ */ jsx12(
638
+ "div",
639
+ {
640
+ className: `color-palette-swatch${activeColor && activeColor.toLowerCase() === color.toLowerCase() ? " active" : ""}`,
641
+ style: { backgroundColor: color },
642
+ onClick: () => handleColor(color),
643
+ title: color
644
+ },
645
+ color
646
+ )) }, ri)) })
647
+ ] }) })
648
+ ]
649
+ }
650
+ );
411
651
  }
412
652
 
413
653
  // src/toolbar/BoldTool.tsx
@@ -416,7 +656,15 @@ import { jsx as jsx13 } from "react/jsx-runtime";
416
656
  function BoldTool() {
417
657
  const { editorRef, isApple, rangeStyle } = useEditor();
418
658
  const isActive = rangeStyle?.bold === true;
419
- return /* @__PURE__ */ jsx13("div", { className: `menu-item__bold ${isActive ? "active" : ""}`, title: `Bold(${isApple ? "\u2318" : "Ctrl"}+B)`, onClick: () => editorRef.current?.command.executeBold(), children: /* @__PURE__ */ jsx13(Bold, { size: 16 }) });
659
+ return /* @__PURE__ */ jsx13(
660
+ "div",
661
+ {
662
+ className: `menu-item__bold ${isActive ? "active" : ""}`,
663
+ title: `Bold(${isApple ? "\u2318" : "Ctrl"}+B)`,
664
+ onClick: () => editorRef.current?.command.executeBold(),
665
+ children: /* @__PURE__ */ jsx13(Bold, { size: 16 })
666
+ }
667
+ );
420
668
  }
421
669
 
422
670
  // src/toolbar/ItalicTool.tsx
@@ -425,7 +673,15 @@ import { jsx as jsx14 } from "react/jsx-runtime";
425
673
  function ItalicTool() {
426
674
  const { editorRef, isApple, rangeStyle } = useEditor();
427
675
  const isActive = rangeStyle?.italic === true;
428
- return /* @__PURE__ */ jsx14("div", { className: `menu-item__italic ${isActive ? "active" : ""}`, title: `Italic(${isApple ? "\u2318" : "Ctrl"}+I)`, onClick: () => editorRef.current?.command.executeItalic(), children: /* @__PURE__ */ jsx14(Italic, { size: 16 }) });
676
+ return /* @__PURE__ */ jsx14(
677
+ "div",
678
+ {
679
+ className: `menu-item__italic ${isActive ? "active" : ""}`,
680
+ title: `Italic(${isApple ? "\u2318" : "Ctrl"}+I)`,
681
+ onClick: () => editorRef.current?.command.executeItalic(),
682
+ children: /* @__PURE__ */ jsx14(Italic, { size: 16 })
683
+ }
684
+ );
429
685
  }
430
686
 
431
687
  // src/toolbar/UnderlineTool.tsx
@@ -437,13 +693,41 @@ function UnderlineTool() {
437
693
  const { editorRef, isApple, rangeStyle } = useEditor();
438
694
  const optionsRef = useRef9(null);
439
695
  const isActive = rangeStyle?.underline === true;
440
- return /* @__PURE__ */ jsxs9("div", { className: `menu-item__underline ${isActive ? "active" : ""}`, title: `Underline(${isApple ? "\u2318" : "Ctrl"}+U)`, children: [
441
- /* @__PURE__ */ jsx15(UnderlineIcon, { size: 16, onClick: () => editorRef.current?.command.executeUnderline(), style: { cursor: "pointer" } }),
442
- /* @__PURE__ */ jsx15("span", { className: "select", onClick: () => optionsRef.current?.classList.toggle("visible") }),
443
- /* @__PURE__ */ jsx15("div", { className: "options", ref: optionsRef, children: /* @__PURE__ */ jsx15("ul", { children: STYLES.map((style) => /* @__PURE__ */ jsx15("li", { "data-decoration-style": style, onClick: () => {
444
- editorRef.current?.command.executeUnderline({ style });
445
- }, children: /* @__PURE__ */ jsx15("i", {}) }, style)) }) })
446
- ] });
696
+ return /* @__PURE__ */ jsxs9(
697
+ "div",
698
+ {
699
+ className: `menu-item__underline ${isActive ? "active" : ""}`,
700
+ title: `Underline(${isApple ? "\u2318" : "Ctrl"}+U)`,
701
+ children: [
702
+ /* @__PURE__ */ jsx15(
703
+ UnderlineIcon,
704
+ {
705
+ size: 16,
706
+ onClick: () => editorRef.current?.command.executeUnderline(),
707
+ style: { cursor: "pointer" }
708
+ }
709
+ ),
710
+ /* @__PURE__ */ jsx15(
711
+ "span",
712
+ {
713
+ className: "select",
714
+ onClick: () => optionsRef.current?.classList.toggle("visible")
715
+ }
716
+ ),
717
+ /* @__PURE__ */ jsx15("div", { className: "options", ref: optionsRef, children: /* @__PURE__ */ jsx15("ul", { children: STYLES.map((style) => /* @__PURE__ */ jsx15(
718
+ "li",
719
+ {
720
+ "data-decoration-style": style,
721
+ onClick: () => {
722
+ editorRef.current?.command.executeUnderline({ style });
723
+ },
724
+ children: /* @__PURE__ */ jsx15("i", {})
725
+ },
726
+ style
727
+ )) }) })
728
+ ]
729
+ }
730
+ );
447
731
  }
448
732
 
449
733
  // src/toolbar/StrikeoutTool.tsx
@@ -452,7 +736,15 @@ import { jsx as jsx16 } from "react/jsx-runtime";
452
736
  function StrikeoutTool() {
453
737
  const { editorRef, rangeStyle } = useEditor();
454
738
  const isActive = rangeStyle?.strikeout === true;
455
- return /* @__PURE__ */ jsx16("div", { className: `menu-item__strikeout ${isActive ? "active" : ""}`, title: "Strikethrough", onClick: () => editorRef.current?.command.executeStrikeout(), children: /* @__PURE__ */ jsx16(Strikethrough, { size: 16 }) });
739
+ return /* @__PURE__ */ jsx16(
740
+ "div",
741
+ {
742
+ className: `menu-item__strikeout ${isActive ? "active" : ""}`,
743
+ title: "Strikethrough",
744
+ onClick: () => editorRef.current?.command.executeStrikeout(),
745
+ children: /* @__PURE__ */ jsx16(Strikethrough, { size: 16 })
746
+ }
747
+ );
456
748
  }
457
749
 
458
750
  // src/toolbar/LeftAlignTool.tsx
@@ -461,7 +753,15 @@ import { jsx as jsx17 } from "react/jsx-runtime";
461
753
  function LeftAlignTool() {
462
754
  const { editorRef, isApple, rangeStyle } = useEditor();
463
755
  const isActive = !rangeStyle?.rowFlex || rangeStyle.rowFlex === "left";
464
- return /* @__PURE__ */ jsx17("div", { className: `menu-item__left ${isActive ? "active" : ""}`, title: `Left align(${isApple ? "\u2318" : "Ctrl"}+L)`, onClick: () => editorRef.current?.command.executeRowFlex("left"), children: /* @__PURE__ */ jsx17(AlignLeft, { size: 16 }) });
756
+ return /* @__PURE__ */ jsx17(
757
+ "div",
758
+ {
759
+ className: `menu-item__left ${isActive ? "active" : ""}`,
760
+ title: `Left align(${isApple ? "\u2318" : "Ctrl"}+L)`,
761
+ onClick: () => editorRef.current?.command.executeRowFlex("left"),
762
+ children: /* @__PURE__ */ jsx17(AlignLeft, { size: 16 })
763
+ }
764
+ );
465
765
  }
466
766
 
467
767
  // src/toolbar/CenterAlignTool.tsx
@@ -470,7 +770,15 @@ import { jsx as jsx18 } from "react/jsx-runtime";
470
770
  function CenterAlignTool() {
471
771
  const { editorRef, isApple, rangeStyle } = useEditor();
472
772
  const isActive = rangeStyle?.rowFlex === "center";
473
- return /* @__PURE__ */ jsx18("div", { className: `menu-item__center ${isActive ? "active" : ""}`, title: `Center align(${isApple ? "\u2318" : "Ctrl"}+E)`, onClick: () => editorRef.current?.command.executeRowFlex("center"), children: /* @__PURE__ */ jsx18(AlignCenter, { size: 16 }) });
773
+ return /* @__PURE__ */ jsx18(
774
+ "div",
775
+ {
776
+ className: `menu-item__center ${isActive ? "active" : ""}`,
777
+ title: `Center align(${isApple ? "\u2318" : "Ctrl"}+E)`,
778
+ onClick: () => editorRef.current?.command.executeRowFlex("center"),
779
+ children: /* @__PURE__ */ jsx18(AlignCenter, { size: 16 })
780
+ }
781
+ );
474
782
  }
475
783
 
476
784
  // src/toolbar/RightAlignTool.tsx
@@ -479,7 +787,15 @@ import { jsx as jsx19 } from "react/jsx-runtime";
479
787
  function RightAlignTool() {
480
788
  const { editorRef, isApple, rangeStyle } = useEditor();
481
789
  const isActive = rangeStyle?.rowFlex === "right";
482
- return /* @__PURE__ */ jsx19("div", { className: `menu-item__right ${isActive ? "active" : ""}`, title: `Right align(${isApple ? "\u2318" : "Ctrl"}+R)`, onClick: () => editorRef.current?.command.executeRowFlex("right"), children: /* @__PURE__ */ jsx19(AlignRight, { size: 16 }) });
790
+ return /* @__PURE__ */ jsx19(
791
+ "div",
792
+ {
793
+ className: `menu-item__right ${isActive ? "active" : ""}`,
794
+ title: `Right align(${isApple ? "\u2318" : "Ctrl"}+R)`,
795
+ onClick: () => editorRef.current?.command.executeRowFlex("right"),
796
+ children: /* @__PURE__ */ jsx19(AlignRight, { size: 16 })
797
+ }
798
+ );
483
799
  }
484
800
 
485
801
  // src/toolbar/JustifyTool.tsx
@@ -488,7 +804,15 @@ import { jsx as jsx20 } from "react/jsx-runtime";
488
804
  function JustifyTool() {
489
805
  const { editorRef, isApple, rangeStyle } = useEditor();
490
806
  const isActive = rangeStyle?.rowFlex === "justify" || rangeStyle?.rowFlex === "alignment";
491
- return /* @__PURE__ */ jsx20("div", { className: `menu-item__justify ${isActive ? "active" : ""}`, title: `Distribute(${isApple ? "\u2318" : "Ctrl"}+Shift+J)`, onClick: () => editorRef.current?.command.executeRowFlex("justify"), children: /* @__PURE__ */ jsx20(AlignJustify, { size: 16 }) });
807
+ return /* @__PURE__ */ jsx20(
808
+ "div",
809
+ {
810
+ className: `menu-item__justify ${isActive ? "active" : ""}`,
811
+ title: `Distribute(${isApple ? "\u2318" : "Ctrl"}+Shift+J)`,
812
+ onClick: () => editorRef.current?.command.executeRowFlex("justify"),
813
+ children: /* @__PURE__ */ jsx20(AlignJustify, { size: 16 })
814
+ }
815
+ );
492
816
  }
493
817
 
494
818
  // src/toolbar/ListTool.tsx
@@ -511,19 +835,22 @@ var UL_PRESETS = [
511
835
  { preset: "ulStar", label: "Star", preview: ["\u2605", "\u25CB", "\u25A0"] },
512
836
  { preset: "ulCheckArr", label: "Check Arrow", preview: ["\u27A4", "\u25CB", "\u25A0"] }
513
837
  ];
514
- function PresetCell({ option, onClick }) {
515
- return /* @__PURE__ */ jsx21(
838
+ function PresetCell({
839
+ option,
840
+ onClick
841
+ }) {
842
+ return /* @__PURE__ */ jsx21("div", { onClick, className: "list-preset-cell", title: option.label, children: option.preview.map((item, i) => /* @__PURE__ */ jsxs10(
516
843
  "div",
517
844
  {
518
- onClick,
519
- className: "list-preset-cell",
520
- title: option.label,
521
- children: option.preview.map((item, i) => /* @__PURE__ */ jsxs10("div", { className: "list-preset-line", style: { paddingLeft: `${i * 10}px` }, children: [
845
+ className: "list-preset-line",
846
+ style: { paddingLeft: `${i * 10}px` },
847
+ children: [
522
848
  /* @__PURE__ */ jsx21("span", { className: "list-preset-marker", children: item }),
523
849
  /* @__PURE__ */ jsx21("span", { className: "list-preset-text" })
524
- ] }, i))
525
- }
526
- );
850
+ ]
851
+ },
852
+ i
853
+ )) });
527
854
  }
528
855
  function ListTool() {
529
856
  const { editorRef, isApple, rangeStyle } = useEditor();
@@ -549,51 +876,109 @@ function ListTool() {
549
876
  editorRef.current?.command.executeListOutdent();
550
877
  close();
551
878
  };
552
- return /* @__PURE__ */ jsxs10("div", { className: `menu-item__list ${isActive ? "active" : ""}`, title: `List(${isApple ? "\u2318" : "Ctrl"}+Shift+U)`, children: [
553
- /* @__PURE__ */ jsx21(List, { size: 16, onClick: () => optionsRef.current?.classList.toggle("visible"), style: { cursor: "pointer" } }),
554
- /* @__PURE__ */ jsx21("div", { className: "options", ref: optionsRef, style: { width: "320px" }, children: /* @__PURE__ */ jsxs10("div", { style: { padding: "8px" }, children: [
555
- /* @__PURE__ */ jsxs10("div", { style: { display: "flex", gap: "4px", marginBottom: "8px" }, children: [
879
+ return /* @__PURE__ */ jsxs10(
880
+ "div",
881
+ {
882
+ className: `menu-item__list ${isActive ? "active" : ""}`,
883
+ title: `List(${isApple ? "\u2318" : "Ctrl"}+Shift+U)`,
884
+ children: [
556
885
  /* @__PURE__ */ jsx21(
557
- "button",
886
+ List,
558
887
  {
559
- onClick: () => handleList("ul", "checkbox"),
560
- className: "list-quick-btn",
561
- children: "Checkbox"
888
+ size: 16,
889
+ onClick: () => optionsRef.current?.classList.toggle("visible"),
890
+ style: { cursor: "pointer" }
562
891
  }
563
892
  ),
564
- /* @__PURE__ */ jsx21("button", { onClick: handleIndent, className: "list-quick-btn", title: "Indent (Tab)", children: /* @__PURE__ */ jsx21(Indent, { size: 14 }) }),
565
- /* @__PURE__ */ jsx21("button", { onClick: handleOutdent, className: "list-quick-btn", title: "Outdent (Shift+Tab)", children: /* @__PURE__ */ jsx21(Outdent, { size: 14 }) })
566
- ] }),
567
- /* @__PURE__ */ jsxs10("div", { style: { marginBottom: "8px" }, children: [
568
- /* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "center", gap: "4px", fontSize: "11px", color: "#667085", marginBottom: "6px", fontWeight: 500 }, children: [
569
- /* @__PURE__ */ jsx21(ListOrdered, { size: 12 }),
570
- "Ordered List"
571
- ] }),
572
- /* @__PURE__ */ jsx21("div", { className: "list-preset-grid", children: OL_PRESETS.map((option) => /* @__PURE__ */ jsx21(
573
- PresetCell,
574
- {
575
- option,
576
- onClick: () => handlePreset("ol", option.preset)
577
- },
578
- option.preset
579
- )) })
580
- ] }),
581
- /* @__PURE__ */ jsxs10("div", { children: [
582
- /* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "center", gap: "4px", fontSize: "11px", color: "#667085", marginBottom: "6px", fontWeight: 500 }, children: [
583
- /* @__PURE__ */ jsx21(List, { size: 12 }),
584
- "Unordered List"
585
- ] }),
586
- /* @__PURE__ */ jsx21("div", { className: "list-preset-grid", children: UL_PRESETS.map((option) => /* @__PURE__ */ jsx21(
587
- PresetCell,
588
- {
589
- option,
590
- onClick: () => handlePreset("ul", option.preset)
591
- },
592
- option.preset
593
- )) })
594
- ] })
595
- ] }) })
596
- ] });
893
+ /* @__PURE__ */ jsx21("div", { className: "options", ref: optionsRef, style: { width: "320px" }, children: /* @__PURE__ */ jsxs10("div", { style: { padding: "8px" }, children: [
894
+ /* @__PURE__ */ jsxs10("div", { style: { display: "flex", gap: "4px", marginBottom: "8px" }, children: [
895
+ /* @__PURE__ */ jsx21(
896
+ "button",
897
+ {
898
+ onClick: () => handleList("ul", "checkbox"),
899
+ className: "list-quick-btn",
900
+ children: "Checkbox"
901
+ }
902
+ ),
903
+ /* @__PURE__ */ jsx21(
904
+ "button",
905
+ {
906
+ onClick: handleIndent,
907
+ className: "list-quick-btn",
908
+ title: "Indent (Tab)",
909
+ children: /* @__PURE__ */ jsx21(Indent, { size: 14 })
910
+ }
911
+ ),
912
+ /* @__PURE__ */ jsx21(
913
+ "button",
914
+ {
915
+ onClick: handleOutdent,
916
+ className: "list-quick-btn",
917
+ title: "Outdent (Shift+Tab)",
918
+ children: /* @__PURE__ */ jsx21(Outdent, { size: 14 })
919
+ }
920
+ )
921
+ ] }),
922
+ /* @__PURE__ */ jsxs10("div", { style: { marginBottom: "8px" }, children: [
923
+ /* @__PURE__ */ jsxs10(
924
+ "div",
925
+ {
926
+ style: {
927
+ display: "flex",
928
+ alignItems: "center",
929
+ gap: "4px",
930
+ fontSize: "11px",
931
+ color: "#667085",
932
+ marginBottom: "6px",
933
+ fontWeight: 500
934
+ },
935
+ children: [
936
+ /* @__PURE__ */ jsx21(ListOrdered, { size: 12 }),
937
+ "Ordered List"
938
+ ]
939
+ }
940
+ ),
941
+ /* @__PURE__ */ jsx21("div", { className: "list-preset-grid", children: OL_PRESETS.map((option) => /* @__PURE__ */ jsx21(
942
+ PresetCell,
943
+ {
944
+ option,
945
+ onClick: () => handlePreset("ol", option.preset)
946
+ },
947
+ option.preset
948
+ )) })
949
+ ] }),
950
+ /* @__PURE__ */ jsxs10("div", { children: [
951
+ /* @__PURE__ */ jsxs10(
952
+ "div",
953
+ {
954
+ style: {
955
+ display: "flex",
956
+ alignItems: "center",
957
+ gap: "4px",
958
+ fontSize: "11px",
959
+ color: "#667085",
960
+ marginBottom: "6px",
961
+ fontWeight: 500
962
+ },
963
+ children: [
964
+ /* @__PURE__ */ jsx21(List, { size: 12 }),
965
+ "Unordered List"
966
+ ]
967
+ }
968
+ ),
969
+ /* @__PURE__ */ jsx21("div", { className: "list-preset-grid", children: UL_PRESETS.map((option) => /* @__PURE__ */ jsx21(
970
+ PresetCell,
971
+ {
972
+ option,
973
+ onClick: () => handlePreset("ul", option.preset)
974
+ },
975
+ option.preset
976
+ )) })
977
+ ] })
978
+ ] }) })
979
+ ]
980
+ }
981
+ );
597
982
  }
598
983
 
599
984
  // src/toolbar/ImageTool.tsx
@@ -619,10 +1004,25 @@ function ImageTool() {
619
1004
  };
620
1005
  e.target.value = "";
621
1006
  };
622
- return /* @__PURE__ */ jsxs11("div", { className: "menu-item__image", onClick: () => document.getElementById("image")?.click(), children: [
623
- /* @__PURE__ */ jsx22(ImageIcon, { size: 16 }),
624
- /* @__PURE__ */ jsx22("input", { type: "file", id: "image", accept: ".png, .jpg, .jpeg, .svg, .gif", onChange: handleImageUpload })
625
- ] });
1007
+ return /* @__PURE__ */ jsxs11(
1008
+ "div",
1009
+ {
1010
+ className: "menu-item__image",
1011
+ onClick: () => document.getElementById("image")?.click(),
1012
+ children: [
1013
+ /* @__PURE__ */ jsx22(ImageIcon, { size: 16 }),
1014
+ /* @__PURE__ */ jsx22(
1015
+ "input",
1016
+ {
1017
+ type: "file",
1018
+ id: "image",
1019
+ accept: ".png, .jpg, .jpeg, .svg, .gif",
1020
+ onChange: handleImageUpload
1021
+ }
1022
+ )
1023
+ ]
1024
+ }
1025
+ );
626
1026
  }
627
1027
 
628
1028
  // src/toolbar/SeparatorTool.tsx
@@ -647,62 +1047,138 @@ function SeparatorTool() {
647
1047
  const lineColor = "#344054";
648
1048
  const handleSeparator = (e, dashArray) => {
649
1049
  e.stopPropagation();
650
- editorRef.current?.command.executeSeparator(dashArray, { lineWidth: selectedWidth });
1050
+ editorRef.current?.command.executeSeparator(dashArray, {
1051
+ lineWidth: selectedWidth
1052
+ });
651
1053
  optionsRef.current?.classList.remove("visible");
652
1054
  };
653
- return /* @__PURE__ */ jsx23("div", { className: "menu-item", title: "Separator", children: /* @__PURE__ */ jsxs12("span", { className: "menu-item__separator", onClick: () => optionsRef.current?.classList.toggle("visible"), style: { display: "flex", alignItems: "center", justifyContent: "center", width: "28px", height: "28px", cursor: "pointer", margin: "0 2px", borderRadius: "8px", color: "#475467", transition: "all 0.2s", position: "relative" }, children: [
654
- /* @__PURE__ */ jsx23(Minus, { size: 16 }),
655
- /* @__PURE__ */ jsx23("div", { className: "options", ref: optionsRef, style: { width: "220px", height: "auto" }, children: /* @__PURE__ */ jsxs12("div", { style: { padding: "8px 10px 10px" }, children: [
656
- /* @__PURE__ */ jsx23("ul", { style: { margin: 0, padding: 0, listStyle: "none" }, children: DASH_STYLES.map(({ label, dashArray }) => /* @__PURE__ */ jsxs12(
657
- "li",
658
- {
659
- onClick: (e) => handleSeparator(e, dashArray),
660
- style: { display: "flex", alignItems: "center", gap: "10px", padding: "5px 6px", cursor: "pointer", borderRadius: "4px" },
661
- children: [
662
- /* @__PURE__ */ jsx23("svg", { style: { flex: 1, minWidth: 0, overflow: "hidden" }, height: "8", children: /* @__PURE__ */ jsx23(
663
- "line",
664
- {
665
- x1: "0",
666
- y1: "4",
667
- x2: "100%",
668
- y2: "4",
669
- stroke: lineColor,
670
- strokeWidth: selectedWidth,
671
- strokeDasharray: dashArray.length ? dashArray.join(",") : "none"
672
- }
673
- ) }),
674
- /* @__PURE__ */ jsx23("span", { style: { fontSize: "11px", color: "#475467", whiteSpace: "nowrap", flexShrink: 0 }, children: label })
675
- ]
676
- },
677
- label
678
- )) }),
679
- /* @__PURE__ */ jsxs12("div", { style: { borderTop: "1px solid #e4e7ec", marginTop: "8px", paddingTop: "8px" }, children: [
680
- /* @__PURE__ */ jsx23("div", { style: { fontSize: "11px", color: "#667085", marginBottom: "6px", fontWeight: 500 }, children: "Line Width" }),
681
- /* @__PURE__ */ jsx23("div", { style: { display: "flex", gap: "4px" }, children: LINE_WIDTHS.map(({ label, value }) => /* @__PURE__ */ jsx23(
682
- "button",
1055
+ return /* @__PURE__ */ jsx23("div", { className: "menu-item", title: "Separator", children: /* @__PURE__ */ jsxs12(
1056
+ "span",
1057
+ {
1058
+ className: "menu-item__separator",
1059
+ onClick: () => optionsRef.current?.classList.toggle("visible"),
1060
+ style: {
1061
+ display: "flex",
1062
+ alignItems: "center",
1063
+ justifyContent: "center",
1064
+ width: "28px",
1065
+ height: "28px",
1066
+ cursor: "pointer",
1067
+ margin: "0 2px",
1068
+ borderRadius: "8px",
1069
+ color: "#475467",
1070
+ transition: "all 0.2s",
1071
+ position: "relative"
1072
+ },
1073
+ children: [
1074
+ /* @__PURE__ */ jsx23(Minus, { size: 16 }),
1075
+ /* @__PURE__ */ jsx23(
1076
+ "div",
683
1077
  {
684
- onClick: (e) => {
685
- e.stopPropagation();
686
- setSelectedWidth(value);
687
- },
688
- style: {
689
- flex: 1,
690
- padding: "3px 6px",
691
- fontSize: "11px",
692
- border: `1px solid ${selectedWidth === value ? "#3b82f6" : "#d0d5dd"}`,
693
- borderRadius: "4px",
694
- background: selectedWidth === value ? "#eff6ff" : "#fff",
695
- color: selectedWidth === value ? "#3b82f6" : "#475467",
696
- cursor: "pointer",
697
- fontWeight: selectedWidth === value ? 600 : 400
698
- },
699
- children: label
700
- },
701
- value
702
- )) })
703
- ] })
704
- ] }) })
705
- ] }) });
1078
+ className: "options",
1079
+ ref: optionsRef,
1080
+ style: { width: "220px", height: "auto" },
1081
+ children: /* @__PURE__ */ jsxs12("div", { style: { padding: "8px 10px 10px" }, children: [
1082
+ /* @__PURE__ */ jsx23("ul", { style: { margin: 0, padding: 0, listStyle: "none" }, children: DASH_STYLES.map(({ label, dashArray }) => /* @__PURE__ */ jsxs12(
1083
+ "li",
1084
+ {
1085
+ onClick: (e) => handleSeparator(e, dashArray),
1086
+ style: {
1087
+ display: "flex",
1088
+ alignItems: "center",
1089
+ gap: "10px",
1090
+ padding: "5px 6px",
1091
+ cursor: "pointer",
1092
+ borderRadius: "4px"
1093
+ },
1094
+ children: [
1095
+ /* @__PURE__ */ jsx23(
1096
+ "svg",
1097
+ {
1098
+ style: { flex: 1, minWidth: 0, overflow: "hidden" },
1099
+ height: "8",
1100
+ children: /* @__PURE__ */ jsx23(
1101
+ "line",
1102
+ {
1103
+ x1: "0",
1104
+ y1: "4",
1105
+ x2: "100%",
1106
+ y2: "4",
1107
+ stroke: lineColor,
1108
+ strokeWidth: selectedWidth,
1109
+ strokeDasharray: dashArray.length ? dashArray.join(",") : "none"
1110
+ }
1111
+ )
1112
+ }
1113
+ ),
1114
+ /* @__PURE__ */ jsx23(
1115
+ "span",
1116
+ {
1117
+ style: {
1118
+ fontSize: "11px",
1119
+ color: "#475467",
1120
+ whiteSpace: "nowrap",
1121
+ flexShrink: 0
1122
+ },
1123
+ children: label
1124
+ }
1125
+ )
1126
+ ]
1127
+ },
1128
+ label
1129
+ )) }),
1130
+ /* @__PURE__ */ jsxs12(
1131
+ "div",
1132
+ {
1133
+ style: {
1134
+ borderTop: "1px solid #e4e7ec",
1135
+ marginTop: "8px",
1136
+ paddingTop: "8px"
1137
+ },
1138
+ children: [
1139
+ /* @__PURE__ */ jsx23(
1140
+ "div",
1141
+ {
1142
+ style: {
1143
+ fontSize: "11px",
1144
+ color: "#667085",
1145
+ marginBottom: "6px",
1146
+ fontWeight: 500
1147
+ },
1148
+ children: "Line Width"
1149
+ }
1150
+ ),
1151
+ /* @__PURE__ */ jsx23("div", { style: { display: "flex", gap: "4px" }, children: LINE_WIDTHS.map(({ label, value }) => /* @__PURE__ */ jsx23(
1152
+ "button",
1153
+ {
1154
+ onClick: (e) => {
1155
+ e.stopPropagation();
1156
+ setSelectedWidth(value);
1157
+ },
1158
+ style: {
1159
+ flex: 1,
1160
+ padding: "3px 6px",
1161
+ fontSize: "11px",
1162
+ border: `1px solid ${selectedWidth === value ? "#3b82f6" : "#d0d5dd"}`,
1163
+ borderRadius: "4px",
1164
+ background: selectedWidth === value ? "#eff6ff" : "#fff",
1165
+ color: selectedWidth === value ? "#3b82f6" : "#475467",
1166
+ cursor: "pointer",
1167
+ fontWeight: selectedWidth === value ? 600 : 400
1168
+ },
1169
+ children: label
1170
+ },
1171
+ value
1172
+ )) })
1173
+ ]
1174
+ }
1175
+ )
1176
+ ] })
1177
+ }
1178
+ )
1179
+ ]
1180
+ }
1181
+ ) });
706
1182
  }
707
1183
 
708
1184
  // src/toolbar/WatermarkTool.tsx
@@ -720,10 +1196,17 @@ function InsertElementTool() {
720
1196
  }
721
1197
  editorRef.current.command.executeSetZone("header");
722
1198
  };
723
- return /* @__PURE__ */ jsxs13("div", { className: "menu-item__insert-element", onClick: () => optionsRef.current?.classList.toggle("visible"), children: [
724
- /* @__PURE__ */ jsx24("i", { title: "Insert Element" }),
725
- /* @__PURE__ */ jsx24("div", { className: "options", ref: optionsRef, children: /* @__PURE__ */ jsx24("ul", { children: /* @__PURE__ */ jsx24("li", { onClick: handleHeader, children: "Add Header" }) }) })
726
- ] });
1199
+ return /* @__PURE__ */ jsxs13(
1200
+ "div",
1201
+ {
1202
+ className: "menu-item__insert-element",
1203
+ onClick: () => optionsRef.current?.classList.toggle("visible"),
1204
+ children: [
1205
+ /* @__PURE__ */ jsx24("i", { title: "Insert Element" }),
1206
+ /* @__PURE__ */ jsx24("div", { className: "options", ref: optionsRef, children: /* @__PURE__ */ jsx24("ul", { children: /* @__PURE__ */ jsx24("li", { onClick: handleHeader, children: "Add Header" }) }) })
1207
+ ]
1208
+ }
1209
+ );
727
1210
  }
728
1211
 
729
1212
  // src/toolbar/PageBreakTool.tsx
@@ -806,7 +1289,15 @@ function EditorToolbar() {
806
1289
  import { jsx as jsx27 } from "react/jsx-runtime";
807
1290
  function CatalogToggleTool() {
808
1291
  const { handleToggleCatalogAction } = useFooter();
809
- return /* @__PURE__ */ jsx27("div", { className: "catalog-mode", title: "Catalog", onClick: handleToggleCatalogAction, children: /* @__PURE__ */ jsx27("i", {}) });
1292
+ return /* @__PURE__ */ jsx27(
1293
+ "div",
1294
+ {
1295
+ className: "catalog-mode",
1296
+ title: "Catalog",
1297
+ onClick: handleToggleCatalogAction,
1298
+ children: /* @__PURE__ */ jsx27("i", {})
1299
+ }
1300
+ );
810
1301
  }
811
1302
 
812
1303
  // src/footer/PageModeTool.tsx
@@ -894,14 +1385,30 @@ function EditorModeTool() {
894
1385
  }
895
1386
  });
896
1387
  };
897
- return /* @__PURE__ */ jsx30("div", { className: "editor-mode", title: "Click to change mode", onClick: handleModeChange, children: editorMode });
1388
+ return /* @__PURE__ */ jsx30(
1389
+ "div",
1390
+ {
1391
+ className: "editor-mode",
1392
+ title: "Click to change mode",
1393
+ onClick: handleModeChange,
1394
+ children: editorMode
1395
+ }
1396
+ );
898
1397
  }
899
1398
 
900
1399
  // src/footer/PageScaleMinusTool.tsx
901
1400
  import { jsx as jsx31 } from "react/jsx-runtime";
902
1401
  function PageScaleMinusTool() {
903
1402
  const { editorRef } = useEditor();
904
- return /* @__PURE__ */ jsx31("div", { className: "page-scale-minus", title: "Zoom Out (Ctrl+-)", onClick: () => editorRef.current?.command.executePageScaleMinus(), children: /* @__PURE__ */ jsx31("i", {}) });
1403
+ return /* @__PURE__ */ jsx31(
1404
+ "div",
1405
+ {
1406
+ className: "page-scale-minus",
1407
+ title: "Zoom Out (Ctrl+-)",
1408
+ onClick: () => editorRef.current?.command.executePageScaleMinus(),
1409
+ children: /* @__PURE__ */ jsx31("i", {})
1410
+ }
1411
+ );
905
1412
  }
906
1413
 
907
1414
  // src/footer/PageScalePercentageTool.tsx
@@ -909,17 +1416,33 @@ import { jsxs as jsxs18 } from "react/jsx-runtime";
909
1416
  function PageScalePercentageTool() {
910
1417
  const { editorRef } = useEditor();
911
1418
  const { pageScale } = useFooter();
912
- return /* @__PURE__ */ jsxs18("span", { className: "page-scale-percentage", title: "Zoom Level", onClick: () => editorRef.current?.command.executePageScaleRecovery(), children: [
913
- pageScale,
914
- "%"
915
- ] });
1419
+ return /* @__PURE__ */ jsxs18(
1420
+ "span",
1421
+ {
1422
+ className: "page-scale-percentage",
1423
+ title: "Zoom Level",
1424
+ onClick: () => editorRef.current?.command.executePageScaleRecovery(),
1425
+ children: [
1426
+ pageScale,
1427
+ "%"
1428
+ ]
1429
+ }
1430
+ );
916
1431
  }
917
1432
 
918
1433
  // src/footer/PageScaleAddTool.tsx
919
1434
  import { jsx as jsx32 } from "react/jsx-runtime";
920
1435
  function PageScaleAddTool() {
921
1436
  const { editorRef } = useEditor();
922
- return /* @__PURE__ */ jsx32("div", { className: "page-scale-add", title: "Zoom In (Ctrl+=)", onClick: () => editorRef.current?.command.executePageScaleAdd(), children: /* @__PURE__ */ jsx32("i", {}) });
1437
+ return /* @__PURE__ */ jsx32(
1438
+ "div",
1439
+ {
1440
+ className: "page-scale-add",
1441
+ title: "Zoom In (Ctrl+=)",
1442
+ onClick: () => editorRef.current?.command.executePageScaleAdd(),
1443
+ children: /* @__PURE__ */ jsx32("i", {})
1444
+ }
1445
+ );
923
1446
  }
924
1447
 
925
1448
  // src/footer/PaperSizeTool.tsx
@@ -940,7 +1463,15 @@ function PaperSizeTool() {
940
1463
  };
941
1464
  return /* @__PURE__ */ jsxs19("div", { className: "paper-size", onClick: () => setVisible(!visible), children: [
942
1465
  /* @__PURE__ */ jsx33("i", { title: "Paper Type" }),
943
- /* @__PURE__ */ jsx33("div", { className: `options ${visible ? "visible" : ""}`, children: /* @__PURE__ */ jsx33("ul", { children: SIZES2.map(({ label, width, height, active }) => /* @__PURE__ */ jsx33("li", { onClick: () => handlePaperSize(width, height), className: active ? "active" : "", children: label }, label)) }) })
1466
+ /* @__PURE__ */ jsx33("div", { className: `options ${visible ? "visible" : ""}`, children: /* @__PURE__ */ jsx33("ul", { children: SIZES2.map(({ label, width, height, active }) => /* @__PURE__ */ jsx33(
1467
+ "li",
1468
+ {
1469
+ onClick: () => handlePaperSize(width, height),
1470
+ className: active ? "active" : "",
1471
+ children: label
1472
+ },
1473
+ label
1474
+ )) }) })
944
1475
  ] });
945
1476
  }
946
1477
 
@@ -957,7 +1488,14 @@ function PaperDirectionTool() {
957
1488
  return /* @__PURE__ */ jsxs20("div", { className: "paper-direction", onClick: () => setVisible(!visible), children: [
958
1489
  /* @__PURE__ */ jsx34("i", { title: "Paper Direction" }),
959
1490
  /* @__PURE__ */ jsx34("div", { className: `options ${visible ? "visible" : ""}`, children: /* @__PURE__ */ jsxs20("ul", { children: [
960
- /* @__PURE__ */ jsx34("li", { onClick: () => handlePaperDirection("vertical"), className: "active", children: "Portrait" }),
1491
+ /* @__PURE__ */ jsx34(
1492
+ "li",
1493
+ {
1494
+ onClick: () => handlePaperDirection("vertical"),
1495
+ className: "active",
1496
+ children: "Portrait"
1497
+ }
1498
+ ),
961
1499
  /* @__PURE__ */ jsx34("li", { onClick: () => handlePaperDirection("horizontal"), children: "Landscape" })
962
1500
  ] }) })
963
1501
  ] });
@@ -975,10 +1513,38 @@ function PaperMarginTool() {
975
1513
  new Dialog({
976
1514
  title: "Page Margins",
977
1515
  data: [
978
- { type: "text", label: "Top Margin (cm)", name: "top", required: true, value: `${pxToCm(topMargin)}`, placeholder: "e.g. 2.54" },
979
- { type: "text", label: "Bottom Margin (cm)", name: "bottom", required: true, value: `${pxToCm(bottomMargin)}`, placeholder: "e.g. 2.54" },
980
- { type: "text", label: "Left Margin (cm)", name: "left", required: true, value: `${pxToCm(leftMargin)}`, placeholder: "e.g. 2.54" },
981
- { type: "text", label: "Right Margin (cm)", name: "right", required: true, value: `${pxToCm(rightMargin)}`, placeholder: "e.g. 2.54" }
1516
+ {
1517
+ type: "text",
1518
+ label: "Top Margin (cm)",
1519
+ name: "top",
1520
+ required: true,
1521
+ value: `${pxToCm(topMargin)}`,
1522
+ placeholder: "e.g. 2.54"
1523
+ },
1524
+ {
1525
+ type: "text",
1526
+ label: "Bottom Margin (cm)",
1527
+ name: "bottom",
1528
+ required: true,
1529
+ value: `${pxToCm(bottomMargin)}`,
1530
+ placeholder: "e.g. 2.54"
1531
+ },
1532
+ {
1533
+ type: "text",
1534
+ label: "Left Margin (cm)",
1535
+ name: "left",
1536
+ required: true,
1537
+ value: `${pxToCm(leftMargin)}`,
1538
+ placeholder: "e.g. 2.54"
1539
+ },
1540
+ {
1541
+ type: "text",
1542
+ label: "Right Margin (cm)",
1543
+ name: "right",
1544
+ required: true,
1545
+ value: `${pxToCm(rightMargin)}`,
1546
+ placeholder: "e.g. 2.54"
1547
+ }
982
1548
  ],
983
1549
  onConfirm: (payload) => {
984
1550
  const top = payload.find((p) => p.name === "top")?.value;
@@ -998,7 +1564,15 @@ function PaperMarginTool() {
998
1564
  }
999
1565
  });
1000
1566
  };
1001
- return /* @__PURE__ */ jsx35("div", { className: "paper-margin", title: "Page Margins", onClick: handlePaperMargin, children: /* @__PURE__ */ jsx35("i", {}) });
1567
+ return /* @__PURE__ */ jsx35(
1568
+ "div",
1569
+ {
1570
+ className: "paper-margin",
1571
+ title: "Page Margins",
1572
+ onClick: handlePaperMargin,
1573
+ children: /* @__PURE__ */ jsx35("i", {})
1574
+ }
1575
+ );
1002
1576
  }
1003
1577
 
1004
1578
  // src/footer/FullscreenTool.tsx
@@ -1043,7 +1617,15 @@ function EditorOptionTool() {
1043
1617
  }
1044
1618
  });
1045
1619
  };
1046
- return /* @__PURE__ */ jsx37("div", { className: "editor-option", title: "Editor Settings", onClick: handleEditorOption, children: /* @__PURE__ */ jsx37("i", {}) });
1620
+ return /* @__PURE__ */ jsx37(
1621
+ "div",
1622
+ {
1623
+ className: "editor-option",
1624
+ title: "Editor Settings",
1625
+ onClick: handleEditorOption,
1626
+ children: /* @__PURE__ */ jsx37("i", {})
1627
+ }
1628
+ );
1047
1629
  }
1048
1630
 
1049
1631
  // src/footer/WatermarkFooterTool.tsx
@@ -1098,30 +1680,33 @@ function WatermarkFooterTool() {
1098
1680
  el.style.left = `${-rect.left + 4}px`;
1099
1681
  }
1100
1682
  }, [visible]);
1101
- const handleFileUpload = useCallback((e) => {
1102
- const file = e.target.files?.[0];
1103
- if (!file) return;
1104
- const reader = new FileReader();
1105
- reader.onload = () => {
1106
- const result = reader.result;
1107
- setImageData(result);
1108
- const img = new Image();
1109
- img.onload = () => {
1110
- const maxDim = 300;
1111
- let w = img.naturalWidth;
1112
- let h = img.naturalHeight;
1113
- if (w > maxDim || h > maxDim) {
1114
- const ratio = Math.min(maxDim / w, maxDim / h);
1115
- w = Math.round(w * ratio);
1116
- h = Math.round(h * ratio);
1117
- }
1118
- setImgWidth(w);
1119
- setImgHeight(h);
1683
+ const handleFileUpload = useCallback(
1684
+ (e) => {
1685
+ const file = e.target.files?.[0];
1686
+ if (!file) return;
1687
+ const reader = new FileReader();
1688
+ reader.onload = () => {
1689
+ const result = reader.result;
1690
+ setImageData(result);
1691
+ const img = new Image();
1692
+ img.onload = () => {
1693
+ const maxDim = 300;
1694
+ let w = img.naturalWidth;
1695
+ let h = img.naturalHeight;
1696
+ if (w > maxDim || h > maxDim) {
1697
+ const ratio = Math.min(maxDim / w, maxDim / h);
1698
+ w = Math.round(w * ratio);
1699
+ h = Math.round(h * ratio);
1700
+ }
1701
+ setImgWidth(w);
1702
+ setImgHeight(h);
1703
+ };
1704
+ img.src = result;
1120
1705
  };
1121
- img.src = result;
1122
- };
1123
- reader.readAsDataURL(file);
1124
- }, []);
1706
+ reader.readAsDataURL(file);
1707
+ },
1708
+ []
1709
+ );
1125
1710
  const handleApply = () => {
1126
1711
  if (!editorRef.current) return;
1127
1712
  if (tab === "text") {
@@ -1154,100 +1739,238 @@ function WatermarkFooterTool() {
1154
1739
  editorRef.current?.command.executeDeleteWatermark();
1155
1740
  setVisible(false);
1156
1741
  };
1157
- return /* @__PURE__ */ jsxs21("div", { className: "watermark-footer", ref: containerRef, onClick: () => setVisible(!visible), children: [
1158
- /* @__PURE__ */ jsx38("i", { title: "Watermark" }),
1159
- visible && /* @__PURE__ */ jsxs21(Fragment3, { children: [
1160
- /* @__PURE__ */ jsx38("div", { className: "wm-panel-mask", onClick: (e) => {
1161
- e.stopPropagation();
1162
- setVisible(false);
1163
- } }),
1164
- /* @__PURE__ */ jsxs21("div", { className: "watermark-footer-panel", ref: panelRef, onClick: (e) => e.stopPropagation(), children: [
1165
- /* @__PURE__ */ jsxs21("div", { className: "wm-panel-title", children: [
1166
- /* @__PURE__ */ jsx38("span", { children: "Watermark" }),
1167
- /* @__PURE__ */ jsx38("i", { onClick: () => setVisible(false) })
1168
- ] }),
1169
- /* @__PURE__ */ jsxs21("div", { className: "wm-panel-tabs", children: [
1170
- /* @__PURE__ */ jsx38("button", { className: `wm-panel-tab ${tab === "text" ? "active" : ""}`, onClick: () => setTab("text"), children: "Text" }),
1171
- /* @__PURE__ */ jsx38("button", { className: `wm-panel-tab ${tab === "image" ? "active" : ""}`, onClick: () => setTab("image"), children: "Image" })
1172
- ] }),
1173
- /* @__PURE__ */ jsxs21("div", { className: "wm-panel-body", children: [
1174
- tab === "text" ? /* @__PURE__ */ jsxs21(Fragment3, { children: [
1175
- /* @__PURE__ */ jsxs21("div", { className: "wm-panel-field", children: [
1176
- /* @__PURE__ */ jsx38("label", { children: "Text" }),
1177
- /* @__PURE__ */ jsx38("input", { type: "text", value: text, onChange: (e) => setText(e.target.value), placeholder: "Watermark text" })
1178
- ] }),
1179
- /* @__PURE__ */ jsxs21("div", { className: "wm-panel-field", children: [
1180
- /* @__PURE__ */ jsx38("label", { children: "Font" }),
1181
- /* @__PURE__ */ jsx38("select", { value: font, onChange: (e) => setFont(e.target.value), children: FONTS2.map((f) => /* @__PURE__ */ jsx38("option", { value: f.family, children: f.label }, f.family)) })
1182
- ] }),
1183
- /* @__PURE__ */ jsxs21("div", { className: "wm-panel-field", children: [
1184
- /* @__PURE__ */ jsx38("label", { children: "Color" }),
1185
- /* @__PURE__ */ jsx38("div", { className: "wm-panel-colors", children: COLOR_PALETTE2.flat().map((c) => /* @__PURE__ */ jsx38(
1186
- "div",
1187
- {
1188
- className: `wm-panel-color ${color.toLowerCase() === c.toLowerCase() ? "active" : ""}`,
1189
- style: { backgroundColor: c },
1190
- onClick: () => setColor(c)
1191
- },
1192
- c
1193
- )) })
1194
- ] })
1195
- ] }) : /* @__PURE__ */ jsxs21(Fragment3, { children: [
1196
- /* @__PURE__ */ jsxs21("div", { className: "wm-panel-field", children: [
1197
- /* @__PURE__ */ jsx38("label", { children: "Image" }),
1198
- /* @__PURE__ */ jsxs21("div", { style: { display: "flex", alignItems: "center", gap: "6px" }, children: [
1199
- /* @__PURE__ */ jsx38("button", { className: "wm-panel-upload", onClick: () => fileInputRef.current?.click(), children: "Choose File" }),
1200
- /* @__PURE__ */ jsx38("input", { ref: fileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: handleFileUpload }),
1201
- imageData && /* @__PURE__ */ jsx38("span", { style: { fontSize: "11px", color: "#667085" }, children: "Loaded" })
1202
- ] })
1203
- ] }),
1204
- imageData && /* @__PURE__ */ jsx38("div", { className: "wm-panel-field", children: /* @__PURE__ */ jsx38("div", { className: "wm-panel-preview", children: /* @__PURE__ */ jsx38("img", { src: imageData, alt: "preview", style: { maxWidth: "100%", maxHeight: "48px", objectFit: "contain" } }) }) }),
1205
- /* @__PURE__ */ jsxs21("div", { className: "wm-panel-field-row", children: [
1206
- /* @__PURE__ */ jsxs21("div", { className: "wm-panel-field wm-panel-field-half", children: [
1207
- /* @__PURE__ */ jsx38("label", { children: "W" }),
1208
- /* @__PURE__ */ jsx38("input", { type: "number", value: imgWidth, min: 10, onChange: (e) => setImgWidth(Number(e.target.value)) })
1209
- ] }),
1210
- /* @__PURE__ */ jsxs21("div", { className: "wm-panel-field wm-panel-field-half", children: [
1211
- /* @__PURE__ */ jsx38("label", { children: "H" }),
1212
- /* @__PURE__ */ jsx38("input", { type: "number", value: imgHeight, min: 10, onChange: (e) => setImgHeight(Number(e.target.value)) })
1213
- ] })
1214
- ] })
1215
- ] }),
1216
- /* @__PURE__ */ jsxs21("div", { className: "wm-panel-field", children: [
1217
- /* @__PURE__ */ jsxs21("label", { children: [
1218
- "Opacity ",
1219
- /* @__PURE__ */ jsxs21("span", { className: "wm-panel-value", children: [
1220
- opacity,
1221
- "%"
1222
- ] })
1223
- ] }),
1224
- /* @__PURE__ */ jsx38("input", { type: "range", min: 0, max: 100, value: opacity, onChange: (e) => setOpacity(Number(e.target.value)), className: "wm-panel-slider" })
1225
- ] }),
1226
- /* @__PURE__ */ jsxs21("div", { className: "wm-panel-field", children: [
1227
- /* @__PURE__ */ jsxs21("label", { children: [
1228
- "Rotation ",
1229
- /* @__PURE__ */ jsxs21("span", { className: "wm-panel-value", children: [
1230
- rotation,
1231
- "\xB0"
1232
- ] })
1233
- ] }),
1234
- /* @__PURE__ */ jsx38("input", { type: "range", min: -90, max: 90, value: rotation, onChange: (e) => setRotation(Number(e.target.value)), className: "wm-panel-slider" })
1235
- ] }),
1236
- /* @__PURE__ */ jsxs21("div", { className: "wm-panel-field", children: [
1237
- /* @__PURE__ */ jsx38("label", { children: "Position" }),
1238
- /* @__PURE__ */ jsxs21("div", { className: "wm-panel-toggle", children: [
1239
- /* @__PURE__ */ jsx38("button", { className: !inFront ? "active" : "", onClick: () => setInFront(false), children: "Behind" }),
1240
- /* @__PURE__ */ jsx38("button", { className: inFront ? "active" : "", onClick: () => setInFront(true), children: "In Front" })
1241
- ] })
1242
- ] })
1243
- ] }),
1244
- /* @__PURE__ */ jsxs21("div", { className: "wm-panel-actions", children: [
1245
- /* @__PURE__ */ jsx38("button", { className: "wm-panel-btn-delete", onClick: handleDelete, children: "Remove" }),
1246
- /* @__PURE__ */ jsx38("button", { className: "wm-panel-btn-apply", onClick: handleApply, children: "Apply" })
1742
+ return /* @__PURE__ */ jsxs21(
1743
+ "div",
1744
+ {
1745
+ className: "watermark-footer",
1746
+ ref: containerRef,
1747
+ onClick: () => setVisible(!visible),
1748
+ children: [
1749
+ /* @__PURE__ */ jsx38("i", { title: "Watermark" }),
1750
+ visible && /* @__PURE__ */ jsxs21(Fragment3, { children: [
1751
+ /* @__PURE__ */ jsx38(
1752
+ "div",
1753
+ {
1754
+ className: "wm-panel-mask",
1755
+ onClick: (e) => {
1756
+ e.stopPropagation();
1757
+ setVisible(false);
1758
+ }
1759
+ }
1760
+ ),
1761
+ /* @__PURE__ */ jsxs21(
1762
+ "div",
1763
+ {
1764
+ className: "watermark-footer-panel",
1765
+ ref: panelRef,
1766
+ onClick: (e) => e.stopPropagation(),
1767
+ children: [
1768
+ /* @__PURE__ */ jsxs21("div", { className: "wm-panel-title", children: [
1769
+ /* @__PURE__ */ jsx38("span", { children: "Watermark" }),
1770
+ /* @__PURE__ */ jsx38("i", { onClick: () => setVisible(false) })
1771
+ ] }),
1772
+ /* @__PURE__ */ jsxs21("div", { className: "wm-panel-tabs", children: [
1773
+ /* @__PURE__ */ jsx38(
1774
+ "button",
1775
+ {
1776
+ className: `wm-panel-tab ${tab === "text" ? "active" : ""}`,
1777
+ onClick: () => setTab("text"),
1778
+ children: "Text"
1779
+ }
1780
+ ),
1781
+ /* @__PURE__ */ jsx38(
1782
+ "button",
1783
+ {
1784
+ className: `wm-panel-tab ${tab === "image" ? "active" : ""}`,
1785
+ onClick: () => setTab("image"),
1786
+ children: "Image"
1787
+ }
1788
+ )
1789
+ ] }),
1790
+ /* @__PURE__ */ jsxs21("div", { className: "wm-panel-body", children: [
1791
+ tab === "text" ? /* @__PURE__ */ jsxs21(Fragment3, { children: [
1792
+ /* @__PURE__ */ jsxs21("div", { className: "wm-panel-field", children: [
1793
+ /* @__PURE__ */ jsx38("label", { children: "Text" }),
1794
+ /* @__PURE__ */ jsx38(
1795
+ "input",
1796
+ {
1797
+ type: "text",
1798
+ value: text,
1799
+ onChange: (e) => setText(e.target.value),
1800
+ placeholder: "Watermark text"
1801
+ }
1802
+ )
1803
+ ] }),
1804
+ /* @__PURE__ */ jsxs21("div", { className: "wm-panel-field", children: [
1805
+ /* @__PURE__ */ jsx38("label", { children: "Font" }),
1806
+ /* @__PURE__ */ jsx38(
1807
+ "select",
1808
+ {
1809
+ value: font,
1810
+ onChange: (e) => setFont(e.target.value),
1811
+ children: FONTS2.map((f) => /* @__PURE__ */ jsx38("option", { value: f.family, children: f.label }, f.family))
1812
+ }
1813
+ )
1814
+ ] }),
1815
+ /* @__PURE__ */ jsxs21("div", { className: "wm-panel-field", children: [
1816
+ /* @__PURE__ */ jsx38("label", { children: "Color" }),
1817
+ /* @__PURE__ */ jsx38("div", { className: "wm-panel-colors", children: COLOR_PALETTE2.flat().map((c) => /* @__PURE__ */ jsx38(
1818
+ "div",
1819
+ {
1820
+ className: `wm-panel-color ${color.toLowerCase() === c.toLowerCase() ? "active" : ""}`,
1821
+ style: { backgroundColor: c },
1822
+ onClick: () => setColor(c)
1823
+ },
1824
+ c
1825
+ )) })
1826
+ ] })
1827
+ ] }) : /* @__PURE__ */ jsxs21(Fragment3, { children: [
1828
+ /* @__PURE__ */ jsxs21("div", { className: "wm-panel-field", children: [
1829
+ /* @__PURE__ */ jsx38("label", { children: "Image" }),
1830
+ /* @__PURE__ */ jsxs21(
1831
+ "div",
1832
+ {
1833
+ style: {
1834
+ display: "flex",
1835
+ alignItems: "center",
1836
+ gap: "6px"
1837
+ },
1838
+ children: [
1839
+ /* @__PURE__ */ jsx38(
1840
+ "button",
1841
+ {
1842
+ className: "wm-panel-upload",
1843
+ onClick: () => fileInputRef.current?.click(),
1844
+ children: "Choose File"
1845
+ }
1846
+ ),
1847
+ /* @__PURE__ */ jsx38(
1848
+ "input",
1849
+ {
1850
+ ref: fileInputRef,
1851
+ type: "file",
1852
+ accept: "image/*",
1853
+ style: { display: "none" },
1854
+ onChange: handleFileUpload
1855
+ }
1856
+ ),
1857
+ imageData && /* @__PURE__ */ jsx38("span", { style: { fontSize: "11px", color: "#667085" }, children: "Loaded" })
1858
+ ]
1859
+ }
1860
+ )
1861
+ ] }),
1862
+ imageData && /* @__PURE__ */ jsx38("div", { className: "wm-panel-field", children: /* @__PURE__ */ jsx38("div", { className: "wm-panel-preview", children: /* @__PURE__ */ jsx38(
1863
+ "img",
1864
+ {
1865
+ src: imageData,
1866
+ alt: "preview",
1867
+ style: {
1868
+ maxWidth: "100%",
1869
+ maxHeight: "48px",
1870
+ objectFit: "contain"
1871
+ }
1872
+ }
1873
+ ) }) }),
1874
+ /* @__PURE__ */ jsxs21("div", { className: "wm-panel-field-row", children: [
1875
+ /* @__PURE__ */ jsxs21("div", { className: "wm-panel-field wm-panel-field-half", children: [
1876
+ /* @__PURE__ */ jsx38("label", { children: "W" }),
1877
+ /* @__PURE__ */ jsx38(
1878
+ "input",
1879
+ {
1880
+ type: "number",
1881
+ value: imgWidth,
1882
+ min: 10,
1883
+ onChange: (e) => setImgWidth(Number(e.target.value))
1884
+ }
1885
+ )
1886
+ ] }),
1887
+ /* @__PURE__ */ jsxs21("div", { className: "wm-panel-field wm-panel-field-half", children: [
1888
+ /* @__PURE__ */ jsx38("label", { children: "H" }),
1889
+ /* @__PURE__ */ jsx38(
1890
+ "input",
1891
+ {
1892
+ type: "number",
1893
+ value: imgHeight,
1894
+ min: 10,
1895
+ onChange: (e) => setImgHeight(Number(e.target.value))
1896
+ }
1897
+ )
1898
+ ] })
1899
+ ] })
1900
+ ] }),
1901
+ /* @__PURE__ */ jsxs21("div", { className: "wm-panel-field", children: [
1902
+ /* @__PURE__ */ jsxs21("label", { children: [
1903
+ "Opacity ",
1904
+ /* @__PURE__ */ jsxs21("span", { className: "wm-panel-value", children: [
1905
+ opacity,
1906
+ "%"
1907
+ ] })
1908
+ ] }),
1909
+ /* @__PURE__ */ jsx38(
1910
+ "input",
1911
+ {
1912
+ type: "range",
1913
+ min: 0,
1914
+ max: 100,
1915
+ value: opacity,
1916
+ onChange: (e) => setOpacity(Number(e.target.value)),
1917
+ className: "wm-panel-slider"
1918
+ }
1919
+ )
1920
+ ] }),
1921
+ /* @__PURE__ */ jsxs21("div", { className: "wm-panel-field", children: [
1922
+ /* @__PURE__ */ jsxs21("label", { children: [
1923
+ "Rotation ",
1924
+ /* @__PURE__ */ jsxs21("span", { className: "wm-panel-value", children: [
1925
+ rotation,
1926
+ "\xB0"
1927
+ ] })
1928
+ ] }),
1929
+ /* @__PURE__ */ jsx38(
1930
+ "input",
1931
+ {
1932
+ type: "range",
1933
+ min: -90,
1934
+ max: 90,
1935
+ value: rotation,
1936
+ onChange: (e) => setRotation(Number(e.target.value)),
1937
+ className: "wm-panel-slider"
1938
+ }
1939
+ )
1940
+ ] }),
1941
+ /* @__PURE__ */ jsxs21("div", { className: "wm-panel-field", children: [
1942
+ /* @__PURE__ */ jsx38("label", { children: "Position" }),
1943
+ /* @__PURE__ */ jsxs21("div", { className: "wm-panel-toggle", children: [
1944
+ /* @__PURE__ */ jsx38(
1945
+ "button",
1946
+ {
1947
+ className: !inFront ? "active" : "",
1948
+ onClick: () => setInFront(false),
1949
+ children: "Behind"
1950
+ }
1951
+ ),
1952
+ /* @__PURE__ */ jsx38(
1953
+ "button",
1954
+ {
1955
+ className: inFront ? "active" : "",
1956
+ onClick: () => setInFront(true),
1957
+ children: "In Front"
1958
+ }
1959
+ )
1960
+ ] })
1961
+ ] })
1962
+ ] }),
1963
+ /* @__PURE__ */ jsxs21("div", { className: "wm-panel-actions", children: [
1964
+ /* @__PURE__ */ jsx38("button", { className: "wm-panel-btn-delete", onClick: handleDelete, children: "Remove" }),
1965
+ /* @__PURE__ */ jsx38("button", { className: "wm-panel-btn-apply", onClick: handleApply, children: "Apply" })
1966
+ ] })
1967
+ ]
1968
+ }
1969
+ )
1247
1970
  ] })
1248
- ] })
1249
- ] })
1250
- ] });
1971
+ ]
1972
+ }
1973
+ );
1251
1974
  }
1252
1975
 
1253
1976
  // src/EditorFooter.tsx