md-editor-v3 1.9.1 → 1.10.2

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.
@@ -22,6 +22,7 @@ var __publicField = (obj, key, value) => {
22
22
  return value;
23
23
  };
24
24
  import { onMounted, onBeforeUnmount, provide, computed, defineComponent, createVNode, reactive, ref, watch, cloneVNode, nextTick, inject, mergeProps, Fragment, Teleport } from "vue";
25
+ const prefix = "md";
25
26
  const iconfontUrl = "//at.alicdn.com/t/font_2605852_pqekijay2ij.js";
26
27
  const highlightUrl = {
27
28
  atom: "https://cdn.jsdelivr.net/npm/highlight.js@11.2.0/styles/atom-one-dark.css",
@@ -259,7 +260,7 @@ class Bus {
259
260
  try {
260
261
  item(...params);
261
262
  } catch (error) {
262
- console.error(`${name}\u76D1\u542C\u4E8B\u4EF6\u6267\u884C\u5F02\u5E38\uFF01`, error);
263
+ console.error(`${name} monitor event exception\uFF01`, error);
263
264
  }
264
265
  });
265
266
  }
@@ -471,19 +472,9 @@ const useKeyBoard = (props2, context) => {
471
472
  }
472
473
  }
473
474
  };
474
- const pasteHandler = (e) => {
475
- if (e.clipboardData && e.clipboardData.files.length > 0) {
476
- const file = e.clipboardData.files[0];
477
- if (/image\/.*/.test(file.type)) {
478
- bus.emit(editorId, "uploadImage", [file]);
479
- e.preventDefault();
480
- }
481
- }
482
- };
483
475
  onMounted(() => {
484
476
  if (!props2.previewOnly) {
485
477
  window.addEventListener("keydown", keyDownHandler);
486
- document.addEventListener("paste", pasteHandler);
487
478
  bus.on(editorId, {
488
479
  name: "onSave",
489
480
  callback() {
@@ -499,7 +490,6 @@ const useKeyBoard = (props2, context) => {
499
490
  onBeforeUnmount(() => {
500
491
  if (!props2.previewOnly) {
501
492
  window.removeEventListener("keydown", keyDownHandler);
502
- document.removeEventListener("paste", pasteHandler);
503
493
  }
504
494
  });
505
495
  };
@@ -719,7 +709,7 @@ const goto = (url, option = {
719
709
  nofollow: true
720
710
  }) => {
721
711
  if (!url) {
722
- console.warn("\u65E0\u6548\u7684\u94FE\u63A5\uFF01");
712
+ console.warn("error link!");
723
713
  }
724
714
  const aEle = document.createElement("a");
725
715
  aEle.href = url;
@@ -761,11 +751,13 @@ const scrollAuto = (pEle, cEle) => {
761
751
  addEvent();
762
752
  }
763
753
  };
764
- addEvent();
765
- return () => {
766
- pEle.removeEventListener("scroll", scrollHandler);
767
- cEle.removeEventListener("scroll", scrollHandler);
768
- };
754
+ return [
755
+ addEvent,
756
+ () => {
757
+ pEle.removeEventListener("scroll", scrollHandler);
758
+ cEle.removeEventListener("scroll", scrollHandler);
759
+ }
760
+ ];
769
761
  };
770
762
  const base642File = (base64, fileName = "image.png") => {
771
763
  const arr = base64.split(",");
@@ -1408,6 +1400,9 @@ var ToolBar = defineComponent({
1408
1400
  tableShape: {
1409
1401
  type: Array,
1410
1402
  default: () => [6, 4]
1403
+ },
1404
+ defToolbars: {
1405
+ type: Object
1411
1406
  }
1412
1407
  },
1413
1408
  setup(props2) {
@@ -1468,552 +1463,562 @@ var ToolBar = defineComponent({
1468
1463
  });
1469
1464
  const barRender = (barItem) => {
1470
1465
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O;
1471
- switch (barItem) {
1472
- case "-": {
1473
- return createVNode(Divider, null, null);
1474
- }
1475
- case "bold": {
1476
- return createVNode("div", {
1477
- "class": `${prefix}-toolbar-item`,
1478
- "title": (_a = ult.value.toolbarTips) == null ? void 0 : _a.bold,
1479
- "onClick": () => {
1480
- emitHandler("bold");
1481
- }
1482
- }, [createVNode("svg", {
1483
- "class": `${prefix}-icon`,
1484
- "aria-hidden": "true"
1485
- }, [createVNode("use", {
1486
- "xlink:href": "#icon-bold"
1487
- }, null)])]);
1488
- }
1489
- case "underline": {
1490
- return createVNode("div", {
1491
- "class": `${prefix}-toolbar-item`,
1492
- "title": (_b = ult.value.toolbarTips) == null ? void 0 : _b.underline,
1493
- "onClick": () => {
1494
- emitHandler("underline");
1495
- }
1496
- }, [createVNode("svg", {
1497
- "class": `${prefix}-icon`,
1498
- "aria-hidden": "true"
1499
- }, [createVNode("use", {
1500
- "xlink:href": "#icon-underline"
1501
- }, null)])]);
1502
- }
1503
- case "italic": {
1504
- return createVNode("div", {
1505
- "class": `${prefix}-toolbar-item`,
1506
- "title": (_c = ult.value.toolbarTips) == null ? void 0 : _c.italic,
1507
- "onClick": () => {
1508
- emitHandler("italic");
1509
- }
1510
- }, [createVNode("svg", {
1511
- "class": `${prefix}-icon`,
1512
- "aria-hidden": "true"
1513
- }, [createVNode("use", {
1514
- "xlink:href": "#icon-italic"
1515
- }, null)])]);
1516
- }
1517
- case "strikeThrough": {
1518
- return createVNode("div", {
1519
- "class": `${prefix}-toolbar-item`,
1520
- "title": (_d = ult.value.toolbarTips) == null ? void 0 : _d.strikeThrough,
1521
- "onClick": () => {
1522
- emitHandler("strikeThrough");
1523
- }
1524
- }, [createVNode("svg", {
1525
- "class": `${prefix}-icon`,
1526
- "aria-hidden": "true"
1527
- }, [createVNode("use", {
1528
- "xlink:href": "#icon-strike-through"
1529
- }, null)])]);
1530
- }
1531
- case "title": {
1532
- return createVNode(Dropdown, {
1533
- "visible": visible.title,
1534
- "onChange": (v) => {
1535
- visible.title = v;
1536
- },
1537
- "overlay": createVNode("ul", {
1538
- "class": `${prefix}-menu`,
1466
+ if (allToolbar.includes(barItem)) {
1467
+ switch (barItem) {
1468
+ case "-": {
1469
+ return createVNode(Divider, null, null);
1470
+ }
1471
+ case "bold": {
1472
+ return createVNode("div", {
1473
+ "class": `${prefix}-toolbar-item`,
1474
+ "title": (_a = ult.value.toolbarTips) == null ? void 0 : _a.bold,
1539
1475
  "onClick": () => {
1540
- visible.title = false;
1476
+ emitHandler("bold");
1541
1477
  }
1542
- }, [createVNode("li", {
1543
- "class": `${prefix}-menu-item`,
1478
+ }, [createVNode("svg", {
1479
+ "class": `${prefix}-icon`,
1480
+ "aria-hidden": "true"
1481
+ }, [createVNode("use", {
1482
+ "xlink:href": "#icon-bold"
1483
+ }, null)])]);
1484
+ }
1485
+ case "underline": {
1486
+ return createVNode("div", {
1487
+ "class": `${prefix}-toolbar-item`,
1488
+ "title": (_b = ult.value.toolbarTips) == null ? void 0 : _b.underline,
1544
1489
  "onClick": () => {
1545
- emitHandler("h1");
1490
+ emitHandler("underline");
1546
1491
  }
1547
- }, [(_e = ult.value.titleItem) == null ? void 0 : _e.h1]), createVNode("li", {
1548
- "class": `${prefix}-menu-item`,
1492
+ }, [createVNode("svg", {
1493
+ "class": `${prefix}-icon`,
1494
+ "aria-hidden": "true"
1495
+ }, [createVNode("use", {
1496
+ "xlink:href": "#icon-underline"
1497
+ }, null)])]);
1498
+ }
1499
+ case "italic": {
1500
+ return createVNode("div", {
1501
+ "class": `${prefix}-toolbar-item`,
1502
+ "title": (_c = ult.value.toolbarTips) == null ? void 0 : _c.italic,
1549
1503
  "onClick": () => {
1550
- emitHandler("h2");
1504
+ emitHandler("italic");
1551
1505
  }
1552
- }, [(_f = ult.value.titleItem) == null ? void 0 : _f.h2]), createVNode("li", {
1553
- "class": `${prefix}-menu-item`,
1506
+ }, [createVNode("svg", {
1507
+ "class": `${prefix}-icon`,
1508
+ "aria-hidden": "true"
1509
+ }, [createVNode("use", {
1510
+ "xlink:href": "#icon-italic"
1511
+ }, null)])]);
1512
+ }
1513
+ case "strikeThrough": {
1514
+ return createVNode("div", {
1515
+ "class": `${prefix}-toolbar-item`,
1516
+ "title": (_d = ult.value.toolbarTips) == null ? void 0 : _d.strikeThrough,
1554
1517
  "onClick": () => {
1555
- emitHandler("h3");
1518
+ emitHandler("strikeThrough");
1556
1519
  }
1557
- }, [(_g = ult.value.titleItem) == null ? void 0 : _g.h3]), createVNode("li", {
1558
- "class": `${prefix}-menu-item`,
1559
- "onClick": () => {
1560
- emitHandler("h4");
1520
+ }, [createVNode("svg", {
1521
+ "class": `${prefix}-icon`,
1522
+ "aria-hidden": "true"
1523
+ }, [createVNode("use", {
1524
+ "xlink:href": "#icon-strike-through"
1525
+ }, null)])]);
1526
+ }
1527
+ case "title": {
1528
+ return createVNode(Dropdown, {
1529
+ "visible": visible.title,
1530
+ "onChange": (v) => {
1531
+ visible.title = v;
1532
+ },
1533
+ "overlay": createVNode("ul", {
1534
+ "class": `${prefix}-menu`,
1535
+ "onClick": () => {
1536
+ visible.title = false;
1537
+ }
1538
+ }, [createVNode("li", {
1539
+ "class": `${prefix}-menu-item`,
1540
+ "onClick": () => {
1541
+ emitHandler("h1");
1542
+ }
1543
+ }, [(_e = ult.value.titleItem) == null ? void 0 : _e.h1]), createVNode("li", {
1544
+ "class": `${prefix}-menu-item`,
1545
+ "onClick": () => {
1546
+ emitHandler("h2");
1547
+ }
1548
+ }, [(_f = ult.value.titleItem) == null ? void 0 : _f.h2]), createVNode("li", {
1549
+ "class": `${prefix}-menu-item`,
1550
+ "onClick": () => {
1551
+ emitHandler("h3");
1552
+ }
1553
+ }, [(_g = ult.value.titleItem) == null ? void 0 : _g.h3]), createVNode("li", {
1554
+ "class": `${prefix}-menu-item`,
1555
+ "onClick": () => {
1556
+ emitHandler("h4");
1557
+ }
1558
+ }, [(_h = ult.value.titleItem) == null ? void 0 : _h.h4]), createVNode("li", {
1559
+ "class": `${prefix}-menu-item`,
1560
+ "onClick": () => {
1561
+ emitHandler("h5");
1562
+ }
1563
+ }, [(_i = ult.value.titleItem) == null ? void 0 : _i.h5]), createVNode("li", {
1564
+ "class": `${prefix}-menu-item`,
1565
+ "onClick": () => {
1566
+ emitHandler("h6");
1567
+ }
1568
+ }, [(_j = ult.value.titleItem) == null ? void 0 : _j.h6])])
1569
+ }, {
1570
+ default: () => {
1571
+ var _a2;
1572
+ return [createVNode("div", {
1573
+ "class": `${prefix}-toolbar-item`,
1574
+ "title": (_a2 = ult.value.toolbarTips) == null ? void 0 : _a2.title
1575
+ }, [createVNode("svg", {
1576
+ "class": `${prefix}-icon`,
1577
+ "aria-hidden": "true"
1578
+ }, [createVNode("use", {
1579
+ "xlink:href": "#icon-title"
1580
+ }, null)])])];
1561
1581
  }
1562
- }, [(_h = ult.value.titleItem) == null ? void 0 : _h.h4]), createVNode("li", {
1563
- "class": `${prefix}-menu-item`,
1582
+ });
1583
+ }
1584
+ case "sub": {
1585
+ return createVNode("div", {
1586
+ "class": `${prefix}-toolbar-item`,
1587
+ "title": (_k = ult.value.toolbarTips) == null ? void 0 : _k.sub,
1564
1588
  "onClick": () => {
1565
- emitHandler("h5");
1589
+ emitHandler("sub");
1566
1590
  }
1567
- }, [(_i = ult.value.titleItem) == null ? void 0 : _i.h5]), createVNode("li", {
1568
- "class": `${prefix}-menu-item`,
1591
+ }, [createVNode("svg", {
1592
+ "class": `${prefix}-icon`,
1593
+ "aria-hidden": "true"
1594
+ }, [createVNode("use", {
1595
+ "xlink:href": "#icon-sub"
1596
+ }, null)])]);
1597
+ }
1598
+ case "sup": {
1599
+ return createVNode("div", {
1600
+ "class": `${prefix}-toolbar-item`,
1601
+ "title": (_l = ult.value.toolbarTips) == null ? void 0 : _l.sup,
1569
1602
  "onClick": () => {
1570
- emitHandler("h6");
1603
+ emitHandler("sup");
1571
1604
  }
1572
- }, [(_j = ult.value.titleItem) == null ? void 0 : _j.h6])])
1573
- }, {
1574
- default: () => {
1575
- var _a2;
1576
- return [createVNode("div", {
1577
- "class": `${prefix}-toolbar-item`,
1578
- "title": (_a2 = ult.value.toolbarTips) == null ? void 0 : _a2.title
1579
- }, [createVNode("svg", {
1580
- "class": `${prefix}-icon`,
1581
- "aria-hidden": "true"
1582
- }, [createVNode("use", {
1583
- "xlink:href": "#icon-title"
1584
- }, null)])])];
1585
- }
1586
- });
1587
- }
1588
- case "sub": {
1589
- return createVNode("div", {
1590
- "class": `${prefix}-toolbar-item`,
1591
- "title": (_k = ult.value.toolbarTips) == null ? void 0 : _k.sub,
1592
- "onClick": () => {
1593
- emitHandler("sub");
1594
- }
1595
- }, [createVNode("svg", {
1596
- "class": `${prefix}-icon`,
1597
- "aria-hidden": "true"
1598
- }, [createVNode("use", {
1599
- "xlink:href": "#icon-sub"
1600
- }, null)])]);
1601
- }
1602
- case "sup": {
1603
- return createVNode("div", {
1604
- "class": `${prefix}-toolbar-item`,
1605
- "title": (_l = ult.value.toolbarTips) == null ? void 0 : _l.sup,
1606
- "onClick": () => {
1607
- emitHandler("sup");
1608
- }
1609
- }, [createVNode("svg", {
1610
- "class": `${prefix}-icon`,
1611
- "aria-hidden": "true"
1612
- }, [createVNode("use", {
1613
- "xlink:href": "#icon-sup"
1614
- }, null)])]);
1615
- }
1616
- case "quote": {
1617
- return createVNode("div", {
1618
- "class": `${prefix}-toolbar-item`,
1619
- "title": (_m = ult.value.toolbarTips) == null ? void 0 : _m.quote,
1620
- "onClick": () => {
1621
- emitHandler("quote");
1622
- }
1623
- }, [createVNode("svg", {
1624
- "class": `${prefix}-icon`,
1625
- "aria-hidden": "true"
1626
- }, [createVNode("use", {
1627
- "xlink:href": "#icon-quote"
1628
- }, null)])]);
1629
- }
1630
- case "unorderedList": {
1631
- return createVNode("div", {
1632
- "class": `${prefix}-toolbar-item`,
1633
- "title": (_n = ult.value.toolbarTips) == null ? void 0 : _n.unorderedList,
1634
- "onClick": () => {
1635
- emitHandler("unorderedList");
1636
- }
1637
- }, [createVNode("svg", {
1638
- "class": `${prefix}-icon`,
1639
- "aria-hidden": "true"
1640
- }, [createVNode("use", {
1641
- "xlink:href": "#icon-unordered-list"
1642
- }, null)])]);
1643
- }
1644
- case "orderedList": {
1645
- return createVNode("div", {
1646
- "class": `${prefix}-toolbar-item`,
1647
- "title": (_o = ult.value.toolbarTips) == null ? void 0 : _o.orderedList,
1648
- "onClick": () => {
1649
- emitHandler("orderedList");
1650
- }
1651
- }, [createVNode("svg", {
1652
- "class": `${prefix}-icon`,
1653
- "aria-hidden": "true"
1654
- }, [createVNode("use", {
1655
- "xlink:href": "#icon-ordered-list"
1656
- }, null)])]);
1657
- }
1658
- case "codeRow": {
1659
- return createVNode("div", {
1660
- "class": `${prefix}-toolbar-item`,
1661
- "title": (_p = ult.value.toolbarTips) == null ? void 0 : _p.codeRow,
1662
- "onClick": () => {
1663
- emitHandler("codeRow");
1664
- }
1665
- }, [createVNode("svg", {
1666
- "class": `${prefix}-icon`,
1667
- "aria-hidden": "true"
1668
- }, [createVNode("use", {
1669
- "xlink:href": "#icon-code-row"
1670
- }, null)])]);
1671
- }
1672
- case "code": {
1673
- return createVNode("div", {
1674
- "class": `${prefix}-toolbar-item`,
1675
- "title": (_q = ult.value.toolbarTips) == null ? void 0 : _q.code,
1676
- "onClick": () => {
1677
- emitHandler("code");
1678
- }
1679
- }, [createVNode("svg", {
1680
- "class": `${prefix}-icon`,
1681
- "aria-hidden": "true"
1682
- }, [createVNode("use", {
1683
- "xlink:href": "#icon-code"
1684
- }, null)])]);
1685
- }
1686
- case "link": {
1687
- return createVNode("div", {
1688
- "class": `${prefix}-toolbar-item`,
1689
- "title": (_r = ult.value.toolbarTips) == null ? void 0 : _r.link,
1690
- "onClick": () => {
1691
- modalData.type = "link";
1692
- modalData.linkVisible = true;
1693
- }
1694
- }, [createVNode("svg", {
1695
- "class": `${prefix}-icon`,
1696
- "aria-hidden": "true"
1697
- }, [createVNode("use", {
1698
- "xlink:href": "#icon-link"
1699
- }, null)])]);
1700
- }
1701
- case "image": {
1702
- return createVNode(Dropdown, {
1703
- "visible": visible.image,
1704
- "onChange": (v) => {
1705
- visible.image = v;
1706
- },
1707
- "overlay": createVNode("ul", {
1708
- "class": `${prefix}-menu`,
1605
+ }, [createVNode("svg", {
1606
+ "class": `${prefix}-icon`,
1607
+ "aria-hidden": "true"
1608
+ }, [createVNode("use", {
1609
+ "xlink:href": "#icon-sup"
1610
+ }, null)])]);
1611
+ }
1612
+ case "quote": {
1613
+ return createVNode("div", {
1614
+ "class": `${prefix}-toolbar-item`,
1615
+ "title": (_m = ult.value.toolbarTips) == null ? void 0 : _m.quote,
1709
1616
  "onClick": () => {
1710
- visible.title = false;
1617
+ emitHandler("quote");
1711
1618
  }
1712
- }, [createVNode("li", {
1713
- "class": `${prefix}-menu-item`,
1619
+ }, [createVNode("svg", {
1620
+ "class": `${prefix}-icon`,
1621
+ "aria-hidden": "true"
1622
+ }, [createVNode("use", {
1623
+ "xlink:href": "#icon-quote"
1624
+ }, null)])]);
1625
+ }
1626
+ case "unorderedList": {
1627
+ return createVNode("div", {
1628
+ "class": `${prefix}-toolbar-item`,
1629
+ "title": (_n = ult.value.toolbarTips) == null ? void 0 : _n.unorderedList,
1714
1630
  "onClick": () => {
1715
- modalData.type = "image";
1716
- modalData.linkVisible = true;
1631
+ emitHandler("unorderedList");
1717
1632
  }
1718
- }, [(_s = ult.value.imgTitleItem) == null ? void 0 : _s.link]), createVNode("li", {
1719
- "class": `${prefix}-menu-item`,
1633
+ }, [createVNode("svg", {
1634
+ "class": `${prefix}-icon`,
1635
+ "aria-hidden": "true"
1636
+ }, [createVNode("use", {
1637
+ "xlink:href": "#icon-unordered-list"
1638
+ }, null)])]);
1639
+ }
1640
+ case "orderedList": {
1641
+ return createVNode("div", {
1642
+ "class": `${prefix}-toolbar-item`,
1643
+ "title": (_o = ult.value.toolbarTips) == null ? void 0 : _o.orderedList,
1720
1644
  "onClick": () => {
1721
- uploadRef.value.click();
1645
+ emitHandler("orderedList");
1722
1646
  }
1723
- }, [(_t = ult.value.imgTitleItem) == null ? void 0 : _t.upload]), createVNode("li", {
1724
- "class": `${prefix}-menu-item`,
1647
+ }, [createVNode("svg", {
1648
+ "class": `${prefix}-icon`,
1649
+ "aria-hidden": "true"
1650
+ }, [createVNode("use", {
1651
+ "xlink:href": "#icon-ordered-list"
1652
+ }, null)])]);
1653
+ }
1654
+ case "codeRow": {
1655
+ return createVNode("div", {
1656
+ "class": `${prefix}-toolbar-item`,
1657
+ "title": (_p = ult.value.toolbarTips) == null ? void 0 : _p.codeRow,
1725
1658
  "onClick": () => {
1726
- modalData.clipVisible = true;
1659
+ emitHandler("codeRow");
1727
1660
  }
1728
- }, [(_u = ult.value.imgTitleItem) == null ? void 0 : _u.clip2upload])])
1729
- }, {
1730
- default: () => {
1731
- var _a2;
1732
- return [createVNode("div", {
1733
- "class": `${prefix}-toolbar-item`,
1734
- "title": (_a2 = ult.value.toolbarTips) == null ? void 0 : _a2.image
1735
- }, [createVNode("svg", {
1736
- "class": `${prefix}-icon`,
1737
- "aria-hidden": "true"
1738
- }, [createVNode("use", {
1739
- "xlink:href": "#icon-image"
1740
- }, null)])])];
1741
- }
1742
- });
1743
- }
1744
- case "table": {
1745
- return createVNode(Dropdown, {
1746
- "visible": visible.table,
1747
- "onChange": (v) => {
1748
- visible.table = v;
1749
- },
1750
- "key": "bar-table",
1751
- "overlay": createVNode(TableShape, {
1752
- "tableShape": props2.tableShape,
1753
- "onSelected": (selectedShape) => {
1754
- emitHandler("table", {
1755
- selectedShape
1756
- });
1757
- }
1758
- }, null)
1759
- }, {
1760
- default: () => {
1761
- var _a2;
1762
- return [createVNode("div", {
1763
- "class": `${prefix}-toolbar-item`,
1764
- "title": (_a2 = ult.value.toolbarTips) == null ? void 0 : _a2.table
1765
- }, [createVNode("svg", {
1766
- "class": `${prefix}-icon`,
1767
- "aria-hidden": "true"
1768
- }, [createVNode("use", {
1769
- "xlink:href": "#icon-table"
1770
- }, null)])])];
1771
- }
1772
- });
1773
- }
1774
- case "revoke": {
1775
- return createVNode("div", {
1776
- "class": `${prefix}-toolbar-item`,
1777
- "title": (_v = ult.value.toolbarTips) == null ? void 0 : _v.revoke,
1778
- "onClick": () => {
1779
- bus.emit(editorId, "ctrlZ");
1780
- }
1781
- }, [createVNode("svg", {
1782
- "class": `${prefix}-icon`,
1783
- "aria-hidden": "true"
1784
- }, [createVNode("use", {
1785
- "xlink:href": "#icon-revoke"
1786
- }, null)])]);
1787
- }
1788
- case "next": {
1789
- return createVNode("div", {
1790
- "class": `${prefix}-toolbar-item`,
1791
- "title": (_w = ult.value.toolbarTips) == null ? void 0 : _w.next,
1792
- "onClick": () => {
1793
- bus.emit(editorId, "ctrlShiftZ");
1794
- }
1795
- }, [createVNode("svg", {
1796
- "class": `${prefix}-icon`,
1797
- "aria-hidden": "true"
1798
- }, [createVNode("use", {
1799
- "xlink:href": "#icon-next"
1800
- }, null)])]);
1801
- }
1802
- case "save": {
1803
- return createVNode("div", {
1804
- "class": `${prefix}-toolbar-item`,
1805
- "title": (_x = ult.value.toolbarTips) == null ? void 0 : _x.save,
1806
- "onClick": () => {
1807
- bus.emit(editorId, "onSave");
1808
- }
1809
- }, [createVNode("svg", {
1810
- "class": `${prefix}-icon`,
1811
- "aria-hidden": "true"
1812
- }, [createVNode("use", {
1813
- "xlink:href": "#icon-baocun"
1814
- }, null)])]);
1815
- }
1816
- case "prettier": {
1817
- return props2.prettier ? createVNode("div", {
1818
- "class": `${prefix}-toolbar-item`,
1819
- "title": (_y = ult.value.toolbarTips) == null ? void 0 : _y.prettier,
1820
- "onClick": () => {
1821
- emitHandler("prettier");
1822
- }
1823
- }, [createVNode("svg", {
1824
- "class": `${prefix}-icon`,
1825
- "aria-hidden": "true"
1826
- }, [createVNode("use", {
1827
- "xlink:href": "#icon-prettier"
1828
- }, null)])]) : "";
1829
- }
1830
- case "pageFullscreen": {
1831
- return !props2.setting.fullscreen && createVNode("div", {
1832
- "class": `${prefix}-toolbar-item`,
1833
- "title": (_z = ult.value.toolbarTips) == null ? void 0 : _z.pageFullscreen,
1834
- "onClick": () => {
1835
- props2.updateSetting(!props2.setting.pageFullScreen, "pageFullScreen");
1836
- }
1837
- }, [createVNode("svg", {
1838
- "class": `${prefix}-icon`,
1839
- "aria-hidden": "true"
1840
- }, [createVNode("use", {
1841
- "xlink:href": `#icon-${props2.setting.pageFullScreen ? "suoxiao" : "fangda"}`
1842
- }, null)])]);
1843
- }
1844
- case "fullscreen": {
1845
- return createVNode("div", {
1846
- "class": `${prefix}-toolbar-item`,
1847
- "title": (_A = ult.value.toolbarTips) == null ? void 0 : _A.fullscreen,
1848
- "onClick": fullScreenHandler
1849
- }, [createVNode("svg", {
1850
- "class": `${prefix}-icon`,
1851
- "aria-hidden": "true"
1852
- }, [createVNode("use", {
1853
- "xlink:href": `#icon-${props2.setting.fullscreen ? "fullScreen-exit" : "fullScreen"}`
1854
- }, null)])]);
1855
- }
1856
- case "preview": {
1857
- return createVNode("div", {
1858
- "class": `${prefix}-toolbar-item`,
1859
- "title": (_B = ult.value.toolbarTips) == null ? void 0 : _B.preview,
1860
- "onClick": () => {
1861
- props2.updateSetting(!props2.setting.preview, "preview");
1862
- }
1863
- }, [createVNode("svg", {
1864
- "class": `${prefix}-icon`,
1865
- "aria-hidden": "true"
1866
- }, [createVNode("use", {
1867
- "xlink:href": "#icon-preview"
1868
- }, null)])]);
1869
- }
1870
- case "htmlPreview": {
1871
- return createVNode("div", {
1872
- "class": `${prefix}-toolbar-item`,
1873
- "title": (_C = ult.value.toolbarTips) == null ? void 0 : _C.htmlPreview,
1874
- "onClick": () => {
1875
- props2.updateSetting(!props2.setting.htmlPreview, "htmlPreview");
1876
- }
1877
- }, [createVNode("svg", {
1878
- "class": `${prefix}-icon`,
1879
- "aria-hidden": "true"
1880
- }, [createVNode("use", {
1881
- "xlink:href": "#icon-coding"
1882
- }, null)])]);
1883
- }
1884
- case "catalog": {
1885
- return createVNode("div", {
1886
- "class": `${prefix}-toolbar-item`,
1887
- "title": (_D = ult.value.toolbarTips) == null ? void 0 : _D.catalog,
1888
- "onClick": () => {
1889
- bus.emit(editorId, "catalogShow");
1890
- },
1891
- "key": "bar-catalog"
1892
- }, [createVNode("svg", {
1893
- "class": `${prefix}-icon`,
1894
- "aria-hidden": "true"
1895
- }, [createVNode("use", {
1896
- "xlink:href": "#icon-catalog"
1897
- }, null)])]);
1898
- }
1899
- case "github": {
1900
- return createVNode("div", {
1901
- "class": `${prefix}-toolbar-item`,
1902
- "title": (_E = ult.value.toolbarTips) == null ? void 0 : _E.github,
1903
- "onClick": () => goto("https://github.com/imzbf/md-editor-v3")
1904
- }, [createVNode("svg", {
1905
- "class": `${prefix}-icon`,
1906
- "aria-hidden": "true"
1907
- }, [createVNode("use", {
1908
- "xlink:href": "#icon-github"
1909
- }, null)])]);
1910
- }
1911
- case "mermaid": {
1912
- return createVNode(Dropdown, {
1913
- "visible": visible.mermaid,
1914
- "onChange": (v) => {
1915
- visible.mermaid = v;
1916
- },
1917
- "overlay": createVNode("ul", {
1918
- "class": `${prefix}-menu`,
1661
+ }, [createVNode("svg", {
1662
+ "class": `${prefix}-icon`,
1663
+ "aria-hidden": "true"
1664
+ }, [createVNode("use", {
1665
+ "xlink:href": "#icon-code-row"
1666
+ }, null)])]);
1667
+ }
1668
+ case "code": {
1669
+ return createVNode("div", {
1670
+ "class": `${prefix}-toolbar-item`,
1671
+ "title": (_q = ult.value.toolbarTips) == null ? void 0 : _q.code,
1919
1672
  "onClick": () => {
1920
- visible.mermaid = false;
1673
+ emitHandler("code");
1921
1674
  }
1922
- }, [createVNode("li", {
1923
- "class": `${prefix}-menu-item`,
1675
+ }, [createVNode("svg", {
1676
+ "class": `${prefix}-icon`,
1677
+ "aria-hidden": "true"
1678
+ }, [createVNode("use", {
1679
+ "xlink:href": "#icon-code"
1680
+ }, null)])]);
1681
+ }
1682
+ case "link": {
1683
+ return createVNode("div", {
1684
+ "class": `${prefix}-toolbar-item`,
1685
+ "title": (_r = ult.value.toolbarTips) == null ? void 0 : _r.link,
1924
1686
  "onClick": () => {
1925
- emitHandler("flow");
1687
+ modalData.type = "link";
1688
+ modalData.linkVisible = true;
1926
1689
  }
1927
- }, [(_F = ult.value.mermaid) == null ? void 0 : _F.flow]), createVNode("li", {
1928
- "class": `${prefix}-menu-item`,
1929
- "onClick": () => {
1930
- emitHandler("sequence");
1690
+ }, [createVNode("svg", {
1691
+ "class": `${prefix}-icon`,
1692
+ "aria-hidden": "true"
1693
+ }, [createVNode("use", {
1694
+ "xlink:href": "#icon-link"
1695
+ }, null)])]);
1696
+ }
1697
+ case "image": {
1698
+ return createVNode(Dropdown, {
1699
+ "visible": visible.image,
1700
+ "onChange": (v) => {
1701
+ visible.image = v;
1702
+ },
1703
+ "overlay": createVNode("ul", {
1704
+ "class": `${prefix}-menu`,
1705
+ "onClick": () => {
1706
+ visible.title = false;
1707
+ }
1708
+ }, [createVNode("li", {
1709
+ "class": `${prefix}-menu-item`,
1710
+ "onClick": () => {
1711
+ modalData.type = "image";
1712
+ modalData.linkVisible = true;
1713
+ }
1714
+ }, [(_s = ult.value.imgTitleItem) == null ? void 0 : _s.link]), createVNode("li", {
1715
+ "class": `${prefix}-menu-item`,
1716
+ "onClick": () => {
1717
+ uploadRef.value.click();
1718
+ }
1719
+ }, [(_t = ult.value.imgTitleItem) == null ? void 0 : _t.upload]), createVNode("li", {
1720
+ "class": `${prefix}-menu-item`,
1721
+ "onClick": () => {
1722
+ modalData.clipVisible = true;
1723
+ }
1724
+ }, [(_u = ult.value.imgTitleItem) == null ? void 0 : _u.clip2upload])])
1725
+ }, {
1726
+ default: () => {
1727
+ var _a2;
1728
+ return [createVNode("div", {
1729
+ "class": `${prefix}-toolbar-item`,
1730
+ "title": (_a2 = ult.value.toolbarTips) == null ? void 0 : _a2.image
1731
+ }, [createVNode("svg", {
1732
+ "class": `${prefix}-icon`,
1733
+ "aria-hidden": "true"
1734
+ }, [createVNode("use", {
1735
+ "xlink:href": "#icon-image"
1736
+ }, null)])])];
1931
1737
  }
1932
- }, [(_G = ult.value.mermaid) == null ? void 0 : _G.sequence]), createVNode("li", {
1933
- "class": `${prefix}-menu-item`,
1934
- "onClick": () => {
1935
- emitHandler("gantt");
1738
+ });
1739
+ }
1740
+ case "table": {
1741
+ return createVNode(Dropdown, {
1742
+ "visible": visible.table,
1743
+ "onChange": (v) => {
1744
+ visible.table = v;
1745
+ },
1746
+ "key": "bar-table",
1747
+ "overlay": createVNode(TableShape, {
1748
+ "tableShape": props2.tableShape,
1749
+ "onSelected": (selectedShape) => {
1750
+ emitHandler("table", {
1751
+ selectedShape
1752
+ });
1753
+ }
1754
+ }, null)
1755
+ }, {
1756
+ default: () => {
1757
+ var _a2;
1758
+ return [createVNode("div", {
1759
+ "class": `${prefix}-toolbar-item`,
1760
+ "title": (_a2 = ult.value.toolbarTips) == null ? void 0 : _a2.table
1761
+ }, [createVNode("svg", {
1762
+ "class": `${prefix}-icon`,
1763
+ "aria-hidden": "true"
1764
+ }, [createVNode("use", {
1765
+ "xlink:href": "#icon-table"
1766
+ }, null)])])];
1936
1767
  }
1937
- }, [(_H = ult.value.mermaid) == null ? void 0 : _H.gantt]), createVNode("li", {
1938
- "class": `${prefix}-menu-item`,
1768
+ });
1769
+ }
1770
+ case "revoke": {
1771
+ return createVNode("div", {
1772
+ "class": `${prefix}-toolbar-item`,
1773
+ "title": (_v = ult.value.toolbarTips) == null ? void 0 : _v.revoke,
1939
1774
  "onClick": () => {
1940
- emitHandler("class");
1775
+ bus.emit(editorId, "ctrlZ");
1941
1776
  }
1942
- }, [(_I = ult.value.mermaid) == null ? void 0 : _I.class]), createVNode("li", {
1943
- "class": `${prefix}-menu-item`,
1777
+ }, [createVNode("svg", {
1778
+ "class": `${prefix}-icon`,
1779
+ "aria-hidden": "true"
1780
+ }, [createVNode("use", {
1781
+ "xlink:href": "#icon-revoke"
1782
+ }, null)])]);
1783
+ }
1784
+ case "next": {
1785
+ return createVNode("div", {
1786
+ "class": `${prefix}-toolbar-item`,
1787
+ "title": (_w = ult.value.toolbarTips) == null ? void 0 : _w.next,
1944
1788
  "onClick": () => {
1945
- emitHandler("state");
1789
+ bus.emit(editorId, "ctrlShiftZ");
1946
1790
  }
1947
- }, [(_J = ult.value.mermaid) == null ? void 0 : _J.state]), createVNode("li", {
1948
- "class": `${prefix}-menu-item`,
1791
+ }, [createVNode("svg", {
1792
+ "class": `${prefix}-icon`,
1793
+ "aria-hidden": "true"
1794
+ }, [createVNode("use", {
1795
+ "xlink:href": "#icon-next"
1796
+ }, null)])]);
1797
+ }
1798
+ case "save": {
1799
+ return createVNode("div", {
1800
+ "class": `${prefix}-toolbar-item`,
1801
+ "title": (_x = ult.value.toolbarTips) == null ? void 0 : _x.save,
1949
1802
  "onClick": () => {
1950
- emitHandler("pie");
1803
+ bus.emit(editorId, "onSave");
1951
1804
  }
1952
- }, [(_K = ult.value.mermaid) == null ? void 0 : _K.pie]), createVNode("li", {
1953
- "class": `${prefix}-menu-item`,
1805
+ }, [createVNode("svg", {
1806
+ "class": `${prefix}-icon`,
1807
+ "aria-hidden": "true"
1808
+ }, [createVNode("use", {
1809
+ "xlink:href": "#icon-baocun"
1810
+ }, null)])]);
1811
+ }
1812
+ case "prettier": {
1813
+ return props2.prettier ? createVNode("div", {
1814
+ "class": `${prefix}-toolbar-item`,
1815
+ "title": (_y = ult.value.toolbarTips) == null ? void 0 : _y.prettier,
1954
1816
  "onClick": () => {
1955
- emitHandler("relationship");
1817
+ emitHandler("prettier");
1956
1818
  }
1957
- }, [(_L = ult.value.mermaid) == null ? void 0 : _L.relationship]), createVNode("li", {
1958
- "class": `${prefix}-menu-item`,
1819
+ }, [createVNode("svg", {
1820
+ "class": `${prefix}-icon`,
1821
+ "aria-hidden": "true"
1822
+ }, [createVNode("use", {
1823
+ "xlink:href": "#icon-prettier"
1824
+ }, null)])]) : "";
1825
+ }
1826
+ case "pageFullscreen": {
1827
+ return !props2.setting.fullscreen && createVNode("div", {
1828
+ "class": `${prefix}-toolbar-item`,
1829
+ "title": (_z = ult.value.toolbarTips) == null ? void 0 : _z.pageFullscreen,
1959
1830
  "onClick": () => {
1960
- emitHandler("journey");
1831
+ props2.updateSetting(!props2.setting.pageFullScreen, "pageFullScreen");
1961
1832
  }
1962
- }, [(_M = ult.value.mermaid) == null ? void 0 : _M.journey])]),
1963
- "key": "bar-mermaid"
1964
- }, {
1965
- default: () => {
1966
- var _a2;
1967
- return [createVNode("div", {
1968
- "class": `${prefix}-toolbar-item`,
1969
- "title": (_a2 = ult.value.toolbarTips) == null ? void 0 : _a2.mermaid
1970
- }, [createVNode("svg", {
1971
- "class": `${prefix}-icon`,
1972
- "aria-hidden": "true"
1973
- }, [createVNode("use", {
1974
- "xlink:href": "#icon-mermaid"
1975
- }, null)])])];
1976
- }
1977
- });
1978
- }
1979
- case "katex": {
1980
- return createVNode(Dropdown, {
1981
- "visible": visible.katex,
1982
- "onChange": (v) => {
1983
- visible.katex = v;
1984
- },
1985
- "overlay": createVNode("ul", {
1986
- "class": `${prefix}-menu`,
1833
+ }, [createVNode("svg", {
1834
+ "class": `${prefix}-icon`,
1835
+ "aria-hidden": "true"
1836
+ }, [createVNode("use", {
1837
+ "xlink:href": `#icon-${props2.setting.pageFullScreen ? "suoxiao" : "fangda"}`
1838
+ }, null)])]);
1839
+ }
1840
+ case "fullscreen": {
1841
+ return createVNode("div", {
1842
+ "class": `${prefix}-toolbar-item`,
1843
+ "title": (_A = ult.value.toolbarTips) == null ? void 0 : _A.fullscreen,
1844
+ "onClick": fullScreenHandler
1845
+ }, [createVNode("svg", {
1846
+ "class": `${prefix}-icon`,
1847
+ "aria-hidden": "true"
1848
+ }, [createVNode("use", {
1849
+ "xlink:href": `#icon-${props2.setting.fullscreen ? "fullScreen-exit" : "fullScreen"}`
1850
+ }, null)])]);
1851
+ }
1852
+ case "preview": {
1853
+ return createVNode("div", {
1854
+ "class": `${prefix}-toolbar-item`,
1855
+ "title": (_B = ult.value.toolbarTips) == null ? void 0 : _B.preview,
1987
1856
  "onClick": () => {
1988
- visible.katex = false;
1857
+ props2.updateSetting(!props2.setting.preview, "preview");
1989
1858
  }
1990
- }, [createVNode("li", {
1991
- "class": `${prefix}-menu-item`,
1859
+ }, [createVNode("svg", {
1860
+ "class": `${prefix}-icon`,
1861
+ "aria-hidden": "true"
1862
+ }, [createVNode("use", {
1863
+ "xlink:href": "#icon-preview"
1864
+ }, null)])]);
1865
+ }
1866
+ case "htmlPreview": {
1867
+ return createVNode("div", {
1868
+ "class": `${prefix}-toolbar-item`,
1869
+ "title": (_C = ult.value.toolbarTips) == null ? void 0 : _C.htmlPreview,
1992
1870
  "onClick": () => {
1993
- emitHandler("katexInline");
1871
+ props2.updateSetting(!props2.setting.htmlPreview, "htmlPreview");
1994
1872
  }
1995
- }, [(_N = ult.value.katex) == null ? void 0 : _N.inline]), createVNode("li", {
1996
- "class": `${prefix}-menu-item`,
1873
+ }, [createVNode("svg", {
1874
+ "class": `${prefix}-icon`,
1875
+ "aria-hidden": "true"
1876
+ }, [createVNode("use", {
1877
+ "xlink:href": "#icon-coding"
1878
+ }, null)])]);
1879
+ }
1880
+ case "catalog": {
1881
+ return createVNode("div", {
1882
+ "class": `${prefix}-toolbar-item`,
1883
+ "title": (_D = ult.value.toolbarTips) == null ? void 0 : _D.catalog,
1997
1884
  "onClick": () => {
1998
- emitHandler("katexBlock");
1885
+ bus.emit(editorId, "catalogShow");
1886
+ },
1887
+ "key": "bar-catalog"
1888
+ }, [createVNode("svg", {
1889
+ "class": `${prefix}-icon`,
1890
+ "aria-hidden": "true"
1891
+ }, [createVNode("use", {
1892
+ "xlink:href": "#icon-catalog"
1893
+ }, null)])]);
1894
+ }
1895
+ case "github": {
1896
+ return createVNode("div", {
1897
+ "class": `${prefix}-toolbar-item`,
1898
+ "title": (_E = ult.value.toolbarTips) == null ? void 0 : _E.github,
1899
+ "onClick": () => goto("https://github.com/imzbf/md-editor-v3")
1900
+ }, [createVNode("svg", {
1901
+ "class": `${prefix}-icon`,
1902
+ "aria-hidden": "true"
1903
+ }, [createVNode("use", {
1904
+ "xlink:href": "#icon-github"
1905
+ }, null)])]);
1906
+ }
1907
+ case "mermaid": {
1908
+ return createVNode(Dropdown, {
1909
+ "visible": visible.mermaid,
1910
+ "onChange": (v) => {
1911
+ visible.mermaid = v;
1912
+ },
1913
+ "overlay": createVNode("ul", {
1914
+ "class": `${prefix}-menu`,
1915
+ "onClick": () => {
1916
+ visible.mermaid = false;
1917
+ }
1918
+ }, [createVNode("li", {
1919
+ "class": `${prefix}-menu-item`,
1920
+ "onClick": () => {
1921
+ emitHandler("flow");
1922
+ }
1923
+ }, [(_F = ult.value.mermaid) == null ? void 0 : _F.flow]), createVNode("li", {
1924
+ "class": `${prefix}-menu-item`,
1925
+ "onClick": () => {
1926
+ emitHandler("sequence");
1927
+ }
1928
+ }, [(_G = ult.value.mermaid) == null ? void 0 : _G.sequence]), createVNode("li", {
1929
+ "class": `${prefix}-menu-item`,
1930
+ "onClick": () => {
1931
+ emitHandler("gantt");
1932
+ }
1933
+ }, [(_H = ult.value.mermaid) == null ? void 0 : _H.gantt]), createVNode("li", {
1934
+ "class": `${prefix}-menu-item`,
1935
+ "onClick": () => {
1936
+ emitHandler("class");
1937
+ }
1938
+ }, [(_I = ult.value.mermaid) == null ? void 0 : _I.class]), createVNode("li", {
1939
+ "class": `${prefix}-menu-item`,
1940
+ "onClick": () => {
1941
+ emitHandler("state");
1942
+ }
1943
+ }, [(_J = ult.value.mermaid) == null ? void 0 : _J.state]), createVNode("li", {
1944
+ "class": `${prefix}-menu-item`,
1945
+ "onClick": () => {
1946
+ emitHandler("pie");
1947
+ }
1948
+ }, [(_K = ult.value.mermaid) == null ? void 0 : _K.pie]), createVNode("li", {
1949
+ "class": `${prefix}-menu-item`,
1950
+ "onClick": () => {
1951
+ emitHandler("relationship");
1952
+ }
1953
+ }, [(_L = ult.value.mermaid) == null ? void 0 : _L.relationship]), createVNode("li", {
1954
+ "class": `${prefix}-menu-item`,
1955
+ "onClick": () => {
1956
+ emitHandler("journey");
1957
+ }
1958
+ }, [(_M = ult.value.mermaid) == null ? void 0 : _M.journey])]),
1959
+ "key": "bar-mermaid"
1960
+ }, {
1961
+ default: () => {
1962
+ var _a2;
1963
+ return [createVNode("div", {
1964
+ "class": `${prefix}-toolbar-item`,
1965
+ "title": (_a2 = ult.value.toolbarTips) == null ? void 0 : _a2.mermaid
1966
+ }, [createVNode("svg", {
1967
+ "class": `${prefix}-icon`,
1968
+ "aria-hidden": "true"
1969
+ }, [createVNode("use", {
1970
+ "xlink:href": "#icon-mermaid"
1971
+ }, null)])])];
1999
1972
  }
2000
- }, [(_O = ult.value.katex) == null ? void 0 : _O.block])]),
2001
- "key": "bar-katex"
2002
- }, {
2003
- default: () => {
2004
- var _a2;
2005
- return [createVNode("div", {
2006
- "class": `${prefix}-toolbar-item`,
2007
- "title": (_a2 = ult.value.toolbarTips) == null ? void 0 : _a2.mermaid
2008
- }, [createVNode("svg", {
2009
- "class": `${prefix}-icon`,
2010
- "aria-hidden": "true"
2011
- }, [createVNode("use", {
2012
- "xlink:href": "#icon-formula"
2013
- }, null)])])];
2014
- }
2015
- });
1973
+ });
1974
+ }
1975
+ case "katex": {
1976
+ return createVNode(Dropdown, {
1977
+ "visible": visible.katex,
1978
+ "onChange": (v) => {
1979
+ visible.katex = v;
1980
+ },
1981
+ "overlay": createVNode("ul", {
1982
+ "class": `${prefix}-menu`,
1983
+ "onClick": () => {
1984
+ visible.katex = false;
1985
+ }
1986
+ }, [createVNode("li", {
1987
+ "class": `${prefix}-menu-item`,
1988
+ "onClick": () => {
1989
+ emitHandler("katexInline");
1990
+ }
1991
+ }, [(_N = ult.value.katex) == null ? void 0 : _N.inline]), createVNode("li", {
1992
+ "class": `${prefix}-menu-item`,
1993
+ "onClick": () => {
1994
+ emitHandler("katexBlock");
1995
+ }
1996
+ }, [(_O = ult.value.katex) == null ? void 0 : _O.block])]),
1997
+ "key": "bar-katex"
1998
+ }, {
1999
+ default: () => {
2000
+ var _a2;
2001
+ return [createVNode("div", {
2002
+ "class": `${prefix}-toolbar-item`,
2003
+ "title": (_a2 = ult.value.toolbarTips) == null ? void 0 : _a2.mermaid
2004
+ }, [createVNode("svg", {
2005
+ "class": `${prefix}-icon`,
2006
+ "aria-hidden": "true"
2007
+ }, [createVNode("use", {
2008
+ "xlink:href": "#icon-formula"
2009
+ }, null)])])];
2010
+ }
2011
+ });
2012
+ }
2016
2013
  }
2014
+ } else if (props2.defToolbars instanceof Array) {
2015
+ const defItem = props2.defToolbars[barItem];
2016
+ return defItem || "";
2017
+ } else if (props2.defToolbars && props2.defToolbars.children instanceof Array) {
2018
+ const defItem = props2.defToolbars.children[barItem];
2019
+ return defItem || "";
2020
+ } else {
2021
+ return "";
2017
2022
  }
2018
2023
  };
2019
2024
  return () => {
@@ -2226,7 +2231,7 @@ function splitCells(tableRow, count) {
2226
2231
  if (!cells[0].trim()) {
2227
2232
  cells.shift();
2228
2233
  }
2229
- if (!cells[cells.length - 1].trim()) {
2234
+ if (cells.length > 0 && !cells[cells.length - 1].trim()) {
2230
2235
  cells.pop();
2231
2236
  }
2232
2237
  if (cells.length > count) {
@@ -2347,14 +2352,11 @@ class Tokenizer {
2347
2352
  }
2348
2353
  space(src) {
2349
2354
  const cap = this.rules.block.newline.exec(src);
2350
- if (cap) {
2351
- if (cap[0].length > 1) {
2352
- return {
2353
- type: "space",
2354
- raw: cap[0]
2355
- };
2356
- }
2357
- return { raw: "\n" };
2355
+ if (cap && cap[0].length > 0) {
2356
+ return {
2357
+ type: "space",
2358
+ raw: cap[0]
2359
+ };
2358
2360
  }
2359
2361
  }
2360
2362
  code(src) {
@@ -2528,7 +2530,21 @@ class Tokenizer {
2528
2530
  for (i = 0; i < l; i++) {
2529
2531
  this.lexer.state.top = false;
2530
2532
  list.items[i].tokens = this.lexer.blockTokens(list.items[i].text, []);
2531
- if (!list.loose && list.items[i].tokens.some((t) => t.type === "space")) {
2533
+ const spacers = list.items[i].tokens.filter((t) => t.type === "space");
2534
+ const hasMultipleLineBreaks = spacers.every((t) => {
2535
+ const chars = t.raw.split("");
2536
+ let lineBreaks = 0;
2537
+ for (const char of chars) {
2538
+ if (char === "\n") {
2539
+ lineBreaks += 1;
2540
+ }
2541
+ if (lineBreaks > 1) {
2542
+ return true;
2543
+ }
2544
+ }
2545
+ return false;
2546
+ });
2547
+ if (!list.loose && spacers.length && hasMultipleLineBreaks) {
2532
2548
  list.loose = true;
2533
2549
  list.items[i].loose = true;
2534
2550
  }
@@ -2578,7 +2594,7 @@ class Tokenizer {
2578
2594
  return { text: c };
2579
2595
  }),
2580
2596
  align: cap[2].replace(/^ *|\| *$/g, "").split(/ *\| */),
2581
- rows: cap[3] ? cap[3].replace(/\n[ \t]*$/, "").split("\n") : []
2597
+ rows: cap[3] && cap[3].trim() ? cap[3].replace(/\n[ \t]*$/, "").split("\n") : []
2582
2598
  };
2583
2599
  if (item.header.length === item.align.length) {
2584
2600
  item.raw = cap[0];
@@ -2927,13 +2943,13 @@ const block = {
2927
2943
  blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
2928
2944
  list: /^( {0,3}bull)( [^\n]+?)?(?:\n|$)/,
2929
2945
  html: "^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",
2930
- def: /^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,
2946
+ def: /^ {0,3}\[(label)\]: *(?:\n *)?<?([^\s>]+)>?(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,
2931
2947
  table: noopTest,
2932
2948
  lheading: /^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,
2933
2949
  _paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,
2934
2950
  text: /^[^\n]+/
2935
2951
  };
2936
- block._label = /(?!\s*\])(?:\\[\[\]]|[^\[\]])+/;
2952
+ block._label = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
2937
2953
  block._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
2938
2954
  block.def = edit(block.def).replace("label", block._label).replace("title", block._title).getRegex();
2939
2955
  block.bullet = /(?:[*+-]|\d{1,9}[.)])/;
@@ -2963,8 +2979,8 @@ const inline = {
2963
2979
  url: noopTest,
2964
2980
  tag: "^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",
2965
2981
  link: /^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,
2966
- reflink: /^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,
2967
- nolink: /^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,
2982
+ reflink: /^!?\[(label)\]\[(ref)\]/,
2983
+ nolink: /^!?\[(ref)\](?:\[\])?/,
2968
2984
  reflinkSearch: "reflink|nolink(?!\\()",
2969
2985
  emStrong: {
2970
2986
  lDelim: /^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,
@@ -2995,7 +3011,8 @@ inline._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
2995
3011
  inline._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;
2996
3012
  inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
2997
3013
  inline.link = edit(inline.link).replace("label", inline._label).replace("href", inline._href).replace("title", inline._title).getRegex();
2998
- inline.reflink = edit(inline.reflink).replace("label", inline._label).getRegex();
3014
+ inline.reflink = edit(inline.reflink).replace("label", inline._label).replace("ref", block._label).getRegex();
3015
+ inline.nolink = edit(inline.nolink).replace("ref", block._label).getRegex();
2999
3016
  inline.reflinkSearch = edit(inline.reflinkSearch, "g").replace("reflink", inline.reflink).replace("nolink", inline.nolink).getRegex();
3000
3017
  inline.normal = merge({}, inline);
3001
3018
  inline.pedantic = merge({}, inline.normal, {
@@ -3045,7 +3062,7 @@ function mangle(text) {
3045
3062
  class Lexer {
3046
3063
  constructor(options) {
3047
3064
  this.tokens = [];
3048
- this.tokens.links = Object.create(null);
3065
+ this.tokens.links = /* @__PURE__ */ Object.create(null);
3049
3066
  this.options = options || defaults;
3050
3067
  this.options.tokenizer = this.options.tokenizer || new Tokenizer();
3051
3068
  this.tokenizer = this.options.tokenizer;
@@ -3115,7 +3132,9 @@ class Lexer {
3115
3132
  }
3116
3133
  if (token = this.tokenizer.space(src)) {
3117
3134
  src = src.substring(token.raw.length);
3118
- if (token.type) {
3135
+ if (token.raw.length === 1 && tokens.length > 0) {
3136
+ tokens[tokens.length - 1].raw += "\n";
3137
+ } else {
3119
3138
  tokens.push(token);
3120
3139
  }
3121
3140
  continue;
@@ -4255,9 +4274,16 @@ const directive2flag = (direct, selectedText = "", inputArea, params) => {
4255
4274
  break;
4256
4275
  }
4257
4276
  case "image": {
4258
- const { desc, url } = params;
4259
- targetValue = `![${desc}](${url})
4277
+ const { desc, url, urls } = params;
4278
+ if (urls instanceof Array) {
4279
+ targetValue = urls.reduce((pVal, url2) => {
4280
+ return pVal + `![${desc}](${url2})
4260
4281
  `;
4282
+ }, "");
4283
+ } else {
4284
+ targetValue = `![${desc}](${url})
4285
+ `;
4286
+ }
4261
4287
  break;
4262
4288
  }
4263
4289
  case "tab": {
@@ -4657,8 +4683,7 @@ const useMarked = (props2, mermaidData) => {
4657
4683
  let svgCode = "";
4658
4684
  if (props2.mermaid) {
4659
4685
  svgCode = props2.mermaid.mermaidAPI.render(idRand, code);
4660
- }
4661
- if (typeof window !== "undefined" && window.mermaid) {
4686
+ } else if (typeof window !== "undefined" && window.mermaid) {
4662
4687
  svgCode = window.mermaid.mermaidAPI.render(idRand, code);
4663
4688
  } else {
4664
4689
  svgCode = `<div class="mermaid">${code}</div>`;
@@ -4701,6 +4726,11 @@ const useMarked = (props2, mermaidData) => {
4701
4726
  }
4702
4727
  });
4703
4728
  }
4729
+ if (props2.extensions instanceof Array && props2.extensions.length > 0) {
4730
+ marked.use({
4731
+ extensions: props2.extensions
4732
+ });
4733
+ }
4704
4734
  const html = computed(() => {
4705
4735
  heads = [];
4706
4736
  const _html = marked(props2.value);
@@ -4757,6 +4787,8 @@ const useAutoScroll = (props2, html, textAreaRef, previewRef, htmlRef) => {
4757
4787
  const editorId = inject("editorId");
4758
4788
  let clearScrollAuto = () => {
4759
4789
  };
4790
+ let initScrollAuto = () => {
4791
+ };
4760
4792
  const initCopyEntry = () => {
4761
4793
  document.querySelectorAll(`#${editorId} .${prefix}-preview pre`).forEach((pre) => {
4762
4794
  var _a;
@@ -4775,26 +4807,30 @@ const useAutoScroll = (props2, html, textAreaRef, previewRef, htmlRef) => {
4775
4807
  pre.appendChild(copyButton);
4776
4808
  });
4777
4809
  };
4810
+ onMounted(() => {
4811
+ [initScrollAuto, clearScrollAuto] = scrollAuto(textAreaRef.value, previewRef.value || htmlRef.value);
4812
+ });
4778
4813
  const htmlChanged = () => {
4779
4814
  nextTick(() => {
4780
4815
  if (props2.setting.preview && !previewOnly) {
4781
- setTimeout(() => {
4782
- clearScrollAuto = scrollAuto(textAreaRef.value, previewRef.value || htmlRef.value);
4783
- }, 0);
4816
+ clearScrollAuto();
4817
+ initScrollAuto();
4784
4818
  }
4785
4819
  initCopyEntry();
4786
4820
  });
4787
4821
  };
4788
- watch(() => html.value, htmlChanged);
4789
- watch(() => props2.setting.preview, (nVal) => {
4822
+ const settingPreviewChanged = (nVal) => {
4790
4823
  if (nVal && !previewOnly) {
4791
4824
  nextTick(() => {
4792
- clearScrollAuto = scrollAuto(textAreaRef.value, previewRef.value || htmlRef.value);
4825
+ clearScrollAuto();
4826
+ [initScrollAuto, clearScrollAuto] = scrollAuto(textAreaRef.value, previewRef.value || htmlRef.value);
4827
+ initScrollAuto();
4793
4828
  });
4794
- } else {
4795
- clearScrollAuto();
4796
4829
  }
4797
- });
4830
+ };
4831
+ watch(() => html.value, htmlChanged);
4832
+ watch(() => props2.setting.preview, settingPreviewChanged);
4833
+ watch(() => props2.setting.htmlPreview, settingPreviewChanged);
4798
4834
  onMounted(htmlChanged);
4799
4835
  };
4800
4836
  const useAutoGenrator = (props2, textAreaRef) => {
@@ -4862,29 +4898,37 @@ const useMermaid = (props2) => {
4862
4898
  reRender: false,
4863
4899
  mermaidInited: !!props2.mermaid
4864
4900
  });
4865
- watch(() => theme.value, () => {
4866
- if (!props2.noMermaid && window.mermaid) {
4867
- window.mermaid.initialize({
4868
- theme: theme.value === "dark" ? "dark" : "default"
4869
- });
4901
+ const reSetMermaidTheme = () => {
4902
+ if (!props2.noMermaid) {
4903
+ if (props2.mermaid) {
4904
+ props2.mermaid.initialize({
4905
+ theme: theme.value === "dark" ? "dark" : "default"
4906
+ });
4907
+ } else if (window.mermaid) {
4908
+ window.mermaid.initialize({
4909
+ theme: theme.value === "dark" ? "dark" : "default"
4910
+ });
4911
+ }
4870
4912
  mermaidData.reRender = !mermaidData.reRender;
4871
4913
  }
4872
- });
4914
+ };
4915
+ watch(() => theme.value, reSetMermaidTheme);
4873
4916
  let mermaidScript;
4874
4917
  onMounted(() => {
4875
- if (!props2.noMermaid && props2.mermaid) {
4876
- window.mermaid = props2.mermaid;
4877
- } else if (!props2.noMermaid && !props2.mermaid) {
4918
+ if (!props2.noMermaid && !props2.mermaid) {
4878
4919
  mermaidScript = document.createElement("script");
4879
4920
  mermaidScript.src = props2.mermaidJs;
4880
4921
  mermaidScript.onload = () => {
4881
- mermaidData.mermaidInited = true;
4882
4922
  window.mermaid.initialize({
4923
+ theme: theme.value === "dark" ? "dark" : "default",
4883
4924
  logLevel: "Fatal"
4884
4925
  });
4926
+ mermaidData.mermaidInited = true;
4885
4927
  };
4886
4928
  mermaidScript.id = `${prefix}-mermaid`;
4887
4929
  appendHandler(mermaidScript);
4930
+ } else if (!props2.noMermaid) {
4931
+ reSetMermaidTheme();
4888
4932
  }
4889
4933
  });
4890
4934
  onBeforeUnmount(() => {
@@ -4894,6 +4938,29 @@ const useMermaid = (props2) => {
4894
4938
  });
4895
4939
  return mermaidData;
4896
4940
  };
4941
+ const usePasteUpload = (textAreaRef) => {
4942
+ const editorId = inject("editorId");
4943
+ const previewOnly = inject("previewOnly");
4944
+ const pasteHandler = (e) => {
4945
+ if (e.clipboardData && e.clipboardData.files.length > 0) {
4946
+ const { files } = e.clipboardData;
4947
+ bus.emit(editorId, "uploadImage", Array.from(files).filter((file) => {
4948
+ return /image\/.*/.test(file.type);
4949
+ }));
4950
+ e.preventDefault();
4951
+ }
4952
+ };
4953
+ onMounted(() => {
4954
+ if (!previewOnly) {
4955
+ textAreaRef.value.addEventListener("paste", pasteHandler);
4956
+ }
4957
+ });
4958
+ onBeforeUnmount(() => {
4959
+ if (!previewOnly) {
4960
+ textAreaRef.value.removeEventListener("paste", pasteHandler);
4961
+ }
4962
+ });
4963
+ };
4897
4964
  var Content = defineComponent({
4898
4965
  name: "MDEditorContent",
4899
4966
  props: {
@@ -4961,6 +5028,9 @@ var Content = defineComponent({
4961
5028
  noKatex: {
4962
5029
  type: Boolean,
4963
5030
  default: false
5031
+ },
5032
+ extensions: {
5033
+ type: Array
4964
5034
  }
4965
5035
  },
4966
5036
  setup(props2) {
@@ -4982,11 +5052,12 @@ var Content = defineComponent({
4982
5052
  selectedText
4983
5053
  } = useAutoGenrator(props2, textAreaRef);
4984
5054
  useHistory(props2, textAreaRef);
5055
+ usePasteUpload(textAreaRef);
4985
5056
  return () => {
4986
5057
  return createVNode(Fragment, null, [createVNode("div", {
4987
5058
  "class": [`${prefix}-content`]
4988
5059
  }, [!previewOnly && createVNode("div", {
4989
- "class": [`${prefix}-input-wrapper`]
5060
+ "class": `${prefix}-input-wrapper`
4990
5061
  }, [createVNode("textarea", {
4991
5062
  "id": `${editorId}-textarea`,
4992
5063
  "ref": textAreaRef,
@@ -4998,12 +5069,18 @@ var Content = defineComponent({
4998
5069
  "class": [props2.setting.preview || props2.setting.htmlPreview ? "" : "textarea-only"],
4999
5070
  "placeholder": props2.placeholder
5000
5071
  }, null)]), props2.setting.preview && createVNode("div", {
5072
+ "class": `${prefix}-preview-wrapper`,
5001
5073
  "ref": previewRef,
5074
+ "key": "content-preview-wrapper"
5075
+ }, [createVNode("div", {
5002
5076
  "id": `${prefix}-preview`,
5003
5077
  "class": [`${prefix}-preview`, `${previewTheme == null ? void 0 : previewTheme.value}-theme`, showCodeRowNumber && `${prefix}-scrn`],
5004
5078
  "innerHTML": html.value
5005
- }, null), props2.setting.htmlPreview && createVNode(Fragment, null, [createVNode("div", {
5079
+ }, null)]), props2.setting.htmlPreview && createVNode("div", {
5080
+ "class": `${prefix}-preview-wrapper`,
5006
5081
  "ref": htmlRef,
5082
+ "key": "html-preview-wrapper"
5083
+ }, [createVNode("div", {
5007
5084
  "class": `${prefix}-html`
5008
5085
  }, [html.value])])]), props2.hljs === null && createVNode(Teleport, {
5009
5086
  "to": "head"
@@ -5035,13 +5112,14 @@ const CatalogLink = defineComponent({
5035
5112
  return () => createVNode("div", {
5036
5113
  "class": `${prefix}-catalog-link`,
5037
5114
  "onClick": (e) => {
5115
+ var _a;
5038
5116
  e.stopPropagation();
5039
5117
  const id = props2.markedHeadingId(props2.tocItem.text, props2.tocItem.level);
5040
5118
  const targetHeadEle = document.getElementById(id);
5041
5119
  const previewEle = document.getElementById(`${prefix}-preview`);
5042
5120
  if (targetHeadEle) {
5043
5121
  const scrollLength = targetHeadEle.offsetTop;
5044
- previewEle == null ? void 0 : previewEle.scrollTo({
5122
+ (_a = previewEle == null ? void 0 : previewEle.parentElement) == null ? void 0 : _a.scrollTo({
5045
5123
  top: scrollLength,
5046
5124
  behavior: "smooth"
5047
5125
  });
@@ -5132,7 +5210,6 @@ const Catalog = defineComponent({
5132
5210
  });
5133
5211
  var index = "";
5134
5212
  var all = "";
5135
- const prefix = "md";
5136
5213
  const markedHeadingId = (text) => text;
5137
5214
  const props = {
5138
5215
  modelValue: {
@@ -5318,6 +5395,12 @@ const props = {
5318
5395
  noKatex: {
5319
5396
  type: Boolean,
5320
5397
  default: false
5398
+ },
5399
+ defToolbars: {
5400
+ type: [String, Object]
5401
+ },
5402
+ extensions: {
5403
+ type: Array
5321
5404
  }
5322
5405
  };
5323
5406
  var Editor = defineComponent({
@@ -5369,13 +5452,9 @@ var Editor = defineComponent({
5369
5452
  name: "uploadImage",
5370
5453
  callback(files, cb) {
5371
5454
  const insertHanlder = (urls) => {
5372
- urls.forEach((url) => {
5373
- setTimeout(() => {
5374
- bus.emit(editorId, "replace", "image", {
5375
- desc: "",
5376
- url
5377
- });
5378
- }, 0);
5455
+ bus.emit(editorId, "replace", "image", {
5456
+ desc: "",
5457
+ urls
5379
5458
  });
5380
5459
  cb && cb();
5381
5460
  };
@@ -5396,84 +5475,170 @@ var Editor = defineComponent({
5396
5475
  const catalogShow = computed(() => {
5397
5476
  return !props2.toolbarsExclude.includes("catalog") && props2.toolbars.includes("catalog");
5398
5477
  });
5399
- return () => createVNode("div", {
5400
- "id": editorId,
5401
- "class": [prefix, props2.editorClass, props2.theme === "dark" && `${prefix}-dark`, setting.fullscreen || setting.pageFullScreen ? `${prefix}-fullscreen` : "", previewOnly && `${prefix}-previewOnly`],
5402
- "style": props2.style
5403
- }, [!previewOnly && createVNode(ToolBar, {
5404
- "prettier": prettier,
5405
- "screenfull": screenfull,
5406
- "screenfullJs": screenfullJs,
5407
- "toolbars": props2.toolbars,
5408
- "toolbarsExclude": props2.toolbarsExclude,
5409
- "setting": setting,
5410
- "updateSetting": updateSetting,
5411
- "tableShape": props2.tableShape
5412
- }, null), createVNode(Content, {
5413
- "hljs": hljs,
5414
- "value": props2.modelValue,
5415
- "onChange": (value) => {
5416
- if (props2.onChange) {
5417
- props2.onChange(value);
5418
- } else {
5419
- context.emit("update:modelValue", value);
5420
- }
5421
- },
5422
- "setting": setting,
5423
- "onHtmlChanged": (html) => {
5424
- if (props2.onHtmlChanged) {
5425
- props2.onHtmlChanged(html);
5426
- } else {
5427
- context.emit("onHtmlChanged", html);
5428
- }
5429
- },
5430
- "onGetCatalog": (list) => {
5431
- if (props2.onGetCatalog) {
5432
- props2.onGetCatalog(list);
5433
- } else {
5434
- context.emit("onGetCatalog", list);
5435
- }
5436
- },
5437
- "markedHeading": props2.markedHeading,
5438
- "mermaid": props2.mermaid,
5439
- "mermaidJs": props2.mermaidJs,
5440
- "noMermaid": props2.noMermaid,
5441
- "sanitize": props2.sanitize,
5442
- "placeholder": props2.placeholder,
5443
- "katex": props2.katex,
5444
- "katexJs": props2.katexJs,
5445
- "katexCss": props2.katexCss,
5446
- "noKatex": props2.noKatex
5447
- }, null), catalogShow.value && createVNode(Catalog, {
5448
- "markedHeadingId": props2.markedHeadingId
5449
- }, null), !previewOnly && createVNode(Teleport, {
5450
- "to": "head"
5451
- }, {
5452
- default: () => [createVNode("script", {
5453
- "src": iconfontJs
5454
- }, null)]
5455
- }), prettier && !previewOnly && createVNode(Teleport, {
5456
- "to": "head"
5457
- }, {
5458
- default: () => [createVNode("script", {
5459
- "src": prettierCDN
5460
- }, null), createVNode("script", {
5461
- "src": prettierMDCDN
5462
- }, null)]
5463
- }), !previewOnly && Cropper === null && createVNode(Teleport, {
5464
- "to": "head"
5465
- }, {
5466
- default: () => [createVNode("link", {
5467
- "href": cropperCss,
5468
- "rel": "stylesheet"
5469
- }, null), createVNode("script", {
5470
- "src": cropperJs
5471
- }, null)]
5472
- })]);
5478
+ return () => {
5479
+ const defToolbars = getSlot({
5480
+ props: props2,
5481
+ ctx: context
5482
+ }, "defToolbars");
5483
+ return createVNode("div", {
5484
+ "id": editorId,
5485
+ "class": [prefix, props2.editorClass, props2.theme === "dark" && `${prefix}-dark`, setting.fullscreen || setting.pageFullScreen ? `${prefix}-fullscreen` : "", previewOnly && `${prefix}-previewOnly`],
5486
+ "style": props2.style
5487
+ }, [!previewOnly && createVNode(ToolBar, {
5488
+ "prettier": prettier,
5489
+ "screenfull": screenfull,
5490
+ "screenfullJs": screenfullJs,
5491
+ "toolbars": props2.toolbars,
5492
+ "toolbarsExclude": props2.toolbarsExclude,
5493
+ "setting": setting,
5494
+ "updateSetting": updateSetting,
5495
+ "tableShape": props2.tableShape,
5496
+ "defToolbars": defToolbars
5497
+ }, null), createVNode(Content, {
5498
+ "hljs": hljs,
5499
+ "value": props2.modelValue,
5500
+ "onChange": (value) => {
5501
+ if (props2.onChange) {
5502
+ props2.onChange(value);
5503
+ } else {
5504
+ context.emit("update:modelValue", value);
5505
+ }
5506
+ },
5507
+ "setting": setting,
5508
+ "onHtmlChanged": (html) => {
5509
+ if (props2.onHtmlChanged) {
5510
+ props2.onHtmlChanged(html);
5511
+ } else {
5512
+ context.emit("onHtmlChanged", html);
5513
+ }
5514
+ },
5515
+ "onGetCatalog": (list) => {
5516
+ if (props2.onGetCatalog) {
5517
+ props2.onGetCatalog(list);
5518
+ } else {
5519
+ context.emit("onGetCatalog", list);
5520
+ }
5521
+ },
5522
+ "markedHeading": props2.markedHeading,
5523
+ "mermaid": props2.mermaid,
5524
+ "mermaidJs": props2.mermaidJs,
5525
+ "noMermaid": props2.noMermaid,
5526
+ "sanitize": props2.sanitize,
5527
+ "placeholder": props2.placeholder,
5528
+ "katex": props2.katex,
5529
+ "katexJs": props2.katexJs,
5530
+ "katexCss": props2.katexCss,
5531
+ "noKatex": props2.noKatex,
5532
+ "extensions": props2.extensions
5533
+ }, null), catalogShow.value && createVNode(Catalog, {
5534
+ "markedHeadingId": props2.markedHeadingId
5535
+ }, null), !previewOnly && createVNode(Teleport, {
5536
+ "to": "head"
5537
+ }, {
5538
+ default: () => [createVNode("script", {
5539
+ "src": iconfontJs
5540
+ }, null)]
5541
+ }), prettier && !previewOnly && createVNode(Teleport, {
5542
+ "to": "head"
5543
+ }, {
5544
+ default: () => [createVNode("script", {
5545
+ "src": prettierCDN
5546
+ }, null), createVNode("script", {
5547
+ "src": prettierMDCDN
5548
+ }, null)]
5549
+ }), !previewOnly && Cropper === null && createVNode(Teleport, {
5550
+ "to": "head"
5551
+ }, {
5552
+ default: () => [createVNode("link", {
5553
+ "href": cropperCss,
5554
+ "rel": "stylesheet"
5555
+ }, null), createVNode("script", {
5556
+ "src": cropperJs
5557
+ }, null)]
5558
+ })]);
5559
+ };
5560
+ }
5561
+ });
5562
+ var NormalToolbar = defineComponent({
5563
+ name: "NormalToolbar",
5564
+ props: {
5565
+ title: {
5566
+ type: String,
5567
+ default: ""
5568
+ },
5569
+ trigger: {
5570
+ type: [String, Object]
5571
+ },
5572
+ onClick: {
5573
+ type: Function,
5574
+ default: () => () => {
5575
+ }
5576
+ }
5577
+ },
5578
+ setup(props2, ctx) {
5579
+ return () => {
5580
+ const Trigger = getSlot({
5581
+ props: props2,
5582
+ ctx
5583
+ }, "trigger");
5584
+ return createVNode("div", {
5585
+ "class": `${prefix}-toolbar-item`,
5586
+ "title": props2.title,
5587
+ "onClick": props2.onClick
5588
+ }, [Trigger]);
5589
+ };
5590
+ }
5591
+ });
5592
+ var DropdownToolbar = defineComponent({
5593
+ name: "DropdownToolbar",
5594
+ props: {
5595
+ title: {
5596
+ type: String,
5597
+ default: ""
5598
+ },
5599
+ visible: {
5600
+ type: Boolean
5601
+ },
5602
+ trigger: {
5603
+ type: [String, Object]
5604
+ },
5605
+ onChange: {
5606
+ type: Function,
5607
+ default: () => () => {
5608
+ }
5609
+ },
5610
+ overlay: {
5611
+ type: [String, Object]
5612
+ }
5613
+ },
5614
+ setup(props2, ctx) {
5615
+ return () => {
5616
+ const Trigger = getSlot({
5617
+ props: props2,
5618
+ ctx
5619
+ }, "trigger");
5620
+ const Overlay = getSlot({
5621
+ props: props2,
5622
+ ctx
5623
+ }, "overlay");
5624
+ return createVNode(Dropdown, {
5625
+ "visible": props2.visible,
5626
+ "onChange": props2.onChange,
5627
+ "overlay": Overlay
5628
+ }, {
5629
+ default: () => [createVNode("div", {
5630
+ "class": `${prefix}-toolbar-item`,
5631
+ "title": props2.title || ""
5632
+ }, [Trigger])]
5633
+ });
5634
+ };
5473
5635
  }
5474
5636
  });
5475
5637
  Editor.install = (app) => {
5476
5638
  app.component(Editor.name, Editor);
5639
+ app.component(NormalToolbar.name, NormalToolbar);
5477
5640
  return app;
5478
5641
  };
5642
+ Editor.NormalToolbar = NormalToolbar;
5643
+ Editor.DropdownToolbar = DropdownToolbar;
5479
5644
  export { Editor as default };