@editorcn/editor 0.3.3 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +256 -250
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +205 -199
- package/dist/index.js.map +1 -1
- package/dist/style.css +1362 -1362
- package/package.json +6 -4
package/dist/index.cjs
CHANGED
|
@@ -44,7 +44,7 @@ __export(index_exports, {
|
|
|
44
44
|
module.exports = __toCommonJS(index_exports);
|
|
45
45
|
|
|
46
46
|
// src/rte-text-editor.tsx
|
|
47
|
-
var
|
|
47
|
+
var import_react21 = require("react");
|
|
48
48
|
|
|
49
49
|
// src/bubble-menu/index.tsx
|
|
50
50
|
var import_core = require("@tiptap/core");
|
|
@@ -1460,101 +1460,20 @@ var LinkControl = () => {
|
|
|
1460
1460
|
|
|
1461
1461
|
// src/controls/rte-twitter-control.tsx
|
|
1462
1462
|
var import_core2 = require("@tiptap/core");
|
|
1463
|
-
var
|
|
1464
|
-
var
|
|
1463
|
+
var import_react15 = require("@tiptap/react");
|
|
1464
|
+
var import_react16 = require("react");
|
|
1465
1465
|
|
|
1466
1466
|
// src/extensions/resizable-node-view.tsx
|
|
1467
|
-
var
|
|
1468
|
-
var
|
|
1467
|
+
var import_react13 = require("@tiptap/react");
|
|
1468
|
+
var import_react14 = require("react");
|
|
1469
1469
|
|
|
1470
1470
|
// src/icons.tsx
|
|
1471
1471
|
var import_lucide_react = require("lucide-react");
|
|
1472
|
+
var import_react12 = require("react");
|
|
1473
|
+
|
|
1474
|
+
// src/language-icons.tsx
|
|
1472
1475
|
var import_react11 = require("react");
|
|
1473
1476
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1474
|
-
var ALIGN_PATHS = {
|
|
1475
|
-
center: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
1476
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
|
|
1477
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("line", { x1: "17", y1: "12", x2: "7", y2: "12" }),
|
|
1478
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("line", { x1: "19", y1: "18", x2: "5", y2: "18" })
|
|
1479
|
-
] }),
|
|
1480
|
-
left: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
1481
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
|
|
1482
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("line", { x1: "15", y1: "12", x2: "3", y2: "12" }),
|
|
1483
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("line", { x1: "17", y1: "18", x2: "3", y2: "18" })
|
|
1484
|
-
] }),
|
|
1485
|
-
right: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
1486
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
|
|
1487
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("line", { x1: "21", y1: "12", x2: "9", y2: "12" }),
|
|
1488
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("line", { x1: "21", y1: "18", x2: "7", y2: "18" })
|
|
1489
|
-
] })
|
|
1490
|
-
};
|
|
1491
|
-
var AlignIcon = ({ dir }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1492
|
-
"svg",
|
|
1493
|
-
{
|
|
1494
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1495
|
-
viewBox: "0 0 24 24",
|
|
1496
|
-
fill: "none",
|
|
1497
|
-
stroke: "currentColor",
|
|
1498
|
-
strokeWidth: "2",
|
|
1499
|
-
strokeLinecap: "round",
|
|
1500
|
-
strokeLinejoin: "round",
|
|
1501
|
-
className: "rte-editor-icon",
|
|
1502
|
-
children: ALIGN_PATHS[dir]
|
|
1503
|
-
}
|
|
1504
|
-
);
|
|
1505
|
-
var EditUrlIcon = () => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
1506
|
-
"svg",
|
|
1507
|
-
{
|
|
1508
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1509
|
-
viewBox: "0 0 24 24",
|
|
1510
|
-
fill: "none",
|
|
1511
|
-
stroke: "currentColor",
|
|
1512
|
-
strokeWidth: "2",
|
|
1513
|
-
strokeLinecap: "round",
|
|
1514
|
-
strokeLinejoin: "round",
|
|
1515
|
-
className: "rte-editor-icon",
|
|
1516
|
-
children: [
|
|
1517
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M12 20h9" }),
|
|
1518
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z" })
|
|
1519
|
-
]
|
|
1520
|
-
}
|
|
1521
|
-
);
|
|
1522
|
-
var OpenInYouTubeIcon = () => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
1523
|
-
"svg",
|
|
1524
|
-
{
|
|
1525
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1526
|
-
viewBox: "0 0 24 24",
|
|
1527
|
-
fill: "none",
|
|
1528
|
-
stroke: "currentColor",
|
|
1529
|
-
strokeWidth: "2",
|
|
1530
|
-
strokeLinecap: "round",
|
|
1531
|
-
strokeLinejoin: "round",
|
|
1532
|
-
className: "rte-editor-icon",
|
|
1533
|
-
children: [
|
|
1534
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" }),
|
|
1535
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("polyline", { points: "15 3 21 3 21 9" }),
|
|
1536
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("line", { x1: "10", y1: "14", x2: "21", y2: "3" })
|
|
1537
|
-
]
|
|
1538
|
-
}
|
|
1539
|
-
);
|
|
1540
|
-
var DeleteEmbedIcon = () => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
1541
|
-
"svg",
|
|
1542
|
-
{
|
|
1543
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1544
|
-
viewBox: "0 0 24 24",
|
|
1545
|
-
fill: "none",
|
|
1546
|
-
stroke: "currentColor",
|
|
1547
|
-
strokeWidth: "2",
|
|
1548
|
-
strokeLinecap: "round",
|
|
1549
|
-
strokeLinejoin: "round",
|
|
1550
|
-
className: "rte-editor-icon",
|
|
1551
|
-
children: [
|
|
1552
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("polyline", { points: "3 6 5 6 21 6" }),
|
|
1553
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" })
|
|
1554
|
-
]
|
|
1555
|
-
}
|
|
1556
|
-
);
|
|
1557
|
-
var iconProps = { className: "rte-editor-icon" };
|
|
1558
1477
|
var LangIcon = ({
|
|
1559
1478
|
children,
|
|
1560
1479
|
className
|
|
@@ -1686,40 +1605,127 @@ var DEFAULT_LANGUAGE_ICONS = {
|
|
|
1686
1605
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M6.5 16h2M9.5 16h7" })
|
|
1687
1606
|
] })
|
|
1688
1607
|
};
|
|
1608
|
+
|
|
1609
|
+
// src/icons.tsx
|
|
1610
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1611
|
+
var ALIGN_PATHS = {
|
|
1612
|
+
center: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
1613
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
|
|
1614
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("line", { x1: "17", y1: "12", x2: "7", y2: "12" }),
|
|
1615
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("line", { x1: "19", y1: "18", x2: "5", y2: "18" })
|
|
1616
|
+
] }),
|
|
1617
|
+
left: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
1618
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
|
|
1619
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("line", { x1: "15", y1: "12", x2: "3", y2: "12" }),
|
|
1620
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("line", { x1: "17", y1: "18", x2: "3", y2: "18" })
|
|
1621
|
+
] }),
|
|
1622
|
+
right: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
1623
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
|
|
1624
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("line", { x1: "21", y1: "12", x2: "9", y2: "12" }),
|
|
1625
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("line", { x1: "21", y1: "18", x2: "7", y2: "18" })
|
|
1626
|
+
] })
|
|
1627
|
+
};
|
|
1628
|
+
var AlignIcon = ({ dir }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1629
|
+
"svg",
|
|
1630
|
+
{
|
|
1631
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1632
|
+
viewBox: "0 0 24 24",
|
|
1633
|
+
fill: "none",
|
|
1634
|
+
stroke: "currentColor",
|
|
1635
|
+
strokeWidth: "2",
|
|
1636
|
+
strokeLinecap: "round",
|
|
1637
|
+
strokeLinejoin: "round",
|
|
1638
|
+
className: "rte-editor-icon",
|
|
1639
|
+
children: ALIGN_PATHS[dir]
|
|
1640
|
+
}
|
|
1641
|
+
);
|
|
1642
|
+
var EditUrlIcon = () => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
1643
|
+
"svg",
|
|
1644
|
+
{
|
|
1645
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1646
|
+
viewBox: "0 0 24 24",
|
|
1647
|
+
fill: "none",
|
|
1648
|
+
stroke: "currentColor",
|
|
1649
|
+
strokeWidth: "2",
|
|
1650
|
+
strokeLinecap: "round",
|
|
1651
|
+
strokeLinejoin: "round",
|
|
1652
|
+
className: "rte-editor-icon",
|
|
1653
|
+
children: [
|
|
1654
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M12 20h9" }),
|
|
1655
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z" })
|
|
1656
|
+
]
|
|
1657
|
+
}
|
|
1658
|
+
);
|
|
1659
|
+
var OpenInYouTubeIcon = () => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
1660
|
+
"svg",
|
|
1661
|
+
{
|
|
1662
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1663
|
+
viewBox: "0 0 24 24",
|
|
1664
|
+
fill: "none",
|
|
1665
|
+
stroke: "currentColor",
|
|
1666
|
+
strokeWidth: "2",
|
|
1667
|
+
strokeLinecap: "round",
|
|
1668
|
+
strokeLinejoin: "round",
|
|
1669
|
+
className: "rte-editor-icon",
|
|
1670
|
+
children: [
|
|
1671
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" }),
|
|
1672
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("polyline", { points: "15 3 21 3 21 9" }),
|
|
1673
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("line", { x1: "10", y1: "14", x2: "21", y2: "3" })
|
|
1674
|
+
]
|
|
1675
|
+
}
|
|
1676
|
+
);
|
|
1677
|
+
var DeleteEmbedIcon = () => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
1678
|
+
"svg",
|
|
1679
|
+
{
|
|
1680
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1681
|
+
viewBox: "0 0 24 24",
|
|
1682
|
+
fill: "none",
|
|
1683
|
+
stroke: "currentColor",
|
|
1684
|
+
strokeWidth: "2",
|
|
1685
|
+
strokeLinecap: "round",
|
|
1686
|
+
strokeLinejoin: "round",
|
|
1687
|
+
className: "rte-editor-icon",
|
|
1688
|
+
children: [
|
|
1689
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("polyline", { points: "3 6 5 6 21 6" }),
|
|
1690
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" })
|
|
1691
|
+
]
|
|
1692
|
+
}
|
|
1693
|
+
);
|
|
1694
|
+
var iconProps = { className: "rte-editor-icon" };
|
|
1689
1695
|
var DEFAULT_ICONS = {
|
|
1690
|
-
alignCenterControlIcon: /* @__PURE__ */ (0,
|
|
1691
|
-
alignJustifyControlIcon: /* @__PURE__ */ (0,
|
|
1692
|
-
alignLeftControlIcon: /* @__PURE__ */ (0,
|
|
1693
|
-
alignRightControlIcon: /* @__PURE__ */ (0,
|
|
1694
|
-
blockquoteControlIcon: /* @__PURE__ */ (0,
|
|
1695
|
-
boldControlIcon: /* @__PURE__ */ (0,
|
|
1696
|
-
bulletListControlIcon: /* @__PURE__ */ (0,
|
|
1697
|
-
clearFormattingControlIcon: /* @__PURE__ */ (0,
|
|
1698
|
-
codeBlockControlIcon: /* @__PURE__ */ (0,
|
|
1699
|
-
codeControlIcon: /* @__PURE__ */ (0,
|
|
1700
|
-
h1ControlIcon: /* @__PURE__ */ (0,
|
|
1701
|
-
h2ControlIcon: /* @__PURE__ */ (0,
|
|
1702
|
-
h3ControlIcon: /* @__PURE__ */ (0,
|
|
1703
|
-
h4ControlIcon: /* @__PURE__ */ (0,
|
|
1704
|
-
h5ControlIcon: /* @__PURE__ */ (0,
|
|
1705
|
-
h6ControlIcon: /* @__PURE__ */ (0,
|
|
1706
|
-
highlightControlIcon: /* @__PURE__ */ (0,
|
|
1707
|
-
hrControlIcon: /* @__PURE__ */ (0,
|
|
1708
|
-
italicControlIcon: /* @__PURE__ */ (0,
|
|
1696
|
+
alignCenterControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.TextAlignCenter, { ...iconProps }),
|
|
1697
|
+
alignJustifyControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.TextAlignJustify, { ...iconProps }),
|
|
1698
|
+
alignLeftControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.TextAlignStart, { ...iconProps }),
|
|
1699
|
+
alignRightControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.TextAlignEnd, { ...iconProps }),
|
|
1700
|
+
blockquoteControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.TextQuote, { ...iconProps }),
|
|
1701
|
+
boldControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Bold, { ...iconProps }),
|
|
1702
|
+
bulletListControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.List, { ...iconProps }),
|
|
1703
|
+
clearFormattingControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.RemoveFormatting, { ...iconProps }),
|
|
1704
|
+
codeBlockControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.SquareCode, { ...iconProps }),
|
|
1705
|
+
codeControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Code, { ...iconProps }),
|
|
1706
|
+
h1ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Heading1, { ...iconProps }),
|
|
1707
|
+
h2ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Heading2, { ...iconProps }),
|
|
1708
|
+
h3ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Heading3, { ...iconProps }),
|
|
1709
|
+
h4ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Heading4, { ...iconProps }),
|
|
1710
|
+
h5ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Heading5, { ...iconProps }),
|
|
1711
|
+
h6ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Heading6, { ...iconProps }),
|
|
1712
|
+
highlightControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Highlighter, { ...iconProps }),
|
|
1713
|
+
hrControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Minus, { ...iconProps }),
|
|
1714
|
+
italicControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Italic, { ...iconProps }),
|
|
1709
1715
|
languageIcons: DEFAULT_LANGUAGE_ICONS,
|
|
1710
|
-
linkControlIcon: /* @__PURE__ */ (0,
|
|
1711
|
-
orderedListControlIcon: /* @__PURE__ */ (0,
|
|
1712
|
-
redoControlIcon: /* @__PURE__ */ (0,
|
|
1713
|
-
strikeControlIcon: /* @__PURE__ */ (0,
|
|
1714
|
-
subscriptControlIcon: /* @__PURE__ */ (0,
|
|
1715
|
-
superscriptControlIcon: /* @__PURE__ */ (0,
|
|
1716
|
-
underlineControlIcon: /* @__PURE__ */ (0,
|
|
1717
|
-
undoControlIcon: /* @__PURE__ */ (0,
|
|
1718
|
-
unlinkControlIcon: /* @__PURE__ */ (0,
|
|
1716
|
+
linkControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Link, { ...iconProps }),
|
|
1717
|
+
orderedListControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.ListOrdered, { ...iconProps }),
|
|
1718
|
+
redoControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Redo2, { ...iconProps }),
|
|
1719
|
+
strikeControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Strikethrough, { ...iconProps }),
|
|
1720
|
+
subscriptControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Subscript, { ...iconProps }),
|
|
1721
|
+
superscriptControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Superscript, { ...iconProps }),
|
|
1722
|
+
underlineControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Underline, { ...iconProps }),
|
|
1723
|
+
undoControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Undo2, { ...iconProps }),
|
|
1724
|
+
unlinkControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Link2Off, { ...iconProps })
|
|
1719
1725
|
};
|
|
1720
1726
|
|
|
1721
1727
|
// src/extensions/resizable-node-view.tsx
|
|
1722
|
-
var
|
|
1728
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1723
1729
|
var EmbedToolbar = ({
|
|
1724
1730
|
align,
|
|
1725
1731
|
videoSrc,
|
|
@@ -1736,8 +1742,8 @@ var EmbedToolbar = ({
|
|
|
1736
1742
|
nodeSrc
|
|
1737
1743
|
}) => {
|
|
1738
1744
|
if (isEditingUrl) {
|
|
1739
|
-
return /* @__PURE__ */ (0,
|
|
1740
|
-
/* @__PURE__ */ (0,
|
|
1745
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "rte-embed-selector-edit-form", children: [
|
|
1746
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1741
1747
|
"input",
|
|
1742
1748
|
{
|
|
1743
1749
|
ref: inputRef,
|
|
@@ -1755,7 +1761,7 @@ var EmbedToolbar = ({
|
|
|
1755
1761
|
}
|
|
1756
1762
|
}
|
|
1757
1763
|
),
|
|
1758
|
-
/* @__PURE__ */ (0,
|
|
1764
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1759
1765
|
"button",
|
|
1760
1766
|
{
|
|
1761
1767
|
type: "button",
|
|
@@ -1764,7 +1770,7 @@ var EmbedToolbar = ({
|
|
|
1764
1770
|
children: "Save"
|
|
1765
1771
|
}
|
|
1766
1772
|
),
|
|
1767
|
-
/* @__PURE__ */ (0,
|
|
1773
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1768
1774
|
"button",
|
|
1769
1775
|
{
|
|
1770
1776
|
type: "button",
|
|
@@ -1775,8 +1781,8 @@ var EmbedToolbar = ({
|
|
|
1775
1781
|
)
|
|
1776
1782
|
] });
|
|
1777
1783
|
}
|
|
1778
|
-
return /* @__PURE__ */ (0,
|
|
1779
|
-
/* @__PURE__ */ (0,
|
|
1784
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
1785
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "rte-embed-selector-group", children: ["left", "center", "right"].map((dir) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1780
1786
|
"button",
|
|
1781
1787
|
{
|
|
1782
1788
|
type: "button",
|
|
@@ -1784,12 +1790,12 @@ var EmbedToolbar = ({
|
|
|
1784
1790
|
"aria-label": `Align ${dir.charAt(0).toUpperCase()}${dir.slice(1)}`,
|
|
1785
1791
|
className: `rte-embed-selector-btn ${align === dir ? "rte-embed-selector-btn--active" : ""}`,
|
|
1786
1792
|
onClick: () => updateAttributes({ align: dir }),
|
|
1787
|
-
children: /* @__PURE__ */ (0,
|
|
1793
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(AlignIcon, { dir })
|
|
1788
1794
|
},
|
|
1789
1795
|
dir
|
|
1790
1796
|
)) }),
|
|
1791
|
-
/* @__PURE__ */ (0,
|
|
1792
|
-
/* @__PURE__ */ (0,
|
|
1797
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "rte-embed-selector-divider" }),
|
|
1798
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "rte-embed-selector-group", children: [25, 50, 75, 100].map((pct) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
1793
1799
|
"button",
|
|
1794
1800
|
{
|
|
1795
1801
|
type: "button",
|
|
@@ -1803,9 +1809,9 @@ var EmbedToolbar = ({
|
|
|
1803
1809
|
},
|
|
1804
1810
|
pct
|
|
1805
1811
|
)) }),
|
|
1806
|
-
/* @__PURE__ */ (0,
|
|
1807
|
-
/* @__PURE__ */ (0,
|
|
1808
|
-
(videoSrc || nodeSrc) && /* @__PURE__ */ (0,
|
|
1812
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "rte-embed-selector-divider" }),
|
|
1813
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "rte-embed-selector-group", children: [
|
|
1814
|
+
(videoSrc || nodeSrc) && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1809
1815
|
"button",
|
|
1810
1816
|
{
|
|
1811
1817
|
type: "button",
|
|
@@ -1816,10 +1822,10 @@ var EmbedToolbar = ({
|
|
|
1816
1822
|
setUrlInput(videoSrc || nodeSrc || "");
|
|
1817
1823
|
setIsEditingUrl(true);
|
|
1818
1824
|
},
|
|
1819
|
-
children: /* @__PURE__ */ (0,
|
|
1825
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(EditUrlIcon, {})
|
|
1820
1826
|
}
|
|
1821
1827
|
),
|
|
1822
|
-
watchUrl && /* @__PURE__ */ (0,
|
|
1828
|
+
watchUrl && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1823
1829
|
"button",
|
|
1824
1830
|
{
|
|
1825
1831
|
type: "button",
|
|
@@ -1827,10 +1833,10 @@ var EmbedToolbar = ({
|
|
|
1827
1833
|
"aria-label": "Open video in YouTube",
|
|
1828
1834
|
className: "rte-embed-selector-btn",
|
|
1829
1835
|
onClick: () => window.open(watchUrl, "_blank"),
|
|
1830
|
-
children: /* @__PURE__ */ (0,
|
|
1836
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(OpenInYouTubeIcon, {})
|
|
1831
1837
|
}
|
|
1832
1838
|
),
|
|
1833
|
-
deleteNode && /* @__PURE__ */ (0,
|
|
1839
|
+
deleteNode && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1834
1840
|
"button",
|
|
1835
1841
|
{
|
|
1836
1842
|
type: "button",
|
|
@@ -1838,7 +1844,7 @@ var EmbedToolbar = ({
|
|
|
1838
1844
|
"aria-label": "Delete Embed",
|
|
1839
1845
|
className: "rte-embed-selector-btn rte-embed-selector-btn--danger",
|
|
1840
1846
|
onClick: () => deleteNode(),
|
|
1841
|
-
children: /* @__PURE__ */ (0,
|
|
1847
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DeleteEmbedIcon, {})
|
|
1842
1848
|
}
|
|
1843
1849
|
)
|
|
1844
1850
|
] })
|
|
@@ -1860,26 +1866,26 @@ var ResizableNodeView = ({
|
|
|
1860
1866
|
watchUrl,
|
|
1861
1867
|
onSrcChange
|
|
1862
1868
|
}) => {
|
|
1863
|
-
const containerRef = (0,
|
|
1864
|
-
const [isEditingUrl, setIsEditingUrl] = (0,
|
|
1865
|
-
const [urlInput, setUrlInput] = (0,
|
|
1866
|
-
const [isResizing, setIsResizing] = (0,
|
|
1867
|
-
const [currentDimensions, setCurrentDimensions] = (0,
|
|
1868
|
-
const resizingRef = (0,
|
|
1869
|
+
const containerRef = (0, import_react14.useRef)(null);
|
|
1870
|
+
const [isEditingUrl, setIsEditingUrl] = (0, import_react14.useState)(false);
|
|
1871
|
+
const [urlInput, setUrlInput] = (0, import_react14.useState)(videoSrc || "");
|
|
1872
|
+
const [isResizing, setIsResizing] = (0, import_react14.useState)(false);
|
|
1873
|
+
const [currentDimensions, setCurrentDimensions] = (0, import_react14.useState)(null);
|
|
1874
|
+
const resizingRef = (0, import_react14.useRef)(null);
|
|
1869
1875
|
const width = node.attrs.width;
|
|
1870
1876
|
const height = node.attrs.height;
|
|
1871
1877
|
const align = node.attrs.align || "center";
|
|
1872
|
-
const getEditorWidth = (0,
|
|
1878
|
+
const getEditorWidth = (0, import_react14.useCallback)(
|
|
1873
1879
|
() => view?.dom?.parentElement?.offsetWidth ?? 800,
|
|
1874
1880
|
[view]
|
|
1875
1881
|
);
|
|
1876
|
-
const inputRef = (0,
|
|
1877
|
-
(0,
|
|
1882
|
+
const inputRef = (0, import_react14.useRef)(null);
|
|
1883
|
+
(0, import_react14.useEffect)(() => {
|
|
1878
1884
|
if (isEditingUrl) {
|
|
1879
1885
|
inputRef.current?.focus();
|
|
1880
1886
|
}
|
|
1881
1887
|
}, [isEditingUrl]);
|
|
1882
|
-
const handleMouseMove = (0,
|
|
1888
|
+
const handleMouseMove = (0, import_react14.useCallback)(
|
|
1883
1889
|
(e) => {
|
|
1884
1890
|
const resize = resizingRef.current;
|
|
1885
1891
|
if (!resize) {
|
|
@@ -1929,7 +1935,7 @@ var ResizableNodeView = ({
|
|
|
1929
1935
|
},
|
|
1930
1936
|
[lockAspect, aspectRatio, minWidth, maxWidth]
|
|
1931
1937
|
);
|
|
1932
|
-
const handleMouseUp = (0,
|
|
1938
|
+
const handleMouseUp = (0, import_react14.useCallback)(
|
|
1933
1939
|
function handleMouseUp2() {
|
|
1934
1940
|
const resize = resizingRef.current;
|
|
1935
1941
|
if (!resize) {
|
|
@@ -1950,7 +1956,7 @@ var ResizableNodeView = ({
|
|
|
1950
1956
|
},
|
|
1951
1957
|
[handleMouseMove, updateAttributes]
|
|
1952
1958
|
);
|
|
1953
|
-
const handleMouseDown = (0,
|
|
1959
|
+
const handleMouseDown = (0, import_react14.useCallback)(
|
|
1954
1960
|
(e, direction) => {
|
|
1955
1961
|
e.preventDefault();
|
|
1956
1962
|
e.stopPropagation();
|
|
@@ -1981,7 +1987,7 @@ var ResizableNodeView = ({
|
|
|
1981
1987
|
},
|
|
1982
1988
|
[width, height, getEditorWidth, handleMouseMove, handleMouseUp]
|
|
1983
1989
|
);
|
|
1984
|
-
(0,
|
|
1990
|
+
(0, import_react14.useEffect)(
|
|
1985
1991
|
() => () => {
|
|
1986
1992
|
document.removeEventListener("mousemove", handleMouseMove);
|
|
1987
1993
|
document.removeEventListener("mouseup", handleMouseUp);
|
|
@@ -2009,13 +2015,13 @@ var ResizableNodeView = ({
|
|
|
2009
2015
|
setIsEditingUrl(false);
|
|
2010
2016
|
};
|
|
2011
2017
|
const isEditable = editor ? editor.isEditable : true;
|
|
2012
|
-
return /* @__PURE__ */ (0,
|
|
2013
|
-
|
|
2018
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2019
|
+
import_react13.NodeViewWrapper,
|
|
2014
2020
|
{
|
|
2015
2021
|
className: "rte-embed-wrapper",
|
|
2016
2022
|
"data-selected": selected || void 0,
|
|
2017
2023
|
"data-align": align,
|
|
2018
|
-
children: /* @__PURE__ */ (0,
|
|
2024
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
2019
2025
|
"div",
|
|
2020
2026
|
{
|
|
2021
2027
|
ref: containerRef,
|
|
@@ -2028,7 +2034,7 @@ var ResizableNodeView = ({
|
|
|
2028
2034
|
},
|
|
2029
2035
|
children: [
|
|
2030
2036
|
children,
|
|
2031
|
-
selected && isEditable && /* @__PURE__ */ (0,
|
|
2037
|
+
selected && isEditable && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "rte-embed-selector", contentEditable: false, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2032
2038
|
EmbedToolbar,
|
|
2033
2039
|
{
|
|
2034
2040
|
align,
|
|
@@ -2046,14 +2052,14 @@ var ResizableNodeView = ({
|
|
|
2046
2052
|
nodeSrc: node.attrs.src
|
|
2047
2053
|
}
|
|
2048
2054
|
) }),
|
|
2049
|
-
isResizing && currentDimensions && /* @__PURE__ */ (0,
|
|
2055
|
+
isResizing && currentDimensions && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "rte-embed-resize-badge", children: [
|
|
2050
2056
|
currentDimensions.w,
|
|
2051
2057
|
" \xD7 ",
|
|
2052
2058
|
currentDimensions.h,
|
|
2053
2059
|
" px"
|
|
2054
2060
|
] }),
|
|
2055
|
-
selected && isEditable && /* @__PURE__ */ (0,
|
|
2056
|
-
/* @__PURE__ */ (0,
|
|
2061
|
+
selected && isEditable && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
2062
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2057
2063
|
"div",
|
|
2058
2064
|
{
|
|
2059
2065
|
className: "rte-resize-handle rte-resize-handle--left",
|
|
@@ -2061,7 +2067,7 @@ var ResizableNodeView = ({
|
|
|
2061
2067
|
role: "presentation"
|
|
2062
2068
|
}
|
|
2063
2069
|
),
|
|
2064
|
-
/* @__PURE__ */ (0,
|
|
2070
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2065
2071
|
"div",
|
|
2066
2072
|
{
|
|
2067
2073
|
className: "rte-resize-handle rte-resize-handle--right",
|
|
@@ -2069,7 +2075,7 @@ var ResizableNodeView = ({
|
|
|
2069
2075
|
role: "presentation"
|
|
2070
2076
|
}
|
|
2071
2077
|
),
|
|
2072
|
-
/* @__PURE__ */ (0,
|
|
2078
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2073
2079
|
"div",
|
|
2074
2080
|
{
|
|
2075
2081
|
className: "rte-resize-handle rte-resize-handle--bottom",
|
|
@@ -2077,7 +2083,7 @@ var ResizableNodeView = ({
|
|
|
2077
2083
|
role: "presentation"
|
|
2078
2084
|
}
|
|
2079
2085
|
),
|
|
2080
|
-
/* @__PURE__ */ (0,
|
|
2086
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2081
2087
|
"div",
|
|
2082
2088
|
{
|
|
2083
2089
|
className: "rte-resize-handle rte-resize-handle--corner rte-resize-handle--corner-bl",
|
|
@@ -2085,7 +2091,7 @@ var ResizableNodeView = ({
|
|
|
2085
2091
|
role: "presentation"
|
|
2086
2092
|
}
|
|
2087
2093
|
),
|
|
2088
|
-
/* @__PURE__ */ (0,
|
|
2094
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2089
2095
|
"div",
|
|
2090
2096
|
{
|
|
2091
2097
|
className: "rte-resize-handle rte-resize-handle--corner rte-resize-handle--corner-br",
|
|
@@ -2102,7 +2108,7 @@ var ResizableNodeView = ({
|
|
|
2102
2108
|
};
|
|
2103
2109
|
|
|
2104
2110
|
// src/controls/rte-twitter-control.tsx
|
|
2105
|
-
var
|
|
2111
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
2106
2112
|
var WIDGET_SCRIPT_URL = "https://platform.twitter.com/widgets.js";
|
|
2107
2113
|
var SCRIPT_LOAD_TIMEOUT_MS = 8e3;
|
|
2108
2114
|
var READY_POLL_INTERVAL_MS = 50;
|
|
@@ -2178,15 +2184,15 @@ var loadTwitterScript = () => {
|
|
|
2178
2184
|
};
|
|
2179
2185
|
var TwitterNodeView = (props) => {
|
|
2180
2186
|
const { node } = props;
|
|
2181
|
-
const containerRef = (0,
|
|
2182
|
-
const [loading, setLoading] = (0,
|
|
2183
|
-
const [failed, setFailed] = (0,
|
|
2187
|
+
const containerRef = (0, import_react16.useRef)(null);
|
|
2188
|
+
const [loading, setLoading] = (0, import_react16.useState)(true);
|
|
2189
|
+
const [failed, setFailed] = (0, import_react16.useState)(false);
|
|
2184
2190
|
const { tweetId } = node.attrs;
|
|
2185
|
-
const renderedTweetIdRef = (0,
|
|
2186
|
-
const activeRenderIdRef = (0,
|
|
2187
|
-
const retryToken = (0,
|
|
2188
|
-
const [retryCount, setRetryCount] = (0,
|
|
2189
|
-
(0,
|
|
2191
|
+
const renderedTweetIdRef = (0, import_react16.useRef)(null);
|
|
2192
|
+
const activeRenderIdRef = (0, import_react16.useRef)(0);
|
|
2193
|
+
const retryToken = (0, import_react16.useRef)(0);
|
|
2194
|
+
const [retryCount, setRetryCount] = (0, import_react16.useState)(0);
|
|
2195
|
+
(0, import_react16.useEffect)(() => {
|
|
2190
2196
|
if (!containerRef.current || !tweetId) {
|
|
2191
2197
|
return;
|
|
2192
2198
|
}
|
|
@@ -2245,11 +2251,11 @@ var TwitterNodeView = (props) => {
|
|
|
2245
2251
|
isCancelled = true;
|
|
2246
2252
|
};
|
|
2247
2253
|
}, [tweetId, retryCount, failed]);
|
|
2248
|
-
const handleRetry = (0,
|
|
2254
|
+
const handleRetry = (0, import_react16.useCallback)(() => {
|
|
2249
2255
|
retryToken.current += 1;
|
|
2250
2256
|
setRetryCount(retryToken.current);
|
|
2251
2257
|
}, []);
|
|
2252
|
-
return /* @__PURE__ */ (0,
|
|
2258
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2253
2259
|
ResizableNodeView,
|
|
2254
2260
|
{
|
|
2255
2261
|
...props,
|
|
@@ -2257,12 +2263,12 @@ var TwitterNodeView = (props) => {
|
|
|
2257
2263
|
minWidth: 300,
|
|
2258
2264
|
maxWidth: 1200,
|
|
2259
2265
|
children: [
|
|
2260
|
-
loading && /* @__PURE__ */ (0,
|
|
2261
|
-
!loading && failed && /* @__PURE__ */ (0,
|
|
2262
|
-
/* @__PURE__ */ (0,
|
|
2263
|
-
/* @__PURE__ */ (0,
|
|
2266
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "rte-embed-loading", children: "Loading tweet..." }),
|
|
2267
|
+
!loading && failed && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "rte-embed-error", children: [
|
|
2268
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { children: "Couldn't load this tweet." }),
|
|
2269
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", onClick: handleRetry, children: "Retry" })
|
|
2264
2270
|
] }),
|
|
2265
|
-
/* @__PURE__ */ (0,
|
|
2271
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { ref: containerRef })
|
|
2266
2272
|
]
|
|
2267
2273
|
}
|
|
2268
2274
|
);
|
|
@@ -2318,7 +2324,7 @@ var TwitterEmbed = import_core2.Node.create({
|
|
|
2318
2324
|
];
|
|
2319
2325
|
},
|
|
2320
2326
|
addNodeView() {
|
|
2321
|
-
return (0,
|
|
2327
|
+
return (0, import_react15.ReactNodeViewRenderer)(TwitterNodeView);
|
|
2322
2328
|
},
|
|
2323
2329
|
atom: true,
|
|
2324
2330
|
draggable: true,
|
|
@@ -2352,10 +2358,10 @@ var extractTweetId = (input) => {
|
|
|
2352
2358
|
};
|
|
2353
2359
|
var TwitterEmbedControl = ({ className }) => {
|
|
2354
2360
|
const { editor } = useRichTextEditorContext();
|
|
2355
|
-
const [open, setOpen] = (0,
|
|
2356
|
-
const [url, setUrl] = (0,
|
|
2357
|
-
const [touched, setTouched] = (0,
|
|
2358
|
-
const { active } = (0,
|
|
2361
|
+
const [open, setOpen] = (0, import_react16.useState)(false);
|
|
2362
|
+
const [url, setUrl] = (0, import_react16.useState)("");
|
|
2363
|
+
const [touched, setTouched] = (0, import_react16.useState)(false);
|
|
2364
|
+
const { active } = (0, import_react15.useEditorState)({
|
|
2359
2365
|
editor: editor ?? null,
|
|
2360
2366
|
selector: (ctx) => ({
|
|
2361
2367
|
active: ctx.editor && !ctx.editor.isDestroyed ? ctx.editor.isActive("twitter") : false
|
|
@@ -2363,11 +2369,11 @@ var TwitterEmbedControl = ({ className }) => {
|
|
|
2363
2369
|
}) ?? { active: false };
|
|
2364
2370
|
const tweetId = url ? extractTweetId(url) : null;
|
|
2365
2371
|
const showError = touched && url.length > 0 && !tweetId;
|
|
2366
|
-
const resetState = (0,
|
|
2372
|
+
const resetState = (0, import_react16.useCallback)(() => {
|
|
2367
2373
|
setUrl("");
|
|
2368
2374
|
setTouched(false);
|
|
2369
2375
|
}, []);
|
|
2370
|
-
const handleInsert = (0,
|
|
2376
|
+
const handleInsert = (0, import_react16.useCallback)(() => {
|
|
2371
2377
|
setTouched(true);
|
|
2372
2378
|
if (!tweetId || !editor) {
|
|
2373
2379
|
return false;
|
|
@@ -2376,7 +2382,7 @@ var TwitterEmbedControl = ({ className }) => {
|
|
|
2376
2382
|
resetState();
|
|
2377
2383
|
return true;
|
|
2378
2384
|
}, [tweetId, editor, resetState]);
|
|
2379
|
-
return /* @__PURE__ */ (0,
|
|
2385
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2380
2386
|
Dialog,
|
|
2381
2387
|
{
|
|
2382
2388
|
open,
|
|
@@ -2387,36 +2393,36 @@ var TwitterEmbedControl = ({ className }) => {
|
|
|
2387
2393
|
}
|
|
2388
2394
|
},
|
|
2389
2395
|
children: [
|
|
2390
|
-
/* @__PURE__ */ (0,
|
|
2396
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2391
2397
|
DialogTrigger,
|
|
2392
2398
|
{
|
|
2393
|
-
render: /* @__PURE__ */ (0,
|
|
2399
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2394
2400
|
RichTextEditorControl,
|
|
2395
2401
|
{
|
|
2396
2402
|
active,
|
|
2397
2403
|
className,
|
|
2398
2404
|
title: "Embed Tweet",
|
|
2399
2405
|
"aria-label": "Embed Tweet",
|
|
2400
|
-
children: /* @__PURE__ */ (0,
|
|
2406
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2401
2407
|
"svg",
|
|
2402
2408
|
{
|
|
2403
2409
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2404
2410
|
viewBox: "0 0 24 24",
|
|
2405
2411
|
fill: "currentColor",
|
|
2406
2412
|
className: "rte-editor-icon",
|
|
2407
|
-
children: /* @__PURE__ */ (0,
|
|
2413
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("path", { d: "M18.2 3.2h3.3l-7.2 8.2 8.5 11.2h-6.6l-5.2-6.8-6 6.8H2.7l7.7-8.8L2.3 3.2h6.8l4.7 6.2 5.4-6.2zm-1.2 17.3h1.8L7 4.8H5.1l11.9 15.7z" })
|
|
2408
2414
|
}
|
|
2409
2415
|
)
|
|
2410
2416
|
}
|
|
2411
2417
|
)
|
|
2412
2418
|
}
|
|
2413
2419
|
),
|
|
2414
|
-
/* @__PURE__ */ (0,
|
|
2415
|
-
/* @__PURE__ */ (0,
|
|
2416
|
-
/* @__PURE__ */ (0,
|
|
2417
|
-
/* @__PURE__ */ (0,
|
|
2420
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(DialogContent, { children: [
|
|
2421
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(DialogHeader, { children: [
|
|
2422
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DialogTitle, { children: "Embed Tweet" }),
|
|
2423
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DialogDescription, { children: "Paste a tweet URL or ID." })
|
|
2418
2424
|
] }),
|
|
2419
|
-
/* @__PURE__ */ (0,
|
|
2425
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2420
2426
|
Input,
|
|
2421
2427
|
{
|
|
2422
2428
|
value: url,
|
|
@@ -2436,10 +2442,10 @@ var TwitterEmbedControl = ({ className }) => {
|
|
|
2436
2442
|
}
|
|
2437
2443
|
}
|
|
2438
2444
|
),
|
|
2439
|
-
showError && /* @__PURE__ */ (0,
|
|
2440
|
-
/* @__PURE__ */ (0,
|
|
2441
|
-
/* @__PURE__ */ (0,
|
|
2442
|
-
/* @__PURE__ */ (0,
|
|
2445
|
+
showError && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "rte-input-error", role: "alert", children: "That doesn't look like a valid tweet URL or ID." }),
|
|
2446
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(DialogFooter, { children: [
|
|
2447
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DialogClose, { children: "Cancel" }),
|
|
2448
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2443
2449
|
"button",
|
|
2444
2450
|
{
|
|
2445
2451
|
type: "button",
|
|
@@ -2462,9 +2468,9 @@ var TwitterEmbedControl = ({ className }) => {
|
|
|
2462
2468
|
|
|
2463
2469
|
// src/controls/rte-youtube-control.tsx
|
|
2464
2470
|
var import_core3 = require("@tiptap/core");
|
|
2465
|
-
var
|
|
2466
|
-
var
|
|
2467
|
-
var
|
|
2471
|
+
var import_react17 = require("@tiptap/react");
|
|
2472
|
+
var import_react18 = require("react");
|
|
2473
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
2468
2474
|
var getYouTubeId = (url) => {
|
|
2469
2475
|
const clean = url.trim();
|
|
2470
2476
|
const patterns = [
|
|
@@ -2492,7 +2498,7 @@ var YouTubeNodeView = (props) => {
|
|
|
2492
2498
|
if (videoId) {
|
|
2493
2499
|
watchUrl = videoId.startsWith("http") ? videoId : `https://www.youtube.com/watch?v=${videoId}`;
|
|
2494
2500
|
}
|
|
2495
|
-
return /* @__PURE__ */ (0,
|
|
2501
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2496
2502
|
ResizableNodeView,
|
|
2497
2503
|
{
|
|
2498
2504
|
...props,
|
|
@@ -2503,7 +2509,7 @@ var YouTubeNodeView = (props) => {
|
|
|
2503
2509
|
videoSrc: rawSrc,
|
|
2504
2510
|
watchUrl,
|
|
2505
2511
|
onSrcChange: (newSrc) => updateAttributes({ src: newSrc }),
|
|
2506
|
-
children: /* @__PURE__ */ (0,
|
|
2512
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2507
2513
|
"iframe",
|
|
2508
2514
|
{
|
|
2509
2515
|
src: `https://www.youtube-nocookie.com/embed/${videoId}`,
|
|
@@ -2567,7 +2573,7 @@ var YouTubeEmbed = import_core3.Node.create({
|
|
|
2567
2573
|
];
|
|
2568
2574
|
},
|
|
2569
2575
|
addNodeView() {
|
|
2570
|
-
return (0,
|
|
2576
|
+
return (0, import_react17.ReactNodeViewRenderer)(YouTubeNodeView);
|
|
2571
2577
|
},
|
|
2572
2578
|
atom: true,
|
|
2573
2579
|
draggable: true,
|
|
@@ -2591,32 +2597,32 @@ var YouTubeEmbed = import_core3.Node.create({
|
|
|
2591
2597
|
});
|
|
2592
2598
|
var YouTubeEmbedControl = ({ className }) => {
|
|
2593
2599
|
const { editor } = useRichTextEditorContext();
|
|
2594
|
-
const [open, setOpen] = (0,
|
|
2595
|
-
const [url, setUrl] = (0,
|
|
2596
|
-
const { active } = (0,
|
|
2600
|
+
const [open, setOpen] = (0, import_react18.useState)(false);
|
|
2601
|
+
const [url, setUrl] = (0, import_react18.useState)("");
|
|
2602
|
+
const { active } = (0, import_react17.useEditorState)({
|
|
2597
2603
|
editor: editor ?? null,
|
|
2598
2604
|
selector: (ctx) => ({
|
|
2599
2605
|
active: ctx.editor && !ctx.editor.isDestroyed ? ctx.editor.isActive("youtube") : false
|
|
2600
2606
|
})
|
|
2601
2607
|
}) ?? { active: false };
|
|
2602
|
-
const handleInsert = (0,
|
|
2608
|
+
const handleInsert = (0, import_react18.useCallback)(() => {
|
|
2603
2609
|
if (url && editor) {
|
|
2604
2610
|
editor.chain().focus().setYouTubeEmbed(url).run();
|
|
2605
2611
|
setUrl("");
|
|
2606
2612
|
}
|
|
2607
2613
|
}, [url, editor]);
|
|
2608
|
-
return /* @__PURE__ */ (0,
|
|
2609
|
-
/* @__PURE__ */ (0,
|
|
2614
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Dialog, { open, onOpenChange: setOpen, children: [
|
|
2615
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2610
2616
|
DialogTrigger,
|
|
2611
2617
|
{
|
|
2612
|
-
render: /* @__PURE__ */ (0,
|
|
2618
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2613
2619
|
RichTextEditorControl,
|
|
2614
2620
|
{
|
|
2615
2621
|
active,
|
|
2616
2622
|
className,
|
|
2617
2623
|
title: "Embed YouTube video",
|
|
2618
2624
|
"aria-label": "Embed YouTube video",
|
|
2619
|
-
children: /* @__PURE__ */ (0,
|
|
2625
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
2620
2626
|
"svg",
|
|
2621
2627
|
{
|
|
2622
2628
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -2628,8 +2634,8 @@ var YouTubeEmbedControl = ({ className }) => {
|
|
|
2628
2634
|
strokeLinejoin: "round",
|
|
2629
2635
|
className: "rte-editor-icon",
|
|
2630
2636
|
children: [
|
|
2631
|
-
/* @__PURE__ */ (0,
|
|
2632
|
-
/* @__PURE__ */ (0,
|
|
2637
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("path", { d: "M23.5 6.2a3 3 0 0 0-2.1-2.1C19.5 3.5 12 3.5 12 3.5s-7.5 0-9.4.6a3 3 0 0 0-2.1 2.1C0 8.1 0 12 0 12s0 3.9.5 5.8a3 3 0 0 0 2.1 2.1c1.9.6 9.4.6 9.4.6s7.5 0 9.4-.6a3 3 0 0 0 2.1-2.1c.5-1.9.5-5.8.5-5.8s0-3.9-.5-5.8z" }),
|
|
2638
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("path", { d: "M9.5 15.5V8.5l6.2 3.5z" })
|
|
2633
2639
|
]
|
|
2634
2640
|
}
|
|
2635
2641
|
)
|
|
@@ -2637,12 +2643,12 @@ var YouTubeEmbedControl = ({ className }) => {
|
|
|
2637
2643
|
)
|
|
2638
2644
|
}
|
|
2639
2645
|
),
|
|
2640
|
-
/* @__PURE__ */ (0,
|
|
2641
|
-
/* @__PURE__ */ (0,
|
|
2642
|
-
/* @__PURE__ */ (0,
|
|
2643
|
-
/* @__PURE__ */ (0,
|
|
2646
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(DialogContent, { showCloseButton: false, children: [
|
|
2647
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(DialogHeader, { children: [
|
|
2648
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DialogTitle, { children: "Embed YouTube video" }),
|
|
2649
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DialogDescription, { children: "Paste a YouTube video URL or ID." })
|
|
2644
2650
|
] }),
|
|
2645
|
-
/* @__PURE__ */ (0,
|
|
2651
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2646
2652
|
Input,
|
|
2647
2653
|
{
|
|
2648
2654
|
value: url,
|
|
@@ -2656,9 +2662,9 @@ var YouTubeEmbedControl = ({ className }) => {
|
|
|
2656
2662
|
}
|
|
2657
2663
|
}
|
|
2658
2664
|
),
|
|
2659
|
-
/* @__PURE__ */ (0,
|
|
2660
|
-
/* @__PURE__ */ (0,
|
|
2661
|
-
/* @__PURE__ */ (0,
|
|
2665
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(DialogFooter, { children: [
|
|
2666
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DialogClose, { children: "Cancel" }),
|
|
2667
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2662
2668
|
DialogClose,
|
|
2663
2669
|
{
|
|
2664
2670
|
disabled: !url,
|
|
@@ -2714,16 +2720,16 @@ var DEFAULT_LABELS = {
|
|
|
2714
2720
|
};
|
|
2715
2721
|
|
|
2716
2722
|
// src/rte-content.tsx
|
|
2717
|
-
var
|
|
2718
|
-
var
|
|
2723
|
+
var import_react19 = require("@tiptap/react");
|
|
2724
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
2719
2725
|
var Content = ({
|
|
2720
2726
|
children,
|
|
2721
2727
|
className
|
|
2722
2728
|
}) => {
|
|
2723
2729
|
const { editor } = useRichTextEditorContext();
|
|
2724
|
-
return /* @__PURE__ */ (0,
|
|
2725
|
-
/* @__PURE__ */ (0,
|
|
2726
|
-
|
|
2730
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "relative", children: [
|
|
2731
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2732
|
+
import_react19.EditorContent,
|
|
2727
2733
|
{
|
|
2728
2734
|
editor,
|
|
2729
2735
|
className: cn("rte-content w-full", className)
|
|
@@ -2734,15 +2740,15 @@ var Content = ({
|
|
|
2734
2740
|
};
|
|
2735
2741
|
|
|
2736
2742
|
// src/rte-controls-group.tsx
|
|
2737
|
-
var
|
|
2743
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
2738
2744
|
var ControlsGroup = ({
|
|
2739
2745
|
children,
|
|
2740
2746
|
className
|
|
2741
|
-
}) => /* @__PURE__ */ (0,
|
|
2747
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: cn("rte-controls-group", className), children });
|
|
2742
2748
|
|
|
2743
2749
|
// src/rte-footer.tsx
|
|
2744
|
-
var
|
|
2745
|
-
var
|
|
2750
|
+
var import_react20 = require("react");
|
|
2751
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
2746
2752
|
var Footer = ({
|
|
2747
2753
|
children,
|
|
2748
2754
|
className,
|
|
@@ -2753,9 +2759,9 @@ var Footer = ({
|
|
|
2753
2759
|
wordCountFormatter
|
|
2754
2760
|
}) => {
|
|
2755
2761
|
const { editor, variant } = useRichTextEditorContext();
|
|
2756
|
-
const [, forceUpdate] = (0,
|
|
2757
|
-
const rafRef = (0,
|
|
2758
|
-
(0,
|
|
2762
|
+
const [, forceUpdate] = (0, import_react20.useState)(0);
|
|
2763
|
+
const rafRef = (0, import_react20.useRef)(null);
|
|
2764
|
+
(0, import_react20.useEffect)(() => {
|
|
2759
2765
|
if (!editor || !showWordCount) {
|
|
2760
2766
|
return;
|
|
2761
2767
|
}
|
|
@@ -2784,7 +2790,7 @@ var Footer = ({
|
|
|
2784
2790
|
}
|
|
2785
2791
|
};
|
|
2786
2792
|
}, [editor, showWordCount]);
|
|
2787
|
-
const wordCount = (0,
|
|
2793
|
+
const wordCount = (0, import_react20.useMemo)(() => {
|
|
2788
2794
|
if (!editor || !showWordCount) {
|
|
2789
2795
|
return null;
|
|
2790
2796
|
}
|
|
@@ -2801,7 +2807,7 @@ var Footer = ({
|
|
|
2801
2807
|
if (!showWordCount && !children) {
|
|
2802
2808
|
return null;
|
|
2803
2809
|
}
|
|
2804
|
-
return /* @__PURE__ */ (0,
|
|
2810
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
2805
2811
|
"div",
|
|
2806
2812
|
{
|
|
2807
2813
|
className: cn(
|
|
@@ -2813,21 +2819,21 @@ var Footer = ({
|
|
|
2813
2819
|
"data-sticky": sticky ? "" : void 0,
|
|
2814
2820
|
style: sticky ? { bottom: stickyOffset } : void 0,
|
|
2815
2821
|
children: [
|
|
2816
|
-
showWordCount && wordCount && /* @__PURE__ */ (0,
|
|
2817
|
-
/* @__PURE__ */ (0,
|
|
2818
|
-
/* @__PURE__ */ (0,
|
|
2819
|
-
/* @__PURE__ */ (0,
|
|
2822
|
+
showWordCount && wordCount && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: cn("rte-footer-word-count", wordCountClassName), children: wordCountFormatter ? wordCountFormatter(wordCount) : /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
2823
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "rte-footer-word-count-stat", children: [
|
|
2824
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "rte-footer-word-count-number", children: wordCount.words }),
|
|
2825
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "rte-footer-word-count-unit", children: "words" })
|
|
2820
2826
|
] }),
|
|
2821
|
-
/* @__PURE__ */ (0,
|
|
2827
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2822
2828
|
"span",
|
|
2823
2829
|
{
|
|
2824
2830
|
className: "rte-footer-word-count-separator",
|
|
2825
2831
|
"aria-hidden": "true"
|
|
2826
2832
|
}
|
|
2827
2833
|
),
|
|
2828
|
-
/* @__PURE__ */ (0,
|
|
2829
|
-
/* @__PURE__ */ (0,
|
|
2830
|
-
/* @__PURE__ */ (0,
|
|
2834
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "rte-footer-word-count-stat", children: [
|
|
2835
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "rte-footer-word-count-number", children: wordCount.characters }),
|
|
2836
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "rte-footer-word-count-unit", children: "characters" })
|
|
2831
2837
|
] })
|
|
2832
2838
|
] }) }),
|
|
2833
2839
|
children
|
|
@@ -2837,7 +2843,7 @@ var Footer = ({
|
|
|
2837
2843
|
};
|
|
2838
2844
|
|
|
2839
2845
|
// src/rte-toolbar.tsx
|
|
2840
|
-
var
|
|
2846
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
2841
2847
|
var Toolbar = ({
|
|
2842
2848
|
children,
|
|
2843
2849
|
className,
|
|
@@ -2848,7 +2854,7 @@ var Toolbar = ({
|
|
|
2848
2854
|
if (!editable) {
|
|
2849
2855
|
return null;
|
|
2850
2856
|
}
|
|
2851
|
-
return /* @__PURE__ */ (0,
|
|
2857
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2852
2858
|
"div",
|
|
2853
2859
|
{
|
|
2854
2860
|
className: cn(
|
|
@@ -2865,7 +2871,7 @@ var Toolbar = ({
|
|
|
2865
2871
|
};
|
|
2866
2872
|
|
|
2867
2873
|
// src/rte-text-editor.tsx
|
|
2868
|
-
var
|
|
2874
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
2869
2875
|
var RichTextEditorRoot = ({
|
|
2870
2876
|
editor,
|
|
2871
2877
|
children,
|
|
@@ -2875,17 +2881,17 @@ var RichTextEditorRoot = ({
|
|
|
2875
2881
|
variant = "default",
|
|
2876
2882
|
editable = true
|
|
2877
2883
|
}) => {
|
|
2878
|
-
const mergedLabels = (0,
|
|
2884
|
+
const mergedLabels = (0, import_react21.useMemo)(
|
|
2879
2885
|
() => ({ ...DEFAULT_LABELS, ...labels }),
|
|
2880
2886
|
[labels]
|
|
2881
2887
|
);
|
|
2882
|
-
const mergedIcons = (0,
|
|
2883
|
-
(0,
|
|
2888
|
+
const mergedIcons = (0, import_react21.useMemo)(() => ({ ...DEFAULT_ICONS, ...icons }), [icons]);
|
|
2889
|
+
(0, import_react21.useEffect)(() => {
|
|
2884
2890
|
if (editor && editor.isEditable !== editable) {
|
|
2885
2891
|
editor.setEditable(editable);
|
|
2886
2892
|
}
|
|
2887
2893
|
}, [editor, editable]);
|
|
2888
|
-
return /* @__PURE__ */ (0,
|
|
2894
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2889
2895
|
RichTextEditorContext.Provider,
|
|
2890
2896
|
{
|
|
2891
2897
|
value: {
|
|
@@ -2895,7 +2901,7 @@ var RichTextEditorRoot = ({
|
|
|
2895
2901
|
labels: mergedLabels,
|
|
2896
2902
|
variant
|
|
2897
2903
|
},
|
|
2898
|
-
children: /* @__PURE__ */ (0,
|
|
2904
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2899
2905
|
"div",
|
|
2900
2906
|
{
|
|
2901
2907
|
className: cn(
|