diff --git a/i18n/translations/en.json b/i18n/translations/en.json index 1592770f82..4bb9aa13e0 100644 --- a/i18n/translations/en.json +++ b/i18n/translations/en.json @@ -294,6 +294,9 @@ "field.blocks.heading.name": "Heading", "field.blocks.heading.text": "Text", "field.blocks.heading.placeholder": "Heading …", + "field.blocks.figure.back.plain": "White", + "field.blocks.figure.back.pattern.light": "Pattern (light)", + "field.blocks.figure.back.pattern.dark": "Pattern (dark)", "field.blocks.image.alt": "Alternative text", "field.blocks.image.caption": "Caption", "field.blocks.image.crop": "Crop", diff --git a/panel/lab/components/block/3_figure/index.vue b/panel/lab/components/block/3_figure/index.vue index 4be8a620de..6f3cec56d1 100644 --- a/panel/lab/components/block/3_figure/index.vue +++ b/panel/lab/components/block/3_figure/index.vue @@ -33,6 +33,17 @@ /> + + + + + diff --git a/panel/lab/components/frames/4_color/index.vue b/panel/lab/components/frames/4_color/index.vue index d5d73a5875..f8b6d6c8d0 100644 --- a/panel/lab/components/frames/4_color/index.vue +++ b/panel/lab/components/frames/4_color/index.vue @@ -25,6 +25,16 @@ /> + + + + + @@ -33,7 +43,7 @@ export default { computed: { ratios() { return ["1/1", "4/3", "16/9"]; - }, - }, + } + } }; diff --git a/panel/src/components/Forms/Blocks/Block.vue b/panel/src/components/Forms/Blocks/Block.vue index 6102e8ceea..3eeeb966e0 100644 --- a/panel/src/components/Forms/Blocks/Block.vue +++ b/panel/src/components/Forms/Blocks/Block.vue @@ -356,7 +356,7 @@ export default { diff --git a/panel/src/components/Forms/Blocks/Elements/BlockFigure.vue b/panel/src/components/Forms/Blocks/Elements/BlockFigure.vue index f199f4cc23..60ae1f31a3 100644 --- a/panel/src/components/Forms/Blocks/Elements/BlockFigure.vue +++ b/panel/src/components/Forms/Blocks/Elements/BlockFigure.vue @@ -1,5 +1,9 @@ @@ -32,6 +35,7 @@ export default { inheritAttrs: false, props: { + back: String, caption: String, captionMarks: { default: true, @@ -47,6 +51,10 @@ export default { diff --git a/panel/src/components/Forms/Blocks/Types/Fields.vue b/panel/src/components/Forms/Blocks/Types/Fields.vue index fbab57bcd8..6f17e0c007 100644 --- a/panel/src/components/Forms/Blocks/Types/Fields.vue +++ b/panel/src/components/Forms/Blocks/Types/Fields.vue @@ -40,7 +40,6 @@ import Block from "./Default.vue"; export default { extends: Block, props: { - endpoints: Object, tabs: Object }, data() { diff --git a/panel/src/components/Forms/Blocks/Types/Gallery.vue b/panel/src/components/Forms/Blocks/Types/Gallery.vue index 12aa8c465b..a3c6517f0a 100644 --- a/panel/src/components/Forms/Blocks/Types/Gallery.vue +++ b/panel/src/components/Forms/Blocks/Types/Gallery.vue @@ -1,7 +1,7 @@ @@ -35,6 +38,11 @@ import Block from "./Default.vue"; */ export default { extends: Block, + data() { + return { + back: this.onBack() ?? "white" + }; + }, computed: { captionMarks() { return this.field("caption", { marks: true }).marks; @@ -56,18 +64,51 @@ export default { ratio() { return this.content.ratio ?? false; } + }, + methods: { + onBack(value) { + const id = `kirby.imageBlock.${this.endpoints.field}.${this.id}`; + + if (value !== undefined) { + this.back = value; + sessionStorage.setItem(id, value); + } else { + return sessionStorage.getItem(id); + } + } } }; diff --git a/panel/src/components/Forms/Blocks/index.js b/panel/src/components/Forms/Blocks/index.js index b67ab3ccea..cdf6198c5e 100644 --- a/panel/src/components/Forms/Blocks/index.js +++ b/panel/src/components/Forms/Blocks/index.js @@ -8,7 +8,9 @@ import BlockPasteboard from "./BlockPasteboard.vue"; import BlockSelector from "./BlockSelector.vue"; // elements +import BlockBackgroundDropdown from "./Elements/BlockBackgroundDropdown.vue"; import BlockFigure from "./Elements/BlockFigure.vue"; +import BlockFigureCaption from "./Elements/BlockFigureCaption.vue"; import BlockTitle from "./Elements/BlockTitle.vue"; // types @@ -36,7 +38,9 @@ export default { app.component("k-block-selector", BlockSelector); // elements + app.component("k-block-background-dropdown", BlockBackgroundDropdown); app.component("k-block-figure", BlockFigure); + app.component("k-block-figure-caption", BlockFigureCaption); app.component("k-block-title", BlockTitle); // block types diff --git a/panel/src/components/Layout/Frame/ColorFrame.vue b/panel/src/components/Layout/Frame/ColorFrame.vue index 7b1c13f695..ce2d4f0b2f 100644 --- a/panel/src/components/Layout/Frame/ColorFrame.vue +++ b/panel/src/components/Layout/Frame/ColorFrame.vue @@ -1,5 +1,9 @@ @@ -28,6 +32,7 @@ export default {