@firecms/editor 3.0.0-canary.295 → 3.0.0-canary.296
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.es.js +99 -121
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +99 -121
- package/dist/index.umd.js.map +1 -1
- package/package.json +3 -3
package/dist/index.es.js
CHANGED
|
@@ -478,7 +478,7 @@ const TextButtons = () => {
|
|
|
478
478
|
const items2 = [{
|
|
479
479
|
name: "bold",
|
|
480
480
|
isActive: _temp$1,
|
|
481
|
-
command: _temp2
|
|
481
|
+
command: _temp2,
|
|
482
482
|
icon: FormatBoldIcon
|
|
483
483
|
}, {
|
|
484
484
|
name: "italic",
|
|
@@ -517,7 +517,7 @@ const TextButtons = () => {
|
|
|
517
517
|
function _temp$1(editor_0) {
|
|
518
518
|
return editor_0?.isActive("bold") ?? false;
|
|
519
519
|
}
|
|
520
|
-
function _temp2
|
|
520
|
+
function _temp2(editor_1) {
|
|
521
521
|
return editor_1?.chain().focus().toggleBold().run();
|
|
522
522
|
}
|
|
523
523
|
function _temp3(editor_2) {
|
|
@@ -1436,7 +1436,6 @@ const suggestion = (ref, {
|
|
|
1436
1436
|
let reference = null;
|
|
1437
1437
|
return {
|
|
1438
1438
|
onStart: (props) => {
|
|
1439
|
-
console.log("[SlashCommand Debug] onStart", props);
|
|
1440
1439
|
component = new ReactRenderer(CommandList, {
|
|
1441
1440
|
props: {
|
|
1442
1441
|
...props,
|
|
@@ -1449,6 +1448,7 @@ const suggestion = (ref, {
|
|
|
1449
1448
|
return;
|
|
1450
1449
|
}
|
|
1451
1450
|
containerEl = document.createElement("div");
|
|
1451
|
+
containerEl.setAttribute("data-suggestion-menu", "true");
|
|
1452
1452
|
containerEl.style.position = "fixed";
|
|
1453
1453
|
containerEl.style.left = "0px";
|
|
1454
1454
|
containerEl.style.top = "0px";
|
|
@@ -1477,7 +1477,6 @@ const suggestion = (ref, {
|
|
|
1477
1477
|
});
|
|
1478
1478
|
},
|
|
1479
1479
|
onUpdate(props) {
|
|
1480
|
-
console.log("[SlashCommand Debug] onUpdate", props);
|
|
1481
1480
|
component.updateProps(props);
|
|
1482
1481
|
if (!props.clientRect || !containerEl || !reference) {
|
|
1483
1482
|
return;
|
|
@@ -1499,15 +1498,14 @@ const suggestion = (ref, {
|
|
|
1499
1498
|
});
|
|
1500
1499
|
},
|
|
1501
1500
|
onKeyDown(props) {
|
|
1502
|
-
console.log("[SlashCommand Debug] onKeyDown", props.event.key);
|
|
1503
1501
|
if (props.event.key === "Escape") {
|
|
1504
1502
|
props.event.preventDefault();
|
|
1505
|
-
|
|
1503
|
+
props.event.stopPropagation();
|
|
1504
|
+
return false;
|
|
1506
1505
|
}
|
|
1507
1506
|
return component.ref?.onKeyDown(props);
|
|
1508
1507
|
},
|
|
1509
1508
|
onExit() {
|
|
1510
|
-
console.log("[SlashCommand Debug] onExit called");
|
|
1511
1509
|
if (cleanupAutoUpdate) cleanupAutoUpdate();
|
|
1512
1510
|
if (containerEl && containerEl.parentNode) {
|
|
1513
1511
|
containerEl.parentNode.removeChild(containerEl);
|
|
@@ -1520,25 +1518,15 @@ const suggestion = (ref, {
|
|
|
1520
1518
|
}
|
|
1521
1519
|
});
|
|
1522
1520
|
const CommandList = forwardRef((props, ref) => {
|
|
1523
|
-
const $ = c(
|
|
1521
|
+
const $ = c(33);
|
|
1524
1522
|
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
1525
|
-
let t0;
|
|
1526
|
-
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1527
|
-
t0 = [];
|
|
1528
|
-
$[0] = t0;
|
|
1529
|
-
} else {
|
|
1530
|
-
t0 = $[0];
|
|
1531
|
-
}
|
|
1532
|
-
useEffect(_temp2, t0);
|
|
1533
1523
|
const {
|
|
1534
1524
|
editor
|
|
1535
1525
|
} = useCurrentEditor();
|
|
1536
|
-
let
|
|
1537
|
-
if ($[
|
|
1538
|
-
|
|
1539
|
-
console.log("[SlashCommand Debug] selectItem called", item?.title, event?.type);
|
|
1526
|
+
let t0;
|
|
1527
|
+
if ($[0] !== editor || $[1] !== props.aiController || $[2] !== props.range || $[3] !== props.upload) {
|
|
1528
|
+
t0 = (item, event) => {
|
|
1540
1529
|
if (!editor) {
|
|
1541
|
-
console.error("[SlashCommand Debug] No editor instance found in selectItem");
|
|
1542
1530
|
return;
|
|
1543
1531
|
}
|
|
1544
1532
|
event?.preventDefault();
|
|
@@ -1550,76 +1538,76 @@ const CommandList = forwardRef((props, ref) => {
|
|
|
1550
1538
|
aiController: props.aiController
|
|
1551
1539
|
});
|
|
1552
1540
|
};
|
|
1553
|
-
$[
|
|
1554
|
-
$[
|
|
1555
|
-
$[
|
|
1556
|
-
$[
|
|
1557
|
-
$[
|
|
1541
|
+
$[0] = editor;
|
|
1542
|
+
$[1] = props.aiController;
|
|
1543
|
+
$[2] = props.range;
|
|
1544
|
+
$[3] = props.upload;
|
|
1545
|
+
$[4] = t0;
|
|
1558
1546
|
} else {
|
|
1559
|
-
|
|
1547
|
+
t0 = $[4];
|
|
1560
1548
|
}
|
|
1561
|
-
const selectItem =
|
|
1562
|
-
let
|
|
1563
|
-
if ($[
|
|
1564
|
-
|
|
1549
|
+
const selectItem = t0;
|
|
1550
|
+
let t1;
|
|
1551
|
+
if ($[5] !== props.items.length || $[6] !== selectedIndex) {
|
|
1552
|
+
t1 = () => {
|
|
1565
1553
|
setSelectedIndex((selectedIndex + props.items.length - 1) % props.items.length);
|
|
1566
1554
|
};
|
|
1567
|
-
$[
|
|
1568
|
-
$[
|
|
1569
|
-
$[
|
|
1555
|
+
$[5] = props.items.length;
|
|
1556
|
+
$[6] = selectedIndex;
|
|
1557
|
+
$[7] = t1;
|
|
1570
1558
|
} else {
|
|
1571
|
-
|
|
1559
|
+
t1 = $[7];
|
|
1572
1560
|
}
|
|
1573
|
-
const upHandler =
|
|
1574
|
-
let
|
|
1575
|
-
if ($[
|
|
1576
|
-
|
|
1561
|
+
const upHandler = t1;
|
|
1562
|
+
let t2;
|
|
1563
|
+
if ($[8] !== props.items.length || $[9] !== selectedIndex) {
|
|
1564
|
+
t2 = () => {
|
|
1577
1565
|
setSelectedIndex((selectedIndex + 1) % props.items.length);
|
|
1578
1566
|
};
|
|
1579
|
-
$[
|
|
1580
|
-
$[
|
|
1581
|
-
$[
|
|
1567
|
+
$[8] = props.items.length;
|
|
1568
|
+
$[9] = selectedIndex;
|
|
1569
|
+
$[10] = t2;
|
|
1582
1570
|
} else {
|
|
1583
|
-
|
|
1571
|
+
t2 = $[10];
|
|
1584
1572
|
}
|
|
1585
|
-
const downHandler =
|
|
1586
|
-
let
|
|
1587
|
-
if ($[
|
|
1588
|
-
|
|
1573
|
+
const downHandler = t2;
|
|
1574
|
+
let t3;
|
|
1575
|
+
if ($[11] !== props.items || $[12] !== selectItem || $[13] !== selectedIndex) {
|
|
1576
|
+
t3 = () => {
|
|
1589
1577
|
const item_0 = props.items[selectedIndex];
|
|
1590
1578
|
selectItem(item_0);
|
|
1591
1579
|
};
|
|
1592
|
-
$[
|
|
1593
|
-
$[
|
|
1594
|
-
$[
|
|
1580
|
+
$[11] = props.items;
|
|
1581
|
+
$[12] = selectItem;
|
|
1582
|
+
$[13] = selectedIndex;
|
|
1583
|
+
$[14] = t3;
|
|
1584
|
+
} else {
|
|
1585
|
+
t3 = $[14];
|
|
1586
|
+
}
|
|
1587
|
+
const enterHandler = t3;
|
|
1588
|
+
let t4;
|
|
1589
|
+
if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1590
|
+
t4 = () => setSelectedIndex(0);
|
|
1595
1591
|
$[15] = t4;
|
|
1596
1592
|
} else {
|
|
1597
1593
|
t4 = $[15];
|
|
1598
1594
|
}
|
|
1599
|
-
const enterHandler = t4;
|
|
1600
1595
|
let t5;
|
|
1601
|
-
if ($[16]
|
|
1602
|
-
t5 =
|
|
1603
|
-
$[16] =
|
|
1596
|
+
if ($[16] !== props.items) {
|
|
1597
|
+
t5 = [props.items];
|
|
1598
|
+
$[16] = props.items;
|
|
1599
|
+
$[17] = t5;
|
|
1604
1600
|
} else {
|
|
1605
|
-
t5 = $[
|
|
1601
|
+
t5 = $[17];
|
|
1606
1602
|
}
|
|
1603
|
+
useEffect(t4, t5);
|
|
1607
1604
|
let t6;
|
|
1608
|
-
if ($[
|
|
1609
|
-
t6 =
|
|
1610
|
-
|
|
1611
|
-
$[18] = t6;
|
|
1612
|
-
} else {
|
|
1613
|
-
t6 = $[18];
|
|
1614
|
-
}
|
|
1615
|
-
useEffect(t5, t6);
|
|
1616
|
-
let t7;
|
|
1617
|
-
if ($[19] !== downHandler || $[20] !== enterHandler || $[21] !== upHandler) {
|
|
1618
|
-
t7 = () => ({
|
|
1619
|
-
onKeyDown: (t82) => {
|
|
1605
|
+
if ($[18] !== downHandler || $[19] !== enterHandler || $[20] !== upHandler) {
|
|
1606
|
+
t6 = () => ({
|
|
1607
|
+
onKeyDown: (t72) => {
|
|
1620
1608
|
const {
|
|
1621
1609
|
event: event_0
|
|
1622
|
-
} =
|
|
1610
|
+
} = t72;
|
|
1623
1611
|
if (event_0.key === "ArrowUp") {
|
|
1624
1612
|
upHandler();
|
|
1625
1613
|
return true;
|
|
@@ -1635,84 +1623,78 @@ const CommandList = forwardRef((props, ref) => {
|
|
|
1635
1623
|
return false;
|
|
1636
1624
|
}
|
|
1637
1625
|
});
|
|
1638
|
-
$[
|
|
1639
|
-
$[
|
|
1640
|
-
$[
|
|
1626
|
+
$[18] = downHandler;
|
|
1627
|
+
$[19] = enterHandler;
|
|
1628
|
+
$[20] = upHandler;
|
|
1629
|
+
$[21] = t6;
|
|
1630
|
+
} else {
|
|
1631
|
+
t6 = $[21];
|
|
1632
|
+
}
|
|
1633
|
+
useImperativeHandle(ref, t6);
|
|
1634
|
+
let t7;
|
|
1635
|
+
if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1636
|
+
t7 = [];
|
|
1641
1637
|
$[22] = t7;
|
|
1642
1638
|
} else {
|
|
1643
1639
|
t7 = $[22];
|
|
1644
1640
|
}
|
|
1645
|
-
|
|
1641
|
+
const itemRefs = useRef(t7);
|
|
1646
1642
|
let t8;
|
|
1647
|
-
if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1648
|
-
t8 = [];
|
|
1649
|
-
$[23] = t8;
|
|
1650
|
-
} else {
|
|
1651
|
-
t8 = $[23];
|
|
1652
|
-
}
|
|
1653
|
-
const itemRefs = useRef(t8);
|
|
1654
|
-
let t10;
|
|
1655
1643
|
let t9;
|
|
1656
|
-
if ($[
|
|
1657
|
-
|
|
1644
|
+
if ($[23] !== selectedIndex) {
|
|
1645
|
+
t8 = () => {
|
|
1658
1646
|
if (itemRefs.current[selectedIndex]) {
|
|
1659
1647
|
itemRefs.current[selectedIndex].scrollIntoView({
|
|
1660
1648
|
block: "nearest"
|
|
1661
1649
|
});
|
|
1662
1650
|
}
|
|
1663
1651
|
};
|
|
1664
|
-
|
|
1665
|
-
$[
|
|
1666
|
-
$[
|
|
1667
|
-
$[
|
|
1652
|
+
t9 = [selectedIndex];
|
|
1653
|
+
$[23] = selectedIndex;
|
|
1654
|
+
$[24] = t8;
|
|
1655
|
+
$[25] = t9;
|
|
1668
1656
|
} else {
|
|
1669
|
-
|
|
1670
|
-
t9 = $[
|
|
1657
|
+
t8 = $[24];
|
|
1658
|
+
t9 = $[25];
|
|
1671
1659
|
}
|
|
1672
|
-
useEffect(
|
|
1673
|
-
let
|
|
1674
|
-
if ($[
|
|
1675
|
-
|
|
1676
|
-
$[
|
|
1660
|
+
useEffect(t8, t9);
|
|
1661
|
+
let t10;
|
|
1662
|
+
if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1663
|
+
t10 = cls("text-surface-900 dark:text-white z-50 max-h-[280px] h-auto w-72 overflow-y-auto rounded-md border bg-white dark:bg-surface-900 px-1 py-2 shadow transition-all", defaultBorderMixin);
|
|
1664
|
+
$[26] = t10;
|
|
1677
1665
|
} else {
|
|
1678
|
-
|
|
1666
|
+
t10 = $[26];
|
|
1679
1667
|
}
|
|
1680
|
-
let
|
|
1681
|
-
if ($[
|
|
1682
|
-
|
|
1668
|
+
let t11;
|
|
1669
|
+
if ($[27] !== props.items || $[28] !== selectItem || $[29] !== selectedIndex) {
|
|
1670
|
+
t11 = props.items.length ? props.items.map((item_1, index) => /* @__PURE__ */ jsxs("button", { value: item_1.title, ref: (el) => {
|
|
1683
1671
|
if (!el) {
|
|
1684
1672
|
return;
|
|
1685
1673
|
}
|
|
1686
1674
|
itemRefs.current[index] = el;
|
|
1687
|
-
}, onMouseDown: (
|
|
1688
|
-
console.log("[SlashCommand Debug] onMouseDown", item_1.title);
|
|
1689
|
-
e.preventDefault();
|
|
1690
|
-
}, onClick: (e_0) => {
|
|
1691
|
-
console.log("[SlashCommand Debug] onClick", item_1.title);
|
|
1692
|
-
selectItem(item_1, e_0);
|
|
1693
|
-
}, tabIndex: index === selectedIndex ? 0 : -1, "aria-selected": index === selectedIndex, className: cls("flex w-full items-center space-x-2 rounded-md px-2 py-1 text-left text-sm hover:bg-blue-50 hover:dark:bg-surface-700 aria-selected:bg-blue-50 aria-selected:dark:bg-surface-700", index === selectedIndex ? "bg-blue-100 dark:bg-surface-accent-950" : ""), children: [
|
|
1675
|
+
}, onMouseDown: _temp, onClick: (e_0) => selectItem(item_1, e_0), tabIndex: index === selectedIndex ? 0 : -1, "aria-selected": index === selectedIndex, className: cls("flex w-full items-center space-x-2 rounded-md px-2 py-1 text-left text-sm hover:bg-blue-50 hover:dark:bg-surface-700 aria-selected:bg-blue-50 aria-selected:dark:bg-surface-700", index === selectedIndex ? "bg-blue-100 dark:bg-surface-accent-950" : ""), children: [
|
|
1694
1676
|
/* @__PURE__ */ jsx("div", { className: cls("flex h-10 w-10 items-center justify-center rounded-md border bg-white dark:bg-surface-900", defaultBorderMixin), children: item_1.icon }),
|
|
1695
1677
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
1696
1678
|
/* @__PURE__ */ jsx("p", { className: "font-medium", children: item_1.title }),
|
|
1697
1679
|
/* @__PURE__ */ jsx("p", { className: "text-xs text-surface-700 dark:text-surface-accent-300", children: item_1.description })
|
|
1698
1680
|
] })
|
|
1699
1681
|
] }, item_1.title)) : /* @__PURE__ */ jsx("div", { className: "item", children: "No result" });
|
|
1700
|
-
$[
|
|
1701
|
-
$[
|
|
1702
|
-
$[
|
|
1703
|
-
$[
|
|
1682
|
+
$[27] = props.items;
|
|
1683
|
+
$[28] = selectItem;
|
|
1684
|
+
$[29] = selectedIndex;
|
|
1685
|
+
$[30] = t11;
|
|
1704
1686
|
} else {
|
|
1705
|
-
|
|
1687
|
+
t11 = $[30];
|
|
1706
1688
|
}
|
|
1707
|
-
let
|
|
1708
|
-
if ($[
|
|
1709
|
-
|
|
1689
|
+
let t12;
|
|
1690
|
+
if ($[31] !== t11) {
|
|
1691
|
+
t12 = /* @__PURE__ */ jsx("div", { className: t10, children: t11 });
|
|
1692
|
+
$[31] = t11;
|
|
1710
1693
|
$[32] = t12;
|
|
1711
|
-
$[33] = t13;
|
|
1712
1694
|
} else {
|
|
1713
|
-
|
|
1695
|
+
t12 = $[32];
|
|
1714
1696
|
}
|
|
1715
|
-
return
|
|
1697
|
+
return t12;
|
|
1716
1698
|
});
|
|
1717
1699
|
CommandList.displayName = "CommandList";
|
|
1718
1700
|
const autocompleteSuggestionItem = {
|
|
@@ -1893,12 +1875,8 @@ const suggestionItems = [{
|
|
|
1893
1875
|
input.click();
|
|
1894
1876
|
}
|
|
1895
1877
|
}];
|
|
1896
|
-
function _temp() {
|
|
1897
|
-
return
|
|
1898
|
-
}
|
|
1899
|
-
function _temp2() {
|
|
1900
|
-
console.log("[SlashCommand Debug] CommandList mounted");
|
|
1901
|
-
return _temp;
|
|
1878
|
+
function _temp(e) {
|
|
1879
|
+
return e.preventDefault();
|
|
1902
1880
|
}
|
|
1903
1881
|
const proseClasses = {
|
|
1904
1882
|
"sm": "prose-sm",
|