We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2ee068f commit 8342d68Copy full SHA for 8342d68
app/assets/javascripts/editor/editor.js
@@ -281,7 +281,8 @@ var CodeOceanEditor = {
281
this.setActiveFile($(element).parent().data('filename'), file_id);
282
283
const full_lines = content.text().split(/\n/);
284
- if (full_lines.length >= 1 && full_lines[0] !== "") {
+ // Prevent inserting a single empty line, as the editor already contains one by default.
285
+ if (full_lines.length > 1 || (full_lines.length === 1 && full_lines[0] !== "")) {
286
document.insertFullLines(0, full_lines);
287
// remove last (empty) that is there by default line
288
document.removeFullLines(document.getLength() - 1, document.getLength() - 1);
0 commit comments