anki/ts/sveltelib/composition.ts
Hikaru Y be6d1dfb66
Work around issue with entering text around MathJax via IME (#2288)
* Add 'placement' property

* Extract logic for moving text node into instance method

... so that it can be used elsewhere.

* Add writable store to indicate whether composition session is active

* Work around issue with entering text around MathJax via IME

* Make get() called only once while composition session is active
2022-12-30 13:32:41 +10:00

13 lines
440 B
TypeScript

// Copyright: Ankitects Pty Ltd and contributors
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import { writable } from "svelte/store";
/**
* Indicates whether an IME composition session is currently active
*/
export const isComposing = writable(false);
window.addEventListener("compositionstart", () => isComposing.set(true));
window.addEventListener("compositionend", () => isComposing.set(false));