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

undate

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

undate

Undoable update for HTMLTextAreaElement

  • 0.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9.7K
decreased by-8.41%
Maintainers
1
Weekly downloads
 
Created
Source

undate

Undoable update for HTMLTextAreaElement

NPM version Build Status Code Climate

Install

npm install --save undate

Usage

import {update, wrapCursor} from 'undate';

const textareaElement = document.getElementById('textarea');

textareaElement.value; //=> ''

// Update whole value
update(textareaElement, 'string before cursor', 'optional string after cursor');

textareaElement.value; //=> 'string before cursoroptional string after cursor'

// Update around the cursor
wrapCursor(textareaElement, ' _', '_ ');

textareaElement.value; //=> 'string before cursor __ optional string after cursor'

// Press cmd-z

textareaElement.value; //=> 'string before cursoroptional string after cursor'

textareaElement.setSelectionRange(14, 27);

textareaElement.value; //=> 'string before cursoroptional string after cursor'
                       //                  ^^^^^^^^^^^^^^ selected

wrapCursor(textareaElement, '**', '**');

textareaElement.value; //=> 'string before **cursoroptional** string after cursor'
                       //                    ^^^^^^^^^^^^^^ selected

// Press cmd-z

textareaElement.value; //=> 'string before cursoroptional string after cursor'
                       //                  ^^^^^^^^^^^^^^ selected

// Press cmd-z

textareaElement.value; //=> ''

License

The MIT License

Keywords

FAQs

Package last updated on 18 Apr 2018

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