• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

worktile / slate-angular / 6659122c-e261-4b71-8a4c-31a76811ea45

pending completion
6659122c-e261-4b71-8a4c-31a76811ea45

Pull #226

circleci

pubuzhixing8
chore(core): update note
Pull Request #226: Android input handing

268 of 892 branches covered (30.04%)

Branch coverage included in aggregate %.

46 of 46 new or added lines in 2 files covered. (100.0%)

682 of 1526 relevant lines covered (44.69%)

29.63 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/packages/src/utils/restore-dom.ts
1
import { Editor } from 'slate';
2
import { EDITOR_TO_ELEMENT } from './weak-maps';
3

4
export function restoreDom(editor: Editor, execute: () => void) {
5
    const editable = EDITOR_TO_ELEMENT.get(editor);
×
6
    let observer = new MutationObserver(mutations => {
×
7
        mutations.reverse().forEach(mutation => {
×
8
            if (mutation.type === 'characterData') {
×
9
                // We don't want to restore the DOM for characterData mutations
10
                // because this interrupts the composition.
11
                return;
×
12
            }
13

14
            mutation.removedNodes.forEach(node => {
×
15
                mutation.target.insertBefore(node, mutation.nextSibling);
×
16
            });
17

18
            mutation.addedNodes.forEach(node => {
×
19
                mutation.target.removeChild(node);
×
20
            });
21
        });
22
        disconnect();
×
23
        execute();
×
24
    });
25
    const disconnect = () => {
×
26
        observer.disconnect();
×
27
        observer = null;
×
28
    };
29
    observer.observe(editable, { subtree: true, childList: true, characterData: true, characterDataOldValue: true });
×
30
    setTimeout(() => {
×
31
        if (observer) {
×
32
            disconnect();
×
33
            execute();
×
34
        }
35
    }, 0);
36
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc