From 6ac5ab6a3a4f8025b1d73b8a9e2f77bdea155ce5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20=C4=8Ciko=C5=A1?= Date: Thu, 10 Nov 2022 14:22:07 +0100 Subject: [PATCH] style: format source --- src/selections/selection-position.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/selections/selection-position.js b/src/selections/selection-position.js index 1e5f6d0a1..f4fc62473 100644 --- a/src/selections/selection-position.js +++ b/src/selections/selection-position.js @@ -53,10 +53,13 @@ const centerToolbar = function(toolbar, rect) { if (ranges && ranges.length === 1) { let startContainer = ranges[0].startContainer; - let nodeName = startContainer.$.nodeName; + if (startContainer.$.nodeType !== Node.ELEMENT_NODE) { startContainer = startContainer.getParent(); } + + const nodeName = startContainer.$.nodeName; + if (nodeName === 'TD' || nodeName === 'TH') { const startContainerClientRect = startContainer.getClientRect(); offsetHeight = startContainerClientRect.y - rect.top;