From b00ca7fbf124cd9740bcb488eaa28c67a879a8f8 Mon Sep 17 00:00:00 2001 From: Fred Every Date: Tue, 19 Jun 2018 15:24:16 +0200 Subject: [PATCH 1/2] #31 - Comment out logic that seems unnecessary --- src/scripts/modules/Selection.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/scripts/modules/Selection.js b/src/scripts/modules/Selection.js index d1da092..8324cb8 100644 --- a/src/scripts/modules/Selection.js +++ b/src/scripts/modules/Selection.js @@ -501,7 +501,7 @@ const Selection = Module({ getSelectionBounds () { const currentRange = this.getCurrentRange(); const rangeRects = currentRange ? currentRange.getClientRects() : []; - const rangeBoundingClientRect = currentRange ? currentRange.getBoundingClientRect() : null; + // const rangeBoundingClientRect = currentRange ? currentRange.getBoundingClientRect() : null; let selectionBounds = { top: null, @@ -536,10 +536,11 @@ const Selection = Module({ }; const setInitialBoundary = function (rangeRect) { - if (rangeBoundingClientRect) { - selectionBounds.initialLeft = rangeBoundingClientRect.left; - selectionBounds.initialWidth = rangeBoundingClientRect.width; - } else if (rangeRect.top === selectionBounds.top) { + // 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 { From 594b9ba52e9fe90d7b752f77d2106de293760f81 Mon Sep 17 00:00:00 2001 From: Fred Every Date: Wed, 27 Jun 2018 20:56:11 +0200 Subject: [PATCH 2/2] #31 - Disclaimer commented code --- src/scripts/modules/Selection.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/scripts/modules/Selection.js b/src/scripts/modules/Selection.js index 8324cb8..fa04130 100644 --- a/src/scripts/modules/Selection.js +++ b/src/scripts/modules/Selection.js @@ -501,6 +501,9 @@ const Selection = Module({ getSelectionBounds () { const currentRange = this.getCurrentRange(); const rangeRects = currentRange ? currentRange.getClientRects() : []; + // 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 = { @@ -536,6 +539,10 @@ const Selection = Module({ }; const setInitialBoundary = function (rangeRect) { + // 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;