package
Angular directive adding fragment highlighting capabilities to textarea inputs
npm install angular-input-highlightGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Estimated unpacked size across 2 packages.
2.0 MB
Includes dependencies.
This directive allows to highlight a text in textarea by regular expression or substring.
Additionaly it tracks position of all highlighter fragments. So you can use it for positioning other overlay elements like tooltips.
Please see demo
Get it with Bower bower i angular-input-highlight or with npm npm i angular-input-highlight
<textarea ng-model="..."
highlight="format"
highlight-onchange="list($markers)"></textarea>where matches is a map of Color - RegExp/String pairs. Color string should be whatever suites CSS color value, e.g.
format = {
'red' : /\d+/g,
'#00ff00' : /@[a-z0-9]/ig,
'rgba(0,0,1,0.5)' : 'hello'
}textarea. In some cases input[type=text] could work but there is no way to track text scrolling inside ittextarea is resizable then horizontal resizing will be disabled by directivefont-family style property for textarea in IE.Fill free to suggest improvements.
Run npm start to mess with the code.