4 ms·
To all developers trying to implement a text-editor inside the browser: Do not fuck with the regular text input/textarea elements.. This editor probably has an
by rglullis 15y ago
To all developers trying to implement a text-editor inside the browser: Do not fuck with the regular text input/textarea elements..
This editor probably has an event handler when the user types quotes on the system - most likely is is trying to insert two quotes and place the cursor in the middle. The problem is, most non-US keyboard layouts use the sequence of "quote + spacebar" to insert a quote.
In the end, your super-smart editor will not allow me (or anyone that does not use a regular US keyboard layout) to type quotes into the damn text-editor.
Enough ranting: it looks like I will have to stay with screen and emacs to have a "collaborative code-editor with syntax highlighting"
- darklajid 15y agoI read this like ten times and while I agree that messing with input events is ~hard~ I still don't get your explanation. Out of curiosity, can you explain that problem again? Entering quotes works fine in US layout (yeah, you said that), DE layout (Shift + 2) and HE layout (well - like the US here, no surprise). I lack experience with any other keyboard layout and couldn't follow your explanation, so - what's going wrong?
- eitally 15y agoSet your keyboard to US International, at which point a double-quote followed by a lower case o gives you o-umlaut: ö. If you want this "o you need to inject a space between the quotation mark and the letter.
- rglullis 15y agoOk, I will try to break down the issue. Hope I make it clear. - My keyboard layout is set to "US, alternative international". - The thing with that layout, and most layouts intended for languages with accented letters, is that the quote keys are used to add accents to letters. To get the character "é", I first type the character for single quote and follow it with a regular "e". Double quote followed by "e" gets you "ë". The same thing applies for tilde and the "back accent" (Crasis). With that you are able to type pretty much everything: áãàäéëíóõöüúüöçñ. - Because of this composability, the way to way get a quote (or tilde or crasis) is by typing the key you want and follow it with <spacebar>. If you just press the key for quote, the system will be waiting for the next key to figure out what you actually want. - Here is the bug, I think: 1) the javascript on the "enhanced text editor" has a handler for the "key-press, code 48" event, that is fired whenever I press the "quotation" key. 2) the handler inserts/manipulates the textarea in any way, by moving the cursor or inserting text in the text area. 3) This manipulation of the text area resets the input buffer, and now there is no sign that I actually pressed the key. 4) when I try to complete my intended input (i.e, when I press <spacebar> to actually get the single-quote char), there is no sign of the previously pressed key, and all I get is a space. I don't know if this is the exact mechanics of the bug. I just know that this is not the first time that I've tried to type single-quotes in a "web-based text-editor" and I get a space instead.