@blockslides/core 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +30 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2812,6 +2812,7 @@ var EventEmitter = class {
|
|
|
2812
2812
|
this.callbacks = {};
|
|
2813
2813
|
}
|
|
2814
2814
|
on(event, fn) {
|
|
2815
|
+
if (!fn) return this;
|
|
2815
2816
|
if (!this.callbacks[event]) {
|
|
2816
2817
|
this.callbacks[event] = [];
|
|
2817
2818
|
}
|
|
@@ -4587,6 +4588,7 @@ function createStyleTag(style2, nonce, suffix) {
|
|
|
4587
4588
|
// src/SlideEditor.ts
|
|
4588
4589
|
var SlideEditor = class extends EventEmitter {
|
|
4589
4590
|
constructor(options = {}) {
|
|
4591
|
+
console.log("[Core SlideEditor] Constructor called with options:", options);
|
|
4590
4592
|
super();
|
|
4591
4593
|
this.css = null;
|
|
4592
4594
|
this.editorView = null;
|
|
@@ -4636,10 +4638,15 @@ var SlideEditor = class extends EventEmitter {
|
|
|
4636
4638
|
this.isCapturingTransaction = false;
|
|
4637
4639
|
this.capturedTransaction = null;
|
|
4638
4640
|
this.setOptions(options);
|
|
4641
|
+
console.log("[Core SlideEditor] this.options.enableCoreExtensions:", this.options.enableCoreExtensions);
|
|
4639
4642
|
this.resolvedTheme = resolveTheme(this.options.theme);
|
|
4643
|
+
console.log("[Core SlideEditor] Theme resolved:", this.resolvedTheme);
|
|
4640
4644
|
this.createExtensionManager();
|
|
4645
|
+
console.log("[Core SlideEditor] Extension manager created");
|
|
4641
4646
|
this.createCommandManager();
|
|
4647
|
+
console.log("[Core SlideEditor] Command manager created");
|
|
4642
4648
|
this.createSchema();
|
|
4649
|
+
console.log("[Core SlideEditor] Schema created");
|
|
4643
4650
|
this.on("beforeCreate", this.options.onBeforeCreate);
|
|
4644
4651
|
this.emit("beforeCreate", { editor: this });
|
|
4645
4652
|
this.on("mount", this.options.onMount);
|
|
@@ -4658,21 +4665,29 @@ var SlideEditor = class extends EventEmitter {
|
|
|
4658
4665
|
);
|
|
4659
4666
|
this.on("paste", ({ event, slice }) => this.options.onPaste(event, slice));
|
|
4660
4667
|
this.on("delete", this.options.onDelete);
|
|
4668
|
+
console.log("[Core SlideEditor] Event handlers registered");
|
|
4661
4669
|
const initialDoc = this.createDoc();
|
|
4670
|
+
console.log("[Core SlideEditor] Initial doc created:", initialDoc);
|
|
4662
4671
|
const selection = resolveFocusPosition(initialDoc, this.options.autofocus);
|
|
4663
4672
|
this.editorState = EditorState.create({
|
|
4664
4673
|
doc: initialDoc,
|
|
4665
4674
|
schema: this.schema,
|
|
4666
4675
|
selection: selection || void 0
|
|
4667
4676
|
});
|
|
4677
|
+
console.log("[Core SlideEditor] Editor state created:", this.editorState);
|
|
4668
4678
|
if (this.options.element) {
|
|
4679
|
+
console.log("[Core SlideEditor] Element provided, calling mount");
|
|
4669
4680
|
this.mount(this.options.element);
|
|
4681
|
+
} else {
|
|
4682
|
+
console.log("[Core SlideEditor] No element provided, skipping mount");
|
|
4670
4683
|
}
|
|
4684
|
+
console.log("[Core SlideEditor] \u2705 Constructor complete");
|
|
4671
4685
|
}
|
|
4672
4686
|
/**
|
|
4673
4687
|
* Attach the editor to the DOM, creating a new editor view.
|
|
4674
4688
|
*/
|
|
4675
4689
|
mount(el) {
|
|
4690
|
+
console.log("[Core SlideEditor] mount() called with element:", el);
|
|
4676
4691
|
if (typeof document === "undefined") {
|
|
4677
4692
|
throw new Error(
|
|
4678
4693
|
`[blockslides error]: The editor cannot be mounted because there is no 'document' defined in this environment.`
|
|
@@ -4684,9 +4699,15 @@ var SlideEditor = class extends EventEmitter {
|
|
|
4684
4699
|
document.head.appendChild(this.css);
|
|
4685
4700
|
}
|
|
4686
4701
|
window.setTimeout(() => {
|
|
4702
|
+
var _a;
|
|
4687
4703
|
if (this.isDestroyed) {
|
|
4688
4704
|
return;
|
|
4689
4705
|
}
|
|
4706
|
+
console.log("[mount setTimeout] this:", this);
|
|
4707
|
+
console.log("[mount setTimeout] this.commandManager:", this.commandManager);
|
|
4708
|
+
console.log("[mount setTimeout] this.commands:", this.commands);
|
|
4709
|
+
console.log("[mount setTimeout] typeof this.commands:", typeof this.commands);
|
|
4710
|
+
console.log("[mount setTimeout] this.commands.focus:", (_a = this.commands) == null ? void 0 : _a.focus);
|
|
4690
4711
|
this.commands.focus(this.options.autofocus);
|
|
4691
4712
|
this.emit("create", { editor: this });
|
|
4692
4713
|
this.isInitialized = true;
|
|
@@ -4886,6 +4907,7 @@ var SlideEditor = class extends EventEmitter {
|
|
|
4886
4907
|
*/
|
|
4887
4908
|
createExtensionManager() {
|
|
4888
4909
|
var _a, _b;
|
|
4910
|
+
console.log("[Core SlideEditor] createExtensionManager - enableCoreExtensions:", this.options.enableCoreExtensions);
|
|
4889
4911
|
const coreExtensions = this.options.enableCoreExtensions ? [
|
|
4890
4912
|
Editable,
|
|
4891
4913
|
ClipboardTextSerializer.configure({
|
|
@@ -4904,6 +4926,8 @@ var SlideEditor = class extends EventEmitter {
|
|
|
4904
4926
|
}
|
|
4905
4927
|
return true;
|
|
4906
4928
|
}) : [];
|
|
4929
|
+
console.log("[Core SlideEditor] coreExtensions:", coreExtensions.map((e) => e.name));
|
|
4930
|
+
console.log("[Core SlideEditor] this.options.extensions:", this.options.extensions.map((e) => e.name));
|
|
4907
4931
|
const allExtensions = [
|
|
4908
4932
|
...coreExtensions,
|
|
4909
4933
|
...this.options.extensions
|
|
@@ -4976,6 +5000,8 @@ var SlideEditor = class extends EventEmitter {
|
|
|
4976
5000
|
*/
|
|
4977
5001
|
createView(element) {
|
|
4978
5002
|
var _a;
|
|
5003
|
+
console.log("[Core SlideEditor] createView() called with element:", element);
|
|
5004
|
+
console.log("[Core SlideEditor] editorState:", this.editorState);
|
|
4979
5005
|
this.editorView = new EditorView(element, {
|
|
4980
5006
|
...this.options.editorProps,
|
|
4981
5007
|
attributes: {
|
|
@@ -4988,10 +5014,14 @@ var SlideEditor = class extends EventEmitter {
|
|
|
4988
5014
|
markViews: this.extensionManager.markViews,
|
|
4989
5015
|
nodeViews: this.extensionManager.nodeViews
|
|
4990
5016
|
});
|
|
5017
|
+
console.log("[Core SlideEditor] EditorView created:", this.editorView);
|
|
5018
|
+
console.log("[Core SlideEditor] EditorView.dom:", this.editorView.dom);
|
|
4991
5019
|
const newState = this.state.reconfigure({
|
|
4992
5020
|
plugins: this.extensionManager.plugins
|
|
4993
5021
|
});
|
|
5022
|
+
console.log("[Core SlideEditor] Reconfigured state with plugins");
|
|
4994
5023
|
this.view.updateState(newState);
|
|
5024
|
+
console.log("[Core SlideEditor] \u2705 View state updated");
|
|
4995
5025
|
this.prependClass();
|
|
4996
5026
|
this.injectCSS();
|
|
4997
5027
|
applyTheme(this.resolvedTheme, this.view.dom);
|