antoniotejada / Trilium-SyntaxHighlightWidget

Syntax highlight Trilium widget for editable note codeblocks using highlight.js
GNU General Public License v3.0
76 stars 6 forks source link

fix: highlight triggered while ime inputs are not committed #5

Open kaaass opened 2 years ago

kaaass commented 2 years ago

The highlighting is wrongly triggered while IME inputs are not committed, which is a normal situation for CJK inputs. The current version will give a result like this:

cn-input-issue

This PR maintains a new state inComposition in HighlightCodeBlockWidget by listening compositionstart and compositionend events, and ignores every changes fired between these events. The fix references facebook/react#3926 and ckeditor/ckeditor5#1342.