Skip to content

Commit cd52819

Browse files
committed
fix: stop sidebar resizer stranding in the editor area
1 parent ffe4019 commit cd52819

3 files changed

Lines changed: 9 additions & 4 deletions

File tree

‎src/utils/Resizer.js‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,9 +394,13 @@ define(function (require, exports, module) {
394394
// reposition it if the element size changes externally
395395
function repositionResizer(elementSize) {
396396
var resizerPosition = elementSize || 1;
397-
if (position === POSITION_RIGHT || position === POSITION_BOTTOM) {
398-
$resizer.css(resizerCSSPosition, resizerPosition);
397+
if (position !== POSITION_RIGHT && position !== POSITION_BOTTOM) {
398+
return;
399399
}
400+
if (collapsible && !isVisible($element)) {
401+
return;
402+
}
403+
$resizer.css(resizerCSSPosition, resizerPosition);
400404
}
401405

402406
$element.data("removeSizable", function () {

‎src/view/CentralControlBar.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ define(function (require, exports, module) {
209209
if (targetWidth < minLPToolbarWidth) {
210210
targetWidth = minLPToolbarWidth;
211211
}
212-
if (sidebarWidth + BAR_WIDTH + targetWidth + MIN_EDITOR_WIDTH > window.innerWidth) {
212+
if (SidebarView.isVisible() &&
213+
sidebarWidth + BAR_WIDTH + targetWidth + MIN_EDITOR_WIDTH > window.innerWidth) {
213214
const trimmedSidebar = Math.max(30, window.innerWidth - BAR_WIDTH - targetWidth - MIN_EDITOR_WIDTH);
214215
$sidebar.width(trimmedSidebar);
215216
// jQuery .width() sidesteps Resizer — manually reposition its handle so

‎src/view/WorkspaceManager.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ define(function (require, exports, module) {
601601
return;
602602
}
603603
var $sb = $("#sidebar");
604-
if (!$sb.length || $sb[0].offsetWidth === 0) {
604+
if (!$sb.length || !Resizer.isVisible($sb) || $sb[0].offsetWidth === 0) {
605605
return;
606606
}
607607
var toolbarW = $mainToolbar.is(":visible") ? $mainToolbar.width() : 0;

0 commit comments

Comments
 (0)