We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
MutationObserver
1 parent 9eb2fb3 commit 7d7067eCopy full SHA for 7d7067e
1 file changed
src/lib/enhancers/modifyDOM.ts
@@ -7,7 +7,18 @@ export function fixupOvertype(instances: OverTypeInstance[]): OverTypeInstance {
7
`Expected OverType to return exactly 1 instance, got ${instances.length}`
8
)
9
}
10
- return instances[0]!
+ const overtype = instances[0]!
11
+ // this works, but we're now updating twice as often as we need to, because
12
+ // overtype has a built-in update which usually works but not always (#101)
13
+ // and we're doing this which does always work
14
+ const updateOnChange = new MutationObserver(() => {
15
+ overtype.updatePreview()
16
+ })
17
+ updateOnChange.observe(overtype.textarea, {
18
+ attributes: true,
19
+ characterData: true,
20
21
+ return overtype
22
23
24
// Modify the DOM to trick overtype into adopting it instead of recreating it
0 commit comments