diff --git a/src/scripts/modules/Selection.js b/src/scripts/modules/Selection.js index d1da092..fa04130 100644 --- a/src/scripts/modules/Selection.js +++ b/src/scripts/modules/Selection.js @@ -501,7 +501,10 @@ const Selection = Module({ getSelectionBounds () { const currentRange = this.getCurrentRange(); const rangeRects = currentRange ? currentRange.getClientRects() : []; - const rangeBoundingClientRect = currentRange ? currentRange.getBoundingClientRect() : null; + // NB: This seems to be unnecessary. It's used later for logic that is causing incorrect toolbar alignment. + // Have commented out in case this is actually required for something else. + // - Fred + // const rangeBoundingClientRect = currentRange ? currentRange.getBoundingClientRect() : null; let selectionBounds = { top: null, @@ -536,10 +539,15 @@ const Selection = Module({ }; const setInitialBoundary = function (rangeRect) { - if (rangeBoundingClientRect) { - selectionBounds.initialLeft = rangeBoundingClientRect.left; - selectionBounds.initialWidth = rangeBoundingClientRect.width; - } else if (rangeRect.top === selectionBounds.top) { + // NB: I have commented this out because it is causing inaccurate toolbar alignment. + // I am leaving it here for now in case it was actually meant for something that I + // can't recall right now. + // - Fred + // if (rangeBoundingClientRect) { + // selectionBounds.initialLeft = rangeBoundingClientRect.left; + // selectionBounds.initialWidth = rangeBoundingClientRect.width; + // } else + if (rangeRect.top === selectionBounds.top) { if (selectionBounds.initialLeft === null) { selectionBounds.initialLeft = rangeRect.left; } else {