lonekorean / highlight-within-textarea

jQuery plugin for highlighting bits of text within a textarea.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Highlight by text-color instead of background-color

golopot opened this issue · comments

Highlight like a normal text editor does.

This might be achieved by hiding the textarea and showing the fake layer.

I didn't think this would work because of issues with selecting text and caret visibility, but... it totally works. :) Will test further and consider more cases.

Test CSS:

.hwt-content {
    color: transparent;
    caret-color: black; /* Edge ignores this, but luckily doesn't need it */
}
.hwt-highlights {
    color: black !important;
}
.hwt-content mark {
    color: red;
    background-color: transparent;
}