Email or username:

Password:

Forgot your password?
Top-level
Chee Aun 🤔

@bramus curious to know, would this work for text inside <textarea>?

7 comments
Bramus

@cheeaun Doesn't work on inputs/textareas (for some reason I haven't found yet)

Chee Aun 🤔

@bramus that's actually the exact thing that I want to implement (for some time). I also couldn't find any reasons except some comments confirming that inputs/textareas don't work 😢

Ьλ∂λ

@cheeaun @bramus I was thinking of hacking something for textarea based on github.com/kueblc/LDT

(which overlays a transparent <textarea> on top of a styled <pre>)

Not sure the highlight API has been thought out for dynamic content... I don't know if you can change the bounds of a range after it's been registered and have the output updated... We'll see 🙂

Ьλ∂λ

@bramus @cheeaun

That makes LDT redundant...

Prism is ~10Kb larger, but its parsing abilities is heaps and bounds better than what LDT offers with just regexps.

Prism also supports styling the content of script and style tags in HTML, out of the box...

Ьλ∂λ

@bramus @cheeaun FWIW, you may want to add

spellcheck="false"

On the contenteditable elements, otherwise "Bramus" is styled as a spelling mistake on click.

Somehow "const" and "EOF" are deemed acceptable.

Roma Komarov

@bramus @cheeaun Yeah, I also wanted to use them for inputs, as on paper it sounds perfect for them: no actual elements added, but the API does not allow for that (as the ranges require actual text content, not the input/textrarea values).

Go Up