Skip to content

Commit

Permalink
Ensure layout blocks have a default ratio
Browse files Browse the repository at this point in the history
  • Loading branch information
wmnnd committed Apr 28, 2023
1 parent c081509 commit 19bae75
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Unreleased

## Version 0.12.0
## Version 0.12.1

New Campaign Block Editor 📝

Expand Down
4 changes: 2 additions & 2 deletions assets/js/campaign-editors/block/blocks/layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const _requiredClasses = "grid-cols-2 grid-cols-3 col-span-1 col-span-2 col-span

export default class Layout {
constructor({ data, config, api, block }) {
this.data = data.blocks ? data : { blocks: [], columns: 2 }
this.data = data.blocks && data.ratio ? data : { blocks: [], columns: 2, ratio: "1-1" }
this.editors = []
this.config = config

Expand All @@ -21,7 +21,7 @@ export default class Layout {

drawView() {
this.wrapper.innerHTML = ""
const colSpans = (this.data.ratio || "1-1").split("-").map(colSpan => parseInt(colSpan))
const colSpans = this.data.ratio.split("-").map(colSpan => parseInt(colSpan))
const colSpanTotal = colSpans.reduce((acc, i) => acc + i)
this.wrapper.className = `layout-block grid grid-cols-${colSpanTotal} gap-4`
this.editors = []
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule Keila.MixProject do
def project do
[
app: :keila,
version: "0.12.0",
version: "0.12.1",
elixir: "~> 1.14",
elixirc_paths: elixirc_paths(Mix.env()),
compilers: [:phoenix] ++ Mix.compilers(),
Expand Down

0 comments on commit 19bae75

Please sign in to comment.