editor is a code editor as an element: a real textarea under coloured lines, with pairs, indenting, comments, find and replace. Bound to state, what is typed is the page's at once.
The element
editor value= lang=Every attribute on a switch. The language list is the highlighter's; each has its own text, kept as you edit.
A value the page assigns replaces the text and raises no event. focus("id") puts the caret in it.
Events
input and changeinput on every edit (typing, a paste, undo, a replace), handed the text. change when the editor is left, if the text is not what it was when it was entered.
placeholder, lines=false, its own stylesIt is a div: height, font-size, border and radius written on it win. One line high with no gutter makes a query field.
Shown as you type: the caret's line is banded, the bracket beside the caret and its partner are outlined, and other places a selected word appears are tinted.
A long file
5,000 linesThe textarea holds the whole text; the coloured layer and the gutter hold only the lines in view and a dozen either side.