From 4d8eec73998c4e9956638e423b41ed9542fa67f7 Mon Sep 17 00:00:00 2001 From: dragonwocky Date: Sun, 24 Oct 2021 13:30:21 +1100 Subject: [PATCH] tweak: image alignment (center/left/right) --- repo/tweaks/client.css | 7 +++++++ repo/tweaks/client.mjs | 5 +++++ repo/tweaks/mod.json | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/repo/tweaks/client.css b/repo/tweaks/client.css index 27c2677..b5491b7 100644 --- a/repo/tweaks/client.css +++ b/repo/tweaks/client.css @@ -133,3 +133,10 @@ right: 2px; bottom: -2px; } + +.enhancer--tweak-img_alignment-left .notion-image-block { + align-self: start !important; +} +.enhancer--tweak-img_alignment-right .notion-image-block { + align-self: end !important; +} diff --git a/repo/tweaks/client.mjs b/repo/tweaks/client.mjs index b859e55..782d579 100644 --- a/repo/tweaks/client.mjs +++ b/repo/tweaks/client.mjs @@ -47,4 +47,9 @@ export default async function ({ web }, db) { document.body.classList.add(`enhancer--tweak-${tweak}`); } } + + const imgAlignment = await db.get(['tweak.img_alignment']); + if (imgAlignment !== 'center') { + document.body.classList.add(`enhancer--tweak-img_alignment-${imgAlignment}`); + } } diff --git a/repo/tweaks/mod.json b/repo/tweaks/mod.json index a95f443..77e5e2d 100644 --- a/repo/tweaks/mod.json +++ b/repo/tweaks/mod.json @@ -113,6 +113,12 @@ "label": "quote block quotation marks", "tooltip": "**wrap quote block content in large, decorative serif quotation marks**", "value": false + }, + { + "type": "select", + "key": "tweak.img_alignment", + "label": "image alignment", + "values": ["center", "left", "right"] } ] }