@editora/core 1.0.13 → 1.0.14
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/LICENSE +21 -0
- package/dist/editora.min.js +2 -2
- package/dist/editora.umd.js +2 -2
- package/dist/{index-YZ5TROdg.mjs → index-B9MPiUAR.mjs} +10 -10
- package/dist/{index-B5BzVUdg.js → index-BLm1MtzH.js} +3 -3
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/webcomponent-core.js +9 -9
- package/dist/webcomponent-core.min.js +2 -2
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +9 -9
- package/dist/webcomponent.min.js +2 -2
- package/package.json +1 -1
package/dist/webcomponent.js
CHANGED
|
@@ -238,7 +238,7 @@ class R {
|
|
|
238
238
|
/**
|
|
239
239
|
* Execute a command
|
|
240
240
|
*/
|
|
241
|
-
execCommand(t, e) {
|
|
241
|
+
execCommand(t, ...e) {
|
|
242
242
|
if (this.isReadonly)
|
|
243
243
|
return console.warn("Cannot execute commands in readonly mode"), !1;
|
|
244
244
|
if (this.isDestroyed)
|
|
@@ -247,7 +247,7 @@ class R {
|
|
|
247
247
|
if (!o)
|
|
248
248
|
return console.warn(`Command not found: ${t}`), !1;
|
|
249
249
|
let r;
|
|
250
|
-
return e
|
|
250
|
+
return e.length === 0 ? r = o(this.state) : e.length === 1 ? r = o(this.state, e[0]) : r = o(this.state, ...e), r instanceof Promise ? (r.then((n) => {
|
|
251
251
|
n && typeof n == "object" && "doc" in n && "selection" in n && (this.setState(n), this.emit("change", this.state));
|
|
252
252
|
}).catch((n) => {
|
|
253
253
|
console.error(`Async command failed: ${t}`, n);
|
|
@@ -1526,9 +1526,9 @@ function et() {
|
|
|
1526
1526
|
function ot() {
|
|
1527
1527
|
if (typeof window == "undefined" || L) return;
|
|
1528
1528
|
w = typeof window.executeEditorCommand == "function" ? window.executeEditorCommand.bind(window) : null, C = typeof window.execEditorCommand == "function" ? window.execEditorCommand.bind(window) : null;
|
|
1529
|
-
const i = (t, e) => {
|
|
1529
|
+
const i = (t, ...e) => {
|
|
1530
1530
|
const o = et();
|
|
1531
|
-
return o ? o.execCommand(t, e) : w ? w(t, e) : C ? C(t, e) : !1;
|
|
1531
|
+
return o ? o.execCommand(t, ...e) : w ? w(t, ...e) : C ? C(t, ...e) : !1;
|
|
1532
1532
|
};
|
|
1533
1533
|
window.executeEditorCommand = i, window.execEditorCommand = i, L = !0;
|
|
1534
1534
|
}
|
|
@@ -1826,7 +1826,7 @@ class m extends HTMLElement {
|
|
|
1826
1826
|
const t = this.getSpellcheckConfig(), e = t.enabled && t.provider === "browser";
|
|
1827
1827
|
this.contentElement.spellcheck = e, this.contentElement.setAttribute("spellcheck", e ? "true" : "false");
|
|
1828
1828
|
}
|
|
1829
|
-
executeCommand(t, e) {
|
|
1829
|
+
executeCommand(t, ...e) {
|
|
1830
1830
|
var n;
|
|
1831
1831
|
typeof window != "undefined" && (window.__editoraCommandEditorRoot = this);
|
|
1832
1832
|
const o = {
|
|
@@ -1838,12 +1838,12 @@ class m extends HTMLElement {
|
|
|
1838
1838
|
const a = r.commands[t];
|
|
1839
1839
|
if (typeof a == "function")
|
|
1840
1840
|
try {
|
|
1841
|
-
return
|
|
1841
|
+
return t === "toggleFullscreen" ? a(this, o) : a(...e, o), !0;
|
|
1842
1842
|
} catch (s) {
|
|
1843
1843
|
return console.error(`[RichTextEditor] Error executing native command ${t}:`, s), !1;
|
|
1844
1844
|
}
|
|
1845
1845
|
}
|
|
1846
|
-
return ((n = this.engine) == null ? void 0 : n.execCommand(t, e)) || !1;
|
|
1846
|
+
return ((n = this.engine) == null ? void 0 : n.execCommand(t, ...e)) || !1;
|
|
1847
1847
|
}
|
|
1848
1848
|
getPluginLoadConfig(t) {
|
|
1849
1849
|
const e = this.config.pluginConfig;
|
|
@@ -2300,8 +2300,8 @@ class m extends HTMLElement {
|
|
|
2300
2300
|
setContent(t) {
|
|
2301
2301
|
this.contentElement && (this.contentElement.innerHTML = t);
|
|
2302
2302
|
}
|
|
2303
|
-
execCommand(t, e) {
|
|
2304
|
-
return this.executeCommand(t, e);
|
|
2303
|
+
execCommand(t, ...e) {
|
|
2304
|
+
return this.executeCommand(t, ...e);
|
|
2305
2305
|
}
|
|
2306
2306
|
focus() {
|
|
2307
2307
|
var t;
|