@mekari/pixel3-rich-text-editor 0.1.3-dev.0 → 0.1.3-dev.1

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.
@@ -725,14 +725,13 @@ var SingleExtention = (0, import_vue8.defineComponent)({
725
725
  },
726
726
  editor: {
727
727
  type: Object
728
+ },
729
+ isDisabled: {
730
+ type: Boolean,
731
+ default: false
728
732
  }
729
733
  },
730
- setup({
731
- name,
732
- tooltipLabel,
733
- onClick,
734
- editor
735
- }) {
734
+ setup(props) {
736
735
  const iconMap = {
737
736
  bold: (0, import_vue7.createVNode)(BoldIcon, null, null),
738
737
  italic: (0, import_vue7.createVNode)(ItalicIcon, null, null),
@@ -751,14 +750,22 @@ var SingleExtention = (0, import_vue8.defineComponent)({
751
750
  variable: (0, import_vue7.createVNode)(VariableIcon, null, null),
752
751
  location: (0, import_vue7.createVNode)(LocationIcon, null, null)
753
752
  };
754
- return () => (0, import_vue7.withDirectives)((0, import_vue7.createVNode)("button", {
755
- "class": {
756
- "is-active": name && (editor == null ? void 0 : editor.isActive(name))
757
- },
758
- "onClick": onClick
759
- }, [name && iconMap[name]]), [[(0, import_vue7.resolveDirective)("tooltip"), {
760
- label: tooltipLabel
761
- }]]);
753
+ return () => {
754
+ var _a;
755
+ return (0, import_vue7.withDirectives)((0, import_vue7.createVNode)("button", {
756
+ "class": {
757
+ "is-active": props.name && ((_a = props.editor) == null ? void 0 : _a.isActive(props.name))
758
+ },
759
+ "style": props.isDisabled ? {
760
+ opacity: "0.4",
761
+ cursor: "not-allowed"
762
+ } : void 0,
763
+ "disabled": props.isDisabled,
764
+ "onClick": props.isDisabled ? void 0 : props.onClick
765
+ }, [props.name && iconMap[props.name]]), [[(0, import_vue7.resolveDirective)("tooltip"), {
766
+ label: props.tooltipLabel
767
+ }]]);
768
+ };
762
769
  }
763
770
  });
764
771
 
@@ -7,7 +7,7 @@ import {
7
7
  } from "../chunk-COZ45QUD.mjs";
8
8
  import {
9
9
  SingleExtention
10
- } from "../chunk-47IOAHWN.mjs";
10
+ } from "../chunk-FCLBNBXD.mjs";
11
11
  import {
12
12
  Variable
13
13
  } from "../chunk-ENKUUZPM.mjs";
@@ -17,6 +17,10 @@ declare const SingleExtention: vue.DefineComponent<{
17
17
  editor: {
18
18
  type: PropType<Editor>;
19
19
  };
20
+ isDisabled: {
21
+ type: BooleanConstructor;
22
+ default: boolean;
23
+ };
20
24
  }, () => JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
21
25
  name: {
22
26
  type: PropType<ExtensionName>;
@@ -30,6 +34,12 @@ declare const SingleExtention: vue.DefineComponent<{
30
34
  editor: {
31
35
  type: PropType<Editor>;
32
36
  };
33
- }>>, {}, {}>;
37
+ isDisabled: {
38
+ type: BooleanConstructor;
39
+ default: boolean;
40
+ };
41
+ }>>, {
42
+ isDisabled: boolean;
43
+ }, {}>;
34
44
 
35
45
  export { SingleExtention };
@@ -17,6 +17,10 @@ declare const SingleExtention: vue.DefineComponent<{
17
17
  editor: {
18
18
  type: PropType<Editor>;
19
19
  };
20
+ isDisabled: {
21
+ type: BooleanConstructor;
22
+ default: boolean;
23
+ };
20
24
  }, () => JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
21
25
  name: {
22
26
  type: PropType<ExtensionName>;
@@ -30,6 +34,12 @@ declare const SingleExtention: vue.DefineComponent<{
30
34
  editor: {
31
35
  type: PropType<Editor>;
32
36
  };
33
- }>>, {}, {}>;
37
+ isDisabled: {
38
+ type: BooleanConstructor;
39
+ default: boolean;
40
+ };
41
+ }>>, {
42
+ isDisabled: boolean;
43
+ }, {}>;
34
44
 
35
45
  export { SingleExtention };
@@ -478,14 +478,13 @@ var SingleExtention = (0, import_vue4.defineComponent)({
478
478
  },
479
479
  editor: {
480
480
  type: Object
481
+ },
482
+ isDisabled: {
483
+ type: Boolean,
484
+ default: false
481
485
  }
482
486
  },
