PageSourceSearch

https://www.nodexr.net/js/GeneratedJS/ContentEditable.js

js nodexr.net collected 2026-09-25 22:29:23 UTC 1,122 bytes, 42 lines download raw bytes

1export function initContentEditable(div, instance, textToDisplay) {
2    div.innerText = textToDisplay;
3    div.addEventListener("input", function () {
4        instance.invokeMethodAsync("GetUpdatedTextFromJavascript", div.innerText);
5    });
6    try {
7        div.contentEditable = "plaintext-only";
8    }
9    catch (e) {
10        setupFallbackPlaintextOnly(div);
11    }
12    moveCursorToEnd(div);
13}
14;
15function moveCursorToEnd(elem) {
16    let s = window.getSelection();
17    let r = document.createRange();
18    r.setStart(elem, 1);
19    r.setEnd(elem, 1);
20    s.removeAllRanges();
21    s.addRange(r);
22}
23;
24function setupFallbackPlaintextOnly(elem) {
25    elem.contentEditable = "true";
26    forcePlaintextPaste(elem);
27    elem.addEventListener("drop", e => {
28        e.preventDefault();
29        return false;
30    });
31}
32;
33function forcePlaintextPaste(elem) {
34    elem.addEventListener("paste", e => {
35        e.preventDefault();
36        if (e.clipboardData && e.clipboardData.getData) {
37            var text = e.clipboardData.getData("text/plain");
38            document.execCommand("insertText", false, text);
39        }
40    });
41}
42;

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.