Skip to content

Commit 3d92852

Browse files
committed
Remove unnecessary editor-content div from Tips and Exercises
The `editor-content` is only used for learners when implementing an exercise, not for teachers when editing tips or exercises. The corresponding JavaScript code was useless.
1 parent 5f54414 commit 3d92852

File tree

3 files changed

+2
-12
lines changed

3 files changed

+2
-12
lines changed

app/assets/javascripts/exercises.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,6 @@ $(document).on('turbolinks:load', function () {
99
const editor = ace.edit(element);
1010
const element_selector = $(element);
1111

12-
const document = editor.getSession().getDocument();
13-
// insert pre-existing code into editor. we have to use insertFullLines, otherwise the deltas are not properly added
14-
const file_id = element_selector.data('file-id');
15-
let content = $(`.editor-content[data-file-id=${file_id}]`);
16-
17-
document.insertFullLines(0, content.text().split(/\n/));
18-
// remove last (empty) that is there by default; disabled due to missing last line
19-
// document.removeFullLines(document.getLength() - 1, document.getLength() - 1);
2012
editor.setReadOnly(element_selector.data('read-only') !== undefined);
2113
editor.setShowPrintMargin(false);
2214
editor.setTheme(CodeOceanEditor.THEME);
@@ -27,7 +19,7 @@ $(document).on('turbolinks:load', function () {
2719
if ($('.edit_tip, .new_tip').isPresent()) {
2820
textarea = $('textarea[id="tip_example"]')
2921
}
30-
content = textarea.val();
22+
const content = textarea.val();
3123

3224
if (content !== undefined) {
3325
editor.getSession().setValue(content);
@@ -571,4 +563,4 @@ $(document).on('turbolinks:load', function () {
571563
}
572564

573565

574-
});
566+
});
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#editor-edit.original-input data-exercise-id[email protected]
22
#frames
33
.edit-frame
4-
.editor-content.d-none
54
.editor.allow_ace_tooltip

app/views/tips/_form.html.slim

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#editor-edit.original-input data-file-id[email protected]
2323
#frames
2424
.edit-frame
25-
.editor-content.d-none
2625
.editor.allow_ace_tooltip
2726
.actions = render('shared/submit_button', f:, object: @tip)
2827
.editor

0 commit comments

Comments
 (0)