483
- setup({
484
- name,
485
- tooltipLabel,
486
- onClick,
487
- editor
488
- }) {
487
+ setup(props) {
489
488
  const iconMap = {
490
489
  bold: (0, import_vue3.createVNode)(BoldIcon, null, null),
491
490
  italic: (0, import_vue3.createVNode)(ItalicIcon, null, null),
@@ -504,14 +503,22 @@ var SingleExtention = (0, import_vue4.defineComponent)({
504
503
  variable: (0, import_vue3.createVNode)(VariableIcon, null, null),
505
504
  location: (0, import_vue3.createVNode)(LocationIcon, null, null)
506
505
  };
507
- return () => (0, import_vue3.withDirectives)((0, import_vue3.createVNode)("button", {
508
- "class": {
509
- "is-active": name && (editor == null ? void 0 : editor.isActive(name))
510
- },
511
- "onClick": onClick
512
- }, [name && iconMap[name]]), [[(0, import_vue3.resolveDirective)("tooltip"), {
513
- label: tooltipLabel
514
- }]]);
506
+ return () => {
507
+ var _a;
508
+ return (0, import_vue3.withDirectives)((0, import_vue3.createVNode)("button", {
509
+ "class": {
510
+ "is-active": props.name && ((_a = props.editor) == null ? void 0 : _a.isActive(props.name))
511
+ },
512
+ "style": props.isDisabled ? {
513
+ opacity: "0.4",
514
+ cursor: "not-allowed"
515
+ } : void 0,
516
+ "disabled": props.isDisabled,
517
+ "onClick": props.isDisabled ? void 0 : props.onClick
518
+ }, [props.name && iconMap[props.name]]), [[(0, import_vue3.resolveDirective)("tooltip"), {
519
+ label: props.tooltipLabel
520
+ }]]);
521
+ };
515
522
  }
516
523
  });
517
524
  // Annotate the CommonJS export names for ESM import in node:
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  SingleExtention
3
- } from "../chunk-47IOAHWN.mjs";
3
+ } from "../chunk-FCLBNBXD.mjs";
4
4
  import "../chunk-IFRJVX2K.mjs";
5
5
  import "../chunk-QZ7VFGWC.mjs";
6
6
  export {
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 () => (0, import_vue8.withDirectives)((0, import_vue8.createVNode)("button", {
905
- "class": {
906
- "is-active": name && (editor == null ? void 0 : editor.isActive(name))
907
- },
908
- "onClick": onClick
909
- }, [name && iconMap[name]]), [[(0, import_vue8.resolveDirective)("tooltip"), {
910
- label: tooltipLabel
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 itemOptions = {
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: () => (editor == null ? void 0 : editor.chain()).focus().toggleBold().run()
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: () => (editor == null ? void 0 : editor.chain()).focus().toggleItalic().run()
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: () => (editor == null ? void 0 : editor.chain()).focus().toggleUnderline().run()
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: () => (editor == null ? void 0 : editor.chain()).focus().toggleStrike().run()
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: () => (editor == null ? void 0 : editor.chain()).focus().toggleBlockquote().run()
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: () => (editor == null ? void 0 : editor.chain()).focus().toggleBulletList().run()
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: () => (editor == null ? void 0 : editor.chain()).focus().toggleOrderedList().run()
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: () => (editor == null ? void 0 : editor.chain()).focus().undo().run()
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: () => (editor == null ? void 0 : editor.chain()).focus().redo().run()
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: () => (editor == null ? void 0 : editor.chain()).focus().unsetAllMarks().run()
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 : editor.chain()).focus().insertContent("@").run();
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 : editor.chain()).focus().insertContent("{").run();
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: () => [(0, import_vue16.createVNode)("div", {
1722
- "class": (0, import_css6.css)({
1723
- display: "flex",
1724
- alignItems: "stretch",
1725
- gap: "1"
1726
- })
1727
- }, [options == null ? void 0 : options.map((option, index) => (0, import_vue16.createVNode)(import_vue16.Fragment, null, [option.map((item) => {
1728
- const resolvedItem = typeof item === "string" ? item : item.value;
1729
- if (items.includes(resolvedItem)) {
1730
- return renderExtension(item);
1731
- }
1732
- }), index !== (options == null ? void 0 : options.length) - 1 && (0, import_vue16.createVNode)(import_pixel3_divider.MpDivider, {
1733
- "id": "divider-toolbar",
1734
- "orientation": "vertical"
1735
- }, null)]))])]
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,12 +1,12 @@
1
1
  import "./chunk-7ZWZAIUI.mjs";
2
2
  import {
3
3
  MpRichTextEditor
4
- } from "./chunk-ZYSEHV5N.mjs";
5
- import "./chunk-UD5PDCGC.mjs";
4
+ } from "./chunk-T7RFFPSJ.mjs";
5
+ import "./chunk-RX7ZEE2M.mjs";
6
6
  import "./chunk-HIHIKPNN.mjs";
7
7
  import "./chunk-X2CB42A3.mjs";
8
8
  import "./chunk-COZ45QUD.mjs";
9
- import "./chunk-47IOAHWN.mjs";
9
+ import "./chunk-FCLBNBXD.mjs";
10
10
  import "./chunk-ENKUUZPM.mjs";
11
11
  import {
12
12
  MpRTEStyleProvider