@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.
@@ -724,14 +724,13 @@ var SingleExtention = (0, import_vue8.defineComponent)({
724
724
  },
725
725
  editor: {
726
726
  type: Object
727
+ },
728
+ isDisabled: {
729
+ type: Boolean,
730
+ default: false
727
731
  }
728
732
  },
729
- setup({
730
- name,
731
- tooltipLabel,
732
- onClick,
733
- editor
734
- }) {
733
+ setup(props) {
735
734
  const iconMap = {
736
735
  bold: (0, import_vue7.createVNode)(BoldIcon, null, null),
737
736
  italic: (0, import_vue7.createVNode)(ItalicIcon, null, null),
@@ -750,14 +749,22 @@ var SingleExtention = (0, import_vue8.defineComponent)({
750
749
  variable: (0, import_vue7.createVNode)(VariableIcon, null, null),
751
750
  location: (0, import_vue7.createVNode)(LocationIcon, null, null)
752
751
  };
753
- return () => (0, import_vue7.withDirectives)((0, import_vue7.createVNode)("button", {
754
- "class": {
755
- "is-active": name && (editor == null ? void 0 : editor.isActive(name))
756
- },
757
- "onClick": onClick
758
- }, [name && iconMap[name]]), [[(0, import_vue7.resolveDirective)("tooltip"), {
759
- label: tooltipLabel
760
- }]]);
752
+ return () => {
753
+ var _a;
754
+ return (0, import_vue7.withDirectives)((0, import_vue7.createVNode)("button", {
755
+ "class": {
756
+ "is-active": props.name && ((_a = props.editor) == null ? void 0 : _a.isActive(props.name))
757
+ },
758
+ "style": props.isDisabled ? {
759
+ opacity: "0.4",
760
+ cursor: "not-allowed"
761
+ } : void 0,
762
+ "disabled": props.isDisabled,
763
+ "onClick": props.isDisabled ? void 0 : props.onClick
764
+ }, [props.name && iconMap[props.name]]), [[(0, import_vue7.resolveDirective)("tooltip"), {
765
+ label: props.tooltipLabel
766
+ }]]);
767
+ };
761
768
  }
762
769
  });
763
770
 
@@ -1395,77 +1402,102 @@ var EditorToolbar = (0, import_vue16.defineComponent)({
1395
1402
  type: Function
1396
1403
  }
1397
1404
  },
1398
- setup({
1399
- editor,
1400
- options,
1401
- validateLink,
1402
- transformLink
1403
- }, {
1405
+ setup(props, {
1404
1406
  emit
1405
1407
  }) {
1406
1408
  const items = ["heading", "bold", "italic", "underline", "strike", "blockquote", "bulletList", "orderedList", "textColor", "fillColor", "textLink", "align", "undo", "redo", "clear", "image", "file", "audio", "mention", "variable", "location"];
1407
- const itemOptions = {
1409
+ const getItemOptions = /* @__PURE__ */ __name(() => ({
1408
1410
  heading: {
1409
1411
  tooltipLabel: "Text style",
1410
- editor
1412
+ editor: props.editor
1411
1413
  },
1412
1414
  bold: {
1413
1415
  tooltipLabel: "Bold",
1414
- onClick: () => (editor == null ? void 0 : editor.chain()).focus().toggleBold().run()
1416
+ onClick: () => {
1417
+ var _a;
1418
+ return ((_a = props.editor) == null ? void 0 : _a.chain()).focus().toggleBold().run();
1419
+ }
1415
1420
  },
1416
1421
  italic: {
1417
1422
  tooltipLabel: "Italic",
1418
- onClick: () => (editor == null ? void 0 : editor.chain()).focus().toggleItalic().run()
1423
+ onClick: () => {
1424
+ var _a;
1425
+ return ((_a = props.editor) == null ? void 0 : _a.chain()).focus().toggleItalic().run();
1426
+ }
1419
1427
  },
1420
1428
  underline: {
1421
1429
  tooltipLabel: "Underline",
1422
- onClick: () => (editor == null ? void 0 : editor.chain()).focus().toggleUnderline().run()
1430
+ onClick: () => {
1431
+ var _a;
1432
+ return ((_a = props.editor) == null ? void 0 : _a.chain()).focus().toggleUnderline().run();
1433
+ }
1423
1434
  },
1424
1435
  strike: {
1425
1436
  tooltipLabel: "Strike",
1426
- onClick: () => (editor == null ? void 0 : editor.chain()).focus().toggleStrike().run()
1437
+ onClick: () => {
1438
+ var _a;
1439
+ return ((_a = props.editor) == null ? void 0 : _a.chain()).focus().toggleStrike().run();
1440
+ }
1427
1441
  },
1428
1442
  blockquote: {
1429
1443
  tooltipLabel: "Blockquote",
1430
- onClick: () => (editor == null ? void 0 : editor.chain()).focus().toggleBlockquote().run()
1444
+ onClick: () => {
1445
+ var _a;
1446
+ return ((_a = props.editor) == null ? void 0 : _a.chain()).focus().toggleBlockquote().run();
1447
+ }
1431
1448
  },
1432
1449
  bulletList: {
1433
1450
  tooltipLabel: "Bullet list",
1434
- onClick: () => (editor == null ? void 0 : editor.chain()).focus().toggleBulletList().run()
1451
+ onClick: () => {
1452
+ var _a;
1453
+ return ((_a = props.editor) == null ? void 0 : _a.chain()).focus().toggleBulletList().run();
1454
+ }
1435
1455
  },
1436
1456
  orderedList: {
1437
1457
  tooltipLabel: "Number list",
1438
- onClick: () => (editor == null ? void 0 : editor.chain()).focus().toggleOrderedList().run()
1458
+ onClick: () => {
1459
+ var _a;
1460
+ return ((_a = props.editor) == null ? void 0 : _a.chain()).focus().toggleOrderedList().run();
1461
+ }
1439
1462
  },
1440
1463
  textColor: {
1441
1464
  tooltipLabel: "Text color",
1442
- editor,
1465
+ editor: props.editor,
1443
1466
  type: "text"
1444
1467
  },
1445
1468
  fillColor: {
1446
1469
  tooltipLabel: "Fill color",
1447
- editor,
1470
+ editor: props.editor,
1448
1471
  type: "fill"
1449
1472
  },
1450
1473
  textLink: {
1451
1474
  tooltipLabel: "Insert link",
1452
- editor
1475
+ editor: props.editor
1453
1476
  },
1454
1477
  align: {
1455
1478
  tooltipLabel: "Text alignment",
1456
- editor
1479
+ editor: props.editor
1457
1480
  },
1458
1481
  undo: {
1459
1482
  tooltipLabel: "Undo",
1460
- onClick: () => (editor == null ? void 0 : editor.chain()).focus().undo().run()
1483
+ onClick: () => {
1484
+ var _a;
1485
+ return ((_a = props.editor) == null ? void 0 : _a.chain()).focus().undo().run();
1486
+ }
1461
1487
  },
1462
1488
  redo: {
1463
1489
  tooltipLabel: "Redo",
1464
- onClick: () => (editor == null ? void 0 : editor.chain()).focus().redo().run()
1490
+ onClick: () => {
1491
+ var _a;
1492
+ return ((_a = props.editor) == null ? void 0 : _a.chain()).focus().redo().run();
1493
+ }
1465
1494
  },
1466
1495
  clear: {
1467
1496
  tooltipLabel: "Reset format",
1468
- onClick: () => (editor == null ? void 0 : editor.chain()).focus().unsetAllMarks().run()
1497
+ onClick: () => {
1498
+ var _a;
1499
+ return ((_a = props.editor) == null ? void 0 : _a.chain()).focus().unsetAllMarks().run();
1500
+ }
1469
1501
  },
1470
1502
  image: {
1471
1503
  tooltipLabel: "Add image",
@@ -1481,19 +1513,21 @@ var EditorToolbar = (0, import_vue16.defineComponent)({
1481
1513
  },
1482
1514
  mention: {
1483
1515
  tooltipLabel: "Mention",
1484
- editor,
1516
+ editor: props.editor,
1485
1517
  onClick: () => {
1518
+ var _a;
1486
1519
  ;
1487
- (editor == null ? void 0 : editor.chain()).focus().insertContent("@").run();
1520
+ ((_a = props.editor) == null ? void 0 : _a.chain()).focus().insertContent("@").run();
1488
1521
  emit("clickMention");
1489
1522
  }
1490
1523
  },
1491
1524
  variable: {
1492
1525
  tooltipLabel: "Insert variable",
1493
- editor,
1526
+ editor: props.editor,
1494
1527
  onClick: () => {
1528
+ var _a;
1495
1529
  ;
1496
- (editor == null ? void 0 : editor.chain()).focus().insertContent("{").run();
1530
+ ((_a = props.editor) == null ? void 0 : _a.chain()).focus().insertContent("{").run();
1497
1531
  emit("clickVariable");
1498
1532
  }
1499
1533
  },
@@ -1501,7 +1535,7 @@ var EditorToolbar = (0, import_vue16.defineComponent)({
1501
1535
  tooltipLabel: "Add location",
1502
1536
  onClick: () => emit("clickLocation")
1503
1537
  }
1504
- };
1538
+ }), "getItemOptions");
1505
1539
  const getResolvedItem = /* @__PURE__ */ __name((option) => {
1506
1540
  if (typeof option === "string") {
1507
1541
  return {
@@ -1510,17 +1544,20 @@ var EditorToolbar = (0, import_vue16.defineComponent)({
1510
1544
  }
1511
1545
  return {
1512
1546
  item: option.value,
1513
- tooltip: option.tooltip
1547
+ tooltip: option.tooltip,
1548
+ disabled: option.disabled
1514
1549
  };
1515
1550
  }, "getResolvedItem");
1516
1551
  const renderExtension = /* @__PURE__ */ __name((option) => {
1517
1552
  const {
1518
1553
  item,
1519
- tooltip
1554
+ tooltip,
1555
+ disabled
1520
1556
  } = getResolvedItem(option);
1521
1557
  if (!items.includes(item))
1522
1558
  return null;
1523
1559
  const resolvedItem = item;
1560
+ const itemOptions = getItemOptions();
1524
1561
  const resolvedOptions = itemOptions[resolvedItem];
1525
1562
  if (!resolvedOptions)
1526
1563
  return null;
@@ -1529,33 +1566,34 @@ var EditorToolbar = (0, import_vue16.defineComponent)({
1529
1566
  case "heading":
1530
1567
  return (0, import_vue15.createVNode)(HeadingExtention, {
1531
1568
  "tooltipLabel": tooltipLabel,
1532
- "editor": editor
1569
+ "editor": props.editor
1533
1570
  }, null);
1534
1571
  case "align":
1535
1572
  return (0, import_vue15.createVNode)(AlignExtention, {
1536
1573
  "tooltipLabel": tooltipLabel,
1537
- "editor": editor
1574
+ "editor": props.editor
1538
1575
  }, null);
1539
1576
  case "textColor":
1540
1577
  case "fillColor":
1541
1578
  return (0, import_vue15.createVNode)(ColorExtension, {
1542
1579
  "tooltipLabel": tooltipLabel,
1543
- "editor": editor,
1580
+ "editor": props.editor,
1544
1581
  "type": resolvedOptions.type
1545
1582
  }, null);
1546
1583
  case "textLink":
1547
1584
  return (0, import_vue15.createVNode)(LinkExtension, {
1548
1585
  "tooltipLabel": tooltipLabel,
1549
- "editor": editor,
1550
- "validateLink": validateLink,
1551
- "transformLink": transformLink
1586
+ "editor": props.editor,
1587
+ "validateLink": props.validateLink,
1588
+ "transformLink": props.transformLink
1552
1589
  }, null);
1553
1590
  default:
1554
1591
  return (0, import_vue15.createVNode)(SingleExtention, {
1555
1592
  "name": resolvedItem,
1556
1593
  "tooltipLabel": tooltipLabel,
1557
1594
  "onClick": resolvedOptions.onClick,
1558
- "editor": editor
1595
+ "editor": props.editor,
1596
+ "isDisabled": disabled
1559
1597
  }, null);
1560
1598
  }
1561
1599
  }, "renderExtension");
@@ -1567,21 +1605,27 @@ var EditorToolbar = (0, import_vue16.defineComponent)({
1567
1605
  }
1568
1606
  }
1569
1607
  }, {
1570
- default: () => [(0, import_vue15.createVNode)("div", {
1571
- "class": (0, import_css6.css)({
1572
- display: "flex",
1573
- alignItems: "stretch",
1574
- gap: "1"
1575
- })
1576
- }, [options == null ? void 0 : options.map((option, index) => (0, import_vue15.createVNode)(import_vue15.Fragment, null, [option.map((item) => {
1577
- const resolvedItem = typeof item === "string" ? item : item.value;
1578
- if (items.includes(resolvedItem)) {
1579
- return renderExtension(item);
1580
- }
1581
- }), index !== (options == null ? void 0 : options.length) - 1 && (0, import_vue15.createVNode)(import_pixel3_divider.MpDivider, {
1582
- "id": "divider-toolbar",
1583
- "orientation": "vertical"
1584
- }, null)]))])]
1608
+ default: () => {
1609
+ var _a;
1610
+ return [(0, import_vue15.createVNode)("div", {
1611
+ "class": (0, import_css6.css)({
1612
+ display: "flex",
1613
+ alignItems: "stretch",
1614
+ gap: "1"
1615
+ })
1616
+ }, [(_a = props.options) == null ? void 0 : _a.map((option, index) => {
1617
+ var _a2, _b;
1618
+ return (0, import_vue15.createVNode)(import_vue15.Fragment, null, [option.map((item) => {
1619
+ const resolvedItem = typeof item === "string" ? item : item.value;
1620
+ if (items.includes(resolvedItem)) {
1621
+ return renderExtension(item);
1622
+ }
1623
+ }), index !== ((_b = (_a2 = props.options) == null ? void 0 : _a2.length) != null ? _b : 0) - 1 && (0, import_vue15.createVNode)(import_pixel3_divider.MpDivider, {
1624
+ "id": "divider-toolbar",
1625
+ "orientation": "vertical"
1626
+ }, null)]);
1627
+ })])];
1628
+ }
1585
1629
  });
1586
1630
  }
1587
1631
  });
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  EditorToolbar
3
- } from "./chunk-UD5PDCGC.mjs";
3
+ } from "./chunk-G4CGNV6P.mjs";
4
4
  import "./chunk-HIHIKPNN.mjs";
5
- import "./chunk-X2CB42A3.mjs";
6
- import "./chunk-COZ45QUD.mjs";
7
- import "./chunk-47IOAHWN.mjs";
5
+ import "./chunk-FCLBNBXD.mjs";
8
6
  import "./chunk-ENKUUZPM.mjs";
9
- import "./chunk-76GEEOAG.mjs";
10
7
  import "./chunk-YWVVMJGP.mjs";
11
8
  import "./chunk-Y6UPQ6EU.mjs";
9
+ import "./chunk-X2CB42A3.mjs";
10
+ import "./chunk-COZ45QUD.mjs";
12
11
  import "./chunk-IFRJVX2K.mjs";
12
+ import "./chunk-76GEEOAG.mjs";
13
13
  import "./chunk-QZ7VFGWC.mjs";
14
14
  export {
15
15
  EditorToolbar
@@ -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
 
@@ -1,26 +1,26 @@
1
1
  import "../chunk-HIHIKPNN.mjs";
2
- import {
3
- HeadingExtention
4
- } from "../chunk-X2CB42A3.mjs";
5
- import {
6
- LinkExtension
7
- } from "../chunk-COZ45QUD.mjs";
8
2
  import {
9
3
  SingleExtention
10
- } from "../chunk-47IOAHWN.mjs";
4
+ } from "../chunk-FCLBNBXD.mjs";
11
5
  import {
12
6
  Variable
13
7
  } from "../chunk-ENKUUZPM.mjs";
14
- import {
15
- VariableList
16
- } from "../chunk-76GEEOAG.mjs";
17
8
  import {
18
9
  AlignExtention
19
10
  } from "../chunk-YWVVMJGP.mjs";
20
11
  import {
21
12
  ColorExtension
22
13
  } from "../chunk-Y6UPQ6EU.mjs";
14
+ import {
15
+ HeadingExtention
16
+ } from "../chunk-X2CB42A3.mjs";
17
+ import {
18
+ LinkExtension
19
+ } from "../chunk-COZ45QUD.mjs";
23
20
  import "../chunk-IFRJVX2K.mjs";
21
+ import {
22
+ VariableList
23
+ } from "../chunk-76GEEOAG.mjs";
24
24
  import "../chunk-QZ7VFGWC.mjs";
25
25
  export {
26
26
  AlignExtention,
@@ -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 {