@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.js
CHANGED
|
@@ -2950,6 +2950,7 @@ var EventEmitter = class {
|
|
|
2950
2950
|
this.callbacks = {};
|
|
2951
2951
|
}
|
|
2952
2952
|
on(event, fn) {
|
|
2953
|
+
if (!fn) return this;
|
|
2953
2954
|
if (!this.callbacks[event]) {
|
|
2954
2955
|
this.callbacks[event] = [];
|
|
2955
2956
|
}
|
|
@@ -4725,6 +4726,7 @@ function createStyleTag(style2, nonce, suffix) {
|
|
|
4725
4726
|
// src/SlideEditor.ts
|
|
4726
4727
|
var SlideEditor = class extends EventEmitter {
|
|
4727
4728
|
constructor(options = {}) {
|
|
4729
|
+
console.log("[Core SlideEditor] Constructor called with options:", options);
|
|
4728
4730
|
super();
|
|
4729
4731
|
this.css = null;
|
|
4730
4732
|
this.editorView = null;
|
|
@@ -4774,10 +4776,15 @@ var SlideEditor = class extends EventEmitter {
|
|
|
4774
4776
|
this.isCapturingTransaction = false;
|
|
4775
4777
|
this.capturedTransaction = null;
|
|
4776
4778
|
this.setOptions(options);
|
|
4779
|
+
console.log("[Core SlideEditor] this.options.enableCoreExtensions:", this.options.enableCoreExtensions);
|
|
4777
4780
|
this.resolvedTheme = resolveTheme(this.options.theme);
|
|
4781
|
+
console.log("[Core SlideEditor] Theme resolved:", this.resolvedTheme);
|
|
4778
4782
|
this.createExtensionManager();
|
|
4783
|
+
console.log("[Core SlideEditor] Extension manager created");
|
|
4779
4784
|
this.createCommandManager();
|
|
4785
|
+
console.log("[Core SlideEditor] Command manager created");
|
|
4780
4786
|
this.createSchema();
|
|
4787
|
+
console.log("[Core SlideEditor] Schema created");
|
|
4781
4788
|
this.on("beforeCreate", this.options.onBeforeCreate);
|
|
4782
4789
|
this.emit("beforeCreate", { editor: this });
|
|
4783
4790
|
this.on("mount", this.options.onMount);
|
|
@@ -4796,21 +4803,29 @@ var SlideEditor = class extends EventEmitter {
|
|
|
4796
4803
|
);
|
|
4797
4804
|
this.on("paste", ({ event, slice }) => this.options.onPaste(event, slice));
|
|
4798
4805
|
this.on("delete", this.options.onDelete);
|
|
4806
|
+
console.log("[Core SlideEditor] Event handlers registered");
|
|
4799
4807
|
const initialDoc = this.createDoc();
|
|
4808
|
+
console.log("[Core SlideEditor] Initial doc created:", initialDoc);
|
|
4800
4809
|
const selection = resolveFocusPosition(initialDoc, this.options.autofocus);
|
|
4801
4810
|
this.editorState = import_state21.EditorState.create({
|
|
4802
4811
|
doc: initialDoc,
|
|
4803
4812
|
schema: this.schema,
|
|
4804
4813
|
selection: selection || void 0
|
|
4805
4814
|
});
|
|
4815
|
+
console.log("[Core SlideEditor] Editor state created:", this.editorState);
|
|
4806
4816
|
if (this.options.element) {
|
|
4817
|
+
console.log("[Core SlideEditor] Element provided, calling mount");
|
|
4807
4818
|
this.mount(this.options.element);
|
|
4819
|
+
} else {
|
|
4820
|
+
console.log("[Core SlideEditor] No element provided, skipping mount");
|
|
4808
4821
|
}
|
|
4822
|
+
console.log("[Core SlideEditor] \u2705 Constructor complete");
|
|
4809
4823
|
}
|
|
4810
4824
|
/**
|
|
4811
4825
|
* Attach the editor to the DOM, creating a new editor view.
|
|
4812
4826
|
*/
|
|
4813
4827
|
mount(el) {
|
|
4828
|
+
console.log("[Core SlideEditor] mount() called with element:", el);
|
|
4814
4829
|
if (typeof document === "undefined") {
|
|
4815
4830
|
throw new Error(
|
|
4816
4831
|
`[blockslides error]: The editor cannot be mounted because there is no 'document' defined in this environment.`
|
|
@@ -4822,9 +4837,15 @@ var SlideEditor = class extends EventEmitter {
|
|
|
4822
4837
|
document.head.appendChild(this.css);
|
|
4823
4838
|
}
|
|
4824
4839
|
window.setTimeout(() => {
|
|
4840
|
+
var _a;
|
|
4825
4841
|
if (this.isDestroyed) {
|
|
4826
4842
|
return;
|
|
4827
4843
|
}
|
|
4844
|
+
console.log("[mount setTimeout] this:", this);
|
|
4845
|
+
console.log("[mount setTimeout] this.commandManager:", this.commandManager);
|
|
4846
|
+
console.log("[mount setTimeout] this.commands:", this.commands);
|
|
4847
|
+
console.log("[mount setTimeout] typeof this.commands:", typeof this.commands);
|
|
4848
|
+
console.log("[mount setTimeout] this.commands.focus:", (_a = this.commands) == null ? void 0 : _a.focus);
|
|
4828
4849
|
this.commands.focus(this.options.autofocus);
|
|
4829
4850
|
this.emit("create", { editor: this });
|
|
4830
4851
|
this.isInitialized = true;
|
|
@@ -5024,6 +5045,7 @@ var SlideEditor = class extends EventEmitter {
|
|
|
5024
5045
|
*/
|
|
5025
5046
|
createExtensionManager() {
|
|
5026
5047
|
var _a, _b;
|
|
5048
|
+
console.log("[Core SlideEditor] createExtensionManager - enableCoreExtensions:", this.options.enableCoreExtensions);
|
|
5027
5049
|
const coreExtensions = this.options.enableCoreExtensions ? [
|
|
5028
5050
|
Editable,
|
|
5029
5051
|
ClipboardTextSerializer.configure({
|
|
@@ -5042,6 +5064,8 @@ var SlideEditor = class extends EventEmitter {
|
|
|
5042
5064
|
}
|
|
5043
5065
|
return true;
|
|
5044
5066
|
}) : [];
|
|
5067
|
+
console.log("[Core SlideEditor] coreExtensions:", coreExtensions.map((e) => e.name));
|
|
5068
|
+
console.log("[Core SlideEditor] this.options.extensions:", this.options.extensions.map((e) => e.name));
|
|
5045
5069
|
const allExtensions = [
|
|
5046
5070
|
...coreExtensions,
|
|
5047
5071
|
...this.options.extensions
|
|
@@ -5114,6 +5138,8 @@ var SlideEditor = class extends EventEmitter {
|
|
|
5114
5138
|
*/
|
|
5115
5139
|
createView(element) {
|
|
5116
5140
|
var _a;
|
|
5141
|
+
console.log("[Core SlideEditor] createView() called with element:", element);
|
|
5142
|
+
console.log("[Core SlideEditor] editorState:", this.editorState);
|
|
5117
5143
|
this.editorView = new import_view.EditorView(element, {
|
|
5118
5144
|
...this.options.editorProps,
|
|
5119
5145
|
attributes: {
|
|
@@ -5126,10 +5152,14 @@ var SlideEditor = class extends EventEmitter {
|
|
|
5126
5152
|
markViews: this.extensionManager.markViews,
|
|
5127
5153
|
nodeViews: this.extensionManager.nodeViews
|
|
5128
5154
|
});
|
|
5155
|
+
console.log("[Core SlideEditor] EditorView created:", this.editorView);
|
|
5156
|
+
console.log("[Core SlideEditor] EditorView.dom:", this.editorView.dom);
|
|
5129
5157
|
const newState = this.state.reconfigure({
|
|
5130
5158
|
plugins: this.extensionManager.plugins
|
|
5131
5159
|
});
|
|
5160
|
+
console.log("[Core SlideEditor] Reconfigured state with plugins");
|
|
5132
5161
|
this.view.updateState(newState);
|
|
5162
|
+
console.log("[Core SlideEditor] \u2705 View state updated");
|
|
5133
5163
|
this.prependClass();
|
|
5134
5164
|
this.injectCSS();
|
|
5135
5165
|
applyTheme(this.resolvedTheme, this.view.dom);
|