Skip to content

Commit 397fa78

Browse files
committed
fix: delete empty lines when deleting an element from the live preview
1 parent 36c692f commit 397fa78

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/LiveDevelopment/LivePreviewEdit.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,13 @@ define(function (require, exports, module) {
138138
}
139139

140140
editor.replaceRange("", range.from, range.to);
141+
142+
// since we remove content from the source, we want to clear the extra line
143+
if(range.from.line !== 0) {
144+
const prevLineText = editor.getLine(range.from.line - 1);
145+
const chPrevLine = prevLineText ? prevLineText.length : 0;
146+
editor.replaceRange("", {line: range.from.line - 1, ch: chPrevLine}, range.from);
147+
}
141148
}
142149

143150
/**

0 commit comments

Comments
 (0)