Open VigibotDev opened 9 years ago
Please recheck master
Awesome and useful trick I test it tonight. Thanks a lot !!!!
This should fix #97 too.
Does it work?
Sorry for the delay, I must launch terminal.js from node-webterm ASAP.
I want to replace term.js with terminal.js on my website, just need to work on the minimal socket.io implementaiton of terminal.js (don't need static I use Apache and it reverse proxy). And the missing Cut/Past.
Copy should work as it, paste can easy be added:
<input type=text id="foo">
<input type=button onclick="terminal.write(document.getElementById('foo').value)">
Just need to build before test... There is a "dist" (and minified) version inside the node package, but how I can get this from sources ?
npm install; node_modules/.bin/grunt
you are too fast lol
i just discovered grunt thanks:)
fast by accident ;)
NOK:( always AltGr + 3-to-8 not working (the \ produce always a backspace delete)
Do you use vanilla node-webterminal to test? Which browser and OS?
Firefox 40.0.3 / Windows Server 2012 R2 (not important, I tested on a lot of computer all the same) I think it must work with lasts browsers Firefox/Chrome/IE
What is Vanilla ? You can look my temporary client here (static served over Apache and websocket tunnel) http://www.serveurperso.com/temp/node-webterm/
I use special config to get many nodejs servers over Apache!
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/(81|82)/socket.io [NC]
RewriteCond %{QUERY_STRING} transport=websocket [NC]
RewriteRule /(81|82)/(.*) ws://127.0.0.1:$1/$2 [P,L]
ProxyPass /81/socket.io http://127.0.0.1:81/socket.io
ProxyPassReverse /81/socket.io http://127.0.0.1:81/socket.io
ProxyPass /82/socket.io http://127.0.0.1:82/socket.io
ProxyPassReverse /82/socket.io http://127.0.0.1:82/socket.io
Strange, for me it worked with the changes.
I tested empty web cache, and another computer : Firefox 31.2.0 on Windows 7 same problem:(
The keypress handler is perfect inside the Anyterm client (http://www.serveurperso.com/anyterm.html) and OK only for Firefox inside my term.js mod (http://www.serveurperso.com/terminal.php)
Can you set a breakpoint to line 1384 and look for the value of String.fromCharCode(key)?
OK
I can add a realtime console.log();
I think I need to use a windows instance to debug that, at least from linux, it looks fine.
I can debug it from a windows box tomorrow.
This is a cool event test http://unixpapa.com/js/testkey.html my AltGr chars work on it there is a input box
It's strange, my chars are never get from your function :
http://www.serveurperso.com/temp/node-webterm/index.html
// Taken from tty.js: https://github.com/chjj/tty.js
DomInput.prototype._keypress = function(ev) {
var key = this.getKeyCode(ev);
console.log("Before " + String.fromCharCode(key));
if (!key || ev.ctrlKey || ev.altKey || ev.metaKey) return;
console.log("After " + String.fromCharCode(key));
if(ev.stopPropagation) ev.stopPropagation();
if(ev.preventDefault) ev.preventDefault();
this.push(String.fromCharCode(key));
return false;
};
I also tested with your input visible and focused. same problem (get any chars but not famous AltGr...).
I discovered a working condition : Just commented out keydown event binding inside your DomInput. But this must create regression with other browser... We need a elegan way to make this. sorry for my bad english lol
function DomInput(target, buffer, opts) {
DomInput.super_.apply(this, arguments);
target.tabIndex = 0;
this._input = document.createElement('input');
this._input.style.width = this._input.style.height = this._input.style.opacity = '0';
this._input.style.border = 'none';
this._input.style.position = 'absolute';
this._input.style.zIndex = -10000;
target.parentNode.insertBefore(this._input, target);
this._addListener(target, 'focus', this._focus);
this._addListener(this._input, 'keypress', this._keypress);
//ends._addListener(this._input, 'keydown', this._keydown);
}
I think it's possible to merge both keypress and keydown into one event listener.
Maybe related to https://github.com/zeit/hyperterm/issues/466
Hello,
This is a JavaScript / Browser problem:
AltGr + 3/4/5/6/7/8 = "#", "{", "[", "|", "`", "\" are not typed on French Keyboard.
Same issue on project "term.js" There is an elegant way to solve this ?
Pascal