From dccc60b7cadfe7ca4fd78a60c341c778be6e825f Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Sun, 4 Sep 2022 23:12:46 +0200 Subject: [PATCH] Remove `renderWebsocketOutput` and use `printWebsocketOutput` instead * The `render` command is not used much * Originally added with commit 898074be3f * The `#render` anchor (see findOrCreateRenderElement) was the "Render" button above the editor, nothing was rendered at all if executing code and otherwise it would be included _within_ the button. --- app/assets/javascripts/editor/editor.js.erb | 10 ---------- app/assets/javascripts/editor/evaluation.js | 5 ----- app/assets/javascripts/editor/execution.js | 2 +- 3 files changed, 1 insertion(+), 16 deletions(-) diff --git a/app/assets/javascripts/editor/editor.js.erb b/app/assets/javascripts/editor/editor.js.erb index ee564da6..05b472cd 100644 --- a/app/assets/javascripts/editor/editor.js.erb +++ b/app/assets/javascripts/editor/editor.js.erb @@ -84,16 +84,6 @@ var CodeOceanEditor = { } }, - findOrCreateRenderElement: function (index) { - if ($('#render-' + index).isPresent()) { - return $('#render-' + index); - } else { - var element = $('
').attr('id', 'render-' + index); - $('#render').append(element); - return element; - } - }, - getCardClass: function (result) { if (result.file_role === 'teacher_defined_linter') { return 'card bg-info text-white' diff --git a/app/assets/javascripts/editor/evaluation.js b/app/assets/javascripts/editor/evaluation.js index 23eb9533..31666c0c 100644 --- a/app/assets/javascripts/editor/evaluation.js +++ b/app/assets/javascripts/editor/evaluation.js @@ -174,11 +174,6 @@ CodeOceanEditorEvaluation = { /** * Output-Logic */ - renderWebsocketOutput: function (msg) { - var element = this.findOrCreateRenderElement(0); - element.append(msg.data); - }, - printWebsocketOutput: function (msg) { if (!msg.data || msg.data === "\r") { return; diff --git a/app/assets/javascripts/editor/execution.js b/app/assets/javascripts/editor/execution.js index ec1784c9..2fd6245b 100644 --- a/app/assets/javascripts/editor/execution.js +++ b/app/assets/javascripts/editor/execution.js @@ -44,7 +44,7 @@ CodeOceanEditorWebsocket = { this.websocket.on('clear', this.clearOutput.bind(this)); this.websocket.on('turtle', this.handleTurtleCommand.bind(this)); this.websocket.on('turtlebatch', this.handleTurtlebatchCommand.bind(this)); - this.websocket.on('render', this.renderWebsocketOutput.bind(this)); + this.websocket.on('render', this.printWebsocketOutput.bind(this)); this.websocket.on('exit', this.handleExitCommand.bind(this)); this.websocket.on('status', this.showStatus.bind(this)); this.websocket.on('hint', this.showHint.bind(this));