tetrons 2.2.2 → 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 +2 -1
- package/dist/app/{layout.jsx → layout.js} +2 -5
- package/dist/app/page.d.ts +1 -1
- 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 -22
- 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} +12 -35
- 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 -14
- package/dist/components/tetrons/toolbar/ToolbarButton.js +7 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +0 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +749 -629
- package/dist/styles/styles/tetrons.css +371 -0
- package/dist/styles/tetrons.css +42 -0
- package/package.json +5 -3
- package/dist/app/page.jsx +0 -9
- 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 -163
- 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,49 +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
|
-
|
|
14529
|
-
|
|
14530
|
-
|
|
14531
|
-
|
|
14532
|
-
|
|
14533
|
-
|
|
14534
|
-
|
|
14535
|
-
|
|
14536
|
-
|
|
14537
|
-
|
|
14538
|
-
|
|
14539
|
-
|
|
14540
|
-
|
|
14541
|
-
|
|
14542
|
-
|
|
14543
|
-
|
|
14544
|
-
|
|
14545
|
-
|
|
14546
|
-
|
|
14547
|
-
|
|
14548
|
-
|
|
14549
|
-
|
|
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
|
+
] });
|
|
14550
14569
|
}
|
|
14551
14570
|
|
|
14552
14571
|
// src/components/tetrons/toolbar/ClipboardGroup.tsx
|
|
@@ -14556,59 +14575,64 @@ import {
|
|
|
14556
14575
|
MdContentCopy,
|
|
14557
14576
|
MdFormatPaint
|
|
14558
14577
|
} from "react-icons/md";
|
|
14559
|
-
import
|
|
14578
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
14560
14579
|
function ClipboardGroup({ editor }) {
|
|
14561
|
-
return /* @__PURE__ */
|
|
14562
|
-
|
|
14563
|
-
|
|
14564
|
-
|
|
14565
|
-
|
|
14566
|
-
|
|
14567
|
-
|
|
14568
|
-
|
|
14569
|
-
|
|
14570
|
-
|
|
14571
|
-
|
|
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
|
+
}
|
|
14572
14593
|
}
|
|
14573
14594
|
}
|
|
14574
|
-
|
|
14575
|
-
|
|
14576
|
-
|
|
14577
|
-
|
|
14578
|
-
|
|
14579
|
-
|
|
14580
|
-
|
|
14581
|
-
|
|
14582
|
-
|
|
14583
|
-
|
|
14584
|
-
|
|
14585
|
-
|
|
14586
|
-
|
|
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
|
+
}
|
|
14587
14609
|
}
|
|
14588
|
-
|
|
14589
|
-
|
|
14590
|
-
|
|
14591
|
-
|
|
14592
|
-
|
|
14593
|
-
|
|
14594
|
-
|
|
14595
|
-
|
|
14596
|
-
|
|
14597
|
-
|
|
14598
|
-
|
|
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
|
+
}
|
|
14599
14622
|
}
|
|
14600
|
-
|
|
14601
|
-
|
|
14602
|
-
|
|
14603
|
-
|
|
14604
|
-
|
|
14605
|
-
|
|
14606
|
-
|
|
14607
|
-
|
|
14608
|
-
|
|
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
|
+
}
|
|
14609
14633
|
}
|
|
14610
|
-
|
|
14611
|
-
)
|
|
14634
|
+
)
|
|
14635
|
+
] });
|
|
14612
14636
|
}
|
|
14613
14637
|
|
|
14614
14638
|
// src/components/tetrons/toolbar/FontStyleGroup.tsx
|
|
@@ -14624,7 +14648,8 @@ import {
|
|
|
14624
14648
|
} from "react-icons/md";
|
|
14625
14649
|
import { ImTextColor } from "react-icons/im";
|
|
14626
14650
|
import { BiSolidColorFill } from "react-icons/bi";
|
|
14627
|
-
import
|
|
14651
|
+
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
14652
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
14628
14653
|
function FontStyleGroup({ editor }) {
|
|
14629
14654
|
const [textColor, setTextColor] = useState2("#000000");
|
|
14630
14655
|
const [highlightColor, setHighlightColor] = useState2("#ffff00");
|
|
@@ -14650,161 +14675,182 @@ function FontStyleGroup({ editor }) {
|
|
|
14650
14675
|
editor.off("transaction", updateStates);
|
|
14651
14676
|
};
|
|
14652
14677
|
}, [editor]);
|
|
14653
|
-
return /* @__PURE__ */
|
|
14654
|
-
|
|
14655
|
-
|
|
14656
|
-
title: "Font Family",
|
|
14657
|
-
value: fontFamily,
|
|
14658
|
-
onChange: (e) => {
|
|
14659
|
-
const value = e.target.value;
|
|
14660
|
-
setFontFamily(value);
|
|
14661
|
-
editor.chain().focus().setFontFamily(value).run();
|
|
14662
|
-
}
|
|
14663
|
-
},
|
|
14664
|
-
/* @__PURE__ */ React4.createElement("option", { value: "Arial" }, "Arial"),
|
|
14665
|
-
/* @__PURE__ */ React4.createElement("option", { value: "Georgia" }, "Georgia"),
|
|
14666
|
-
/* @__PURE__ */ React4.createElement("option", { value: "Times New Roman" }, "Times New Roman"),
|
|
14667
|
-
/* @__PURE__ */ React4.createElement("option", { value: "Courier New" }, "Courier New"),
|
|
14668
|
-
/* @__PURE__ */ React4.createElement("option", { value: "Verdana" }, "Verdana")
|
|
14669
|
-
), /* @__PURE__ */ React4.createElement(
|
|
14670
|
-
"select",
|
|
14671
|
-
{
|
|
14672
|
-
title: "Font Size",
|
|
14673
|
-
value: fontSize,
|
|
14674
|
-
onChange: (e) => {
|
|
14675
|
-
const value = e.target.value;
|
|
14676
|
-
setFontSize(value);
|
|
14677
|
-
editor.chain().focus().setFontSize(value).run();
|
|
14678
|
-
}
|
|
14679
|
-
},
|
|
14680
|
-
/* @__PURE__ */ React4.createElement("option", { value: "12px" }, "12"),
|
|
14681
|
-
/* @__PURE__ */ React4.createElement("option", { value: "14px" }, "14"),
|
|
14682
|
-
/* @__PURE__ */ React4.createElement("option", { value: "16px" }, "16"),
|
|
14683
|
-
/* @__PURE__ */ React4.createElement("option", { value: "18px" }, "18"),
|
|
14684
|
-
/* @__PURE__ */ React4.createElement("option", { value: "24px" }, "24"),
|
|
14685
|
-
/* @__PURE__ */ React4.createElement("option", { value: "36px" }, "36"),
|
|
14686
|
-
/* @__PURE__ */ React4.createElement("option", { value: "48px" }, "48"),
|
|
14687
|
-
/* @__PURE__ */ React4.createElement("option", { value: "64px" }, "64"),
|
|
14688
|
-
/* @__PURE__ */ React4.createElement("option", { value: "72px" }, "72")
|
|
14689
|
-
), /* @__PURE__ */ React4.createElement(
|
|
14690
|
-
ToolbarButton_default,
|
|
14691
|
-
{
|
|
14692
|
-
icon: MdFormatBold,
|
|
14693
|
-
label: "Bold",
|
|
14694
|
-
onClick: () => editor.chain().focus().toggleBold().run(),
|
|
14695
|
-
isActive: editor.isActive("bold")
|
|
14696
|
-
}
|
|
14697
|
-
), /* @__PURE__ */ React4.createElement(
|
|
14698
|
-
ToolbarButton_default,
|
|
14699
|
-
{
|
|
14700
|
-
icon: MdFormatItalic,
|
|
14701
|
-
label: "Italic",
|
|
14702
|
-
onClick: () => editor.chain().focus().toggleItalic().run(),
|
|
14703
|
-
isActive: editor.isActive("italic")
|
|
14704
|
-
}
|
|
14705
|
-
), /* @__PURE__ */ React4.createElement(
|
|
14706
|
-
ToolbarButton_default,
|
|
14707
|
-
{
|
|
14708
|
-
icon: MdFormatUnderlined,
|
|
14709
|
-
label: "Underline",
|
|
14710
|
-
onClick: () => editor.chain().focus().toggleUnderline().run(),
|
|
14711
|
-
isActive: editor.isActive("underline")
|
|
14712
|
-
}
|
|
14713
|
-
), /* @__PURE__ */ React4.createElement(
|
|
14714
|
-
ToolbarButton_default,
|
|
14715
|
-
{
|
|
14716
|
-
icon: MdStrikethroughS,
|
|
14717
|
-
label: "Strikethrough",
|
|
14718
|
-
onClick: () => editor.chain().focus().toggleStrike().run(),
|
|
14719
|
-
isActive: editor.isActive("strike")
|
|
14720
|
-
}
|
|
14721
|
-
), /* @__PURE__ */ React4.createElement(
|
|
14722
|
-
ToolbarButton_default,
|
|
14723
|
-
{
|
|
14724
|
-
icon: MdSubscript,
|
|
14725
|
-
label: "Subscript",
|
|
14726
|
-
onClick: () => editor.chain().focus().toggleSubscript().run(),
|
|
14727
|
-
isActive: editor.isActive("subscript")
|
|
14728
|
-
}
|
|
14729
|
-
), /* @__PURE__ */ React4.createElement(
|
|
14730
|
-
ToolbarButton_default,
|
|
14731
|
-
{
|
|
14732
|
-
icon: MdSuperscript,
|
|
14733
|
-
label: "Superscript",
|
|
14734
|
-
onClick: () => editor.chain().focus().toggleSuperscript().run(),
|
|
14735
|
-
isActive: editor.isActive("superscript")
|
|
14736
|
-
}
|
|
14737
|
-
), /* @__PURE__ */ React4.createElement(
|
|
14738
|
-
"label",
|
|
14739
|
-
{
|
|
14740
|
-
title: "Font Color",
|
|
14741
|
-
"aria-label": "Font Color",
|
|
14742
|
-
className: "color-label",
|
|
14743
|
-
style: { "--indicator-color": textColor }
|
|
14744
|
-
},
|
|
14745
|
-
/* @__PURE__ */ React4.createElement(ImTextColor, { size: 20 }),
|
|
14746
|
-
/* @__PURE__ */ React4.createElement("div", { className: "color-indicator" }),
|
|
14747
|
-
/* @__PURE__ */ React4.createElement(
|
|
14748
|
-
"input",
|
|
14678
|
+
return /* @__PURE__ */ jsxs3("div", { className: "font-style-group", children: [
|
|
14679
|
+
/* @__PURE__ */ jsxs3(
|
|
14680
|
+
"select",
|
|
14749
14681
|
{
|
|
14750
|
-
|
|
14751
|
-
value:
|
|
14682
|
+
title: "Font Family",
|
|
14683
|
+
value: fontFamily,
|
|
14752
14684
|
onChange: (e) => {
|
|
14753
|
-
const
|
|
14754
|
-
|
|
14755
|
-
editor.chain().focus().
|
|
14756
|
-
}
|
|
14685
|
+
const value = e.target.value;
|
|
14686
|
+
setFontFamily(value);
|
|
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
|
+
]
|
|
14757
14696
|
}
|
|
14758
|
-
)
|
|
14759
|
-
|
|
14760
|
-
|
|
14761
|
-
{
|
|
14762
|
-
title: "Highlight Color",
|
|
14763
|
-
"aria-label": "Highlight Color",
|
|
14764
|
-
className: "color-label",
|
|
14765
|
-
style: { "--indicator-color": highlightColor }
|
|
14766
|
-
},
|
|
14767
|
-
/* @__PURE__ */ React4.createElement(BiSolidColorFill, { size: 20 }),
|
|
14768
|
-
/* @__PURE__ */ React4.createElement("div", { className: "color-indicator" }),
|
|
14769
|
-
/* @__PURE__ */ React4.createElement(
|
|
14770
|
-
"input",
|
|
14697
|
+
),
|
|
14698
|
+
/* @__PURE__ */ jsxs3(
|
|
14699
|
+
"select",
|
|
14771
14700
|
{
|
|
14772
|
-
|
|
14773
|
-
value:
|
|
14701
|
+
title: "Font Size",
|
|
14702
|
+
value: fontSize,
|
|
14774
14703
|
onChange: (e) => {
|
|
14775
|
-
const
|
|
14776
|
-
|
|
14777
|
-
editor.chain().focus().
|
|
14778
|
-
}
|
|
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
|
+
]
|
|
14779
14719
|
}
|
|
14780
|
-
)
|
|
14781
|
-
|
|
14782
|
-
|
|
14783
|
-
|
|
14784
|
-
|
|
14785
|
-
|
|
14786
|
-
|
|
14787
|
-
|
|
14788
|
-
|
|
14789
|
-
|
|
14790
|
-
|
|
14791
|
-
|
|
14792
|
-
|
|
14793
|
-
|
|
14794
|
-
|
|
14795
|
-
|
|
14796
|
-
)
|
|
14797
|
-
|
|
14798
|
-
|
|
14799
|
-
|
|
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
|
+
}
|
|
14800
14846
|
}
|
|
14801
14847
|
}
|
|
14802
|
-
|
|
14803
|
-
)
|
|
14848
|
+
)
|
|
14849
|
+
] });
|
|
14804
14850
|
}
|
|
14805
14851
|
|
|
14806
14852
|
// src/components/tetrons/toolbar/InsertGroup.tsx
|
|
14807
|
-
import
|
|
14853
|
+
import { useRef as useRef2, useState as useState3 } from "react";
|
|
14808
14854
|
import {
|
|
14809
14855
|
MdTableChart,
|
|
14810
14856
|
MdInsertPhoto,
|
|
@@ -14816,6 +14862,7 @@ import {
|
|
|
14816
14862
|
MdOutlineOndemandVideo
|
|
14817
14863
|
} from "react-icons/md";
|
|
14818
14864
|
import Picker from "@emoji-mart/react";
|
|
14865
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
14819
14866
|
function InsertGroup({ editor }) {
|
|
14820
14867
|
const [showTableGrid, setShowTableGrid] = useState3(false);
|
|
14821
14868
|
const [selectedRows, setSelectedRows] = useState3(1);
|
|
@@ -14891,145 +14938,165 @@ function InsertGroup({ editor }) {
|
|
|
14891
14938
|
return url;
|
|
14892
14939
|
}
|
|
14893
14940
|
}
|
|
14894
|
-
return /* @__PURE__ */
|
|
14895
|
-
|
|
14896
|
-
|
|
14897
|
-
|
|
14898
|
-
|
|
14899
|
-
|
|
14900
|
-
|
|
14901
|
-
|
|
14902
|
-
|
|
14903
|
-
|
|
14904
|
-
|
|
14905
|
-
|
|
14906
|
-
|
|
14907
|
-
|
|
14908
|
-
|
|
14909
|
-
|
|
14910
|
-
|
|
14911
|
-
|
|
14912
|
-
|
|
14913
|
-
|
|
14914
|
-
|
|
14915
|
-
|
|
14916
|
-
|
|
14917
|
-
|
|
14918
|
-
|
|
14919
|
-
|
|
14920
|
-
|
|
14921
|
-
|
|
14922
|
-
|
|
14923
|
-
|
|
14924
|
-
|
|
14925
|
-
|
|
14926
|
-
|
|
14927
|
-
|
|
14928
|
-
|
|
14929
|
-
|
|
14930
|
-
|
|
14931
|
-
|
|
14932
|
-
|
|
14933
|
-
"div",
|
|
14934
|
-
|
|
14935
|
-
|
|
14936
|
-
|
|
14937
|
-
|
|
14938
|
-
|
|
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();
|
|
14939
15027
|
}
|
|
14940
|
-
);
|
|
14941
|
-
})
|
|
14942
|
-
)),
|
|
14943
|
-
/* @__PURE__ */ React5.createElement("div", { className: "table-grid-label" }, selectedRows, " x ", selectedCols)
|
|
14944
|
-
), /* @__PURE__ */ React5.createElement(
|
|
14945
|
-
ToolbarButton_default,
|
|
14946
|
-
{
|
|
14947
|
-
icon: MdInsertPhoto,
|
|
14948
|
-
label: "Insert Image",
|
|
14949
|
-
onClick: () => imageInputRef.current?.click()
|
|
14950
|
-
}
|
|
14951
|
-
), /* @__PURE__ */ React5.createElement(
|
|
14952
|
-
ToolbarButton_default,
|
|
14953
|
-
{
|
|
14954
|
-
icon: MdVideoLibrary,
|
|
14955
|
-
label: "Insert Video",
|
|
14956
|
-
onClick: () => videoInputRef.current?.click()
|
|
14957
|
-
}
|
|
14958
|
-
), /* @__PURE__ */ React5.createElement(
|
|
14959
|
-
ToolbarButton_default,
|
|
14960
|
-
{
|
|
14961
|
-
icon: MdInsertLink,
|
|
14962
|
-
label: "Insert Link",
|
|
14963
|
-
onClick: () => {
|
|
14964
|
-
const url = prompt("Enter URL");
|
|
14965
|
-
if (url) {
|
|
14966
|
-
editor.chain().focus().extendMarkRange("link").setLink({ href: url }).run();
|
|
14967
15028
|
}
|
|
14968
15029
|
}
|
|
14969
|
-
|
|
14970
|
-
|
|
14971
|
-
|
|
14972
|
-
|
|
14973
|
-
|
|
14974
|
-
|
|
14975
|
-
|
|
14976
|
-
|
|
14977
|
-
|
|
14978
|
-
|
|
14979
|
-
|
|
14980
|
-
|
|
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
|
+
}
|
|
14981
15043
|
}
|
|
14982
15044
|
}
|
|
14983
|
-
|
|
14984
|
-
|
|
14985
|
-
|
|
14986
|
-
|
|
14987
|
-
|
|
14988
|
-
|
|
14989
|
-
|
|
14990
|
-
|
|
14991
|
-
|
|
14992
|
-
|
|
14993
|
-
|
|
14994
|
-
|
|
14995
|
-
|
|
14996
|
-
|
|
14997
|
-
|
|
14998
|
-
|
|
14999
|
-
|
|
15000
|
-
|
|
15001
|
-
|
|
15002
|
-
|
|
15003
|
-
|
|
15004
|
-
|
|
15005
|
-
|
|
15006
|
-
|
|
15007
|
-
|
|
15008
|
-
|
|
15009
|
-
|
|
15010
|
-
|
|
15011
|
-
icon: MdOutlineOndemandVideo,
|
|
15012
|
-
label: "Embed",
|
|
15013
|
-
onClick: () => {
|
|
15014
|
-
const url = prompt(
|
|
15015
|
-
"Enter embed URL (YouTube, Vimeo, Google Maps, etc.)"
|
|
15016
|
-
);
|
|
15017
|
-
if (!url) return;
|
|
15018
|
-
const embedUrl = normalizeEmbedUrl(url);
|
|
15019
|
-
const width = prompt("Enter width in pixels", "560");
|
|
15020
|
-
const height = prompt("Enter height in pixels", "315");
|
|
15021
|
-
editor.chain().focus().setEmbed({
|
|
15022
|
-
src: embedUrl,
|
|
15023
|
-
width: width ? parseInt(width) : 560,
|
|
15024
|
-
height: height ? parseInt(height) : 315
|
|
15025
|
-
}).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()
|
|
15026
15073
|
}
|
|
15027
|
-
|
|
15028
|
-
|
|
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
|
+
] });
|
|
15029
15097
|
}
|
|
15030
15098
|
|
|
15031
15099
|
// src/components/tetrons/toolbar/ListAlignGroup.tsx
|
|
15032
|
-
import React6 from "react";
|
|
15033
15100
|
import {
|
|
15034
15101
|
MdFormatListBulleted,
|
|
15035
15102
|
MdFormatListNumbered,
|
|
@@ -15040,76 +15107,85 @@ import {
|
|
|
15040
15107
|
MdFormatAlignRight,
|
|
15041
15108
|
MdFormatAlignJustify
|
|
15042
15109
|
} from "react-icons/md";
|
|
15110
|
+
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
15043
15111
|
function ListAlignGroup({ editor }) {
|
|
15044
|
-
return /* @__PURE__ */
|
|
15045
|
-
|
|
15046
|
-
|
|
15047
|
-
|
|
15048
|
-
|
|
15049
|
-
|
|
15050
|
-
|
|
15051
|
-
|
|
15052
|
-
|
|
15053
|
-
|
|
15054
|
-
|
|
15055
|
-
|
|
15056
|
-
|
|
15057
|
-
|
|
15058
|
-
|
|
15059
|
-
|
|
15060
|
-
|
|
15061
|
-
|
|
15062
|
-
|
|
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
|
-
|
|
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
|
+
] });
|
|
15109
15186
|
}
|
|
15110
15187
|
|
|
15111
15188
|
// src/components/tetrons/toolbar/MiscGroup.tsx
|
|
15112
|
-
import React7 from "react";
|
|
15113
15189
|
import {
|
|
15114
15190
|
MdUndo,
|
|
15115
15191
|
MdRedo,
|
|
@@ -15117,6 +15193,7 @@ import {
|
|
|
15117
15193
|
MdVisibility,
|
|
15118
15194
|
MdCode
|
|
15119
15195
|
} from "react-icons/md";
|
|
15196
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
15120
15197
|
function MiscGroup({ editor }) {
|
|
15121
15198
|
const handlePreview = () => {
|
|
15122
15199
|
const html = editor.getHTML();
|
|
@@ -15137,51 +15214,58 @@ function MiscGroup({ editor }) {
|
|
|
15137
15214
|
previewWindow.document.close();
|
|
15138
15215
|
}
|
|
15139
15216
|
};
|
|
15140
|
-
return /* @__PURE__ */
|
|
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
|
-
|
|
15178
|
-
|
|
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
|
+
] });
|
|
15179
15262
|
}
|
|
15180
15263
|
|
|
15181
15264
|
// src/components/tetrons/toolbar/FileGroup.tsx
|
|
15182
15265
|
import { FaRegFolderOpen } from "react-icons/fa";
|
|
15183
15266
|
import { VscNewFile } from "react-icons/vsc";
|
|
15184
|
-
import
|
|
15267
|
+
import { useRef as useRef3 } from "react";
|
|
15268
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
15185
15269
|
function FileGroup({ editor }) {
|
|
15186
15270
|
const fileInputRef = useRef3(null);
|
|
15187
15271
|
const handleNew = () => {
|
|
@@ -15210,29 +15294,34 @@ function FileGroup({ editor }) {
|
|
|
15210
15294
|
e.target.value = "";
|
|
15211
15295
|
}
|
|
15212
15296
|
};
|
|
15213
|
-
return /* @__PURE__ */
|
|
15214
|
-
|
|
15215
|
-
|
|
15216
|
-
|
|
15217
|
-
|
|
15218
|
-
|
|
15219
|
-
|
|
15220
|
-
|
|
15221
|
-
|
|
15222
|
-
|
|
15223
|
-
|
|
15224
|
-
|
|
15225
|
-
{
|
|
15226
|
-
|
|
15227
|
-
|
|
15228
|
-
|
|
15229
|
-
|
|
15230
|
-
|
|
15297
|
+
return /* @__PURE__ */ jsxs7("div", { className: "file-group", role: "group", "aria-label": "File actions", children: [
|
|
15298
|
+
/* @__PURE__ */ jsx8(
|
|
15299
|
+
"input",
|
|
15300
|
+
{
|
|
15301
|
+
type: "file",
|
|
15302
|
+
accept: ".json",
|
|
15303
|
+
ref: fileInputRef,
|
|
15304
|
+
onChange: handleFileChange,
|
|
15305
|
+
className: "hidden",
|
|
15306
|
+
"aria-label": "Open JSON file"
|
|
15307
|
+
}
|
|
15308
|
+
),
|
|
15309
|
+
/* @__PURE__ */ jsx8(ToolbarButton_default, { icon: VscNewFile, onClick: handleNew, title: "New" }),
|
|
15310
|
+
/* @__PURE__ */ jsx8(
|
|
15311
|
+
ToolbarButton_default,
|
|
15312
|
+
{
|
|
15313
|
+
icon: FaRegFolderOpen,
|
|
15314
|
+
onClick: handleOpen,
|
|
15315
|
+
title: "Open File"
|
|
15316
|
+
}
|
|
15317
|
+
)
|
|
15318
|
+
] });
|
|
15231
15319
|
}
|
|
15232
15320
|
|
|
15233
15321
|
// src/components/tetrons/toolbar/TetronsToolbar.tsx
|
|
15322
|
+
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
15234
15323
|
function TetronsToolbar({ editor }) {
|
|
15235
|
-
const [autoSave, setAutoSave] =
|
|
15324
|
+
const [autoSave, setAutoSave] = React6.useState(false);
|
|
15236
15325
|
useEffect3(() => {
|
|
15237
15326
|
if (!editor) return;
|
|
15238
15327
|
const handleUpdate = () => {
|
|
@@ -15249,15 +15338,27 @@ function TetronsToolbar({ editor }) {
|
|
|
15249
15338
|
editor.off("update", handleUpdate);
|
|
15250
15339
|
};
|
|
15251
15340
|
}, [autoSave, editor]);
|
|
15252
|
-
return /* @__PURE__ */
|
|
15253
|
-
"
|
|
15254
|
-
|
|
15255
|
-
|
|
15256
|
-
|
|
15257
|
-
|
|
15258
|
-
|
|
15259
|
-
|
|
15260
|
-
|
|
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
|
+
] });
|
|
15261
15362
|
}
|
|
15262
15363
|
|
|
15263
15364
|
// src/components/tetrons/ResizableImage.ts
|
|
@@ -15265,8 +15366,9 @@ import Image from "@tiptap/extension-image";
|
|
|
15265
15366
|
import { ReactNodeViewRenderer } from "@tiptap/react";
|
|
15266
15367
|
|
|
15267
15368
|
// src/components/tetrons/ResizableImageComponent.tsx
|
|
15268
|
-
import
|
|
15369
|
+
import { useRef as useRef4, useEffect as useEffect4 } from "react";
|
|
15269
15370
|
import { NodeViewWrapper } from "@tiptap/react";
|
|
15371
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
15270
15372
|
var ResizableImageComponent = ({
|
|
15271
15373
|
node,
|
|
15272
15374
|
updateAttributes: updateAttributes2,
|
|
@@ -15286,7 +15388,7 @@ var ResizableImageComponent = ({
|
|
|
15286
15388
|
observer.observe(img);
|
|
15287
15389
|
return () => observer.disconnect();
|
|
15288
15390
|
}, [updateAttributes2]);
|
|
15289
|
-
return /* @__PURE__ */
|
|
15391
|
+
return /* @__PURE__ */ jsx10(
|
|
15290
15392
|
NodeViewWrapper,
|
|
15291
15393
|
{
|
|
15292
15394
|
ref: wrapperRef,
|
|
@@ -15299,26 +15401,26 @@ var ResizableImageComponent = ({
|
|
|
15299
15401
|
padding: 2,
|
|
15300
15402
|
display: "inline-block",
|
|
15301
15403
|
maxWidth: "100%"
|
|
15302
|
-
}
|
|
15303
|
-
|
|
15304
|
-
|
|
15305
|
-
|
|
15306
|
-
|
|
15307
|
-
|
|
15308
|
-
|
|
15309
|
-
|
|
15310
|
-
|
|
15311
|
-
|
|
15312
|
-
|
|
15313
|
-
|
|
15314
|
-
|
|
15315
|
-
|
|
15316
|
-
|
|
15317
|
-
|
|
15318
|
-
|
|
15319
|
-
|
|
15320
|
-
|
|
15321
|
-
|
|
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
|
+
}
|
|
15322
15424
|
);
|
|
15323
15425
|
};
|
|
15324
15426
|
var ResizableImageComponent_default = ResizableImageComponent;
|
|
@@ -15359,8 +15461,9 @@ var ResizableImage = Image.extend({
|
|
|
15359
15461
|
import { ReactNodeViewRenderer as ReactNodeViewRenderer2 } from "@tiptap/react";
|
|
15360
15462
|
|
|
15361
15463
|
// src/components/tetrons/ResizableVideoComponent.tsx
|
|
15362
|
-
import
|
|
15464
|
+
import { useRef as useRef5, useEffect as useEffect5 } from "react";
|
|
15363
15465
|
import { NodeViewWrapper as NodeViewWrapper2 } from "@tiptap/react";
|
|
15466
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
15364
15467
|
var ResizableVideoComponent = ({
|
|
15365
15468
|
node,
|
|
15366
15469
|
updateAttributes: updateAttributes2,
|
|
@@ -15380,7 +15483,7 @@ var ResizableVideoComponent = ({
|
|
|
15380
15483
|
observer.observe(video);
|
|
15381
15484
|
return () => observer.disconnect();
|
|
15382
15485
|
}, [updateAttributes2]);
|
|
15383
|
-
return /* @__PURE__ */
|
|
15486
|
+
return /* @__PURE__ */ jsx11(
|
|
15384
15487
|
NodeViewWrapper2,
|
|
15385
15488
|
{
|
|
15386
15489
|
ref: wrapperRef,
|
|
@@ -15392,20 +15495,20 @@ var ResizableVideoComponent = ({
|
|
|
15392
15495
|
border: "1px solid #ccc",
|
|
15393
15496
|
padding: "2px",
|
|
15394
15497
|
display: "inline-block"
|
|
15395
|
-
}
|
|
15396
|
-
|
|
15397
|
-
|
|
15398
|
-
|
|
15399
|
-
|
|
15400
|
-
|
|
15401
|
-
|
|
15402
|
-
|
|
15403
|
-
|
|
15404
|
-
|
|
15405
|
-
|
|
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
|
+
}
|
|
15406
15509
|
}
|
|
15407
|
-
|
|
15408
|
-
|
|
15510
|
+
)
|
|
15511
|
+
}
|
|
15409
15512
|
);
|
|
15410
15513
|
};
|
|
15411
15514
|
var ResizableVideoComponent_default = ResizableVideoComponent;
|
|
@@ -15458,7 +15561,8 @@ var ResizableVideo = Node2.create({
|
|
|
15458
15561
|
});
|
|
15459
15562
|
|
|
15460
15563
|
// src/components/tetrons/toolbar/TableContextMenu.tsx
|
|
15461
|
-
import
|
|
15564
|
+
import { useEffect as useEffect6, useState as useState4 } from "react";
|
|
15565
|
+
import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
15462
15566
|
function TableContextMenu({ editor }) {
|
|
15463
15567
|
const [menuPosition, setMenuPosition] = useState4(null);
|
|
15464
15568
|
useEffect6(() => {
|
|
@@ -15486,60 +15590,62 @@ function TableContextMenu({ editor }) {
|
|
|
15486
15590
|
const deleteRow = () => editor.chain().focus().deleteRow().run();
|
|
15487
15591
|
const deleteCol = () => editor.chain().focus().deleteColumn().run();
|
|
15488
15592
|
if (!menuPosition) return null;
|
|
15489
|
-
return /* @__PURE__ */
|
|
15593
|
+
return /* @__PURE__ */ jsxs9(
|
|
15490
15594
|
"ul",
|
|
15491
15595
|
{
|
|
15492
15596
|
className: "absolute bg-white shadow border rounded text-sm z-50",
|
|
15493
|
-
style: { top: menuPosition.y, left: menuPosition.x }
|
|
15494
|
-
|
|
15495
|
-
|
|
15496
|
-
|
|
15497
|
-
|
|
15498
|
-
|
|
15499
|
-
|
|
15500
|
-
|
|
15501
|
-
|
|
15502
|
-
|
|
15503
|
-
|
|
15504
|
-
|
|
15505
|
-
|
|
15506
|
-
|
|
15507
|
-
|
|
15508
|
-
|
|
15509
|
-
|
|
15510
|
-
|
|
15511
|
-
|
|
15512
|
-
|
|
15513
|
-
|
|
15514
|
-
|
|
15515
|
-
|
|
15516
|
-
|
|
15517
|
-
|
|
15518
|
-
|
|
15519
|
-
|
|
15520
|
-
|
|
15521
|
-
|
|
15522
|
-
|
|
15523
|
-
|
|
15524
|
-
|
|
15525
|
-
|
|
15526
|
-
|
|
15527
|
-
|
|
15528
|
-
|
|
15529
|
-
|
|
15530
|
-
|
|
15531
|
-
|
|
15532
|
-
|
|
15533
|
-
|
|
15534
|
-
|
|
15535
|
-
|
|
15536
|
-
|
|
15537
|
-
|
|
15538
|
-
|
|
15539
|
-
|
|
15540
|
-
|
|
15541
|
-
|
|
15542
|
-
|
|
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
|
+
}
|
|
15543
15649
|
);
|
|
15544
15650
|
}
|
|
15545
15651
|
|
|
@@ -17063,12 +17169,13 @@ function typescript(hljs) {
|
|
|
17063
17169
|
}
|
|
17064
17170
|
|
|
17065
17171
|
// src/components/tetrons/EditorContent.tsx
|
|
17172
|
+
import { Fragment as Fragment2, jsx as jsx13, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
17066
17173
|
var lowlight = createLowlight();
|
|
17067
17174
|
lowlight.register("js", javascript);
|
|
17068
17175
|
lowlight.register("ts", typescript);
|
|
17069
17176
|
function EditorContent() {
|
|
17070
|
-
const [versions, setVersions] =
|
|
17071
|
-
const [currentVersionIndex, setCurrentVersionIndex] =
|
|
17177
|
+
const [versions, setVersions] = React10.useState([]);
|
|
17178
|
+
const [currentVersionIndex, setCurrentVersionIndex] = React10.useState(null);
|
|
17072
17179
|
const editor = useEditor({
|
|
17073
17180
|
extensions: [
|
|
17074
17181
|
Document,
|
|
@@ -17152,34 +17259,47 @@ function EditorContent() {
|
|
|
17152
17259
|
setCurrentVersionIndex(index);
|
|
17153
17260
|
}
|
|
17154
17261
|
};
|
|
17155
|
-
return /* @__PURE__ */
|
|
17156
|
-
"
|
|
17157
|
-
|
|
17158
|
-
|
|
17159
|
-
|
|
17160
|
-
|
|
17161
|
-
|
|
17162
|
-
|
|
17163
|
-
|
|
17164
|
-
|
|
17165
|
-
|
|
17166
|
-
|
|
17167
|
-
|
|
17168
|
-
|
|
17169
|
-
|
|
17170
|
-
|
|
17171
|
-
|
|
17172
|
-
|
|
17173
|
-
|
|
17174
|
-
|
|
17175
|
-
|
|
17176
|
-
|
|
17177
|
-
|
|
17178
|
-
|
|
17179
|
-
|
|
17180
|
-
|
|
17181
|
-
|
|
17182
|
-
|
|
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
|
+
] });
|
|
17183
17303
|
}
|
|
17184
17304
|
|
|
17185
17305
|
// src/index.ts
|