-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Paste and Documentation #344
Comments
I can not use paste, can you please let me know if there are any example code/fix for my code? |
Hi @goflatworld, if you are attaching a socket on your terminal using the attach addon, this should work fine out of the box. If this does not work for you, can you please:
|
Hi @parisk, I don't have the console log at the moment, I'll try to get it when I can access the device. I have uploaded the relevant code to below URL. https://github.com/goflatworld/xtermjs In the PHP file, it includes multiple files however all these included files (except the attach.js) are included in the xterm.js 2.0. I only modified attach.js a bit to suit my needs and I have attached that js to the source code as well. Please let me know if you need anything else. Thanks Thanks |
Here is what I tried in the browser:
SCRIPT5022: IndexSizeError File: xterm.js, Line: 484, Column: 7 And the code is as below. It points to r = s.getRangeAt(0); var s = document.getSelection(), |
Thanks for sharing @goflatworld. This issue got fixed in #332 (this is where the criminal line got removed 😅 ). Please update your version of xterm.js to 2.1.0, which got released this week and everything should be fine. I am closing this issue now, but feel free to drop any other comments or re-open it if this issue continues to exist. |
Thanks Parisk for updating this. I have tested the new code and I'm sorry to let you know that paste still doesn't work for me. Below is my testing result:
Do you mind double check my code to see if it has any issue? Do you mind post an example which shows that paste works? |
Details
Steps to reproduce
Thanks for the code. It is a good terminal simulator. Can you please help on below issues/questions? It would be much appreciated.
I have below code (taken from the example and modified a bit for my application). It works however I can not use paste. I tried the new xterm.js code which was published around 7 days ago, but with new code, it even doesn't show the terminal. I tried to find out more documentation about this package on how to use the xterm.js but no luck...
Here is what I have done:
Download the code, save the code to the web home folder.
Wrote below simple HTML file to use the xterm.js
I see people talked about build the xterm.js. This really confused me.... I thought that Javascript doesn't need any extra work apart from include it in my file?
........................................................................
<!doctype html>
<title>Stingray Solution</title> <script> var hash= "\n"; </script> <script src="xterminal.js/dist/xterm.js" ></script>........................................................................
Below is the main.js
........................................................................
var term,
protocol,
socketURL,
socket,
pid,
charWidth,
charHeight;
var terminalContainer = document.getElementById('terminal-container');
createTerminal();
function createTerminal() {
while (terminalContainer.children.length) {
terminalContainer.removeChild(terminalContainer.children[0]);
}
term = new Terminal({
cursorBlink: true
});
protocol = 'wss://';
socketURL = 'wss://www.flatworld.com:443';
term.open(terminalContainer);
term.fit();
var initialGeometry = term.proposeGeometry(),
cols = 80,
rows = 30;
});
term.on('paste', function (data, ev) {
socket.send(data);
});
}
function onClose()
{
term.write("\rDisconnected from server.");
}
function onError()
{
term.write("\rFail: ");
term.write("Communication error");
}
........................................................................
The text was updated successfully, but these errors were encountered: