@blockslides/core 0.2.0 → 0.3.1

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.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: false
4812
+ get isDestroyed() {
4813
+ return editor.editorView == null;
4814
+ }
4812
4815
  },
4813
4816
  {
4814
4817
  get: (obj, key) => {
@@ -5413,14 +5416,14 @@ function parseLayout(layout, columnCount) {
5413
5416
  const ratios = layout.split("-").map(Number);
5414
5417
  if (ratios.length !== columnCount) {
5415
5418
  console.warn(
5416
- `[BlockSlides] Layout '${layout}' expects ${ratios.length} column(s) but found ${columnCount} column(s) in the row. Using equal distribution.`
5419
+ `[BlockSlides] Layout '${layout}' expects ${ratios.length} column(s) but found ${columnCount} column(s) in the columnGroup. Using equal distribution.`
5417
5420
  );
5418
5421
  return new Array(columnCount).fill(1);
5419
5422
  }
5420
5423
  return ratios;
5421
5424
  }
5422
- function applyLayoutToRow(rowElement, layout) {
5423
- const columns = Array.from(rowElement.children).filter(
5425
+ function applyLayoutToColumnGroup(columnGroupElement, layout) {
5426
+ const columns = Array.from(columnGroupElement.children).filter(
5424
5427
  (el) => el.getAttribute("data-node-type") === "column"
5425
5428
  );
5426
5429
  if (columns.length === 0) {
@@ -5436,16 +5439,19 @@ function applyLayoutToRow(rowElement, layout) {
5436
5439
  });
5437
5440
  }
5438
5441
  function applyAllLayouts(editorElement) {
5439
- const rows = editorElement.querySelectorAll(
5440
- '[data-node-type="row"]'
5442
+ const columnGroups = editorElement.querySelectorAll(
5443
+ '[data-node-type="columnGroup"]'
5441
5444
  );
5442
- rows.forEach((row) => {
5443
- const layout = row.getAttribute("data-layout");
5445
+ columnGroups.forEach((columnGroup) => {
5446
+ const layout = columnGroup.getAttribute("data-layout");
5444
5447
  if (layout && layout !== "auto") {
5445
- applyLayoutToRow(row, layout);
5448
+ applyLayoutToColumnGroup(columnGroup, layout);
5446
5449
  }
5447
5450
  });
5448
5451
  }
5452
+ function applyLayoutToRow(rowElement, layout) {
5453
+ applyLayoutToColumnGroup(rowElement, layout);
5454
+ }
5449
5455
 
5450
5456
  // src/utilities/markdown/index.ts
5451
5457
  var markdown_exports = {};
@@ -6373,6 +6379,7 @@ export {
6373
6379
  SlideEditor,
6374
6380
  Tracker,
6375
6381
  applyAllLayouts,
6382
+ applyLayoutToColumnGroup,
6376
6383
  applyLayoutToRow,
6377
6384
  applyTheme,
6378
6385
  callOrReturn,