Skip to content

This module provide the selected HTML and Text

Notifications You must be signed in to change notification settings

mohan1361/get-selected-text

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Demo

Image of work

text selection react

text selection react module provide the selected text and html on desktop and mobile browser. It also provide the feature to color the selected text/html

Installation

To install this package you have to run

npm install text-selection-react

Real Demo

Link of demo

UPDATE

Now Support Mobile Browser and Can undo selected text

NEXT RELEASE

  1. Improve Remove button style and also add functionality for user to add preffered style to Remove button
  2. Add choise to highlight the selected text or not

Usage

This is a independent module. To use it you don't have to wrap it around any component. You can put it any where in the component or in the file inside render to use this component.


import TextSelector from 'text-selection-react'

    <TextSelector
        events={[
        {
            text: 'Submit',
            handler: this.handler
        }
        ]}
        color={'yellow'}
        colorText={true}
    />

Here In events you can add as many event as you want. like currently i am using only one event then it will be shown as

color :- In color you can add color of you choise

colorText :- if true then it color the selected text

Image of work

so if you click on submit it will change the background of the text into

Image of change background

Mobile View

Image of multi events

Undo selected text Image of multi events

Attribute for Remove/Undo button Image of multi events

you can add as many event as you want in it

like

Image of multi events

this will look like Image of multi events view

Handler

handle will return two params. which are html and text.

Image of return params

Shoutouts

This is written during one of my project in which i have to provide the selected text but i didn't find any library that give you the selected text so i research on it and find this solution uptill now. And will add new function in future as there are many in my mind

Question

if you have any question or want me to add or modify as per your requirement then contact me i will do it for you.

Request

If you like it please give a star on github. Thanks

text selection react

text-selection-react

About

This module provide the selected HTML and Text

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%