antonmedv/codejar

Conflict with ibus IME if highlighting is enabled

Opened this issue · 8 comments

I'm integrating codejar with my personal website, a Vietnamese blog. I use ibus-unikey, on Ubuntu, to input Vietnamese, and encounter an issue that, very often, uncommited chars are lost.

I found that codejar is relying on event.isComposing to detect if the IME is in its task. But actually, it is not reliable. You can read more here: https://lists.w3.org/Archives/Public/public-editing-tf/2015Nov/0001.html

So what is the best way to fix this?

Just to inform. I haven't had solution yet. I may look into other web-based editors (CodeMirror, Monaco Editor etc.) to see if they suffer this. It may take time.

I found that other editors overcome this issue by creating a copy of input text, put it on top of the original one (using z-index), and apply highlighting to that copy, instead of the original one.

What I'm not clear is that how they let user see the caret (text cursor), which actually belongs to the original text input.

Yes and codejar uses other approach with contenteditable. Both methods have advantages and disadvantages.

Other editors also use contenteditable. The difference is that, other editors apply highlighting to the copy of input texts, whereas CodeJar does directly on the being-edited one.

contenteditable or textarea+copy

I never seen an editor with contenteditable set to transparent and copy of text for highlighting. Usually textarea is used.

This one https://editor.kullna.org/demo.html is using contenteditable + copy.

Hmm, very interesting.