All Projects → funktechno → texthighlighter

funktechno / texthighlighter

Licence: MIT license
a no dependency typescript npm package for highlighting user selected text

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects

Projects that are alternatives of or similar to texthighlighter

web-marker
a web page highlighter - Please star if you like this project
Stars: ✭ 51 (+200%)
Mutual labels:  annotation, text, range, highlight
Web Highlighter
✨ A no-runtime dependency lib for text highlighting & persistence on any website ✨🖍️
Stars: ✭ 373 (+2094.12%)
Mutual labels:  text, range, highlight
Vscode Highlight
Advanced text highlighter based on regexes. Useful for todos, annotations etc.
Stars: ✭ 71 (+317.65%)
Mutual labels:  annotation, text, highlight
Hrjs
🔄 Tiny JavaScript plugin for highlighting and replacing text in the DOM
Stars: ✭ 420 (+2370.59%)
Mutual labels:  dom, highlight
Qolor
An atom package to color your queries!
Stars: ✭ 18 (+5.88%)
Mutual labels:  color, highlight
Nord Highlightjs
An arctic, north-bluish clean and elegant highlight.js theme.
Stars: ✭ 49 (+188.24%)
Mutual labels:  color, highlight
Colorhighlight
🎨 Lightweight Color Highlight colorizer for Sublime Text
Stars: ✭ 76 (+347.06%)
Mutual labels:  color, highlight
Traces.vim
Range, pattern and substitute preview for Vim
Stars: ✭ 568 (+3241.18%)
Mutual labels:  range, highlight
colocat
Fegeya Colocat, Colorized 'cat' implementation. Written in C++17.
Stars: ✭ 14 (-17.65%)
Mutual labels:  color, highlight
VIAN
No description or website provided.
Stars: ✭ 18 (+5.88%)
Mutual labels:  color, annotation
react-native-styled-text
Styled Text for React Native
Stars: ✭ 57 (+235.29%)
Mutual labels:  color, text
ChromaTerm
Color your Terminal with RegEx!
Stars: ✭ 149 (+776.47%)
Mutual labels:  color, highlight
text-editor
A text selection range API written in pure JavaScript, for modern browsers.
Stars: ✭ 24 (+41.18%)
Mutual labels:  text, range
chalk
🖍️🎨Composable and simple terminal highlighting package for OCaml.
Stars: ✭ 29 (+70.59%)
Mutual labels:  color, highlight
color-console
A lightweight header-only C++ library to bring colors to your Windows console with a very-easy-to-use API.
Stars: ✭ 97 (+470.59%)
Mutual labels:  color
sinonimo
🇧🇷 Sinonimo é um pacote Node que traz sinônimos de palavras em português
Stars: ✭ 14 (-17.65%)
Mutual labels:  text
stringx
Drop-in replacements for base R string functions powered by stringi
Stars: ✭ 14 (-17.65%)
Mutual labels:  text
Godot-Share
Simple share text and/or image module for Godot Engine (Android & iOS)
Stars: ✭ 58 (+241.18%)
Mutual labels:  text
Colorwaver
🎨 An app to detect color palettes in the real world - powered by VisionCamera
Stars: ✭ 365 (+2047.06%)
Mutual labels:  color
hl-fill-column
Highlight fill column for emacs.
Stars: ✭ 16 (-5.88%)
Mutual labels:  highlight

texthighlighter

Usage

  • npm install @funktechno/texthighlighter
  • in code
import { doHighlight, deserializeHighlights, serializeHighlights, removeHighlights, optionsImpl } from "@/../node_modules/@funktechno/texthighlighter/lib/index";
const domEle = document.getElementById("sandbox");
const options: optionsImpl = {};
if (this.color) options.color = this.color;
if (domEle) doHighlight(domEle, true, options);

In project need to set up own mouseup and touchend events. touchend is for mobile

vue example

<div
    id="sandbox"
    @mouseup="runHighlight($event)"
    @touchend="runMobileHighlight($event)"
    v-html="content"
></div>

vue script

var methods = {
  runMobileHighlight(:any){
    const selection = document.getSelection();
      if (selection) {
        const domEle = document.getElementById("sandbox");
        const options: optionsImpl = {};
        if (domEle) {
            const highlightMade = doHighlight(domEle, true, options);
        }
    }

  },
  runHighlight(:any){
    // run mobile a bit different
    if (this.isMobile()) return;
    const domEle = document.getElementById("sandbox");
    const options: optionsImpl = {};
    if (domEle) {
        const highlightMade = doHighlight(domEle, true, options);
    }
  }
}

Demos

development

  • npm install or yarn import
  • npm run build
  • npm run build:client
  • npm run lint:fix
  • yarn run live-server

deploy

  • npm publish --access public

todo

  • convert library to typescript
    • works where it's being used (in a vue ts project)
  • bring over demos and examples
  • improve unit tests
    • pipeline
    • bring over previous unit tests
  • extend highlights for more options
    • whole element selection for comment support, or keeprange disabled
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].