|
@@ -39,7 +39,8 @@ export class DOMConsole {
|
|
return 3;
|
|
return 3;
|
|
}
|
|
}
|
|
|
|
|
|
- constructor (elementID) {
|
|
|
|
|
|
+ constructor (elementID, disableMarginTop = false) {
|
|
|
|
+ this.disableMarginTop = disableMarginTop;
|
|
this.input = null;
|
|
this.input = null;
|
|
this.cursorInterval = null;
|
|
this.cursorInterval = null;
|
|
this.idleInterval = null;
|
|
this.idleInterval = null;
|
|
@@ -198,10 +199,16 @@ export class DOMConsole {
|
|
}
|
|
}
|
|
|
|
|
|
getOutputText (text) {
|
|
getOutputText (text) {
|
|
|
|
+ if(text.trim().length == 0) {
|
|
|
|
+ text = " ";
|
|
|
|
+ }
|
|
return `<span>${text}</span>`;
|
|
return `<span>${text}</span>`;
|
|
}
|
|
}
|
|
|
|
|
|
getUserInputText (text) {
|
|
getUserInputText (text) {
|
|
|
|
+ if(text.trim().length == 0) {
|
|
|
|
+ text = " ";
|
|
|
|
+ }
|
|
return `<i class="icon keyboard outline" style="float:left"></i><span>${text}</span>`;
|
|
return `<i class="icon keyboard outline" style="float:left"></i><span>${text}</span>`;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -213,8 +220,7 @@ export class DOMConsole {
|
|
focus () {
|
|
focus () {
|
|
this.termDiv.style.display = 'block';
|
|
this.termDiv.style.display = 'block';
|
|
// Is in draggable mode?
|
|
// Is in draggable mode?
|
|
- console.log(this.parent.style.top.length);
|
|
|
|
- if(this.parent.style.top.length == 0) {
|
|
|
|
|
|
+ if(!this.disableMarginTop && this.parent.style.top.length == 0) {
|
|
this.parent.style.marginTop = "-160px";
|
|
this.parent.style.marginTop = "-160px";
|
|
}
|
|
}
|
|
if(!isElementInViewport(this.termDiv))
|
|
if(!isElementInViewport(this.termDiv))
|
|
@@ -224,7 +230,7 @@ export class DOMConsole {
|
|
|
|
|
|
hide () {
|
|
hide () {
|
|
// Is in draggable mode?
|
|
// Is in draggable mode?
|
|
- if(this.parent.style.top.length == 0) {
|
|
|
|
|
|
+ if(!this.disableMarginTop && this.parent.style.top.length == 0) {
|
|
this.parent.style.marginTop = "0";
|
|
this.parent.style.marginTop = "0";
|
|
}
|
|
}
|
|
this.termDiv.style.display = 'none';
|
|
this.termDiv.style.display = 'none';
|
|
@@ -297,7 +303,8 @@ export class DOMConsole {
|
|
sendOutput (text) {
|
|
sendOutput (text) {
|
|
const output = ""+text;
|
|
const output = ""+text;
|
|
output.split("\n").forEach(t => {
|
|
output.split("\n").forEach(t => {
|
|
- t = t.replace(/\t/g,'	');
|
|
|
|
|
|
+ t = t.replace(/\t/g,' ');
|
|
|
|
+ t = t.replace(/\s/g," ");
|
|
this.write(t)
|
|
this.write(t)
|
|
});
|
|
});
|
|
}
|
|
}
|