Resolve deprecation warnings for ACE Editor 1.32.6
This commit is contained in:

committed by
Sebastian Serth

parent
b00d45521b
commit
e366ebd34c
@ -16,7 +16,7 @@ $(document).on('turbolinks:load', function(event) {
|
||||
if ($('#editor').isPresent() && CodeOceanEditor && event.originalEvent.data.url.includes("/implement")) {
|
||||
// This call will (amon other things) initializeEditors and load the content except for the last line
|
||||
// It must not be called during page navigation. Otherwise, content will be duplicated!
|
||||
// Search for insertLines and Turbolinks reload / cache control
|
||||
// Search for insertFullLines and Turbolinks reload / cache control
|
||||
CodeOceanEditor.initializeEverything();
|
||||
}
|
||||
|
||||
|
@ -282,14 +282,14 @@ var CodeOceanEditor = {
|
||||
var editor = ace.edit(element);
|
||||
|
||||
var document = editor.getSession().getDocument();
|
||||
// insert pre-existing code into editor. we have to use insertLines, otherwise the deltas are not properly added
|
||||
// insert pre-existing code into editor. we have to use insertFullLines, otherwise the deltas are not properly added
|
||||
var file_id = $(element).data('file-id');
|
||||
var content = $('.editor-content[data-file-id=' + file_id + ']');
|
||||
this.setActiveFile($(element).parent().data('filename'), file_id);
|
||||
|
||||
document.insertLines(0, content.text().split(/\n/));
|
||||
document.insertFullLines(0, content.text().split(/\n/));
|
||||
// remove last (empty) that is there by default line
|
||||
document.removeLines(document.getLength() - 1, document.getLength() - 1);
|
||||
document.removeFullLines(document.getLength() - 1, document.getLength() - 1);
|
||||
editor.setReadOnly($(element).parent().data('read-only') !== undefined);
|
||||
if (editor.getReadOnly()) {
|
||||
editor.setHighlightActiveLine(false);
|
||||
|
@ -15,13 +15,13 @@ $(document).on('turbolinks:load', function () {
|
||||
var editor = ace.edit(element);
|
||||
|
||||
var document = editor.getSession().getDocument();
|
||||
// insert pre-existing code into editor. we have to use insertLines, otherwise the deltas are not properly added
|
||||
// insert pre-existing code into editor. we have to use insertFullLines, otherwise the deltas are not properly added
|
||||
var file_id = $(element).data('file-id');
|
||||
var content = $('.editor-content[data-file-id=' + file_id + ']');
|
||||
|
||||
document.insertLines(0, content.text().split(/\n/));
|
||||
document.insertFullLines(0, content.text().split(/\n/));
|
||||
// remove last (empty) that is there by default; disabled due to missing last line
|
||||
// document.removeLines(document.getLength() - 1, document.getLength() - 1);
|
||||
// document.removeFullLines(document.getLength() - 1, document.getLength() - 1);
|
||||
editor.setReadOnly($(element).data('read-only') !== undefined);
|
||||
editor.setShowPrintMargin(false);
|
||||
editor.setTheme(CodeOceanEditor.THEME);
|
||||
|
Reference in New Issue
Block a user