From 94f55e0d7ffed2556cb9ba065115f3d6d23e6737 Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Thu, 23 May 2024 12:35:12 +0200 Subject: [PATCH] service2.js: Revise --- samples/styles.css | 3 ++- service2.js | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/samples/styles.css b/samples/styles.css index 01c0f85..39d24c4 100644 --- a/samples/styles.css +++ b/samples/styles.css @@ -17,5 +17,6 @@ } .ck-editor__editable { - height: 400px; + min-height: 100px; + max-height: 500px; } diff --git a/service2.js b/service2.js index d8aadbe..00a831d 100644 --- a/service2.js +++ b/service2.js @@ -309,7 +309,7 @@ class BesService { const scrollLeft = window.scrollX || document.documentElement.scrollLeft const scrollTop = window.scrollY || document.documentElement.scrollTop this.statusDiv.style.left = `${rect.right - 40 + scrollLeft}px` - this.statusDiv.style.top = `${rect.top + rect.height - 30 + scrollTop}px` + this.statusDiv.style.top = `${rect.bottom - 30 + scrollTop}px` } /** @@ -911,12 +911,14 @@ class BesCKService extends BesTreeService { * Repositions status DIV element. */ setStatusDivPosition() { - // TODO: New position needs to be tested on better displays (4K, etc.) + // TODO: The position returned by this.hostElement.getBoundingClientRect() appears to be absolute, + // while this.statusDiv.style.left and .top require relative position. Either compensate by subtracting + // CKEditor frame position, or change statusDiv placement to absolute. const rect = this.hostElement.getBoundingClientRect() const scrollLeft = window.scrollX || document.documentElement.scrollLeft const scrollTop = window.scrollY || document.documentElement.scrollTop this.statusDiv.style.left = `${rect.right - 50 + scrollLeft}px` - this.statusDiv.style.top = `${rect.top + rect.height - 120 + scrollTop}px` + this.statusDiv.style.top = `${rect.bottom - 120 + scrollTop}px` } }