@blockslides/core 0.2.0 → 0.3.0
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.d.mts +10 -8
- package/dist/index.d.ts +10 -8
- package/dist/index.js +28 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -4795,6 +4795,7 @@ var SlideEditor = class extends EventEmitter {
|
|
|
4795
4795
|
if (this.editorView) {
|
|
4796
4796
|
return this.editorView;
|
|
4797
4797
|
}
|
|
4798
|
+
const editor = this;
|
|
4798
4799
|
return new Proxy(
|
|
4799
4800
|
{
|
|
4800
4801
|
state: this.editorState,
|
|
@@ -4808,7 +4809,9 @@ var SlideEditor = class extends EventEmitter {
|
|
|
4808
4809
|
composing: false,
|
|
4809
4810
|
dragging: null,
|
|
4810
4811
|
editable: true,
|
|
4811
|
-
isDestroyed
|
|
4812
|
+
get isDestroyed() {
|
|
4813
|
+
return editor.editorView == null;
|
|
4814
|
+
}
|
|
4812
4815
|
},
|
|
4813
4816
|
{
|
|
4814
4817
|
get: (obj, key) => {
|
|
@@ -5027,6 +5030,14 @@ var SlideEditor = class extends EventEmitter {
|
|
|
5027
5030
|
* @param transaction An editor state transaction
|
|
5028
5031
|
*/
|
|
5029
5032
|
dispatchTransaction(transaction) {
|
|
5033
|
+
var _a;
|
|
5034
|
+
console.log("[dispatchTransaction]", {
|
|
5035
|
+
hasView: !!this.editorView,
|
|
5036
|
+
isDestroyed: this.isDestroyed,
|
|
5037
|
+
hasState: !!this.state,
|
|
5038
|
+
selection: (_a = this.state) == null ? void 0 : _a.selection,
|
|
5039
|
+
bubbleMenuMeta: typeof transaction.getMeta === "function" ? transaction.getMeta("bubbleMenu") : void 0
|
|
5040
|
+
});
|
|
5030
5041
|
if (this.view.isDestroyed) {
|
|
5031
5042
|
return;
|
|
5032
5043
|
}
|
|
@@ -5036,8 +5047,8 @@ var SlideEditor = class extends EventEmitter {
|
|
|
5036
5047
|
return;
|
|
5037
5048
|
}
|
|
5038
5049
|
transaction.steps.forEach((step) => {
|
|
5039
|
-
var
|
|
5040
|
-
return (
|
|
5050
|
+
var _a2;
|
|
5051
|
+
return (_a2 = this.capturedTransaction) == null ? void 0 : _a2.step(step);
|
|
5041
5052
|
});
|
|
5042
5053
|
return;
|
|
5043
5054
|
}
|
|
@@ -5171,6 +5182,7 @@ var SlideEditor = class extends EventEmitter {
|
|
|
5171
5182
|
* Destroy the editor.
|
|
5172
5183
|
*/
|
|
5173
5184
|
destroy() {
|
|
5185
|
+
console.log("[editor destroy]", { instanceId: this.instanceId });
|
|
5174
5186
|
this.emit("destroy");
|
|
5175
5187
|
this.unmount();
|
|
5176
5188
|
this.removeAllListeners();
|
|
@@ -5413,14 +5425,14 @@ function parseLayout(layout, columnCount) {
|
|
|
5413
5425
|
const ratios = layout.split("-").map(Number);
|
|
5414
5426
|
if (ratios.length !== columnCount) {
|
|
5415
5427
|
console.warn(
|
|
5416
|
-
`[BlockSlides] Layout '${layout}' expects ${ratios.length} column(s) but found ${columnCount} column(s) in the
|
|
5428
|
+
`[BlockSlides] Layout '${layout}' expects ${ratios.length} column(s) but found ${columnCount} column(s) in the columnGroup. Using equal distribution.`
|
|
5417
5429
|
);
|
|
5418
5430
|
return new Array(columnCount).fill(1);
|
|
5419
5431
|
}
|
|
5420
5432
|
return ratios;
|
|
5421
5433
|
}
|
|
5422
|
-
function
|
|
5423
|
-
const columns = Array.from(
|
|
5434
|
+
function applyLayoutToColumnGroup(columnGroupElement, layout) {
|
|
5435
|
+
const columns = Array.from(columnGroupElement.children).filter(
|
|
5424
5436
|
(el) => el.getAttribute("data-node-type") === "column"
|
|
5425
5437
|
);
|
|
5426
5438
|
if (columns.length === 0) {
|
|
@@ -5436,16 +5448,19 @@ function applyLayoutToRow(rowElement, layout) {
|
|
|
5436
5448
|
});
|
|
5437
5449
|
}
|
|
5438
5450
|
function applyAllLayouts(editorElement) {
|
|
5439
|
-
const
|
|
5440
|
-
'[data-node-type="
|
|
5451
|
+
const columnGroups = editorElement.querySelectorAll(
|
|
5452
|
+
'[data-node-type="columnGroup"]'
|
|
5441
5453
|
);
|
|
5442
|
-
|
|
5443
|
-
const layout =
|
|
5454
|
+
columnGroups.forEach((columnGroup) => {
|
|
5455
|
+
const layout = columnGroup.getAttribute("data-layout");
|
|
5444
5456
|
if (layout && layout !== "auto") {
|
|
5445
|
-
|
|
5457
|
+
applyLayoutToColumnGroup(columnGroup, layout);
|
|
5446
5458
|
}
|
|
5447
5459
|
});
|
|
5448
5460
|
}
|
|
5461
|
+
function applyLayoutToRow(rowElement, layout) {
|
|
5462
|
+
applyLayoutToColumnGroup(rowElement, layout);
|
|
5463
|
+
}
|
|
5449
5464
|
|
|
5450
5465
|
// src/utilities/markdown/index.ts
|
|
5451
5466
|
var markdown_exports = {};
|
|
@@ -6373,6 +6388,7 @@ export {
|
|
|
6373
6388
|
SlideEditor,
|
|
6374
6389
|
Tracker,
|
|
6375
6390
|
applyAllLayouts,
|
|
6391
|
+
applyLayoutToColumnGroup,
|
|
6376
6392
|
applyLayoutToRow,
|
|
6377
6393
|
applyTheme,
|
|
6378
6394
|
callOrReturn,
|