Closed azat closed 2 years ago
Very interesting.
I tried a similar approach for syntax highlighting: add highlighting while keeping all the accessibility properties of textarea (searchable, native copy-paste, zero added input lag, etc), and failed, because the textarea has a slightly different text wrapping behavior than pre-wrap.
Let's try...
https://codersblock.com/blog/highlight-text-inside-a-textarea
I have used exactly the same tutorial and it has failed.
Ok, it is working.
Sometimes it leads to a double vertical scroll bar (at least in Chromium). Please take a look:
It is also extremely weird if I Ctrl+F in the browser:
Let's revert, because I prefer bug-free over features.
This pastebin service contains lots of logs (mostly ClickHouse), and it is useful to highlight selected text in the whole logs (query_id, logger name, function name).
This is simpler implementation of highlight-within-textarea without jQuery.
Note: this implementation is hackish enough, since I don't know either of CSS/HTML/JavaScript, but want this feature since I'm looking lots of logs in this pastebin
Refs: https://codersblock.com/blog/highlight-text-inside-a-textarea