Skip to content

Commit 7c37ed9

Browse files
authored
Improvements for terminal plugins support 🔧
1 parent 4488579 commit 7c37ed9

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

src/code-runner-wc.js

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -292,15 +292,18 @@ See the repo if there is any plugins that support "${this.getAttribute("language
292292
} else{
293293
// Code Runner WC - is NOT using Piston API & a plugin has been loaded.
294294

295-
// load ace editor for custom compiler plugin
296-
async function AceEditorForCustomPlugin(element){
295+
// make sure the editor is only set for non-terminal.
296+
if (!this.getAttribute("custom-compiler").includes("shell") && !this.getAttribute("custom-compiler").includes("terminal")){
297+
// load ace editor for custom compiler plugin
298+
async function AceEditorForPistonAPI(element){
297299
// Wait till AceEditor is loaded - so no errors occur.
298300
let isAceLoaded = await loadAceEditor()
299-
if (isAceLoaded.loaded === "true"){
300-
CreateAceCodeEditor(element, element.getAttribute("language").toLowerCase())//
301-
}
302-
}
303-
AceEditorForCustomPlugin(this)
301+
if (isAceLoaded.loaded === "true"){
302+
CreateAceCodeEditor(element, element.getAttribute("language").toLowerCase())//
303+
}
304+
}
305+
AceEditorForPistonAPI(this)
306+
}
304307
}
305308

306309

@@ -429,17 +432,8 @@ function handleclick(codeRunner){
429432
}
430433

431434

432-
433-
434-
window.customElements.define('code-runner', CodeRunner);
435-
436-
437-
438-
// LEAVE THESE OUTSIDE OF THE CLASS - SO THEY CAN BE USED FOR CUSTOM PLUGINS
439-
440435
/// function to create Ace Editors for CodeRunner-WC
441436

442-
443437
function CreateAceCodeEditor(html_element, language){
444438

445439
// url to load Ace Editor + resources
@@ -483,4 +477,6 @@ editor.setOptions({
483477
maxLines: Infinity
484478
});
485479
}
480+
486481

482+
window.customElements.define('code-runner', CodeRunner);

0 commit comments

Comments
 (0)