npm

Join us for the upcoming webinar, "Enterprise JavaScript done right: the tools you love, the security you need."Sign up here »

get-selection-more

1.0.2 • Public • Published

Get Selection More npm-version Build Status Coverage Status

APIs

/**
 * Returns the selected text
 */
export declare function getText(win?: Window): string;
/**
 * Returns the paragraph containing the selection text.
 */
export declare function getParagraph(win?: Window): string;
/**
 * Returns the sentence containing the selection text.
 */
export declare function getSentence(win?: Window): string;

Optionally pass window of other frame to get selection within that frame.

Usage

import { getText, getParagraph, getSentence } from 'get-selection-more'
 
document.addEventListener('selectionchange', () => {
  console.log(getText(), getParagraph(), getSentence())
})

Or load the UMD module directly which exposes getSelectionMore global.

install

npm i get-selection-more

Downloadsweekly downloads

8

version

1.0.2

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability