@harbour-enterprises/superdoc 0.11.32 → 0.11.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{eventemitter3-CRfwKE7Z.es.js → eventemitter3-C9iBZY5R.es.js} +1 -1
- package/dist/chunks/{eventemitter3-D38HWRLP.cjs → eventemitter3-Cj9ZwxFw.cjs} +1 -1
- package/dist/chunks/{index-CPZ-IxHT.es.js → index-BTkgQgI7.es.js} +2 -2
- package/dist/chunks/{index-BXKGjuVW.cjs → index-C6SLw2ph.cjs} +1 -1
- package/dist/chunks/{index-CqRwYOdx.cjs → index-CbUTRvRk.cjs} +1 -1
- package/dist/chunks/{index-Y7BlAr93.es.js → index-kWwSELc2.es.js} +4 -4
- package/dist/chunks/{jszip-ChlzEvf9.cjs → jszip-D9YbjC4E.cjs} +1 -1
- package/dist/chunks/{jszip-DO3il9iI.es.js → jszip-OpmRHhd4.es.js} +1 -1
- package/dist/chunks/{super-editor.es-ZJ0ylc_0.cjs → super-editor.es-CYMQ40x9.cjs} +65 -65
- package/dist/chunks/{super-editor.es-Bs9UaxnP.es.js → super-editor.es-SDc8qWY8.es.js} +11447 -11035
- package/dist/chunks/{url-t15h9onH.es.js → url-C29KYeaj.es.js} +2 -2
- package/dist/chunks/{url-6Xu7gR4T.cjs → url-DRGmEUtI.cjs} +1 -1
- package/dist/chunks/vue-BQCc2YbW.cjs +13 -0
- package/dist/chunks/{vue-DXpzqXur.es.js → vue-DKS68Dra.es.js} +1159 -1140
- package/dist/chunks/{xml-js-zhwNEV5e.cjs → xml-js-CMQ3QRee.cjs} +1 -1
- package/dist/chunks/{xml-js-kwrvzyhm.es.js → xml-js-CgHhGhcJ.es.js} +2 -2
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-ajcAkpke.js → converter-DnveZphs.js} +681 -651
- package/dist/super-editor/chunks/{docx-zipper-BQ70zniM.js → docx-zipper-B-azX40c.js} +1 -1
- package/dist/super-editor/chunks/{editor-CI9Y8Eul.js → editor-XSjyC_V1.js} +10613 -10390
- package/dist/super-editor/chunks/{toolbar-DhThnUPN.js → toolbar-DhWBLihJ.js} +2 -2
- package/dist/super-editor/components/toolbar/super-toolbar.d.ts +454 -83
- package/dist/super-editor/components/toolbar/super-toolbar.d.ts.map +1 -1
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/core/Attribute.d.ts +2 -2
- package/dist/super-editor/core/Editor.d.ts +470 -45
- package/dist/super-editor/core/Editor.d.ts.map +1 -1
- package/dist/super-editor/core/Schema.d.ts +2 -2
- package/dist/super-editor/core/index.d.ts +3 -3
- package/dist/super-editor/core/super-converter/exporter.d.ts.map +1 -1
- package/dist/super-editor/docx-zipper.es.js +2 -2
- package/dist/super-editor/editor.es.js +3 -3
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/super-editor.es.js +225 -27
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +1 -1
- package/dist/super-editor.es.js +2 -2
- package/dist/superdoc.cjs +5 -5
- package/dist/superdoc.es.js +9 -9
- package/dist/superdoc.umd.js +11412 -10964
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/vue-Ckf0DkDN.cjs +0 -13
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { E as m } from "./chunks/editor-
|
|
2
|
-
import "./chunks/converter-
|
|
3
|
-
import "./chunks/docx-zipper-
|
|
1
|
+
import { E as m } from "./chunks/editor-XSjyC_V1.js";
|
|
2
|
+
import "./chunks/converter-DnveZphs.js";
|
|
3
|
+
import "./chunks/docx-zipper-B-azX40c.js";
|
|
4
4
|
export {
|
|
5
5
|
m as Editor
|
|
6
6
|
};
|
|
@@ -6,14 +6,14 @@ var bt = (t, a, o) => a in t ? yt(t, a, { enumerable: !0, configurable: !0, writ
|
|
|
6
6
|
var Re = (t, a, o) => bt(t, typeof a != "symbol" ? a + "" : a, o), qe = (t, a, o) => a.has(t) || Ue("Cannot " + o);
|
|
7
7
|
var Ae = (t, a, o) => (qe(t, a, "read from private field"), o ? o.call(t) : a.get(t)), Oe = (t, a, o) => a.has(t) ? Ue("Cannot add the same private member more than once") : a instanceof WeakSet ? a.add(t) : a.set(t, o);
|
|
8
8
|
var z = (t, a, o) => (qe(t, a, "access private method"), o);
|
|
9
|
-
import { _ as q, a as Ze, b as wt, I as Ne, f as Ct, c as Ge, d as kt, i as _t, u as xt, r as Et, E as ze, e as St, P as At, h as Tt, M as Ft, j as It, A as Lt, N as Mt } from "./chunks/editor-
|
|
10
|
-
import { C as No, T as zo, l as Vo, n as Wo, k as Po, m as jo } from "./chunks/editor-
|
|
11
|
-
import { a1 as Dt,
|
|
12
|
-
import { O as qo } from "./chunks/converter-
|
|
9
|
+
import { _ as q, a as Ze, b as wt, I as Ne, f as Ct, c as Ge, d as kt, i as _t, u as xt, r as Et, E as ze, e as St, P as At, h as Tt, M as Ft, j as It, A as Lt, N as Mt } from "./chunks/editor-XSjyC_V1.js";
|
|
10
|
+
import { C as No, T as zo, l as Vo, n as Wo, k as Po, m as jo } from "./chunks/editor-XSjyC_V1.js";
|
|
11
|
+
import { a1 as Dt, E as $t, a3 as Ht, T as Ye, a as Bt } from "./chunks/converter-DnveZphs.js";
|
|
12
|
+
import { O as qo } from "./chunks/converter-DnveZphs.js";
|
|
13
13
|
import { ref as f, createElementBlock as C, openBlock as w, createElementVNode as k, unref as D, getCurrentInstance as Rt, computed as j, watch as Ot, onMounted as ke, createCommentVNode as Q, withDirectives as Je, withKeys as Qe, normalizeClass as oe, withModifiers as ge, vModelText as et, createTextVNode as tt, toDisplayString as ie, Fragment as U, renderList as ee, normalizeStyle as J, createVNode as P, h as B, createApp as Nt, reactive as Ke, onUnmounted as zt, shallowRef as nt, onBeforeUnmount as ot, createBlock as Vt } from "vue";
|
|
14
|
-
import { t as X, s as Wt, T as Pt, N as Y } from "./chunks/toolbar-
|
|
14
|
+
import { t as X, s as Wt, T as Pt, N as Y } from "./chunks/toolbar-DhWBLihJ.js";
|
|
15
15
|
import jt from "./ai-writer.es.js";
|
|
16
|
-
import { D as Ko } from "./chunks/docx-zipper-
|
|
16
|
+
import { D as Ko } from "./chunks/docx-zipper-B-azX40c.js";
|
|
17
17
|
import { createZip as Zo } from "./file-zipper.es.js";
|
|
18
18
|
var it = { exports: {} };
|
|
19
19
|
(function(t) {
|
|
@@ -603,7 +603,7 @@ const x = (t) => {
|
|
|
603
603
|
h("#6CA0DC"),
|
|
604
604
|
h("#9DBFE8"),
|
|
605
605
|
h("#CEDFF3"),
|
|
606
|
-
h("#
|
|
606
|
+
h("#21c8ce")
|
|
607
607
|
],
|
|
608
608
|
[
|
|
609
609
|
h("#3E027A"),
|
|
@@ -1573,9 +1573,18 @@ const x = (t) => {
|
|
|
1573
1573
|
};
|
|
1574
1574
|
var L, lt, ve, We, at, rt, Pe, ct, fe;
|
|
1575
1575
|
class Mo extends qt {
|
|
1576
|
+
/**
|
|
1577
|
+
* Creates a new SuperToolbar instance
|
|
1578
|
+
* @param {ToolbarConfig} config - The configuration for the toolbar
|
|
1579
|
+
* @returns {void}
|
|
1580
|
+
*/
|
|
1576
1581
|
constructor(o) {
|
|
1577
1582
|
super();
|
|
1578
1583
|
Oe(this, L);
|
|
1584
|
+
/**
|
|
1585
|
+
* Default configuration for the toolbar
|
|
1586
|
+
* @type {ToolbarConfig}
|
|
1587
|
+
*/
|
|
1579
1588
|
Re(this, "config", {
|
|
1580
1589
|
selector: null,
|
|
1581
1590
|
toolbarGroups: ["left", "center", "right"],
|
|
@@ -1589,7 +1598,19 @@ class Mo extends qt {
|
|
|
1589
1598
|
aiApiKey: null,
|
|
1590
1599
|
aiEndpoint: null
|
|
1591
1600
|
});
|
|
1601
|
+
/**
|
|
1602
|
+
* Custom commands that override default behavior
|
|
1603
|
+
* @private
|
|
1604
|
+
* @type {Object.<string, function(CommandItem): void>}
|
|
1605
|
+
*/
|
|
1592
1606
|
Oe(this, ve, {
|
|
1607
|
+
/**
|
|
1608
|
+
* Handles zoom level changes
|
|
1609
|
+
* @param {Object} params - Command parameters
|
|
1610
|
+
* @param {CommandItem} params.item - The command item
|
|
1611
|
+
* @param {string|number} params.argument - The zoom level (percentage)
|
|
1612
|
+
* @returns {void}
|
|
1613
|
+
*/
|
|
1593
1614
|
setZoom: ({ item: o, argument: n }) => {
|
|
1594
1615
|
if (!n) return;
|
|
1595
1616
|
o.onActivate({ zoom: n }), this.emit("superdoc-command", { item: o, argument: n });
|
|
@@ -1598,65 +1619,153 @@ class Mo extends qt {
|
|
|
1598
1619
|
const i = typeof screen.orientation < "u", r = window.matchMedia("(max-width: 834px)").matches;
|
|
1599
1620
|
i && r ? (e.style.transformOrigin = "0 0", e.style.transform = `scale(${parseInt(n) / 100})`) : e.style.zoom = parseInt(n) / 100, this.superdoc.superdocStore.activeZoom = parseInt(n);
|
|
1600
1621
|
},
|
|
1622
|
+
/**
|
|
1623
|
+
* Sets the document mode
|
|
1624
|
+
* @param {Object} params - Command parameters
|
|
1625
|
+
* @param {CommandItem} params.item - The command item
|
|
1626
|
+
* @param {string} params.argument - The document mode to set
|
|
1627
|
+
* @returns {void}
|
|
1628
|
+
*/
|
|
1601
1629
|
setDocumentMode: ({ item: o, argument: n }) => {
|
|
1602
1630
|
n && this.emit("superdoc-command", { item: o, argument: n });
|
|
1603
1631
|
},
|
|
1632
|
+
/**
|
|
1633
|
+
* Sets the font size for text
|
|
1634
|
+
* @param {Object} params - Command parameters
|
|
1635
|
+
* @param {CommandItem} params.item - The command item
|
|
1636
|
+
* @param {string|number} params.argument - The font size to set
|
|
1637
|
+
* @returns {void}
|
|
1638
|
+
*/
|
|
1604
1639
|
setFontSize: ({ item: o, argument: n }) => {
|
|
1605
1640
|
z(this, L, fe).call(this, { item: o, argument: n }, () => {
|
|
1606
1641
|
this.activeEditor?.commands.setFieldAnnotationsFontSize(n, !0);
|
|
1607
1642
|
});
|
|
1608
1643
|
},
|
|
1644
|
+
/**
|
|
1645
|
+
* Sets the font family for text
|
|
1646
|
+
* @param {Object} params - Command parameters
|
|
1647
|
+
* @param {CommandItem} params.item - The command item
|
|
1648
|
+
* @param {string} params.argument - The font family to set
|
|
1649
|
+
* @returns {void}
|
|
1650
|
+
*/
|
|
1609
1651
|
setFontFamily: ({ item: o, argument: n }) => {
|
|
1610
1652
|
z(this, L, fe).call(this, { item: o, argument: n }, () => {
|
|
1611
1653
|
this.activeEditor?.commands.setFieldAnnotationsFontFamily(n, !0);
|
|
1612
1654
|
});
|
|
1613
1655
|
},
|
|
1656
|
+
/**
|
|
1657
|
+
* Sets the text color
|
|
1658
|
+
* @param {Object} params - Command parameters
|
|
1659
|
+
* @param {CommandItem} params.item - The command item
|
|
1660
|
+
* @param {string} params.argument - The color to set
|
|
1661
|
+
* @returns {void}
|
|
1662
|
+
*/
|
|
1614
1663
|
setColor: ({ item: o, argument: n }) => {
|
|
1615
1664
|
z(this, L, fe).call(this, { item: o, argument: n }, () => {
|
|
1616
1665
|
this.activeEditor?.commands.setFieldAnnotationsTextColor(n, !0);
|
|
1617
1666
|
});
|
|
1618
1667
|
},
|
|
1668
|
+
/**
|
|
1669
|
+
* Sets the highlight color for text
|
|
1670
|
+
* @param {Object} params - Command parameters
|
|
1671
|
+
* @param {CommandItem} params.item - The command item
|
|
1672
|
+
* @param {string} params.argument - The highlight color to set
|
|
1673
|
+
* @returns {void}
|
|
1674
|
+
*/
|
|
1619
1675
|
setHighlight: ({ item: o, argument: n }) => {
|
|
1620
1676
|
z(this, L, fe).call(this, { item: o, argument: n, noArgumentCallback: !0 }, () => {
|
|
1621
1677
|
let e = n !== "none" ? n : null;
|
|
1622
1678
|
this.activeEditor?.commands.setFieldAnnotationsTextHighlight(e, !0), this.activeEditor?.commands.setCellBackground(e);
|
|
1623
1679
|
});
|
|
1624
1680
|
},
|
|
1625
|
-
|
|
1681
|
+
/**
|
|
1682
|
+
* Toggles the ruler visibility
|
|
1683
|
+
* @param {Object} [_params=null] - Command parameters (not used)
|
|
1684
|
+
* @returns {void}
|
|
1685
|
+
*/
|
|
1686
|
+
toggleRuler: (o = null) => {
|
|
1626
1687
|
this.superdoc.toggleRuler();
|
|
1627
1688
|
},
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1689
|
+
/**
|
|
1690
|
+
* Initiates the image upload process
|
|
1691
|
+
* @async
|
|
1692
|
+
* @param {Object} [_params=null - Command parameters (not used)
|
|
1693
|
+
* @returns {Promise<void>}
|
|
1694
|
+
*/
|
|
1695
|
+
startImageUpload: async (o = null) => {
|
|
1696
|
+
let e = await ro()();
|
|
1697
|
+
e?.file && po({
|
|
1631
1698
|
editor: this.activeEditor,
|
|
1632
1699
|
view: this.activeEditor.view,
|
|
1633
|
-
file:
|
|
1700
|
+
file: e.file
|
|
1634
1701
|
});
|
|
1635
1702
|
},
|
|
1703
|
+
/**
|
|
1704
|
+
* Increases text indentation or list level
|
|
1705
|
+
* @param {Object} params - Command parameters
|
|
1706
|
+
* @param {CommandItem} params.item - The command item
|
|
1707
|
+
* @param {*} params.argument - Command arguments
|
|
1708
|
+
* @returns {void}
|
|
1709
|
+
*/
|
|
1636
1710
|
increaseTextIndent: ({ item: o, argument: n }) => {
|
|
1637
1711
|
let e = o.command, { state: i } = this.activeEditor;
|
|
1638
1712
|
if (Ge((l) => l.type.name === "listItem")(i.selection))
|
|
1639
1713
|
return this.activeEditor.commands.increaseListIndent();
|
|
1640
1714
|
e in this.activeEditor.commands && this.activeEditor.commands[e](n);
|
|
1641
1715
|
},
|
|
1716
|
+
/**
|
|
1717
|
+
* Decreases text indentation or list level
|
|
1718
|
+
* @param {Object} params - Command parameters
|
|
1719
|
+
* @param {CommandItem} params.item - The command item
|
|
1720
|
+
* @param {*} params.argument - Command arguments
|
|
1721
|
+
* @returns {boolean}
|
|
1722
|
+
*/
|
|
1642
1723
|
decreaseTextIndent: ({ item: o, argument: n }) => {
|
|
1643
1724
|
let e = o.command, { state: i } = this.activeEditor;
|
|
1644
1725
|
if (Ge((l) => l.type.name === "listItem")(i.selection))
|
|
1645
1726
|
return this.activeEditor.commands.decreaseListIndent();
|
|
1646
1727
|
e in this.activeEditor.commands && this.activeEditor.commands[e](n);
|
|
1647
1728
|
},
|
|
1729
|
+
/**
|
|
1730
|
+
* Toggles bold formatting for text
|
|
1731
|
+
* @param {Object} params - Command parameters
|
|
1732
|
+
* @param {CommandItem} params.item - The command item
|
|
1733
|
+
* @param {*} params.argument - Command arguments
|
|
1734
|
+
* @returns {void}
|
|
1735
|
+
*/
|
|
1648
1736
|
toggleBold: ({ item: o, argument: n }) => {
|
|
1649
1737
|
let e = o.command;
|
|
1650
1738
|
e in this.activeEditor.commands && (this.activeEditor.commands[e](n), this.activeEditor.commands.toggleFieldAnnotationsFormat("bold", !0)), this.updateToolbarState();
|
|
1651
1739
|
},
|
|
1740
|
+
/**
|
|
1741
|
+
* Toggles italic formatting for text
|
|
1742
|
+
* @param {Object} params - Command parameters
|
|
1743
|
+
* @param {CommandItem} params.item - The command item
|
|
1744
|
+
* @param {*} params.argument - Command arguments
|
|
1745
|
+
* @returns {void}
|
|
1746
|
+
*/
|
|
1652
1747
|
toggleItalic: ({ item: o, argument: n }) => {
|
|
1653
1748
|
let e = o.command;
|
|
1654
1749
|
e in this.activeEditor.commands && (this.activeEditor.commands[e](n), this.activeEditor.commands.toggleFieldAnnotationsFormat("italic", !0)), this.updateToolbarState();
|
|
1655
1750
|
},
|
|
1751
|
+
/**
|
|
1752
|
+
* Toggles underline formatting for text
|
|
1753
|
+
* @param {Object} params - Command parameters
|
|
1754
|
+
* @param {CommandItem} params.item - The command item
|
|
1755
|
+
* @param {*} params.argument - Command arguments
|
|
1756
|
+
* @returns {void}
|
|
1757
|
+
*/
|
|
1656
1758
|
toggleUnderline: ({ item: o, argument: n }) => {
|
|
1657
1759
|
let e = o.command;
|
|
1658
1760
|
e in this.activeEditor.commands && (this.activeEditor.commands[e](n), this.activeEditor.commands.toggleFieldAnnotationsFormat("underline", !0)), this.updateToolbarState();
|
|
1659
1761
|
},
|
|
1762
|
+
/**
|
|
1763
|
+
* Toggles link formatting and updates cursor position
|
|
1764
|
+
* @param {Object} params - Command parameters
|
|
1765
|
+
* @param {CommandItem} params.item - The command item
|
|
1766
|
+
* @param {*} params.argument - Command arguments
|
|
1767
|
+
* @returns {void}
|
|
1768
|
+
*/
|
|
1660
1769
|
toggleLink: ({ item: o, argument: n }) => {
|
|
1661
1770
|
let e = o.command;
|
|
1662
1771
|
if (e in this.activeEditor.commands) {
|
|
@@ -1668,15 +1777,34 @@ class Mo extends qt {
|
|
|
1668
1777
|
}
|
|
1669
1778
|
this.updateToolbarState();
|
|
1670
1779
|
},
|
|
1780
|
+
/**
|
|
1781
|
+
* Inserts a table into the document
|
|
1782
|
+
* @param {Object} params - Command parameters
|
|
1783
|
+
* @param {CommandItem} params.item - The command item
|
|
1784
|
+
* @param {Object} params.argument - Table configuration
|
|
1785
|
+
* @returns {void}
|
|
1786
|
+
*/
|
|
1671
1787
|
insertTable: ({ item: o, argument: n }) => {
|
|
1672
1788
|
z(this, L, fe).call(this, { item: o, argument: n });
|
|
1673
1789
|
},
|
|
1790
|
+
/**
|
|
1791
|
+
* Executes a table-related command
|
|
1792
|
+
* @param {Object} params - Command parameters
|
|
1793
|
+
* @param {CommandItem} params.item - The command item
|
|
1794
|
+
* @param {Object} params.argument - The table command and its parameters
|
|
1795
|
+
* @param {string} params.argument.command - The specific table command to execute
|
|
1796
|
+
* @returns {void}
|
|
1797
|
+
*/
|
|
1674
1798
|
executeTableCommand: ({ item: o, argument: n }) => {
|
|
1675
1799
|
if (!n) return;
|
|
1676
1800
|
let e = n.command;
|
|
1677
1801
|
e in this.activeEditor.commands && this.activeEditor.commands[e](n), this.updateToolbarState();
|
|
1678
1802
|
}
|
|
1679
1803
|
});
|
|
1804
|
+
/**
|
|
1805
|
+
* Handler for toolbar resize events
|
|
1806
|
+
* @returns {void}
|
|
1807
|
+
*/
|
|
1680
1808
|
Re(this, "onToolbarResize", () => {
|
|
1681
1809
|
z(this, L, We).call(this, this, this.config.icons, this.isDev), this.role === "viewer" && z(this, L, Pe).call(this);
|
|
1682
1810
|
});
|
|
@@ -1691,29 +1819,51 @@ class Mo extends qt {
|
|
|
1691
1819
|
}
|
|
1692
1820
|
this.app = Nt(Pt), this.app.directive("click-outside", Ht), this.app.config.globalProperties.$toolbar = this, n && (this.toolbar = this.app.mount(n)), this.activeEditor = o.editor || null, this.updateToolbarState();
|
|
1693
1821
|
}
|
|
1822
|
+
/**
|
|
1823
|
+
* Log debug information to the console
|
|
1824
|
+
* @param {...*} args - Arguments to log
|
|
1825
|
+
* @returns {void}
|
|
1826
|
+
*/
|
|
1694
1827
|
log(...o) {
|
|
1695
1828
|
console.debug("[🎨 super-toolbar]", ...o);
|
|
1696
1829
|
}
|
|
1830
|
+
/**
|
|
1831
|
+
* Set the zoom level
|
|
1832
|
+
* @param {number} percent_int - The zoom percentage as an integer
|
|
1833
|
+
* @returns {void}
|
|
1834
|
+
*/
|
|
1697
1835
|
setZoom(o) {
|
|
1698
1836
|
const e = [...this.toolbarItems, ...this.overflowItems].find((i) => i.name.value === "zoom");
|
|
1699
1837
|
Ae(this, ve).setZoom({ item: e, argument: o });
|
|
1700
1838
|
}
|
|
1701
1839
|
/**
|
|
1702
1840
|
* The toolbar expects an active Super Editor instance.
|
|
1703
|
-
* @param {
|
|
1841
|
+
* @param {Object} editor - The editor instance to attach to the toolbar
|
|
1842
|
+
* @returns {void}
|
|
1704
1843
|
*/
|
|
1705
1844
|
setActiveEditor(o) {
|
|
1706
1845
|
this.activeEditor = o, this.activeEditor.on("transaction", this.onEditorTransaction.bind(this));
|
|
1707
1846
|
}
|
|
1847
|
+
/**
|
|
1848
|
+
* Get toolbar items by group name
|
|
1849
|
+
* @param {string} groupName - The name of the group
|
|
1850
|
+
* @returns {ToolbarItem[]} An array of toolbar items in the specified group
|
|
1851
|
+
*/
|
|
1708
1852
|
getToolbarItemByGroup(o) {
|
|
1709
1853
|
return this.toolbarItems.filter((n) => n.group.value === o);
|
|
1710
1854
|
}
|
|
1855
|
+
/**
|
|
1856
|
+
* Get a toolbar item by name
|
|
1857
|
+
* @param {string} name - The name of the toolbar item
|
|
1858
|
+
* @returns {ToolbarItem|undefined} The toolbar item with the specified name or undefined if not found
|
|
1859
|
+
*/
|
|
1711
1860
|
getToolbarItemByName(o) {
|
|
1712
1861
|
return this.toolbarItems.find((n) => n.name.value === o);
|
|
1713
1862
|
}
|
|
1714
1863
|
/**
|
|
1715
|
-
* Update the toolbar state
|
|
1716
|
-
*
|
|
1864
|
+
* Update the toolbar state based on the current editor state
|
|
1865
|
+
* Updates active/inactive state of all toolbar items
|
|
1866
|
+
* @returns {void}
|
|
1717
1867
|
*/
|
|
1718
1868
|
updateToolbarState() {
|
|
1719
1869
|
if (z(this, L, ct).call(this), z(this, L, at).call(this), z(this, L, rt).call(this), !this.activeEditor || this.documentMode === "viewing") {
|
|
@@ -1747,16 +1897,21 @@ class Mo extends qt {
|
|
|
1747
1897
|
}
|
|
1748
1898
|
/**
|
|
1749
1899
|
* React to editor transactions. Might want to debounce this.
|
|
1900
|
+
* @param {Object} params - Transaction parameters
|
|
1901
|
+
* @param {Object} params.editor - The editor instance (not used)
|
|
1902
|
+
* @param {Object} params.transaction - The transaction object
|
|
1903
|
+
* @returns {void}
|
|
1750
1904
|
*/
|
|
1751
1905
|
onEditorTransaction({ editor: o, transaction: n }) {
|
|
1752
1906
|
!n.docChanged && !n.selectionSet || this.updateToolbarState();
|
|
1753
1907
|
}
|
|
1754
1908
|
/**
|
|
1755
|
-
* Main handler for toolbar commands
|
|
1756
|
-
*
|
|
1757
|
-
* @param {
|
|
1758
|
-
* @param {
|
|
1759
|
-
|
|
1909
|
+
* Main handler for toolbar commands
|
|
1910
|
+
* @param {CommandItem} params - Command parameters
|
|
1911
|
+
* @param {ToolbarItem} params.item - An instance of the useToolbarItem composable
|
|
1912
|
+
* @param {*} [params.argument] - The argument passed to the command
|
|
1913
|
+
* @returns {*} The result of the executed command, undefined if no result is returned
|
|
1914
|
+
*/
|
|
1760
1915
|
emitCommand({ item: o, argument: n }) {
|
|
1761
1916
|
this.activeEditor?.focus();
|
|
1762
1917
|
const { command: e } = o;
|
|
@@ -1770,9 +1925,22 @@ class Mo extends qt {
|
|
|
1770
1925
|
}
|
|
1771
1926
|
}
|
|
1772
1927
|
}
|
|
1773
|
-
L = new WeakSet(),
|
|
1928
|
+
L = new WeakSet(), /**
|
|
1929
|
+
* Initiate toolbar groups
|
|
1930
|
+
* @private
|
|
1931
|
+
* @returns {void}
|
|
1932
|
+
*/
|
|
1933
|
+
lt = function() {
|
|
1774
1934
|
this.config.groups && !Array.isArray(this.config.groups) && Object.keys(this.config.groups).length && (this.config.toolbarGroups = Object.keys(this.config.groups));
|
|
1775
|
-
}, ve = new WeakMap(),
|
|
1935
|
+
}, ve = new WeakMap(), /**
|
|
1936
|
+
* Create toolbar items based on configuration
|
|
1937
|
+
* @private
|
|
1938
|
+
* @param {SuperToolbar} superToolbar - The toolbar instance
|
|
1939
|
+
* @param {Object} icons - Icons to use for toolbar items
|
|
1940
|
+
* @param {boolean} [isDev=false] - Whether in development mode
|
|
1941
|
+
* @returns {void}
|
|
1942
|
+
*/
|
|
1943
|
+
We = function(o, n, e = !1) {
|
|
1776
1944
|
const i = document.documentElement.clientWidth, { defaultItems: r, overflowItems: l } = lo(o, e, i, this.role, n);
|
|
1777
1945
|
let s = [
|
|
1778
1946
|
...r.map((d) => d.name.value),
|
|
@@ -1781,13 +1949,23 @@ L = new WeakSet(), lt = function() {
|
|
|
1781
1949
|
this.config.groups && (s = Object.values(this.config.groups).flatMap((d) => d));
|
|
1782
1950
|
const c = r.filter((d) => s.includes(d.name.value)).filter((d) => !this.config.excludeItems.includes(d.name.value));
|
|
1783
1951
|
this.toolbarItems = c, this.overflowItems = l.filter((d) => s.includes(d.name.value));
|
|
1784
|
-
},
|
|
1952
|
+
}, /**
|
|
1953
|
+
* Initialize default fonts from the editor
|
|
1954
|
+
* @private
|
|
1955
|
+
* @returns {void}
|
|
1956
|
+
*/
|
|
1957
|
+
at = function() {
|
|
1785
1958
|
if (!this.activeEditor || !this.activeEditor.converter) return;
|
|
1786
1959
|
const { typeface: o = "Arial", fontSizePt: n = 12 } = this.activeEditor.converter.getDocumentDefaultStyles() ?? {}, e = this.toolbarItems.find((r) => r.name.value === "fontSize");
|
|
1787
1960
|
e && (e.defaultLabel.value = n);
|
|
1788
1961
|
const i = this.toolbarItems.find((r) => r.name.value === "fontFamily");
|
|
1789
1962
|
i && (i.defaultLabel.value = o);
|
|
1790
|
-
},
|
|
1963
|
+
}, /**
|
|
1964
|
+
* Update highlight color options based on document colors
|
|
1965
|
+
* @private
|
|
1966
|
+
* @returns {void}
|
|
1967
|
+
*/
|
|
1968
|
+
rt = function() {
|
|
1791
1969
|
if (!this.activeEditor || !this.activeEditor.converter || !this.activeEditor.converter.docHiglightColors.size) return;
|
|
1792
1970
|
const o = this.toolbarItems.find((l) => l.name.value === "highlight"), n = Vn(), e = 7, i = Array.from(this.activeEditor.converter.docHiglightColors).reduce((l, s, c) => {
|
|
1793
1971
|
const d = Math.floor(c / e);
|
|
@@ -1798,14 +1976,34 @@ L = new WeakSet(), lt = function() {
|
|
|
1798
1976
|
render: () => Ve(this, o, i, !0)
|
|
1799
1977
|
};
|
|
1800
1978
|
o.nestedOptions.value = [r];
|
|
1801
|
-
},
|
|
1979
|
+
}, /**
|
|
1980
|
+
* Deactivate all toolbar items
|
|
1981
|
+
* @private
|
|
1982
|
+
* @returns {void}
|
|
1983
|
+
*/
|
|
1984
|
+
Pe = function() {
|
|
1802
1985
|
this.activeEditor = null, this.toolbarItems.forEach((o) => {
|
|
1803
1986
|
const { allowWithoutEditor: n } = o;
|
|
1804
1987
|
n.value || o.setDisabled(!0);
|
|
1805
1988
|
});
|
|
1806
|
-
},
|
|
1989
|
+
}, /**
|
|
1990
|
+
* Update undo/redo history state in the toolbar
|
|
1991
|
+
* @private
|
|
1992
|
+
* @returns {void}
|
|
1993
|
+
*/
|
|
1994
|
+
ct = function() {
|
|
1807
1995
|
this.activeEditor && (this.undoDepth = xt(this.activeEditor.state), this.redoDepth = Et(this.activeEditor.state));
|
|
1808
|
-
},
|
|
1996
|
+
}, /**
|
|
1997
|
+
* Run a command that requires an argument
|
|
1998
|
+
* @private
|
|
1999
|
+
* @param {CommandItem} params - Command parameters
|
|
2000
|
+
* @param {ToolbarItem} params.item - The toolbar item
|
|
2001
|
+
* @param {*} params.argument - The argument for the command
|
|
2002
|
+
* @param {boolean} params.noArgumentCallback - Whether to call callback even if argument === 'none'
|
|
2003
|
+
* @param {Function} [callback] - Optional callback to run after the command
|
|
2004
|
+
* @returns {void}
|
|
2005
|
+
*/
|
|
2006
|
+
fe = function({ item: o, argument: n, noArgumentCallback: e = !1 }, i) {
|
|
1809
2007
|
if (!n || !this.activeEditor) return;
|
|
1810
2008
|
let r = o.command;
|
|
1811
2009
|
const l = o.noArgumentCommand;
|
package/dist/super-editor.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/super-editor.es-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/super-editor.es-CYMQ40x9.cjs");require("./chunks/vue-BQCc2YbW.cjs");exports.AIWriter=e.xe;exports.BasicUpload=e.$o;exports.CommentsPluginKey=e.ge;exports.DocxZipper=e.Nt;exports.Editor=e.ns;exports.Extensions=e.Bo;exports.SuperConverter=e.Ot;exports.SuperEditor=e.Do;exports.SuperInput=e.Ho;exports.SuperToolbar=e.Mo;exports.Toolbar=e.P0;exports.TrackChangesBasePluginKey=e.ce;exports.createZip=e.c;exports.fieldAnnotationHelpers=e.Xx;exports.getActiveFormatting=e.ap;exports.getAllowedImageDimensions=e.mo;exports.getMarksFromSelection=e.Vo;exports.getRichTextExtensions=e.Fx;exports.getStarterExtensions=e.Bx;exports.helpers=e.Rs;exports.trackChangesHelpers=e.Yx;
|
package/dist/super-editor.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { x as r, $ as t, g as o, N as n, n as i, B as p, O as g, D as l, H as c, M as m, P as u, c as x, a as d,
|
|
2
|
-
import "./chunks/vue-
|
|
1
|
+
import { x as r, $ as t, g as o, N as n, n as i, B as p, O as g, D as l, H as c, M as m, P as u, c as x, a as d, X as S, b as E, m as h, V as A, F as C, d as T, R as b, Y as k } from "./chunks/super-editor.es-SDc8qWY8.es.js";
|
|
2
|
+
import "./chunks/vue-DKS68Dra.es.js";
|
|
3
3
|
export {
|
|
4
4
|
r as AIWriter,
|
|
5
5
|
t as BasicUpload,
|