
Security News
Open Source Maintainers Feeling the Weight of the EU’s Cyber Resilience Act
The EU Cyber Resilience Act is prompting compliance requests that open source maintainers may not be obligated or equipped to handle.
toggle-selection
Advanced tools
The toggle-selection npm package is designed to enable and disable text selection on web pages. It provides a simple API to programmatically control the user's ability to select text within the document, which can be useful in various user interface scenarios where text selection might interfere with other interactions or where it needs to be controlled for security or aesthetic reasons.
Disable text selection
This feature allows developers to disable text selection on the entire web page. It is useful in scenarios where text selection could interfere with drag-and-drop interactions or other UI elements.
const toggleSelection = require('toggle-selection');
function disableSelection() {
toggleSelection.disable();
}
Enable text selection
This feature allows developers to re-enable text selection if it has been previously disabled. This is useful for toggling text selection dynamically based on certain user actions or application states.
const toggleSelection = require('toggle-selection');
function enableSelection() {
toggleSelection.enable();
}
Simple module exposing function that deselects current browser selection and returns function that restores selection.
var deselect = require('toggle-selection');
var reselect = deselect(); // remove all selection
// …
// do something with current selection, text, etc;
// …
reselect(); // restore selection
All credits go to @shvaikalesh.
FAQs
Toggle current selected content in browser
The npm package toggle-selection receives a total of 6,588,032 weekly downloads. As such, toggle-selection popularity was classified as popular.
We found that toggle-selection demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
The EU Cyber Resilience Act is prompting compliance requests that open source maintainers may not be obligated or equipped to handle.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.