Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

text-field-edit

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

text-field-edit - npm Package Compare versions

Comparing version 4.1.0 to 4.1.1

2

index.js

@@ -71,3 +71,3 @@ function isNativeField(field) {

field.selectionStart = selectionStart + wrap.length;
field.selectionEnd = selectionEnd + wrapEnd.length;
field.selectionEnd = selectionEnd + wrap.length;
}

@@ -74,0 +74,0 @@ function collapseCursor(selection, range, toStart) {

{
"name": "text-field-edit",
"version": "4.1.0",
"description": "Insert text in a `<textarea>` and `<input>` (including Undo in most browsers)",
"version": "4.1.1",
"description": "Insert text in a `<textarea>`, `<input>` and `contenteditable` elements (including Undo support)",
"keywords": [

@@ -15,2 +15,4 @@ "at cursor",

"safari",
"content editable",
"paste",
"form",

@@ -17,0 +19,0 @@ "inject",

@@ -8,7 +8,7 @@ # text-field-edit [![][badge-gzip]](#link-npm)

> Insert text in a `<textarea>` and `<input>` (including Undo in most browsers)
> Insert text in a `<textarea>`, `<input>` and `contenteditable` (including Undo support)
You should use this instead of setting the `field.value` directly because:
- it doesn't break the undo history (in Chrome, Firefox, and Safari)
- it doesn't break the undo history
- it fires an `input` event (with `event.inputType === 'insertText'`)

@@ -18,3 +18,3 @@ - it's the most efficient way of adding/replacing selected text in a field

It uses `document.execCommand('insertText')` under the hood. [Firefox added support for Undo](https://bugzilla.mozilla.org/show_bug.cgi?id=1220696) in Firefox 89 (June 2021). If you need IE support, use [insert-text-at-cursor](https://github.com/grassator/insert-text-at-cursor).
It uses `document.execCommand('insertText')` under the hood and it automatically focuses/blurs the field you pass.

@@ -80,3 +80,3 @@ ## Install

Type: `HTMLTextAreaElement | HTMLInputElement`
Type: `HTMLTextAreaElement | HTMLInputElement` or any `contenteditable` element

@@ -100,3 +100,3 @@ #### text

Type: `HTMLTextAreaElement | HTMLInputElement`
Type: `HTMLTextAreaElement | HTMLInputElement` or any `contenteditable` element

@@ -124,3 +124,3 @@ #### text

Type: `HTMLTextAreaElement | HTMLInputElement`
Type: `HTMLTextAreaElement | HTMLInputElement` (not available on `contenteditable`)

@@ -157,2 +157,18 @@ #### searchValue

#### field
Type: `HTMLTextAreaElement | HTMLInputElement` or any `contenteditable` elements
#### wrappingText
Type: `string`
The string to prepend to the selection.
#### endWrappingText
Type: `string`
The string to append to the selection. If not provided, `wrappingText` will be used.
### textFieldEdit.getSelection(field)

@@ -159,0 +175,0 @@

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