@editora/core 1.0.27 → 1.0.28
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/editora.min.js +16 -16
- package/dist/editora.umd.js +16 -16
- package/dist/{index-DHPPVQwx.js → index-B-Vt_adn.js} +2 -2
- package/dist/{index-gI4djib2.mjs → index-B3zKYrPA.mjs} +20 -18
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/webcomponent-core.js +19 -17
- package/dist/webcomponent-core.min.js +1 -1
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +19 -17
- package/dist/webcomponent.min.js +1 -1
- package/package.json +1 -1
package/dist/webcomponent.js
CHANGED
|
@@ -3185,7 +3185,7 @@ function bi() {
|
|
|
3185
3185
|
}
|
|
3186
3186
|
class W extends HTMLElement {
|
|
3187
3187
|
constructor() {
|
|
3188
|
-
if (super(), this.pluginLoader = bi(), this.config = {}, this.isInitialized = !1, this.keyboardShortcutManager = new vn(), this.lastAutosavedContent = "", this.preservedContent = null, this.loadedPlugins = [], this.lastBeforeInputType = null, this.pendingHistorySnapshot = null, gi(), !this.hasAttribute("data-initial-content")) {
|
|
3188
|
+
if (super(), this.pluginLoader = bi(), this.config = {}, this.isInitialized = !1, this.buildGeneration = 0, this.keyboardShortcutManager = new vn(), this.lastAutosavedContent = "", this.preservedContent = null, this.loadedPlugins = [], this.lastBeforeInputType = null, this.pendingHistorySnapshot = null, gi(), !this.hasAttribute("data-initial-content")) {
|
|
3189
3189
|
const t = this.innerHTML.trim();
|
|
3190
3190
|
t && this.setAttribute("data-initial-content", t);
|
|
3191
3191
|
}
|
|
@@ -3285,31 +3285,33 @@ class W extends HTMLElement {
|
|
|
3285
3285
|
* Initialize the editor
|
|
3286
3286
|
*/
|
|
3287
3287
|
async initialize() {
|
|
3288
|
-
var
|
|
3288
|
+
var a;
|
|
3289
3289
|
if (this.querySelector(".editora-toolbar") || this.isInitialized) return;
|
|
3290
|
+
const t = ++this.buildGeneration;
|
|
3290
3291
|
this.setAttribute("data-editora-editor", "true"), Ae.add(this), Q || (Q = this), mi(), this.config.height && (this.style.height = typeof this.config.height == "number" ? `${this.config.height}px` : this.config.height), this.config.width && (this.style.width = typeof this.config.width == "number" ? `${this.config.width}px` : this.config.width), this.classList.add("editora-editor"), this.config.theme && this.classList.add(`editora-theme-${this.config.theme}`);
|
|
3291
|
-
const
|
|
3292
|
-
if (this.
|
|
3293
|
-
|
|
3292
|
+
const e = await this.loadPlugins();
|
|
3293
|
+
if (t !== this.buildGeneration || !this.isConnected) return;
|
|
3294
|
+
if (this.loadedPlugins = e, e.forEach((l) => {
|
|
3295
|
+
if (l.init && typeof l.init == "function")
|
|
3294
3296
|
try {
|
|
3295
|
-
|
|
3296
|
-
} catch (
|
|
3297
|
-
console.error(`[RichTextEditor] Error initializing plugin ${
|
|
3297
|
+
l.init({ editorElement: this });
|
|
3298
|
+
} catch (c) {
|
|
3299
|
+
console.error(`[RichTextEditor] Error initializing plugin ${l.name}:`, c);
|
|
3298
3300
|
}
|
|
3299
3301
|
}), !this.hasAttribute("data-initial-content") && !this.contentElement) {
|
|
3300
|
-
const
|
|
3301
|
-
|
|
3302
|
+
const l = this.innerHTML.trim();
|
|
3303
|
+
l && this.setAttribute("data-initial-content", l);
|
|
3302
3304
|
}
|
|
3303
|
-
const
|
|
3305
|
+
const o = this.preservedContent;
|
|
3304
3306
|
this.preservedContent = null;
|
|
3305
|
-
const
|
|
3306
|
-
(
|
|
3307
|
+
const r = this.sanitizeLoadedContent(
|
|
3308
|
+
(a = o != null ? o : this.restoreAutosavedContent()) != null ? a : this.getAttribute("data-initial-content") || ""
|
|
3307
3309
|
);
|
|
3308
3310
|
this.engine = new un({
|
|
3309
|
-
content:
|
|
3310
|
-
plugins:
|
|
3311
|
+
content: r,
|
|
3312
|
+
plugins: e,
|
|
3311
3313
|
readonly: this.config.readonly
|
|
3312
|
-
}), this.createUI(
|
|
3314
|
+
}), this.createUI(e, r), this.setupEventListeners(), this.startAutosave(), this.isInitialized = !0, this.dispatchEvent(new CustomEvent("editor-ready", {
|
|
3313
3315
|
detail: { api: this.getAPI() },
|
|
3314
3316
|
bubbles: !0
|
|
3315
3317
|
}));
|
|
@@ -3969,7 +3971,7 @@ class W extends HTMLElement {
|
|
|
3969
3971
|
*/
|
|
3970
3972
|
destroy() {
|
|
3971
3973
|
var t, e, o, r;
|
|
3972
|
-
this.contentChangeDebounceTimer && (clearTimeout(this.contentChangeDebounceTimer), this.contentChangeDebounceTimer = void 0), this.contentElement && (this.preservedContent = xt(this.contentElement), this.persistAutosave(this.preservedContent)), this.stopAutosave(), this.selectionChangeHandler && (document.removeEventListener("selectionchange", this.selectionChangeHandler), this.selectionChangeHandler = void 0), (t = this.engine) == null || t.destroy(), (e = this.toolbar) == null || e.destroy(), (o = this.floatingToolbar) == null || o.destroy(), (r = this.statusBar) == null || r.destroy(), this.innerHTML = "", this.contentElement = void 0, this.toolbarElement = void 0, this.statusBarElement = void 0, this.loadedPlugins = [], this.isInitialized = !1, Ae.delete(this), Q === this && (Q = null), this.dispatchEvent(new Event("editor-destroy", { bubbles: !0 }));
|
|
3974
|
+
this.buildGeneration += 1, this.contentChangeDebounceTimer && (clearTimeout(this.contentChangeDebounceTimer), this.contentChangeDebounceTimer = void 0), this.contentElement && (this.preservedContent = xt(this.contentElement), this.persistAutosave(this.preservedContent)), this.stopAutosave(), this.selectionChangeHandler && (document.removeEventListener("selectionchange", this.selectionChangeHandler), this.selectionChangeHandler = void 0), (t = this.engine) == null || t.destroy(), (e = this.toolbar) == null || e.destroy(), (o = this.floatingToolbar) == null || o.destroy(), (r = this.statusBar) == null || r.destroy(), this.innerHTML = "", this.contentElement = void 0, this.toolbarElement = void 0, this.statusBarElement = void 0, this.loadedPlugins = [], this.isInitialized = !1, Ae.delete(this), Q === this && (Q = null), this.dispatchEvent(new Event("editor-destroy", { bubbles: !0 }));
|
|
3973
3975
|
}
|
|
3974
3976
|
// Public API methods
|
|
3975
3977
|
getContent() {
|