tetrons 2.2.1 → 2.2.3
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/app/layout.d.ts +1 -1
- package/dist/app/{layout.jsx → layout.js} +2 -5
- package/dist/app/page.d.ts +2 -2
- package/dist/app/page.js +6 -0
- package/dist/components/tetrons/EditorContent.d.ts +1 -2
- package/dist/components/tetrons/{EditorContent.jsx → EditorContent.js} +2 -24
- package/dist/components/tetrons/{ResizableImageComponent.jsx → ResizableImageComponent.js} +10 -12
- package/dist/components/tetrons/{ResizableVideoComponent.jsx → ResizableVideoComponent.js} +7 -8
- package/dist/components/tetrons/toolbar/ActionGroup.d.ts +1 -2
- package/dist/components/tetrons/toolbar/{ActionGroup.jsx → ActionGroup.js} +18 -39
- package/dist/components/tetrons/toolbar/ClipboardGroup.d.ts +1 -2
- package/dist/components/tetrons/toolbar/ClipboardGroup.js +31 -0
- package/dist/components/tetrons/toolbar/FileGroup.d.ts +1 -2
- package/dist/components/tetrons/toolbar/{FileGroup.jsx → FileGroup.js} +3 -6
- package/dist/components/tetrons/toolbar/FontStyleGroup.d.ts +1 -2
- package/dist/components/tetrons/toolbar/FontStyleGroup.js +63 -0
- package/dist/components/tetrons/toolbar/InsertGroup.d.ts +1 -2
- package/dist/components/tetrons/toolbar/InsertGroup.js +138 -0
- package/dist/components/tetrons/toolbar/ListAlignGroup.d.ts +1 -2
- package/dist/components/tetrons/toolbar/ListAlignGroup.js +7 -0
- package/dist/components/tetrons/toolbar/MiscGroup.d.ts +1 -2
- package/dist/components/tetrons/toolbar/MiscGroup.js +25 -0
- package/dist/components/tetrons/toolbar/TableContextMenu.d.ts +1 -2
- package/dist/components/tetrons/toolbar/{TableContextMenu.jsx → TableContextMenu.js} +3 -21
- package/dist/components/tetrons/toolbar/TetronsToolbar.d.ts +1 -2
- package/dist/components/tetrons/toolbar/{TetronsToolbar.jsx → TetronsToolbar.js} +2 -16
- package/dist/components/tetrons/toolbar/ToolbarButton.js +7 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.js +1 -0
- package/dist/index.mjs +731 -638
- package/dist/styles/styles/tetrons.css +371 -0
- package/dist/styles/tetrons.css +371 -0
- package/package.json +7 -4
- package/dist/app/page.jsx +0 -8
- package/dist/components/tetrons/toolbar/ClipboardGroup.jsx +0 -36
- package/dist/components/tetrons/toolbar/FontStyleGroup.jsx +0 -104
- package/dist/components/tetrons/toolbar/InsertGroup.jsx +0 -162
- package/dist/components/tetrons/toolbar/ListAlignGroup.jsx +0 -16
- package/dist/components/tetrons/toolbar/MiscGroup.jsx +0 -31
- package/dist/components/tetrons/toolbar/ToolbarButton.jsx +0 -8
- /package/dist/components/UI/{Button.jsx → Button.js} +0 -0
- /package/dist/components/UI/{Dropdown.jsx → Dropdown.js} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/components/tetrons/EditorContent.tsx
|
|
2
|
-
import
|
|
2
|
+
import React10 from "react";
|
|
3
3
|
|
|
4
4
|
// node_modules/orderedmap/dist/index.js
|
|
5
5
|
function OrderedMap(content) {
|
|
@@ -14345,10 +14345,10 @@ var FontSize = Mark2.create({
|
|
|
14345
14345
|
});
|
|
14346
14346
|
|
|
14347
14347
|
// src/components/tetrons/toolbar/TetronsToolbar.tsx
|
|
14348
|
-
import
|
|
14348
|
+
import React6, { useEffect as useEffect3 } from "react";
|
|
14349
14349
|
|
|
14350
14350
|
// src/components/tetrons/toolbar/ActionGroup.tsx
|
|
14351
|
-
import
|
|
14351
|
+
import { useEffect, useRef, useState } from "react";
|
|
14352
14352
|
import {
|
|
14353
14353
|
MdZoomIn,
|
|
14354
14354
|
MdZoomOut,
|
|
@@ -14359,9 +14359,10 @@ import {
|
|
|
14359
14359
|
|
|
14360
14360
|
// src/components/tetrons/toolbar/ToolbarButton.tsx
|
|
14361
14361
|
import React from "react";
|
|
14362
|
+
import { jsx } from "react/jsx-runtime";
|
|
14362
14363
|
var ToolbarButton = React.forwardRef(
|
|
14363
14364
|
({ icon: Icon, onClick, disabled = false, title, label, isActive = false }, ref) => {
|
|
14364
|
-
return /* @__PURE__ */
|
|
14365
|
+
return /* @__PURE__ */ jsx(
|
|
14365
14366
|
"button",
|
|
14366
14367
|
{
|
|
14367
14368
|
type: "button",
|
|
@@ -14370,9 +14371,9 @@ var ToolbarButton = React.forwardRef(
|
|
|
14370
14371
|
disabled,
|
|
14371
14372
|
title: title ?? label,
|
|
14372
14373
|
"aria-label": title ?? label,
|
|
14373
|
-
className: `
|
|
14374
|
-
|
|
14375
|
-
|
|
14374
|
+
className: `toolbar-button ${isActive ? "active" : ""}`,
|
|
14375
|
+
children: /* @__PURE__ */ jsx(Icon, { size: 20 })
|
|
14376
|
+
}
|
|
14376
14377
|
);
|
|
14377
14378
|
}
|
|
14378
14379
|
);
|
|
@@ -14380,6 +14381,7 @@ ToolbarButton.displayName = "ToolbarButton";
|
|
|
14380
14381
|
var ToolbarButton_default = ToolbarButton;
|
|
14381
14382
|
|
|
14382
14383
|
// src/components/tetrons/toolbar/ActionGroup.tsx
|
|
14384
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
14383
14385
|
function ActionGroup({ editor }) {
|
|
14384
14386
|
const [dropdownOpen, setDropdownOpen] = useState(false);
|
|
14385
14387
|
const dropdownRef = useRef(null);
|
|
@@ -14403,9 +14405,10 @@ function ActionGroup({ editor }) {
|
|
|
14403
14405
|
".ProseMirror"
|
|
14404
14406
|
);
|
|
14405
14407
|
if (element) {
|
|
14406
|
-
const
|
|
14408
|
+
const style = element.style;
|
|
14409
|
+
const currentZoom = parseFloat(style.zoom || "1");
|
|
14407
14410
|
const next = Math.min(currentZoom + 0.1, 2);
|
|
14408
|
-
|
|
14411
|
+
style.zoom = next.toString();
|
|
14409
14412
|
}
|
|
14410
14413
|
};
|
|
14411
14414
|
const zoomOut = () => {
|
|
@@ -14413,9 +14416,10 @@ function ActionGroup({ editor }) {
|
|
|
14413
14416
|
".ProseMirror"
|
|
14414
14417
|
);
|
|
14415
14418
|
if (element) {
|
|
14416
|
-
const
|
|
14419
|
+
const style = element.style;
|
|
14420
|
+
const currentZoom = parseFloat(style.zoom || "1");
|
|
14417
14421
|
const next = Math.max(currentZoom - 0.1, 0.5);
|
|
14418
|
-
|
|
14422
|
+
style.zoom = next.toString();
|
|
14419
14423
|
}
|
|
14420
14424
|
};
|
|
14421
14425
|
const handlePrint = () => {
|
|
@@ -14504,64 +14508,64 @@ function ActionGroup({ editor }) {
|
|
|
14504
14508
|
link.click();
|
|
14505
14509
|
document.body.removeChild(link);
|
|
14506
14510
|
};
|
|
14507
|
-
return /* @__PURE__ */
|
|
14508
|
-
"
|
|
14509
|
-
{
|
|
14510
|
-
|
|
14511
|
-
|
|
14512
|
-
|
|
14513
|
-
|
|
14514
|
-
|
|
14515
|
-
|
|
14516
|
-
|
|
14517
|
-
|
|
14518
|
-
|
|
14519
|
-
|
|
14520
|
-
|
|
14521
|
-
|
|
14522
|
-
|
|
14523
|
-
|
|
14524
|
-
|
|
14525
|
-
|
|
14526
|
-
|
|
14527
|
-
|
|
14528
|
-
/* @__PURE__ */
|
|
14529
|
-
|
|
14530
|
-
|
|
14531
|
-
|
|
14532
|
-
|
|
14533
|
-
|
|
14534
|
-
|
|
14535
|
-
|
|
14536
|
-
|
|
14537
|
-
|
|
14538
|
-
|
|
14539
|
-
|
|
14540
|
-
|
|
14541
|
-
|
|
14542
|
-
|
|
14543
|
-
|
|
14544
|
-
|
|
14545
|
-
|
|
14546
|
-
|
|
14547
|
-
|
|
14548
|
-
|
|
14549
|
-
|
|
14550
|
-
|
|
14551
|
-
|
|
14552
|
-
|
|
14553
|
-
|
|
14554
|
-
|
|
14555
|
-
|
|
14556
|
-
|
|
14557
|
-
|
|
14558
|
-
|
|
14559
|
-
|
|
14560
|
-
|
|
14561
|
-
|
|
14562
|
-
|
|
14563
|
-
)
|
|
14564
|
-
);
|
|
14511
|
+
return /* @__PURE__ */ jsxs("div", { className: "action-group", role: "group", "aria-label": "Editor actions", children: [
|
|
14512
|
+
/* @__PURE__ */ jsx2(ToolbarButton_default, { icon: MdZoomIn, onClick: zoomIn, title: "Zoom In" }),
|
|
14513
|
+
/* @__PURE__ */ jsx2(ToolbarButton_default, { icon: MdZoomOut, onClick: zoomOut, title: "Zoom Out" }),
|
|
14514
|
+
/* @__PURE__ */ jsx2(ToolbarButton_default, { icon: MdPrint, onClick: handlePrint, title: "Print" }),
|
|
14515
|
+
/* @__PURE__ */ jsx2(ToolbarButton_default, { icon: MdSave, onClick: handleSave, title: "Save" }),
|
|
14516
|
+
/* @__PURE__ */ jsxs("div", { className: "relative", ref: dropdownRef, children: [
|
|
14517
|
+
/* @__PURE__ */ jsxs(
|
|
14518
|
+
"button",
|
|
14519
|
+
{
|
|
14520
|
+
type: "button",
|
|
14521
|
+
onClick: () => setDropdownOpen((open) => !open),
|
|
14522
|
+
"aria-haspopup": "menu",
|
|
14523
|
+
"aria-expanded": dropdownOpen ? "true" : "false",
|
|
14524
|
+
className: "export-button",
|
|
14525
|
+
title: "Export",
|
|
14526
|
+
children: [
|
|
14527
|
+
/* @__PURE__ */ jsx2(MdDownload, {}),
|
|
14528
|
+
/* @__PURE__ */ jsx2("span", { className: "text-sm" })
|
|
14529
|
+
]
|
|
14530
|
+
}
|
|
14531
|
+
),
|
|
14532
|
+
dropdownOpen && /* @__PURE__ */ jsxs("div", { className: "export-dropdown", children: [
|
|
14533
|
+
/* @__PURE__ */ jsx2(
|
|
14534
|
+
"button",
|
|
14535
|
+
{
|
|
14536
|
+
type: "button",
|
|
14537
|
+
onClick: () => {
|
|
14538
|
+
setDropdownOpen(false);
|
|
14539
|
+
handleDownloadPDF();
|
|
14540
|
+
},
|
|
14541
|
+
children: "Export as PDF"
|
|
14542
|
+
}
|
|
14543
|
+
),
|
|
14544
|
+
/* @__PURE__ */ jsx2(
|
|
14545
|
+
"button",
|
|
14546
|
+
{
|
|
14547
|
+
type: "button",
|
|
14548
|
+
onClick: () => {
|
|
14549
|
+
setDropdownOpen(false);
|
|
14550
|
+
handleDownloadHTML();
|
|
14551
|
+
},
|
|
14552
|
+
children: "Export as HTML"
|
|
14553
|
+
}
|
|
14554
|
+
),
|
|
14555
|
+
/* @__PURE__ */ jsx2(
|
|
14556
|
+
"button",
|
|
14557
|
+
{
|
|
14558
|
+
type: "button",
|
|
14559
|
+
onClick: () => {
|
|
14560
|
+
setDropdownOpen(false);
|
|
14561
|
+
handleDownloadDOCX();
|
|
14562
|
+
},
|
|
14563
|
+
children: "Export as DOCX"
|
|
14564
|
+
}
|
|
14565
|
+
)
|
|
14566
|
+
] })
|
|
14567
|
+
] })
|
|
14568
|
+
] });
|
|
14565
14569
|
}
|
|
14566
14570
|
|
|
14567
14571
|
// src/components/tetrons/toolbar/ClipboardGroup.tsx
|
|
@@ -14571,59 +14575,64 @@ import {
|
|
|
14571
14575
|
MdContentCopy,
|
|
14572
14576
|
MdFormatPaint
|
|
14573
14577
|
} from "react-icons/md";
|
|
14574
|
-
import
|
|
14578
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
14575
14579
|
function ClipboardGroup({ editor }) {
|
|
14576
|
-
return /* @__PURE__ */
|
|
14577
|
-
|
|
14578
|
-
|
|
14579
|
-
|
|
14580
|
-
|
|
14581
|
-
|
|
14582
|
-
|
|
14583
|
-
|
|
14584
|
-
|
|
14585
|
-
|
|
14586
|
-
|
|
14580
|
+
return /* @__PURE__ */ jsxs2("div", { className: "clipboard-group", children: [
|
|
14581
|
+
/* @__PURE__ */ jsx3(
|
|
14582
|
+
ToolbarButton_default,
|
|
14583
|
+
{
|
|
14584
|
+
icon: MdContentPaste,
|
|
14585
|
+
title: "Paste",
|
|
14586
|
+
onClick: async () => {
|
|
14587
|
+
try {
|
|
14588
|
+
const text = await navigator.clipboard.readText();
|
|
14589
|
+
editor.chain().focus().insertContent(text).run();
|
|
14590
|
+
} catch (error) {
|
|
14591
|
+
console.error("Failed to read clipboard contents:", error);
|
|
14592
|
+
}
|
|
14587
14593
|
}
|
|
14588
14594
|
}
|
|
14589
|
-
|
|
14590
|
-
|
|
14591
|
-
|
|
14592
|
-
|
|
14593
|
-
|
|
14594
|
-
|
|
14595
|
-
|
|
14596
|
-
|
|
14597
|
-
|
|
14598
|
-
|
|
14599
|
-
|
|
14600
|
-
|
|
14601
|
-
|
|
14595
|
+
),
|
|
14596
|
+
/* @__PURE__ */ jsx3(
|
|
14597
|
+
ToolbarButton_default,
|
|
14598
|
+
{
|
|
14599
|
+
icon: MdContentCut,
|
|
14600
|
+
title: "Cut",
|
|
14601
|
+
onClick: () => {
|
|
14602
|
+
const { from: from2, to } = editor.state.selection;
|
|
14603
|
+
if (from2 === to) return;
|
|
14604
|
+
const selectedText = editor.state.doc.textBetween(from2, to);
|
|
14605
|
+
navigator.clipboard.writeText(selectedText).then(() => {
|
|
14606
|
+
editor.chain().focus().deleteRange({ from: from2, to }).run();
|
|
14607
|
+
});
|
|
14608
|
+
}
|
|
14602
14609
|
}
|
|
14603
|
-
|
|
14604
|
-
|
|
14605
|
-
|
|
14606
|
-
|
|
14607
|
-
|
|
14608
|
-
|
|
14609
|
-
|
|
14610
|
-
|
|
14611
|
-
|
|
14612
|
-
|
|
14613
|
-
|
|
14610
|
+
),
|
|
14611
|
+
/* @__PURE__ */ jsx3(
|
|
14612
|
+
ToolbarButton_default,
|
|
14613
|
+
{
|
|
14614
|
+
icon: MdContentCopy,
|
|
14615
|
+
title: "Copy",
|
|
14616
|
+
onClick: () => {
|
|
14617
|
+
const { from: from2, to } = editor.state.selection;
|
|
14618
|
+
if (from2 === to) return;
|
|
14619
|
+
const selectedText = editor.state.doc.textBetween(from2, to);
|
|
14620
|
+
navigator.clipboard.writeText(selectedText);
|
|
14621
|
+
}
|
|
14614
14622
|
}
|
|
14615
|
-
|
|
14616
|
-
|
|
14617
|
-
|
|
14618
|
-
|
|
14619
|
-
|
|
14620
|
-
|
|
14621
|
-
|
|
14622
|
-
|
|
14623
|
-
|
|
14623
|
+
),
|
|
14624
|
+
/* @__PURE__ */ jsx3(
|
|
14625
|
+
ToolbarButton_default,
|
|
14626
|
+
{
|
|
14627
|
+
icon: MdFormatPaint,
|
|
14628
|
+
title: "Format Painter",
|
|
14629
|
+
onClick: () => {
|
|
14630
|
+
const currentMarks = editor.getAttributes("textStyle");
|
|
14631
|
+
localStorage.setItem("formatPainter", JSON.stringify(currentMarks));
|
|
14632
|
+
}
|
|
14624
14633
|
}
|
|
14625
|
-
|
|
14626
|
-
)
|
|
14634
|
+
)
|
|
14635
|
+
] });
|
|
14627
14636
|
}
|
|
14628
14637
|
|
|
14629
14638
|
// src/components/tetrons/toolbar/FontStyleGroup.tsx
|
|
@@ -14639,7 +14648,8 @@ import {
|
|
|
14639
14648
|
} from "react-icons/md";
|
|
14640
14649
|
import { ImTextColor } from "react-icons/im";
|
|
14641
14650
|
import { BiSolidColorFill } from "react-icons/bi";
|
|
14642
|
-
import
|
|
14651
|
+
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
14652
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
14643
14653
|
function FontStyleGroup({ editor }) {
|
|
14644
14654
|
const [textColor, setTextColor] = useState2("#000000");
|
|
14645
14655
|
const [highlightColor, setHighlightColor] = useState2("#ffff00");
|
|
@@ -14665,165 +14675,182 @@ function FontStyleGroup({ editor }) {
|
|
|
14665
14675
|
editor.off("transaction", updateStates);
|
|
14666
14676
|
};
|
|
14667
14677
|
}, [editor]);
|
|
14668
|
-
return /* @__PURE__ */
|
|
14669
|
-
|
|
14670
|
-
|
|
14671
|
-
title: "Font Family",
|
|
14672
|
-
className: "text-sm border rounded px-1 py-0.5 mr-2",
|
|
14673
|
-
value: fontFamily,
|
|
14674
|
-
onChange: (e) => {
|
|
14675
|
-
const value = e.target.value;
|
|
14676
|
-
setFontFamily(value);
|
|
14677
|
-
editor.chain().focus().setFontFamily(value).run();
|
|
14678
|
-
}
|
|
14679
|
-
},
|
|
14680
|
-
/* @__PURE__ */ React4.createElement("option", { value: "Arial" }, "Arial"),
|
|
14681
|
-
/* @__PURE__ */ React4.createElement("option", { value: "Georgia" }, "Georgia"),
|
|
14682
|
-
/* @__PURE__ */ React4.createElement("option", { value: "Times New Roman" }, "Times New Roman"),
|
|
14683
|
-
/* @__PURE__ */ React4.createElement("option", { value: "Courier New" }, "Courier New"),
|
|
14684
|
-
/* @__PURE__ */ React4.createElement("option", { value: "Verdana" }, "Verdana")
|
|
14685
|
-
), /* @__PURE__ */ React4.createElement(
|
|
14686
|
-
"select",
|
|
14687
|
-
{
|
|
14688
|
-
title: "Font Size",
|
|
14689
|
-
className: "text-sm border rounded px-1 py-0.5 mr-2",
|
|
14690
|
-
value: fontSize,
|
|
14691
|
-
onChange: (e) => {
|
|
14692
|
-
const value = e.target.value;
|
|
14693
|
-
setFontSize(value);
|
|
14694
|
-
editor.chain().focus().setFontSize(value).run();
|
|
14695
|
-
}
|
|
14696
|
-
},
|
|
14697
|
-
/* @__PURE__ */ React4.createElement("option", { value: "12px" }, "12"),
|
|
14698
|
-
/* @__PURE__ */ React4.createElement("option", { value: "14px" }, "14"),
|
|
14699
|
-
/* @__PURE__ */ React4.createElement("option", { value: "16px" }, "16"),
|
|
14700
|
-
/* @__PURE__ */ React4.createElement("option", { value: "18px" }, "18"),
|
|
14701
|
-
/* @__PURE__ */ React4.createElement("option", { value: "24px" }, "24"),
|
|
14702
|
-
/* @__PURE__ */ React4.createElement("option", { value: "36px" }, "36"),
|
|
14703
|
-
/* @__PURE__ */ React4.createElement("option", { value: "48px" }, "48"),
|
|
14704
|
-
/* @__PURE__ */ React4.createElement("option", { value: "64px" }, "64"),
|
|
14705
|
-
/* @__PURE__ */ React4.createElement("option", { value: "72px" }, "72")
|
|
14706
|
-
), /* @__PURE__ */ React4.createElement(
|
|
14707
|
-
ToolbarButton_default,
|
|
14708
|
-
{
|
|
14709
|
-
icon: MdFormatBold,
|
|
14710
|
-
label: "Bold",
|
|
14711
|
-
onClick: () => editor.chain().focus().toggleBold().run(),
|
|
14712
|
-
isActive: editor.isActive("bold")
|
|
14713
|
-
}
|
|
14714
|
-
), /* @__PURE__ */ React4.createElement(
|
|
14715
|
-
ToolbarButton_default,
|
|
14716
|
-
{
|
|
14717
|
-
icon: MdFormatItalic,
|
|
14718
|
-
label: "Italic",
|
|
14719
|
-
onClick: () => editor.chain().focus().toggleItalic().run(),
|
|
14720
|
-
isActive: editor.isActive("italic")
|
|
14721
|
-
}
|
|
14722
|
-
), /* @__PURE__ */ React4.createElement(
|
|
14723
|
-
ToolbarButton_default,
|
|
14724
|
-
{
|
|
14725
|
-
icon: MdFormatUnderlined,
|
|
14726
|
-
label: "Underline",
|
|
14727
|
-
onClick: () => editor.chain().focus().toggleUnderline().run(),
|
|
14728
|
-
isActive: editor.isActive("underline")
|
|
14729
|
-
}
|
|
14730
|
-
), /* @__PURE__ */ React4.createElement(
|
|
14731
|
-
ToolbarButton_default,
|
|
14732
|
-
{
|
|
14733
|
-
icon: MdStrikethroughS,
|
|
14734
|
-
label: "Strikethrough",
|
|
14735
|
-
onClick: () => editor.chain().focus().toggleStrike().run(),
|
|
14736
|
-
isActive: editor.isActive("strike")
|
|
14737
|
-
}
|
|
14738
|
-
), /* @__PURE__ */ React4.createElement(
|
|
14739
|
-
ToolbarButton_default,
|
|
14740
|
-
{
|
|
14741
|
-
icon: MdSubscript,
|
|
14742
|
-
label: "Subscript",
|
|
14743
|
-
onClick: () => editor.chain().focus().toggleSubscript().run(),
|
|
14744
|
-
isActive: editor.isActive("subscript")
|
|
14745
|
-
}
|
|
14746
|
-
), /* @__PURE__ */ React4.createElement(
|
|
14747
|
-
ToolbarButton_default,
|
|
14748
|
-
{
|
|
14749
|
-
icon: MdSuperscript,
|
|
14750
|
-
label: "Superscript",
|
|
14751
|
-
onClick: () => editor.chain().focus().toggleSuperscript().run(),
|
|
14752
|
-
isActive: editor.isActive("superscript")
|
|
14753
|
-
}
|
|
14754
|
-
), /* @__PURE__ */ React4.createElement(
|
|
14755
|
-
"label",
|
|
14756
|
-
{
|
|
14757
|
-
title: "Font Color",
|
|
14758
|
-
"aria-label": "Font Color",
|
|
14759
|
-
className: "relative w-8 h-8 flex items-center justify-center cursor-pointer color-label",
|
|
14760
|
-
style: { "--indicator-color": textColor }
|
|
14761
|
-
},
|
|
14762
|
-
/* @__PURE__ */ React4.createElement(ImTextColor, { size: 20, className: "text-gray-700" }),
|
|
14763
|
-
/* @__PURE__ */ React4.createElement("div", { className: "color-indicator" }),
|
|
14764
|
-
/* @__PURE__ */ React4.createElement(
|
|
14765
|
-
"input",
|
|
14678
|
+
return /* @__PURE__ */ jsxs3("div", { className: "font-style-group", children: [
|
|
14679
|
+
/* @__PURE__ */ jsxs3(
|
|
14680
|
+
"select",
|
|
14766
14681
|
{
|
|
14767
|
-
|
|
14768
|
-
value:
|
|
14682
|
+
title: "Font Family",
|
|
14683
|
+
value: fontFamily,
|
|
14769
14684
|
onChange: (e) => {
|
|
14770
|
-
const
|
|
14771
|
-
|
|
14772
|
-
editor.chain().focus().
|
|
14685
|
+
const value = e.target.value;
|
|
14686
|
+
setFontFamily(value);
|
|
14687
|
+
editor.chain().focus().setFontFamily(value).run();
|
|
14773
14688
|
},
|
|
14774
|
-
|
|
14689
|
+
children: [
|
|
14690
|
+
/* @__PURE__ */ jsx4("option", { value: "Arial", children: "Arial" }),
|
|
14691
|
+
/* @__PURE__ */ jsx4("option", { value: "Georgia", children: "Georgia" }),
|
|
14692
|
+
/* @__PURE__ */ jsx4("option", { value: "Times New Roman", children: "Times New Roman" }),
|
|
14693
|
+
/* @__PURE__ */ jsx4("option", { value: "Courier New", children: "Courier New" }),
|
|
14694
|
+
/* @__PURE__ */ jsx4("option", { value: "Verdana", children: "Verdana" })
|
|
14695
|
+
]
|
|
14775
14696
|
}
|
|
14776
|
-
)
|
|
14777
|
-
|
|
14778
|
-
|
|
14779
|
-
{
|
|
14780
|
-
title: "Highlight Color",
|
|
14781
|
-
"aria-label": "Highlight Color",
|
|
14782
|
-
className: "relative w-8 h-8 flex items-center justify-center cursor-pointer color-label",
|
|
14783
|
-
style: { "--indicator-color": highlightColor }
|
|
14784
|
-
},
|
|
14785
|
-
/* @__PURE__ */ React4.createElement(BiSolidColorFill, { size: 20, className: "text-gray-700" }),
|
|
14786
|
-
/* @__PURE__ */ React4.createElement("div", { className: "color-indicator" }),
|
|
14787
|
-
/* @__PURE__ */ React4.createElement(
|
|
14788
|
-
"input",
|
|
14697
|
+
),
|
|
14698
|
+
/* @__PURE__ */ jsxs3(
|
|
14699
|
+
"select",
|
|
14789
14700
|
{
|
|
14790
|
-
|
|
14791
|
-
value:
|
|
14701
|
+
title: "Font Size",
|
|
14702
|
+
value: fontSize,
|
|
14792
14703
|
onChange: (e) => {
|
|
14793
|
-
const
|
|
14794
|
-
|
|
14795
|
-
editor.chain().focus().
|
|
14704
|
+
const value = e.target.value;
|
|
14705
|
+
setFontSize(value);
|
|
14706
|
+
editor.chain().focus().setFontSize(value).run();
|
|
14796
14707
|
},
|
|
14797
|
-
|
|
14708
|
+
children: [
|
|
14709
|
+
/* @__PURE__ */ jsx4("option", { value: "12px", children: "12" }),
|
|
14710
|
+
/* @__PURE__ */ jsx4("option", { value: "14px", children: "14" }),
|
|
14711
|
+
/* @__PURE__ */ jsx4("option", { value: "16px", children: "16" }),
|
|
14712
|
+
/* @__PURE__ */ jsx4("option", { value: "18px", children: "18" }),
|
|
14713
|
+
/* @__PURE__ */ jsx4("option", { value: "24px", children: "24" }),
|
|
14714
|
+
/* @__PURE__ */ jsx4("option", { value: "36px", children: "36" }),
|
|
14715
|
+
/* @__PURE__ */ jsx4("option", { value: "48px", children: "48" }),
|
|
14716
|
+
/* @__PURE__ */ jsx4("option", { value: "64px", children: "64" }),
|
|
14717
|
+
/* @__PURE__ */ jsx4("option", { value: "72px", children: "72" })
|
|
14718
|
+
]
|
|
14798
14719
|
}
|
|
14799
|
-
)
|
|
14800
|
-
|
|
14801
|
-
|
|
14802
|
-
|
|
14803
|
-
|
|
14804
|
-
|
|
14805
|
-
|
|
14806
|
-
|
|
14807
|
-
|
|
14808
|
-
|
|
14809
|
-
|
|
14810
|
-
|
|
14811
|
-
|
|
14812
|
-
|
|
14813
|
-
|
|
14814
|
-
|
|
14815
|
-
)
|
|
14816
|
-
|
|
14817
|
-
|
|
14818
|
-
|
|
14720
|
+
),
|
|
14721
|
+
/* @__PURE__ */ jsx4(
|
|
14722
|
+
ToolbarButton_default,
|
|
14723
|
+
{
|
|
14724
|
+
icon: MdFormatBold,
|
|
14725
|
+
label: "Bold",
|
|
14726
|
+
onClick: () => editor.chain().focus().toggleBold().run(),
|
|
14727
|
+
isActive: editor.isActive("bold")
|
|
14728
|
+
}
|
|
14729
|
+
),
|
|
14730
|
+
/* @__PURE__ */ jsx4(
|
|
14731
|
+
ToolbarButton_default,
|
|
14732
|
+
{
|
|
14733
|
+
icon: MdFormatItalic,
|
|
14734
|
+
label: "Italic",
|
|
14735
|
+
onClick: () => editor.chain().focus().toggleItalic().run(),
|
|
14736
|
+
isActive: editor.isActive("italic")
|
|
14737
|
+
}
|
|
14738
|
+
),
|
|
14739
|
+
/* @__PURE__ */ jsx4(
|
|
14740
|
+
ToolbarButton_default,
|
|
14741
|
+
{
|
|
14742
|
+
icon: MdFormatUnderlined,
|
|
14743
|
+
label: "Underline",
|
|
14744
|
+
onClick: () => editor.chain().focus().toggleUnderline().run(),
|
|
14745
|
+
isActive: editor.isActive("underline")
|
|
14746
|
+
}
|
|
14747
|
+
),
|
|
14748
|
+
/* @__PURE__ */ jsx4(
|
|
14749
|
+
ToolbarButton_default,
|
|
14750
|
+
{
|
|
14751
|
+
icon: MdStrikethroughS,
|
|
14752
|
+
label: "Strikethrough",
|
|
14753
|
+
onClick: () => editor.chain().focus().toggleStrike().run(),
|
|
14754
|
+
isActive: editor.isActive("strike")
|
|
14755
|
+
}
|
|
14756
|
+
),
|
|
14757
|
+
/* @__PURE__ */ jsx4(
|
|
14758
|
+
ToolbarButton_default,
|
|
14759
|
+
{
|
|
14760
|
+
icon: MdSubscript,
|
|
14761
|
+
label: "Subscript",
|
|
14762
|
+
onClick: () => editor.chain().focus().toggleSubscript().run(),
|
|
14763
|
+
isActive: editor.isActive("subscript")
|
|
14764
|
+
}
|
|
14765
|
+
),
|
|
14766
|
+
/* @__PURE__ */ jsx4(
|
|
14767
|
+
ToolbarButton_default,
|
|
14768
|
+
{
|
|
14769
|
+
icon: MdSuperscript,
|
|
14770
|
+
label: "Superscript",
|
|
14771
|
+
onClick: () => editor.chain().focus().toggleSuperscript().run(),
|
|
14772
|
+
isActive: editor.isActive("superscript")
|
|
14773
|
+
}
|
|
14774
|
+
),
|
|
14775
|
+
/* @__PURE__ */ jsxs3(
|
|
14776
|
+
"label",
|
|
14777
|
+
{
|
|
14778
|
+
title: "Font Color",
|
|
14779
|
+
"aria-label": "Font Color",
|
|
14780
|
+
className: "color-label",
|
|
14781
|
+
style: { "--indicator-color": textColor },
|
|
14782
|
+
children: [
|
|
14783
|
+
/* @__PURE__ */ jsx4(ImTextColor, { size: 20 }),
|
|
14784
|
+
/* @__PURE__ */ jsx4("div", { className: "color-indicator" }),
|
|
14785
|
+
/* @__PURE__ */ jsx4(
|
|
14786
|
+
"input",
|
|
14787
|
+
{
|
|
14788
|
+
type: "color",
|
|
14789
|
+
value: textColor,
|
|
14790
|
+
onChange: (e) => {
|
|
14791
|
+
const color = e.target.value;
|
|
14792
|
+
setTextColor(color);
|
|
14793
|
+
editor.chain().focus().setColor(color).run();
|
|
14794
|
+
}
|
|
14795
|
+
}
|
|
14796
|
+
)
|
|
14797
|
+
]
|
|
14798
|
+
}
|
|
14799
|
+
),
|
|
14800
|
+
/* @__PURE__ */ jsxs3(
|
|
14801
|
+
"label",
|
|
14802
|
+
{
|
|
14803
|
+
title: "Highlight Color",
|
|
14804
|
+
"aria-label": "Highlight Color",
|
|
14805
|
+
className: "color-label",
|
|
14806
|
+
style: { "--indicator-color": highlightColor },
|
|
14807
|
+
children: [
|
|
14808
|
+
/* @__PURE__ */ jsx4(BiSolidColorFill, { size: 20 }),
|
|
14809
|
+
/* @__PURE__ */ jsx4("div", { className: "color-indicator" }),
|
|
14810
|
+
/* @__PURE__ */ jsx4(
|
|
14811
|
+
"input",
|
|
14812
|
+
{
|
|
14813
|
+
type: "color",
|
|
14814
|
+
value: highlightColor,
|
|
14815
|
+
onChange: (e) => {
|
|
14816
|
+
const color = e.target.value;
|
|
14817
|
+
setHighlightColor(color);
|
|
14818
|
+
editor.chain().focus().setHighlight({ color }).run();
|
|
14819
|
+
}
|
|
14820
|
+
}
|
|
14821
|
+
)
|
|
14822
|
+
]
|
|
14823
|
+
}
|
|
14824
|
+
),
|
|
14825
|
+
/* @__PURE__ */ jsx4(
|
|
14826
|
+
ToolbarButton_default,
|
|
14827
|
+
{
|
|
14828
|
+
icon: MdFormatClear,
|
|
14829
|
+
label: "Clear Formatting",
|
|
14830
|
+
onClick: () => editor.chain().focus().unsetAllMarks().run()
|
|
14831
|
+
}
|
|
14832
|
+
),
|
|
14833
|
+
/* @__PURE__ */ jsx4(
|
|
14834
|
+
ToolbarButton_default,
|
|
14835
|
+
{
|
|
14836
|
+
icon: MdFormatPaint2,
|
|
14837
|
+
label: "Apply Painter Format",
|
|
14838
|
+
onClick: () => {
|
|
14839
|
+
const format = JSON.parse(
|
|
14840
|
+
localStorage.getItem("formatPainter") || "{}"
|
|
14841
|
+
);
|
|
14842
|
+
if (format.color) editor.chain().focus().setColor(format.color).run();
|
|
14843
|
+
if (format.backgroundColor) {
|
|
14844
|
+
editor.chain().focus().setHighlight({ color: format.backgroundColor }).run();
|
|
14845
|
+
}
|
|
14819
14846
|
}
|
|
14820
14847
|
}
|
|
14821
|
-
|
|
14822
|
-
)
|
|
14848
|
+
)
|
|
14849
|
+
] });
|
|
14823
14850
|
}
|
|
14824
14851
|
|
|
14825
14852
|
// src/components/tetrons/toolbar/InsertGroup.tsx
|
|
14826
|
-
import
|
|
14853
|
+
import { useRef as useRef2, useState as useState3 } from "react";
|
|
14827
14854
|
import {
|
|
14828
14855
|
MdTableChart,
|
|
14829
14856
|
MdInsertPhoto,
|
|
@@ -14835,6 +14862,7 @@ import {
|
|
|
14835
14862
|
MdOutlineOndemandVideo
|
|
14836
14863
|
} from "react-icons/md";
|
|
14837
14864
|
import Picker from "@emoji-mart/react";
|
|
14865
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
14838
14866
|
function InsertGroup({ editor }) {
|
|
14839
14867
|
const [showTableGrid, setShowTableGrid] = useState3(false);
|
|
14840
14868
|
const [selectedRows, setSelectedRows] = useState3(1);
|
|
@@ -14910,144 +14938,165 @@ function InsertGroup({ editor }) {
|
|
|
14910
14938
|
return url;
|
|
14911
14939
|
}
|
|
14912
14940
|
}
|
|
14913
|
-
return /* @__PURE__ */
|
|
14914
|
-
|
|
14915
|
-
|
|
14916
|
-
|
|
14917
|
-
|
|
14918
|
-
|
|
14919
|
-
|
|
14920
|
-
|
|
14921
|
-
|
|
14922
|
-
|
|
14923
|
-
|
|
14924
|
-
|
|
14925
|
-
|
|
14926
|
-
|
|
14927
|
-
|
|
14928
|
-
|
|
14929
|
-
|
|
14930
|
-
|
|
14931
|
-
|
|
14932
|
-
|
|
14933
|
-
|
|
14934
|
-
|
|
14935
|
-
|
|
14936
|
-
|
|
14937
|
-
|
|
14938
|
-
|
|
14939
|
-
|
|
14940
|
-
|
|
14941
|
-
|
|
14942
|
-
|
|
14943
|
-
|
|
14944
|
-
|
|
14945
|
-
|
|
14946
|
-
|
|
14947
|
-
|
|
14948
|
-
|
|
14949
|
-
|
|
14950
|
-
|
|
14951
|
-
|
|
14952
|
-
"div",
|
|
14953
|
-
|
|
14954
|
-
|
|
14955
|
-
|
|
14956
|
-
|
|
14957
|
-
|
|
14941
|
+
return /* @__PURE__ */ jsxs4("div", { className: "insert-group", children: [
|
|
14942
|
+
/* @__PURE__ */ jsx5(
|
|
14943
|
+
"input",
|
|
14944
|
+
{
|
|
14945
|
+
type: "file",
|
|
14946
|
+
accept: "image/*",
|
|
14947
|
+
ref: imageInputRef,
|
|
14948
|
+
className: "hidden-input",
|
|
14949
|
+
onChange: handleImageUpload,
|
|
14950
|
+
"aria-label": "Upload Image",
|
|
14951
|
+
title: "Upload Image"
|
|
14952
|
+
}
|
|
14953
|
+
),
|
|
14954
|
+
/* @__PURE__ */ jsx5(
|
|
14955
|
+
"input",
|
|
14956
|
+
{
|
|
14957
|
+
type: "file",
|
|
14958
|
+
accept: "video/*",
|
|
14959
|
+
ref: videoInputRef,
|
|
14960
|
+
className: "hidden-input",
|
|
14961
|
+
onChange: handleVideoUpload,
|
|
14962
|
+
"aria-label": "Upload Video",
|
|
14963
|
+
title: "Upload Video"
|
|
14964
|
+
}
|
|
14965
|
+
),
|
|
14966
|
+
/* @__PURE__ */ jsx5(
|
|
14967
|
+
ToolbarButton_default,
|
|
14968
|
+
{
|
|
14969
|
+
icon: MdTableChart,
|
|
14970
|
+
label: "Insert Table",
|
|
14971
|
+
onClick: () => setShowTableGrid(!showTableGrid)
|
|
14972
|
+
}
|
|
14973
|
+
),
|
|
14974
|
+
showTableGrid && /* @__PURE__ */ jsxs4(
|
|
14975
|
+
"div",
|
|
14976
|
+
{
|
|
14977
|
+
className: "table-grid-popup",
|
|
14978
|
+
onMouseLeave: () => setShowTableGrid(false),
|
|
14979
|
+
children: [
|
|
14980
|
+
/* @__PURE__ */ jsx5("div", { className: "table-grid", children: [...Array(10)].map(
|
|
14981
|
+
(_, row) => [...Array(10)].map((_2, col) => {
|
|
14982
|
+
const isSelected = row < selectedRows && col < selectedCols;
|
|
14983
|
+
return /* @__PURE__ */ jsx5(
|
|
14984
|
+
"div",
|
|
14985
|
+
{
|
|
14986
|
+
className: `table-grid-cell ${isSelected ? "selected" : ""}`,
|
|
14987
|
+
onMouseEnter: () => handleTableCellHover(row + 1, col + 1),
|
|
14988
|
+
onClick: () => handleTableInsert(row + 1, col + 1)
|
|
14989
|
+
},
|
|
14990
|
+
`${row}-${col}`
|
|
14991
|
+
);
|
|
14992
|
+
})
|
|
14993
|
+
) }),
|
|
14994
|
+
/* @__PURE__ */ jsxs4("div", { className: "table-grid-label", children: [
|
|
14995
|
+
selectedRows,
|
|
14996
|
+
" x ",
|
|
14997
|
+
selectedCols
|
|
14998
|
+
] })
|
|
14999
|
+
]
|
|
15000
|
+
}
|
|
15001
|
+
),
|
|
15002
|
+
/* @__PURE__ */ jsx5(
|
|
15003
|
+
ToolbarButton_default,
|
|
15004
|
+
{
|
|
15005
|
+
icon: MdInsertPhoto,
|
|
15006
|
+
label: "Insert Image",
|
|
15007
|
+
onClick: () => imageInputRef.current?.click()
|
|
15008
|
+
}
|
|
15009
|
+
),
|
|
15010
|
+
/* @__PURE__ */ jsx5(
|
|
15011
|
+
ToolbarButton_default,
|
|
15012
|
+
{
|
|
15013
|
+
icon: MdVideoLibrary,
|
|
15014
|
+
label: "Insert Video",
|
|
15015
|
+
onClick: () => videoInputRef.current?.click()
|
|
15016
|
+
}
|
|
15017
|
+
),
|
|
15018
|
+
/* @__PURE__ */ jsx5(
|
|
15019
|
+
ToolbarButton_default,
|
|
15020
|
+
{
|
|
15021
|
+
icon: MdInsertLink,
|
|
15022
|
+
label: "Insert Link",
|
|
15023
|
+
onClick: () => {
|
|
15024
|
+
const url = prompt("Enter URL");
|
|
15025
|
+
if (url) {
|
|
15026
|
+
editor.chain().focus().extendMarkRange("link").setLink({ href: url }).run();
|
|
14958
15027
|
}
|
|
14959
|
-
|
|
14960
|
-
})
|
|
14961
|
-
)),
|
|
14962
|
-
/* @__PURE__ */ React5.createElement("div", { className: "text-sm mt-2 text-center text-gray-600" }, selectedRows, " x ", selectedCols)
|
|
14963
|
-
), /* @__PURE__ */ React5.createElement(
|
|
14964
|
-
ToolbarButton_default,
|
|
14965
|
-
{
|
|
14966
|
-
icon: MdInsertPhoto,
|
|
14967
|
-
label: "Insert Image",
|
|
14968
|
-
onClick: () => imageInputRef.current?.click()
|
|
14969
|
-
}
|
|
14970
|
-
), /* @__PURE__ */ React5.createElement(
|
|
14971
|
-
ToolbarButton_default,
|
|
14972
|
-
{
|
|
14973
|
-
icon: MdVideoLibrary,
|
|
14974
|
-
label: "Insert Video",
|
|
14975
|
-
onClick: () => videoInputRef.current?.click()
|
|
14976
|
-
}
|
|
14977
|
-
), /* @__PURE__ */ React5.createElement(
|
|
14978
|
-
ToolbarButton_default,
|
|
14979
|
-
{
|
|
14980
|
-
icon: MdInsertLink,
|
|
14981
|
-
label: "Insert Link",
|
|
14982
|
-
onClick: () => {
|
|
14983
|
-
const url = prompt("Enter URL");
|
|
14984
|
-
if (url)
|
|
14985
|
-
editor.chain().focus().extendMarkRange("link").setLink({ href: url }).run();
|
|
15028
|
+
}
|
|
14986
15029
|
}
|
|
14987
|
-
|
|
14988
|
-
|
|
14989
|
-
|
|
14990
|
-
|
|
14991
|
-
|
|
14992
|
-
|
|
14993
|
-
|
|
14994
|
-
|
|
14995
|
-
|
|
14996
|
-
|
|
14997
|
-
|
|
14998
|
-
|
|
15030
|
+
),
|
|
15031
|
+
/* @__PURE__ */ jsx5(
|
|
15032
|
+
ToolbarButton_default,
|
|
15033
|
+
{
|
|
15034
|
+
icon: MdInsertComment,
|
|
15035
|
+
label: "Insert Comment",
|
|
15036
|
+
onClick: () => {
|
|
15037
|
+
const comment = prompt("Enter your comment");
|
|
15038
|
+
if (comment && editor.can().chain().focus().setComment(comment).run()) {
|
|
15039
|
+
editor.chain().focus().setComment(comment).run();
|
|
15040
|
+
} else {
|
|
15041
|
+
console.warn("Cannot apply comment \u2014 maybe no selection?");
|
|
15042
|
+
}
|
|
14999
15043
|
}
|
|
15000
15044
|
}
|
|
15001
|
-
|
|
15002
|
-
|
|
15003
|
-
|
|
15004
|
-
|
|
15005
|
-
|
|
15006
|
-
|
|
15007
|
-
|
|
15008
|
-
|
|
15009
|
-
|
|
15010
|
-
|
|
15011
|
-
|
|
15012
|
-
|
|
15013
|
-
|
|
15014
|
-
|
|
15015
|
-
|
|
15016
|
-
|
|
15017
|
-
|
|
15018
|
-
|
|
15019
|
-
|
|
15020
|
-
|
|
15021
|
-
|
|
15022
|
-
|
|
15023
|
-
|
|
15024
|
-
|
|
15025
|
-
|
|
15026
|
-
|
|
15027
|
-
|
|
15028
|
-
|
|
15029
|
-
icon: MdOutlineOndemandVideo,
|
|
15030
|
-
label: "Embed",
|
|
15031
|
-
onClick: () => {
|
|
15032
|
-
const url = prompt(
|
|
15033
|
-
"Enter embed URL (YouTube, Vimeo, Google Maps, etc.)"
|
|
15034
|
-
);
|
|
15035
|
-
if (!url) return;
|
|
15036
|
-
const embedUrl = normalizeEmbedUrl(url);
|
|
15037
|
-
const width = prompt("Enter width in pixels", "560");
|
|
15038
|
-
const height = prompt("Enter height in pixels", "315");
|
|
15039
|
-
editor.chain().focus().setEmbed({
|
|
15040
|
-
src: embedUrl,
|
|
15041
|
-
width: width ? parseInt(width) : 560,
|
|
15042
|
-
height: height ? parseInt(height) : 315
|
|
15043
|
-
}).run();
|
|
15045
|
+
),
|
|
15046
|
+
/* @__PURE__ */ jsxs4("div", { className: "relative", children: [
|
|
15047
|
+
/* @__PURE__ */ jsx5(
|
|
15048
|
+
ToolbarButton_default,
|
|
15049
|
+
{
|
|
15050
|
+
icon: MdInsertEmoticon,
|
|
15051
|
+
label: "Emoji",
|
|
15052
|
+
onClick: () => setShowPicker(!showPicker)
|
|
15053
|
+
}
|
|
15054
|
+
),
|
|
15055
|
+
showPicker && /* @__PURE__ */ jsx5("div", { className: "emoji-picker", children: /* @__PURE__ */ jsx5(
|
|
15056
|
+
Picker,
|
|
15057
|
+
{
|
|
15058
|
+
onEmojiSelect: addEmoji,
|
|
15059
|
+
theme: "auto",
|
|
15060
|
+
emoji: "point_up",
|
|
15061
|
+
showPreview: false,
|
|
15062
|
+
showSkinTones: true,
|
|
15063
|
+
emojiTooltip: true
|
|
15064
|
+
}
|
|
15065
|
+
) })
|
|
15066
|
+
] }),
|
|
15067
|
+
/* @__PURE__ */ jsx5(
|
|
15068
|
+
ToolbarButton_default,
|
|
15069
|
+
{
|
|
15070
|
+
icon: MdHorizontalRule,
|
|
15071
|
+
label: "Horizontal Line",
|
|
15072
|
+
onClick: () => editor.chain().focus().setHorizontalRule().run()
|
|
15044
15073
|
}
|
|
15045
|
-
|
|
15046
|
-
|
|
15074
|
+
),
|
|
15075
|
+
/* @__PURE__ */ jsx5(
|
|
15076
|
+
ToolbarButton_default,
|
|
15077
|
+
{
|
|
15078
|
+
icon: MdOutlineOndemandVideo,
|
|
15079
|
+
label: "Embed",
|
|
15080
|
+
onClick: () => {
|
|
15081
|
+
const url = prompt(
|
|
15082
|
+
"Enter embed URL (YouTube, Vimeo, Google Maps, etc.)"
|
|
15083
|
+
);
|
|
15084
|
+
if (!url) return;
|
|
15085
|
+
const embedUrl = normalizeEmbedUrl(url);
|
|
15086
|
+
const width = prompt("Enter width in pixels", "560");
|
|
15087
|
+
const height = prompt("Enter height in pixels", "315");
|
|
15088
|
+
editor.chain().focus().setEmbed({
|
|
15089
|
+
src: embedUrl,
|
|
15090
|
+
width: width ? parseInt(width) : 560,
|
|
15091
|
+
height: height ? parseInt(height) : 315
|
|
15092
|
+
}).run();
|
|
15093
|
+
}
|
|
15094
|
+
}
|
|
15095
|
+
)
|
|
15096
|
+
] });
|
|
15047
15097
|
}
|
|
15048
15098
|
|
|
15049
15099
|
// src/components/tetrons/toolbar/ListAlignGroup.tsx
|
|
15050
|
-
import React6 from "react";
|
|
15051
15100
|
import {
|
|
15052
15101
|
MdFormatListBulleted,
|
|
15053
15102
|
MdFormatListNumbered,
|
|
@@ -15058,76 +15107,85 @@ import {
|
|
|
15058
15107
|
MdFormatAlignRight,
|
|
15059
15108
|
MdFormatAlignJustify
|
|
15060
15109
|
} from "react-icons/md";
|
|
15110
|
+
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
15061
15111
|
function ListAlignGroup({ editor }) {
|
|
15062
|
-
return /* @__PURE__ */
|
|
15063
|
-
|
|
15064
|
-
|
|
15065
|
-
|
|
15066
|
-
|
|
15067
|
-
|
|
15068
|
-
|
|
15069
|
-
|
|
15070
|
-
|
|
15071
|
-
|
|
15072
|
-
|
|
15073
|
-
|
|
15074
|
-
|
|
15075
|
-
|
|
15076
|
-
|
|
15077
|
-
|
|
15078
|
-
|
|
15079
|
-
|
|
15080
|
-
|
|
15081
|
-
|
|
15082
|
-
|
|
15083
|
-
|
|
15084
|
-
|
|
15085
|
-
|
|
15086
|
-
|
|
15087
|
-
|
|
15088
|
-
|
|
15089
|
-
|
|
15090
|
-
|
|
15091
|
-
|
|
15092
|
-
|
|
15093
|
-
|
|
15094
|
-
|
|
15095
|
-
|
|
15096
|
-
|
|
15097
|
-
|
|
15098
|
-
|
|
15099
|
-
|
|
15100
|
-
|
|
15101
|
-
|
|
15102
|
-
|
|
15103
|
-
|
|
15104
|
-
|
|
15105
|
-
|
|
15106
|
-
|
|
15107
|
-
|
|
15108
|
-
|
|
15109
|
-
|
|
15110
|
-
|
|
15111
|
-
|
|
15112
|
-
|
|
15113
|
-
|
|
15114
|
-
|
|
15115
|
-
|
|
15116
|
-
|
|
15117
|
-
|
|
15118
|
-
|
|
15119
|
-
|
|
15120
|
-
|
|
15121
|
-
|
|
15122
|
-
|
|
15123
|
-
|
|
15124
|
-
|
|
15125
|
-
|
|
15126
|
-
|
|
15112
|
+
return /* @__PURE__ */ jsxs5("div", { className: "list-align-group", children: [
|
|
15113
|
+
/* @__PURE__ */ jsx6(
|
|
15114
|
+
ToolbarButton_default,
|
|
15115
|
+
{
|
|
15116
|
+
icon: MdFormatListBulleted,
|
|
15117
|
+
title: "Bulleted List",
|
|
15118
|
+
onClick: () => editor.chain().focus().toggleBulletList().run(),
|
|
15119
|
+
disabled: !editor.can().toggleBulletList()
|
|
15120
|
+
}
|
|
15121
|
+
),
|
|
15122
|
+
/* @__PURE__ */ jsx6(
|
|
15123
|
+
ToolbarButton_default,
|
|
15124
|
+
{
|
|
15125
|
+
icon: MdFormatListNumbered,
|
|
15126
|
+
title: "Numbered List",
|
|
15127
|
+
onClick: () => editor.chain().focus().toggleOrderedList().run(),
|
|
15128
|
+
disabled: !editor.can().toggleOrderedList()
|
|
15129
|
+
}
|
|
15130
|
+
),
|
|
15131
|
+
/* @__PURE__ */ jsx6(
|
|
15132
|
+
ToolbarButton_default,
|
|
15133
|
+
{
|
|
15134
|
+
icon: MdFormatIndentIncrease,
|
|
15135
|
+
title: "Increase Indent",
|
|
15136
|
+
onClick: () => editor.chain().focus().sinkListItem("listItem").run(),
|
|
15137
|
+
disabled: !editor.can().sinkListItem("listItem")
|
|
15138
|
+
}
|
|
15139
|
+
),
|
|
15140
|
+
/* @__PURE__ */ jsx6(
|
|
15141
|
+
ToolbarButton_default,
|
|
15142
|
+
{
|
|
15143
|
+
icon: MdFormatIndentDecrease,
|
|
15144
|
+
title: "Decrease Indent",
|
|
15145
|
+
onClick: () => editor.chain().focus().liftListItem("listItem").run(),
|
|
15146
|
+
disabled: !editor.can().liftListItem("listItem")
|
|
15147
|
+
}
|
|
15148
|
+
),
|
|
15149
|
+
/* @__PURE__ */ jsx6(
|
|
15150
|
+
ToolbarButton_default,
|
|
15151
|
+
{
|
|
15152
|
+
icon: MdFormatAlignLeft,
|
|
15153
|
+
title: "Align Left",
|
|
15154
|
+
onClick: () => editor.chain().focus().setTextAlign("left").run(),
|
|
15155
|
+
disabled: !editor.can().setTextAlign("left")
|
|
15156
|
+
}
|
|
15157
|
+
),
|
|
15158
|
+
/* @__PURE__ */ jsx6(
|
|
15159
|
+
ToolbarButton_default,
|
|
15160
|
+
{
|
|
15161
|
+
icon: MdFormatAlignCenter,
|
|
15162
|
+
title: "Align Center",
|
|
15163
|
+
onClick: () => editor.chain().focus().setTextAlign("center").run(),
|
|
15164
|
+
disabled: !editor.can().setTextAlign("center")
|
|
15165
|
+
}
|
|
15166
|
+
),
|
|
15167
|
+
/* @__PURE__ */ jsx6(
|
|
15168
|
+
ToolbarButton_default,
|
|
15169
|
+
{
|
|
15170
|
+
icon: MdFormatAlignRight,
|
|
15171
|
+
title: "Align Right",
|
|
15172
|
+
onClick: () => editor.chain().focus().setTextAlign("right").run(),
|
|
15173
|
+
disabled: !editor.can().setTextAlign("right")
|
|
15174
|
+
}
|
|
15175
|
+
),
|
|
15176
|
+
/* @__PURE__ */ jsx6(
|
|
15177
|
+
ToolbarButton_default,
|
|
15178
|
+
{
|
|
15179
|
+
icon: MdFormatAlignJustify,
|
|
15180
|
+
title: "Justify",
|
|
15181
|
+
onClick: () => editor.chain().focus().setTextAlign("justify").run(),
|
|
15182
|
+
disabled: !editor.can().setTextAlign("justify")
|
|
15183
|
+
}
|
|
15184
|
+
)
|
|
15185
|
+
] });
|
|
15127
15186
|
}
|
|
15128
15187
|
|
|
15129
15188
|
// src/components/tetrons/toolbar/MiscGroup.tsx
|
|
15130
|
-
import React7 from "react";
|
|
15131
15189
|
import {
|
|
15132
15190
|
MdUndo,
|
|
15133
15191
|
MdRedo,
|
|
@@ -15135,6 +15193,7 @@ import {
|
|
|
15135
15193
|
MdVisibility,
|
|
15136
15194
|
MdCode
|
|
15137
15195
|
} from "react-icons/md";
|
|
15196
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
15138
15197
|
function MiscGroup({ editor }) {
|
|
15139
15198
|
const handlePreview = () => {
|
|
15140
15199
|
const html = editor.getHTML();
|
|
@@ -15155,51 +15214,58 @@ function MiscGroup({ editor }) {
|
|
|
15155
15214
|
previewWindow.document.close();
|
|
15156
15215
|
}
|
|
15157
15216
|
};
|
|
15158
|
-
return /* @__PURE__ */
|
|
15159
|
-
|
|
15160
|
-
|
|
15161
|
-
|
|
15162
|
-
|
|
15163
|
-
|
|
15164
|
-
|
|
15165
|
-
|
|
15166
|
-
|
|
15167
|
-
|
|
15168
|
-
|
|
15169
|
-
|
|
15170
|
-
|
|
15171
|
-
|
|
15172
|
-
|
|
15173
|
-
|
|
15174
|
-
|
|
15175
|
-
|
|
15176
|
-
|
|
15177
|
-
|
|
15178
|
-
|
|
15179
|
-
|
|
15180
|
-
|
|
15181
|
-
|
|
15182
|
-
|
|
15183
|
-
|
|
15184
|
-
|
|
15185
|
-
|
|
15186
|
-
|
|
15187
|
-
|
|
15188
|
-
|
|
15189
|
-
|
|
15190
|
-
|
|
15191
|
-
|
|
15192
|
-
|
|
15193
|
-
|
|
15194
|
-
|
|
15195
|
-
|
|
15196
|
-
|
|
15217
|
+
return /* @__PURE__ */ jsxs6("div", { className: "misc-group", children: [
|
|
15218
|
+
/* @__PURE__ */ jsx7(
|
|
15219
|
+
ToolbarButton_default,
|
|
15220
|
+
{
|
|
15221
|
+
icon: MdUndo,
|
|
15222
|
+
label: "Undo",
|
|
15223
|
+
onClick: () => editor.chain().focus().undo().run(),
|
|
15224
|
+
disabled: !editor.can().undo()
|
|
15225
|
+
}
|
|
15226
|
+
),
|
|
15227
|
+
/* @__PURE__ */ jsx7(
|
|
15228
|
+
ToolbarButton_default,
|
|
15229
|
+
{
|
|
15230
|
+
icon: MdRedo,
|
|
15231
|
+
label: "Redo",
|
|
15232
|
+
onClick: () => editor.chain().focus().redo().run(),
|
|
15233
|
+
disabled: !editor.can().redo()
|
|
15234
|
+
}
|
|
15235
|
+
),
|
|
15236
|
+
/* @__PURE__ */ jsx7(
|
|
15237
|
+
ToolbarButton_default,
|
|
15238
|
+
{
|
|
15239
|
+
icon: MdRefresh,
|
|
15240
|
+
label: "Reset Formatting",
|
|
15241
|
+
onClick: () => editor.chain().focus().unsetAllMarks().clearNodes().run()
|
|
15242
|
+
}
|
|
15243
|
+
),
|
|
15244
|
+
/* @__PURE__ */ jsx7(
|
|
15245
|
+
ToolbarButton_default,
|
|
15246
|
+
{
|
|
15247
|
+
icon: MdCode,
|
|
15248
|
+
label: "Toggle Code Block",
|
|
15249
|
+
onClick: () => editor.chain().focus().toggleCodeBlock().run(),
|
|
15250
|
+
isActive: editor.isActive("codeBlock")
|
|
15251
|
+
}
|
|
15252
|
+
),
|
|
15253
|
+
/* @__PURE__ */ jsx7(
|
|
15254
|
+
ToolbarButton_default,
|
|
15255
|
+
{
|
|
15256
|
+
icon: MdVisibility,
|
|
15257
|
+
label: "Preview",
|
|
15258
|
+
onClick: handlePreview
|
|
15259
|
+
}
|
|
15260
|
+
)
|
|
15261
|
+
] });
|
|
15197
15262
|
}
|
|
15198
15263
|
|
|
15199
15264
|
// src/components/tetrons/toolbar/FileGroup.tsx
|
|
15200
15265
|
import { FaRegFolderOpen } from "react-icons/fa";
|
|
15201
15266
|
import { VscNewFile } from "react-icons/vsc";
|
|
15202
|
-
import
|
|
15267
|
+
import { useRef as useRef3 } from "react";
|
|
15268
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
15203
15269
|
function FileGroup({ editor }) {
|
|
15204
15270
|
const fileInputRef = useRef3(null);
|
|
15205
15271
|
const handleNew = () => {
|
|
@@ -15228,14 +15294,8 @@ function FileGroup({ editor }) {
|
|
|
15228
15294
|
e.target.value = "";
|
|
15229
15295
|
}
|
|
15230
15296
|
};
|
|
15231
|
-
return /* @__PURE__ */
|
|
15232
|
-
|
|
15233
|
-
{
|
|
15234
|
-
className: "flex items-center gap-1 border-r pr-3",
|
|
15235
|
-
role: "group",
|
|
15236
|
-
"aria-label": "File actions"
|
|
15237
|
-
},
|
|
15238
|
-
/* @__PURE__ */ React8.createElement(
|
|
15297
|
+
return /* @__PURE__ */ jsxs7("div", { className: "file-group", role: "group", "aria-label": "File actions", children: [
|
|
15298
|
+
/* @__PURE__ */ jsx8(
|
|
15239
15299
|
"input",
|
|
15240
15300
|
{
|
|
15241
15301
|
type: "file",
|
|
@@ -15246,8 +15306,8 @@ function FileGroup({ editor }) {
|
|
|
15246
15306
|
"aria-label": "Open JSON file"
|
|
15247
15307
|
}
|
|
15248
15308
|
),
|
|
15249
|
-
/* @__PURE__ */
|
|
15250
|
-
/* @__PURE__ */
|
|
15309
|
+
/* @__PURE__ */ jsx8(ToolbarButton_default, { icon: VscNewFile, onClick: handleNew, title: "New" }),
|
|
15310
|
+
/* @__PURE__ */ jsx8(
|
|
15251
15311
|
ToolbarButton_default,
|
|
15252
15312
|
{
|
|
15253
15313
|
icon: FaRegFolderOpen,
|
|
@@ -15255,12 +15315,13 @@ function FileGroup({ editor }) {
|
|
|
15255
15315
|
title: "Open File"
|
|
15256
15316
|
}
|
|
15257
15317
|
)
|
|
15258
|
-
);
|
|
15318
|
+
] });
|
|
15259
15319
|
}
|
|
15260
15320
|
|
|
15261
15321
|
// src/components/tetrons/toolbar/TetronsToolbar.tsx
|
|
15322
|
+
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
15262
15323
|
function TetronsToolbar({ editor }) {
|
|
15263
|
-
const [autoSave, setAutoSave] =
|
|
15324
|
+
const [autoSave, setAutoSave] = React6.useState(false);
|
|
15264
15325
|
useEffect3(() => {
|
|
15265
15326
|
if (!editor) return;
|
|
15266
15327
|
const handleUpdate = () => {
|
|
@@ -15277,16 +15338,27 @@ function TetronsToolbar({ editor }) {
|
|
|
15277
15338
|
editor.off("update", handleUpdate);
|
|
15278
15339
|
};
|
|
15279
15340
|
}, [autoSave, editor]);
|
|
15280
|
-
return /* @__PURE__ */
|
|
15281
|
-
"
|
|
15282
|
-
|
|
15283
|
-
|
|
15284
|
-
|
|
15285
|
-
|
|
15286
|
-
|
|
15287
|
-
|
|
15288
|
-
|
|
15289
|
-
|
|
15341
|
+
return /* @__PURE__ */ jsxs8("div", { className: "tetrons-toolbar", children: [
|
|
15342
|
+
/* @__PURE__ */ jsxs8("div", { className: "group", children: [
|
|
15343
|
+
/* @__PURE__ */ jsx9(
|
|
15344
|
+
"input",
|
|
15345
|
+
{
|
|
15346
|
+
type: "checkbox",
|
|
15347
|
+
id: "autoSave",
|
|
15348
|
+
checked: autoSave,
|
|
15349
|
+
onChange: (e) => setAutoSave(e.target.checked)
|
|
15350
|
+
}
|
|
15351
|
+
),
|
|
15352
|
+
/* @__PURE__ */ jsx9("label", { htmlFor: "autoSave", children: "Auto Save" })
|
|
15353
|
+
] }),
|
|
15354
|
+
/* @__PURE__ */ jsx9(FileGroup, { editor }),
|
|
15355
|
+
/* @__PURE__ */ jsx9(ClipboardGroup, { editor }),
|
|
15356
|
+
/* @__PURE__ */ jsx9(FontStyleGroup, { editor }),
|
|
15357
|
+
/* @__PURE__ */ jsx9(ListAlignGroup, { editor }),
|
|
15358
|
+
/* @__PURE__ */ jsx9(InsertGroup, { editor }),
|
|
15359
|
+
/* @__PURE__ */ jsx9(MiscGroup, { editor }),
|
|
15360
|
+
/* @__PURE__ */ jsx9(ActionGroup, { editor })
|
|
15361
|
+
] });
|
|
15290
15362
|
}
|
|
15291
15363
|
|
|
15292
15364
|
// src/components/tetrons/ResizableImage.ts
|
|
@@ -15294,8 +15366,9 @@ import Image from "@tiptap/extension-image";
|
|
|
15294
15366
|
import { ReactNodeViewRenderer } from "@tiptap/react";
|
|
15295
15367
|
|
|
15296
15368
|
// src/components/tetrons/ResizableImageComponent.tsx
|
|
15297
|
-
import
|
|
15369
|
+
import { useRef as useRef4, useEffect as useEffect4 } from "react";
|
|
15298
15370
|
import { NodeViewWrapper } from "@tiptap/react";
|
|
15371
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
15299
15372
|
var ResizableImageComponent = ({
|
|
15300
15373
|
node,
|
|
15301
15374
|
updateAttributes: updateAttributes2,
|
|
@@ -15315,7 +15388,7 @@ var ResizableImageComponent = ({
|
|
|
15315
15388
|
observer.observe(img);
|
|
15316
15389
|
return () => observer.disconnect();
|
|
15317
15390
|
}, [updateAttributes2]);
|
|
15318
|
-
return /* @__PURE__ */
|
|
15391
|
+
return /* @__PURE__ */ jsx10(
|
|
15319
15392
|
NodeViewWrapper,
|
|
15320
15393
|
{
|
|
15321
15394
|
ref: wrapperRef,
|
|
@@ -15328,26 +15401,26 @@ var ResizableImageComponent = ({
|
|
|
15328
15401
|
padding: 2,
|
|
15329
15402
|
display: "inline-block",
|
|
15330
15403
|
maxWidth: "100%"
|
|
15331
|
-
}
|
|
15332
|
-
|
|
15333
|
-
|
|
15334
|
-
|
|
15335
|
-
|
|
15336
|
-
|
|
15337
|
-
|
|
15338
|
-
|
|
15339
|
-
|
|
15340
|
-
|
|
15341
|
-
|
|
15342
|
-
|
|
15343
|
-
|
|
15344
|
-
|
|
15345
|
-
|
|
15346
|
-
|
|
15347
|
-
|
|
15348
|
-
|
|
15349
|
-
|
|
15350
|
-
|
|
15404
|
+
},
|
|
15405
|
+
children: /* @__PURE__ */ jsx10(
|
|
15406
|
+
"img",
|
|
15407
|
+
{
|
|
15408
|
+
ref: imgRef,
|
|
15409
|
+
src,
|
|
15410
|
+
alt: alt ?? "",
|
|
15411
|
+
title: title ?? "",
|
|
15412
|
+
loading: "lazy",
|
|
15413
|
+
style: {
|
|
15414
|
+
width: width ? `${width}px` : "auto",
|
|
15415
|
+
height: height ? `${height}px` : "auto",
|
|
15416
|
+
display: "block",
|
|
15417
|
+
userSelect: "none",
|
|
15418
|
+
pointerEvents: "auto"
|
|
15419
|
+
},
|
|
15420
|
+
draggable: false
|
|
15421
|
+
}
|
|
15422
|
+
)
|
|
15423
|
+
}
|
|
15351
15424
|
);
|
|
15352
15425
|
};
|
|
15353
15426
|
var ResizableImageComponent_default = ResizableImageComponent;
|
|
@@ -15388,8 +15461,9 @@ var ResizableImage = Image.extend({
|
|
|
15388
15461
|
import { ReactNodeViewRenderer as ReactNodeViewRenderer2 } from "@tiptap/react";
|
|
15389
15462
|
|
|
15390
15463
|
// src/components/tetrons/ResizableVideoComponent.tsx
|
|
15391
|
-
import
|
|
15464
|
+
import { useRef as useRef5, useEffect as useEffect5 } from "react";
|
|
15392
15465
|
import { NodeViewWrapper as NodeViewWrapper2 } from "@tiptap/react";
|
|
15466
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
15393
15467
|
var ResizableVideoComponent = ({
|
|
15394
15468
|
node,
|
|
15395
15469
|
updateAttributes: updateAttributes2,
|
|
@@ -15409,7 +15483,7 @@ var ResizableVideoComponent = ({
|
|
|
15409
15483
|
observer.observe(video);
|
|
15410
15484
|
return () => observer.disconnect();
|
|
15411
15485
|
}, [updateAttributes2]);
|
|
15412
|
-
return /* @__PURE__ */
|
|
15486
|
+
return /* @__PURE__ */ jsx11(
|
|
15413
15487
|
NodeViewWrapper2,
|
|
15414
15488
|
{
|
|
15415
15489
|
ref: wrapperRef,
|
|
@@ -15421,20 +15495,20 @@ var ResizableVideoComponent = ({
|
|
|
15421
15495
|
border: "1px solid #ccc",
|
|
15422
15496
|
padding: "2px",
|
|
15423
15497
|
display: "inline-block"
|
|
15424
|
-
}
|
|
15425
|
-
|
|
15426
|
-
|
|
15427
|
-
|
|
15428
|
-
|
|
15429
|
-
|
|
15430
|
-
|
|
15431
|
-
|
|
15432
|
-
|
|
15433
|
-
|
|
15434
|
-
|
|
15498
|
+
},
|
|
15499
|
+
children: /* @__PURE__ */ jsx11(
|
|
15500
|
+
"video",
|
|
15501
|
+
{
|
|
15502
|
+
ref: videoRef,
|
|
15503
|
+
src,
|
|
15504
|
+
controls,
|
|
15505
|
+
style: {
|
|
15506
|
+
width: width ? `${width}px` : "auto",
|
|
15507
|
+
height: height ? `${height}px` : "auto"
|
|
15508
|
+
}
|
|
15435
15509
|
}
|
|
15436
|
-
|
|
15437
|
-
|
|
15510
|
+
)
|
|
15511
|
+
}
|
|
15438
15512
|
);
|
|
15439
15513
|
};
|
|
15440
15514
|
var ResizableVideoComponent_default = ResizableVideoComponent;
|
|
@@ -15487,7 +15561,8 @@ var ResizableVideo = Node2.create({
|
|
|
15487
15561
|
});
|
|
15488
15562
|
|
|
15489
15563
|
// src/components/tetrons/toolbar/TableContextMenu.tsx
|
|
15490
|
-
import
|
|
15564
|
+
import { useEffect as useEffect6, useState as useState4 } from "react";
|
|
15565
|
+
import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
15491
15566
|
function TableContextMenu({ editor }) {
|
|
15492
15567
|
const [menuPosition, setMenuPosition] = useState4(null);
|
|
15493
15568
|
useEffect6(() => {
|
|
@@ -15515,60 +15590,62 @@ function TableContextMenu({ editor }) {
|
|
|
15515
15590
|
const deleteRow = () => editor.chain().focus().deleteRow().run();
|
|
15516
15591
|
const deleteCol = () => editor.chain().focus().deleteColumn().run();
|
|
15517
15592
|
if (!menuPosition) return null;
|
|
15518
|
-
return /* @__PURE__ */
|
|
15593
|
+
return /* @__PURE__ */ jsxs9(
|
|
15519
15594
|
"ul",
|
|
15520
15595
|
{
|
|
15521
15596
|
className: "absolute bg-white shadow border rounded text-sm z-50",
|
|
15522
|
-
style: { top: menuPosition.y, left: menuPosition.x }
|
|
15523
|
-
|
|
15524
|
-
|
|
15525
|
-
|
|
15526
|
-
|
|
15527
|
-
|
|
15528
|
-
|
|
15529
|
-
|
|
15530
|
-
|
|
15531
|
-
|
|
15532
|
-
|
|
15533
|
-
|
|
15534
|
-
|
|
15535
|
-
|
|
15536
|
-
|
|
15537
|
-
|
|
15538
|
-
|
|
15539
|
-
|
|
15540
|
-
|
|
15541
|
-
|
|
15542
|
-
|
|
15543
|
-
|
|
15544
|
-
|
|
15545
|
-
|
|
15546
|
-
|
|
15547
|
-
|
|
15548
|
-
|
|
15549
|
-
|
|
15550
|
-
|
|
15551
|
-
|
|
15552
|
-
|
|
15553
|
-
|
|
15554
|
-
|
|
15555
|
-
|
|
15556
|
-
|
|
15557
|
-
|
|
15558
|
-
|
|
15559
|
-
|
|
15560
|
-
|
|
15561
|
-
|
|
15562
|
-
|
|
15563
|
-
|
|
15564
|
-
|
|
15565
|
-
|
|
15566
|
-
|
|
15567
|
-
|
|
15568
|
-
|
|
15569
|
-
|
|
15570
|
-
|
|
15571
|
-
|
|
15597
|
+
style: { top: menuPosition.y, left: menuPosition.x },
|
|
15598
|
+
children: [
|
|
15599
|
+
/* @__PURE__ */ jsx12(
|
|
15600
|
+
"li",
|
|
15601
|
+
{
|
|
15602
|
+
className: "px-3 py-1 hover:bg-gray-100 cursor-pointer",
|
|
15603
|
+
onClick: insertRowAbove,
|
|
15604
|
+
children: "Insert Row Above"
|
|
15605
|
+
}
|
|
15606
|
+
),
|
|
15607
|
+
/* @__PURE__ */ jsx12(
|
|
15608
|
+
"li",
|
|
15609
|
+
{
|
|
15610
|
+
className: "px-3 py-1 hover:bg-gray-100 cursor-pointer",
|
|
15611
|
+
onClick: insertRowBelow,
|
|
15612
|
+
children: "Insert Row Below"
|
|
15613
|
+
}
|
|
15614
|
+
),
|
|
15615
|
+
/* @__PURE__ */ jsx12(
|
|
15616
|
+
"li",
|
|
15617
|
+
{
|
|
15618
|
+
className: "px-3 py-1 hover:bg-gray-100 cursor-pointer",
|
|
15619
|
+
onClick: insertColLeft,
|
|
15620
|
+
children: "Insert Column Left"
|
|
15621
|
+
}
|
|
15622
|
+
),
|
|
15623
|
+
/* @__PURE__ */ jsx12(
|
|
15624
|
+
"li",
|
|
15625
|
+
{
|
|
15626
|
+
className: "px-3 py-1 hover:bg-gray-100 cursor-pointer",
|
|
15627
|
+
onClick: insertColRight,
|
|
15628
|
+
children: "Insert Column Right"
|
|
15629
|
+
}
|
|
15630
|
+
),
|
|
15631
|
+
/* @__PURE__ */ jsx12(
|
|
15632
|
+
"li",
|
|
15633
|
+
{
|
|
15634
|
+
className: "px-3 py-1 hover:bg-red-100 cursor-pointer",
|
|
15635
|
+
onClick: deleteRow,
|
|
15636
|
+
children: "Delete Row"
|
|
15637
|
+
}
|
|
15638
|
+
),
|
|
15639
|
+
/* @__PURE__ */ jsx12(
|
|
15640
|
+
"li",
|
|
15641
|
+
{
|
|
15642
|
+
className: "px-3 py-1 hover:bg-red-100 cursor-pointer",
|
|
15643
|
+
onClick: deleteCol,
|
|
15644
|
+
children: "Delete Column"
|
|
15645
|
+
}
|
|
15646
|
+
)
|
|
15647
|
+
]
|
|
15648
|
+
}
|
|
15572
15649
|
);
|
|
15573
15650
|
}
|
|
15574
15651
|
|
|
@@ -17092,12 +17169,13 @@ function typescript(hljs) {
|
|
|
17092
17169
|
}
|
|
17093
17170
|
|
|
17094
17171
|
// src/components/tetrons/EditorContent.tsx
|
|
17172
|
+
import { Fragment as Fragment2, jsx as jsx13, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
17095
17173
|
var lowlight = createLowlight();
|
|
17096
17174
|
lowlight.register("js", javascript);
|
|
17097
17175
|
lowlight.register("ts", typescript);
|
|
17098
17176
|
function EditorContent() {
|
|
17099
|
-
const [versions, setVersions] =
|
|
17100
|
-
const [currentVersionIndex, setCurrentVersionIndex] =
|
|
17177
|
+
const [versions, setVersions] = React10.useState([]);
|
|
17178
|
+
const [currentVersionIndex, setCurrentVersionIndex] = React10.useState(null);
|
|
17101
17179
|
const editor = useEditor({
|
|
17102
17180
|
extensions: [
|
|
17103
17181
|
Document,
|
|
@@ -17181,32 +17259,47 @@ function EditorContent() {
|
|
|
17181
17259
|
setCurrentVersionIndex(index);
|
|
17182
17260
|
}
|
|
17183
17261
|
};
|
|
17184
|
-
return /* @__PURE__ */
|
|
17185
|
-
"
|
|
17186
|
-
|
|
17187
|
-
|
|
17188
|
-
|
|
17189
|
-
|
|
17190
|
-
|
|
17191
|
-
|
|
17192
|
-
|
|
17193
|
-
|
|
17194
|
-
|
|
17195
|
-
|
|
17196
|
-
|
|
17197
|
-
|
|
17198
|
-
|
|
17199
|
-
|
|
17200
|
-
|
|
17201
|
-
|
|
17202
|
-
|
|
17203
|
-
|
|
17204
|
-
|
|
17205
|
-
|
|
17206
|
-
|
|
17207
|
-
|
|
17208
|
-
|
|
17209
|
-
|
|
17262
|
+
return /* @__PURE__ */ jsxs10("div", { className: "editor-container", children: [
|
|
17263
|
+
/* @__PURE__ */ jsxs10("div", { className: "editor-toolbar", children: [
|
|
17264
|
+
/* @__PURE__ */ jsx13(
|
|
17265
|
+
"button",
|
|
17266
|
+
{
|
|
17267
|
+
type: "button",
|
|
17268
|
+
onClick: saveVersion,
|
|
17269
|
+
disabled: !editor,
|
|
17270
|
+
className: "editor-save-btn",
|
|
17271
|
+
children: "Save Version"
|
|
17272
|
+
}
|
|
17273
|
+
),
|
|
17274
|
+
/* @__PURE__ */ jsxs10("div", { className: "editor-versions-wrapper", children: [
|
|
17275
|
+
versions.length === 0 && /* @__PURE__ */ jsx13("span", { className: "editor-no-versions", children: "No saved versions" }),
|
|
17276
|
+
versions.map((_, idx) => /* @__PURE__ */ jsx13(
|
|
17277
|
+
"button",
|
|
17278
|
+
{
|
|
17279
|
+
type: "button",
|
|
17280
|
+
onClick: () => restoreVersion(idx),
|
|
17281
|
+
className: `editor-version-btn ${idx === currentVersionIndex ? "active" : ""}`,
|
|
17282
|
+
title: `Restore Version ${idx + 1}`,
|
|
17283
|
+
children: `V${idx + 1}`
|
|
17284
|
+
},
|
|
17285
|
+
idx
|
|
17286
|
+
))
|
|
17287
|
+
] })
|
|
17288
|
+
] }),
|
|
17289
|
+
editor && /* @__PURE__ */ jsx13(TetronsToolbar, { editor }),
|
|
17290
|
+
/* @__PURE__ */ jsx13(
|
|
17291
|
+
"div",
|
|
17292
|
+
{
|
|
17293
|
+
ref: wrapperRef,
|
|
17294
|
+
className: "editor-content-wrapper",
|
|
17295
|
+
onClick: handleEditorClick,
|
|
17296
|
+
children: editor ? /* @__PURE__ */ jsxs10(Fragment2, { children: [
|
|
17297
|
+
/* @__PURE__ */ jsx13(TiptapEditorContent, { editor }),
|
|
17298
|
+
editor && /* @__PURE__ */ jsx13(TableContextMenu, { editor })
|
|
17299
|
+
] }) : /* @__PURE__ */ jsx13("div", { className: "editor-loading", children: "Loading editor..." })
|
|
17300
|
+
}
|
|
17301
|
+
)
|
|
17302
|
+
] });
|
|
17210
17303
|
}
|
|
17211
17304
|
|
|
17212
17305
|
// src/index.ts
|