@mekari/pixel3-rich-text-editor 0.1.3-dev.0 → 0.1.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/{chunk-ZYSEHV5N.mjs → chunk-4ZCPCZD2.mjs} +5 -5
- package/dist/{chunk-47IOAHWN.mjs → chunk-FCLBNBXD.mjs} +21 -14
- package/dist/{chunk-UD5PDCGC.mjs → chunk-G4CGNV6P.mjs} +95 -58
- package/dist/editor-toolbar.js +109 -65
- package/dist/editor-toolbar.mjs +5 -5
- package/dist/extensions/index.js +21 -14
- package/dist/extensions/index.mjs +10 -10
- package/dist/extensions/single-extension.d.mts +11 -1
- package/dist/extensions/single-extension.d.ts +11 -1
- package/dist/extensions/single-extension.js +21 -14
- package/dist/extensions/single-extension.mjs +1 -1
- package/dist/index.js +109 -65
- package/dist/index.mjs +10 -10
- package/dist/metafile-cjs.json +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/modules/rich-text-editor.types.d.mts +1 -0
- package/dist/modules/rich-text-editor.types.d.ts +1 -0
- package/dist/rich-text-editor.js +109 -65
- package/dist/rich-text-editor.mjs +10 -10
- package/dist/rte-style-provider.mjs +2 -2
- package/package.json +12 -12
- package/dist/{chunk-AIWY3FHJ.mjs → chunk-BA5A7DIS.mjs} +3 -3
package/dist/index.js
CHANGED
|
@@ -875,14 +875,13 @@ var SingleExtention = (0, import_vue9.defineComponent)({
|
|
|
875
875
|
},
|
|
876
876
|
editor: {
|
|
877
877
|
type: Object
|
|
878
|
+
},
|
|
879
|
+
isDisabled: {
|
|
880
|
+
type: Boolean,
|
|
881
|
+
default: false
|
|
878
882
|
}
|
|
879
883
|
},
|
|
880
|
-
setup({
|
|
881
|
-
name,
|
|
882
|
-
tooltipLabel,
|
|
883
|
-
onClick,
|
|
884
|
-
editor
|
|
885
|
-
}) {
|
|
884
|
+
setup(props) {
|
|
886
885
|
const iconMap = {
|
|
887
886
|
bold: (0, import_vue8.createVNode)(BoldIcon, null, null),
|
|
888
887
|
italic: (0, import_vue8.createVNode)(ItalicIcon, null, null),
|
|
@@ -901,14 +900,22 @@ var SingleExtention = (0, import_vue9.defineComponent)({
|
|
|
901
900
|
variable: (0, import_vue8.createVNode)(VariableIcon, null, null),
|
|
902
901
|
location: (0, import_vue8.createVNode)(LocationIcon, null, null)
|
|
903
902
|
};
|
|
904
|
-
return () =>
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
903
|
+
return () => {
|
|
904
|
+
var _a;
|
|
905
|
+
return (0, import_vue8.withDirectives)((0, import_vue8.createVNode)("button", {
|
|
906
|
+
"class": {
|
|
907
|
+
"is-active": props.name && ((_a = props.editor) == null ? void 0 : _a.isActive(props.name))
|
|
908
|
+
},
|
|
909
|
+
"style": props.isDisabled ? {
|
|
910
|
+
opacity: "0.4",
|
|
911
|
+
cursor: "not-allowed"
|
|
912
|
+
} : void 0,
|
|
913
|
+
"disabled": props.isDisabled,
|
|
914
|
+
"onClick": props.isDisabled ? void 0 : props.onClick
|
|
915
|
+
}, [props.name && iconMap[props.name]]), [[(0, import_vue8.resolveDirective)("tooltip"), {
|
|
916
|
+
label: props.tooltipLabel
|
|
917
|
+
}]]);
|
|
918
|
+
};
|
|
912
919
|
}
|
|
913
920
|
});
|
|
914
921
|
|
|
@@ -1546,77 +1553,102 @@ var EditorToolbar = (0, import_vue17.defineComponent)({
|
|
|
1546
1553
|
type: Function
|
|
1547
1554
|
}
|
|
1548
1555
|
},
|
|
1549
|
-
setup({
|
|
1550
|
-
editor,
|
|
1551
|
-
options,
|
|
1552
|
-
validateLink,
|
|
1553
|
-
transformLink
|
|
1554
|
-
}, {
|
|
1556
|
+
setup(props, {
|
|
1555
1557
|
emit
|
|
1556
1558
|
}) {
|
|
1557
1559
|
const items = ["heading", "bold", "italic", "underline", "strike", "blockquote", "bulletList", "orderedList", "textColor", "fillColor", "textLink", "align", "undo", "redo", "clear", "image", "file", "audio", "mention", "variable", "location"];
|
|
1558
|
-
const
|
|
1560
|
+
const getItemOptions = /* @__PURE__ */ __name(() => ({
|
|
1559
1561
|
heading: {
|
|
1560
1562
|
tooltipLabel: "Text style",
|
|
1561
|
-
editor
|
|
1563
|
+
editor: props.editor
|
|
1562
1564
|
},
|
|
1563
1565
|
bold: {
|
|
1564
1566
|
tooltipLabel: "Bold",
|
|
1565
|
-
onClick: () =>
|
|
1567
|
+
onClick: () => {
|
|
1568
|
+
var _a;
|
|
1569
|
+
return ((_a = props.editor) == null ? void 0 : _a.chain()).focus().toggleBold().run();
|
|
1570
|
+
}
|
|
1566
1571
|
},
|
|
1567
1572
|
italic: {
|
|
1568
1573
|
tooltipLabel: "Italic",
|
|
1569
|
-
onClick: () =>
|
|
1574
|
+
onClick: () => {
|
|
1575
|
+
var _a;
|
|
1576
|
+
return ((_a = props.editor) == null ? void 0 : _a.chain()).focus().toggleItalic().run();
|
|
1577
|
+
}
|
|
1570
1578
|
},
|
|
1571
1579
|
underline: {
|
|
1572
1580
|
tooltipLabel: "Underline",
|
|
1573
|
-
onClick: () =>
|
|
1581
|
+
onClick: () => {
|
|
1582
|
+
var _a;
|
|
1583
|
+
return ((_a = props.editor) == null ? void 0 : _a.chain()).focus().toggleUnderline().run();
|
|
1584
|
+
}
|
|
1574
1585
|
},
|
|
1575
1586
|
strike: {
|
|
1576
1587
|
tooltipLabel: "Strike",
|
|
1577
|
-
onClick: () =>
|
|
1588
|
+
onClick: () => {
|
|
1589
|
+
var _a;
|
|
1590
|
+
return ((_a = props.editor) == null ? void 0 : _a.chain()).focus().toggleStrike().run();
|
|
1591
|
+
}
|
|
1578
1592
|
},
|
|
1579
1593
|
blockquote: {
|
|
1580
1594
|
tooltipLabel: "Blockquote",
|
|
1581
|
-
onClick: () =>
|
|
1595
|
+
onClick: () => {
|
|
1596
|
+
var _a;
|
|
1597
|
+
return ((_a = props.editor) == null ? void 0 : _a.chain()).focus().toggleBlockquote().run();
|
|
1598
|
+
}
|
|
1582
1599
|
},
|
|
1583
1600
|
bulletList: {
|
|
1584
1601
|
tooltipLabel: "Bullet list",
|
|
1585
|
-
onClick: () =>
|
|
1602
|
+
onClick: () => {
|
|
1603
|
+
var _a;
|
|
1604
|
+
return ((_a = props.editor) == null ? void 0 : _a.chain()).focus().toggleBulletList().run();
|
|
1605
|
+
}
|
|
1586
1606
|
},
|
|
1587
1607
|
orderedList: {
|
|
1588
1608
|
tooltipLabel: "Number list",
|
|
1589
|
-
onClick: () =>
|
|
1609
|
+
onClick: () => {
|
|
1610
|
+
var _a;
|
|
1611
|
+
return ((_a = props.editor) == null ? void 0 : _a.chain()).focus().toggleOrderedList().run();
|
|
1612
|
+
}
|
|
1590
1613
|
},
|
|
1591
1614
|
textColor: {
|
|
1592
1615
|
tooltipLabel: "Text color",
|
|
1593
|
-
editor,
|
|
1616
|
+
editor: props.editor,
|
|
1594
1617
|
type: "text"
|
|
1595
1618
|
},
|
|
1596
1619
|
fillColor: {
|
|
1597
1620
|
tooltipLabel: "Fill color",
|
|
1598
|
-
editor,
|
|
1621
|
+
editor: props.editor,
|
|
1599
1622
|
type: "fill"
|
|
1600
1623
|
},
|
|
1601
1624
|
textLink: {
|
|
1602
1625
|
tooltipLabel: "Insert link",
|
|
1603
|
-
editor
|
|
1626
|
+
editor: props.editor
|
|
1604
1627
|
},
|
|
1605
1628
|
align: {
|
|
1606
1629
|
tooltipLabel: "Text alignment",
|
|
1607
|
-
editor
|
|
1630
|
+
editor: props.editor
|
|
1608
1631
|
},
|
|
1609
1632
|
undo: {
|
|
1610
1633
|
tooltipLabel: "Undo",
|
|
1611
|
-
onClick: () =>
|
|
1634
|
+
onClick: () => {
|
|
1635
|
+
var _a;
|
|
1636
|
+
return ((_a = props.editor) == null ? void 0 : _a.chain()).focus().undo().run();
|
|
1637
|
+
}
|
|
1612
1638
|
},
|
|
1613
1639
|
redo: {
|
|
1614
1640
|
tooltipLabel: "Redo",
|
|
1615
|
-
onClick: () =>
|
|
1641
|
+
onClick: () => {
|
|
1642
|
+
var _a;
|
|
1643
|
+
return ((_a = props.editor) == null ? void 0 : _a.chain()).focus().redo().run();
|
|
1644
|
+
}
|
|
1616
1645
|
},
|
|
1617
1646
|
clear: {
|
|
1618
1647
|
tooltipLabel: "Reset format",
|
|
1619
|
-
onClick: () =>
|
|
1648
|
+
onClick: () => {
|
|
1649
|
+
var _a;
|
|
1650
|
+
return ((_a = props.editor) == null ? void 0 : _a.chain()).focus().unsetAllMarks().run();
|
|
1651
|
+
}
|
|
1620
1652
|
},
|
|
1621
1653
|
image: {
|
|
1622
1654
|
tooltipLabel: "Add image",
|
|
@@ -1632,19 +1664,21 @@ var EditorToolbar = (0, import_vue17.defineComponent)({
|
|
|
1632
1664
|
},
|
|
1633
1665
|
mention: {
|
|
1634
1666
|
tooltipLabel: "Mention",
|
|
1635
|
-
editor,
|
|
1667
|
+
editor: props.editor,
|
|
1636
1668
|
onClick: () => {
|
|
1669
|
+
var _a;
|
|
1637
1670
|
;
|
|
1638
|
-
(editor == null ? void 0 :
|
|
1671
|
+
((_a = props.editor) == null ? void 0 : _a.chain()).focus().insertContent("@").run();
|
|
1639
1672
|
emit("clickMention");
|
|
1640
1673
|
}
|
|
1641
1674
|
},
|
|
1642
1675
|
variable: {
|
|
1643
1676
|
tooltipLabel: "Insert variable",
|
|
1644
|
-
editor,
|
|
1677
|
+
editor: props.editor,
|
|
1645
1678
|
onClick: () => {
|
|
1679
|
+
var _a;
|
|
1646
1680
|
;
|
|
1647
|
-
(editor == null ? void 0 :
|
|
1681
|
+
((_a = props.editor) == null ? void 0 : _a.chain()).focus().insertContent("{").run();
|
|
1648
1682
|
emit("clickVariable");
|
|
1649
1683
|
}
|
|
1650
1684
|
},
|
|
@@ -1652,7 +1686,7 @@ var EditorToolbar = (0, import_vue17.defineComponent)({
|
|
|
1652
1686
|
tooltipLabel: "Add location",
|
|
1653
1687
|
onClick: () => emit("clickLocation")
|
|
1654
1688
|
}
|
|
1655
|
-
};
|
|
1689
|
+
}), "getItemOptions");
|
|
1656
1690
|
const getResolvedItem = /* @__PURE__ */ __name((option) => {
|
|
1657
1691
|
if (typeof option === "string") {
|
|
1658
1692
|
return {
|
|
@@ -1661,17 +1695,20 @@ var EditorToolbar = (0, import_vue17.defineComponent)({
|
|
|
1661
1695
|
}
|
|
1662
1696
|
return {
|
|
1663
1697
|
item: option.value,
|
|
1664
|
-
tooltip: option.tooltip
|
|
1698
|
+
tooltip: option.tooltip,
|
|
1699
|
+
disabled: option.disabled
|
|
1665
1700
|
};
|
|
1666
1701
|
}, "getResolvedItem");
|
|
1667
1702
|
const renderExtension = /* @__PURE__ */ __name((option) => {
|
|
1668
1703
|
const {
|
|
1669
1704
|
item,
|
|
1670
|
-
tooltip
|
|
1705
|
+
tooltip,
|
|
1706
|
+
disabled
|
|
1671
1707
|
} = getResolvedItem(option);
|
|
1672
1708
|
if (!items.includes(item))
|
|
1673
1709
|
return null;
|
|
1674
1710
|
const resolvedItem = item;
|
|
1711
|
+
const itemOptions = getItemOptions();
|
|
1675
1712
|
const resolvedOptions = itemOptions[resolvedItem];
|
|
1676
1713
|
if (!resolvedOptions)
|
|
1677
1714
|
return null;
|
|
@@ -1680,33 +1717,34 @@ var EditorToolbar = (0, import_vue17.defineComponent)({
|
|
|
1680
1717
|
case "heading":
|
|
1681
1718
|
return (0, import_vue16.createVNode)(HeadingExtention, {
|
|
1682
1719
|
"tooltipLabel": tooltipLabel,
|
|
1683
|
-
"editor": editor
|
|
1720
|
+
"editor": props.editor
|
|
1684
1721
|
}, null);
|
|
1685
1722
|
case "align":
|
|
1686
1723
|
return (0, import_vue16.createVNode)(AlignExtention, {
|
|
1687
1724
|
"tooltipLabel": tooltipLabel,
|
|
1688
|
-
"editor": editor
|
|
1725
|
+
"editor": props.editor
|
|
1689
1726
|
}, null);
|
|
1690
1727
|
case "textColor":
|
|
1691
1728
|
case "fillColor":
|
|
1692
1729
|
return (0, import_vue16.createVNode)(ColorExtension, {
|
|
1693
1730
|
"tooltipLabel": tooltipLabel,
|
|
1694
|
-
"editor": editor,
|
|
1731
|
+
"editor": props.editor,
|
|
1695
1732
|
"type": resolvedOptions.type
|
|
1696
1733
|
}, null);
|
|
1697
1734
|
case "textLink":
|
|
1698
1735
|
return (0, import_vue16.createVNode)(LinkExtension, {
|
|
1699
1736
|
"tooltipLabel": tooltipLabel,
|
|
1700
|
-
"editor": editor,
|
|
1701
|
-
"validateLink": validateLink,
|
|
1702
|
-
"transformLink": transformLink
|
|
1737
|
+
"editor": props.editor,
|
|
1738
|
+
"validateLink": props.validateLink,
|
|
1739
|
+
"transformLink": props.transformLink
|
|
1703
1740
|
}, null);
|
|
1704
1741
|
default:
|
|
1705
1742
|
return (0, import_vue16.createVNode)(SingleExtention, {
|
|
1706
1743
|
"name": resolvedItem,
|
|
1707
1744
|
"tooltipLabel": tooltipLabel,
|
|
1708
1745
|
"onClick": resolvedOptions.onClick,
|
|
1709
|
-
"editor": editor
|
|
1746
|
+
"editor": props.editor,
|
|
1747
|
+
"isDisabled": disabled
|
|
1710
1748
|
}, null);
|
|
1711
1749
|
}
|
|
1712
1750
|
}, "renderExtension");
|
|
@@ -1718,21 +1756,27 @@ var EditorToolbar = (0, import_vue17.defineComponent)({
|
|
|
1718
1756
|
}
|
|
1719
1757
|
}
|
|
1720
1758
|
}, {
|
|
1721
|
-
default: () =>
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1759
|
+
default: () => {
|
|
1760
|
+
var _a;
|
|
1761
|
+
return [(0, import_vue16.createVNode)("div", {
|
|
1762
|
+
"class": (0, import_css6.css)({
|
|
1763
|
+
display: "flex",
|
|
1764
|
+
alignItems: "stretch",
|
|
1765
|
+
gap: "1"
|
|
1766
|
+
})
|
|
1767
|
+
}, [(_a = props.options) == null ? void 0 : _a.map((option, index) => {
|
|
1768
|
+
var _a2, _b;
|
|
1769
|
+
return (0, import_vue16.createVNode)(import_vue16.Fragment, null, [option.map((item) => {
|
|
1770
|
+
const resolvedItem = typeof item === "string" ? item : item.value;
|
|
1771
|
+
if (items.includes(resolvedItem)) {
|
|
1772
|
+
return renderExtension(item);
|
|
1773
|
+
}
|
|
1774
|
+
}), index !== ((_b = (_a2 = props.options) == null ? void 0 : _a2.length) != null ? _b : 0) - 1 && (0, import_vue16.createVNode)(import_pixel3_divider.MpDivider, {
|
|
1775
|
+
"id": "divider-toolbar",
|
|
1776
|
+
"orientation": "vertical"
|
|
1777
|
+
}, null)]);
|
|
1778
|
+
})])];
|
|
1779
|
+
}
|
|
1736
1780
|
});
|
|
1737
1781
|
}
|
|
1738
1782
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import "./chunk-7ZWZAIUI.mjs";
|
|
2
2
|
import {
|
|
3
3
|
MpRichTextEditor
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-4ZCPCZD2.mjs";
|
|
5
|
+
import "./chunk-G4CGNV6P.mjs";
|
|
6
6
|
import "./chunk-HIHIKPNN.mjs";
|
|
7
|
+
import "./chunk-FCLBNBXD.mjs";
|
|
8
|
+
import "./chunk-ENKUUZPM.mjs";
|
|
9
|
+
import "./chunk-YWVVMJGP.mjs";
|
|
10
|
+
import "./chunk-Y6UPQ6EU.mjs";
|
|
7
11
|
import "./chunk-X2CB42A3.mjs";
|
|
8
12
|
import "./chunk-COZ45QUD.mjs";
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-ENKUUZPM.mjs";
|
|
13
|
+
import "./chunk-IFRJVX2K.mjs";
|
|
11
14
|
import {
|
|
12
15
|
MpRTEStyleProvider
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-ZRAXSVO5.mjs";
|
|
15
|
-
import "./chunk-ZAXJ3BEP.mjs";
|
|
16
|
+
} from "./chunk-BA5A7DIS.mjs";
|
|
16
17
|
import "./chunk-6O4HSL2C.mjs";
|
|
17
18
|
import "./chunk-4KJOYLJI.mjs";
|
|
18
19
|
import "./chunk-4TUA5VF4.mjs";
|
|
19
20
|
import "./chunk-BWRU2WZN.mjs";
|
|
20
21
|
import "./chunk-76GEEOAG.mjs";
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import "./chunk-
|
|
23
|
-
import "./chunk-IFRJVX2K.mjs";
|
|
22
|
+
import "./chunk-ZRAXSVO5.mjs";
|
|
23
|
+
import "./chunk-ZAXJ3BEP.mjs";
|
|
24
24
|
import "./chunk-QZ7VFGWC.mjs";
|
|
25
25
|
export {
|
|
26
26
|
MpRTEStyleProvider,
|