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