From eee289aee8a0f8603c70d5922f2019a8e73904a2 Mon Sep 17 00:00:00 2001 From: Veeck Date: Sat, 10 Dec 2022 21:17:29 +0100 Subject: [PATCH] Only add clock type wrappers to DOM when they are used (#2971) Fixes a layout gap when digital clock is displayd on the left Reported via discord: https://discord.com/channels/545884423703494657/545884914982322177/1044376412997562418 Co-authored-by: veeck --- CHANGELOG.md | 1 + modules/default/clock/clock.js | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 64d1b6ea..bd6520b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ Special thanks to: @rejas, @sdetweil, @MagMar94 - Possibility to change FontAwesome class in calendar, so icons like `fab fa-facebook-square` works. - Fix cors problems with newsfeed articles (as far as possible), allow disabling cors per feed with option `useCorsProxy: false` (#2840) - Tests not waiting for the application to start and stop before starting the next test +- Fixed gap in clock module when displayed on the left side with displayType=digital ## [2.21.0] - 2022-10-01 diff --git a/modules/default/clock/clock.js b/modules/default/clock/clock.js index 7c9310f0..31922a58 100644 --- a/modules/default/clock/clock.js +++ b/modules/default/clock/clock.js @@ -303,7 +303,7 @@ Module.register("clock", { } /******************************************* - * Update placement, respect old analogShowDate even if its not needed anymore + * Update placement, respect old analogShowDate even if it's not needed anymore */ if (this.config.displayType === "analog") { // Display only an analog clock @@ -311,16 +311,16 @@ Module.register("clock", { wrapper.classList.add("clockGrid--bottom"); } else if (this.config.analogShowDate === "bottom") { wrapper.classList.add("clockGrid--top"); - } else { - //analogWrapper.style.gridArea = "center"; } + wrapper.appendChild(analogWrapper); + } else if (this.config.displayType === "digital") { + wrapper.appendChild(digitalWrapper); } else if (this.config.displayType === "both") { wrapper.classList.add("clockGrid--" + this.config.analogPlacement); + wrapper.appendChild(analogWrapper); + wrapper.appendChild(digitalWrapper); } - wrapper.appendChild(analogWrapper); - wrapper.appendChild(digitalWrapper); - // Return the wrapper to the dom. return wrapper; }