New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

get-selection-more

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-selection-more

Get text and context sentence from window.getSelection()

  • 1.0.2
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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.

Keywords

FAQs

Package last updated on 17 Jun 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc