Replace Ace Editor with ToastUi editor in the ExecutionEnvironments form

Drop unused code related to the Ace markdown editor.
This commit is contained in:
Julia Casamitjana
2024-04-11 10:55:55 +02:00
committed by Dominic Sauer
parent 17a4485ce2
commit f10bcb96a6
4 changed files with 9 additions and 28 deletions

View File

@ -1,7 +0,0 @@
$(document).on('turbolinks:load', function() {
if ($.isController('execution_environments')) {
if ($('.edit_execution_environment, .new_execution_environment').isPresent()) {
new MarkdownEditor('#execution_environment_help');
}
}
});

View File

@ -1,14 +0,0 @@
(function() {
window.MarkdownEditor = function(selector) {
var editor = ace.edit($(selector).next()[0]);
editor.on('change', function() {
$(selector).val(editor.getValue());
});
editor.setShowPrintMargin(false);
editor.setTheme(CodeOceanEditor.THEME);
var session = editor.getSession();
session.setMode('ace/mode/markdown');
session.setUseWrapMode(true);
session.setValue($(selector).val());
};
})();

View File

@ -125,10 +125,6 @@ html[data-bs-theme="light"] {
}
}
.markdown {
height: 200px;
}
.spinner {
width: 40px;
height: 40px;

View File

@ -1,4 +1,11 @@
= form_for(@execution_environment) do |f|
- content_for :head do
// Force a full page reload, see https://github.com/turbolinks/turbolinks/issues/326.
Otherwise, code might not be highlighted correctly (race condition)
meta name='turbolinks-visit-control' content='reload'
- append_javascript_pack_tag('toast-ui')
- append_stylesheet_pack_tag('toast-ui')
= form_for(@execution_environment, builder: MarkdownFormBuilder) do |f|
= render('shared/form_errors', object: @execution_environment)
.mb-3
= f.label(:name, class: 'form-label')
@ -51,6 +58,5 @@
= f.select(:testing_framework, @testing_framework_adapters, {include_blank: true}, class: 'form-control')
.mb-3
= f.label(:help, class: 'form-label')
= f.hidden_field(:help)
.form-control.markdown
= f.markdown :help
.actions = render('shared/submit_button', f:, object: @execution_environment)