Skip to content
This repository

ability to change parentElement of a terminal instead of document.body #52

Open
wants to merge 1 commit into from

3 participants

Patrick Debois Grégoire Pineau Daniel Risacher
Patrick Debois

By default terminals get appended to the bottom of document.body.

By setting the parentElement of the terminal before the open, you can control the position where the code gets inserted.

var term = new Terminal(80, 24);
term.parentElement = document.getElementById('terminal');
term.open();

Daniel Risacher

This feature is in the current codebase by setting options.parent or options.body.

Recommend closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 2 additions and 1 deletion. Show diff stats Hide diff stats

  1. 3  static/term.js
3  static/term.js
@@ -179,6 +179,7 @@ function Terminal(cols, rows, handler) {
179 179
   this.savedX;
180 180
   this.savedY;
181 181
   this.savedCols;
  182
+  this.parentElement = document.body;
182 183
 
183 184
   // stream
184 185
   this.readable = true;
@@ -340,7 +341,7 @@ Terminal.prototype.open = function() {
340 341
     this.children.push(div);
341 342
   }
342 343
 
343  
-  document.body.appendChild(this.element);
  344
+  this.parentElement.appendChild(this.element);
344 345
 
345 346
   this.refresh(0, this.rows - 1);
346 347
 
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.