text-field-edit
Advanced tools
Comparing version 3.1.2022 to 3.1.9001
@@ -0,1 +1,8 @@ | ||
// https://github.com/fregante/text-field-edit/issues/16 | ||
function safeTextInsert(text) { | ||
if (text === '') { | ||
return document.execCommand('delete'); | ||
} | ||
return document.execCommand('insertText', false, text); | ||
} | ||
function insertTextFirefox(field, text) { | ||
@@ -16,3 +23,3 @@ // Found on https://www.everythingfrontend.com/posts/insert-text-into-textarea-at-cursor-position.html 🎈 | ||
} | ||
if (!document.execCommand('insertText', false, text)) { | ||
if (!safeTextInsert(text)) { | ||
insertTextFirefox(field, text); | ||
@@ -19,0 +26,0 @@ } |
{ | ||
"name": "text-field-edit", | ||
"version": "3.1.2022", | ||
"version": "3.1.9001", | ||
"description": "Insert text in a `<textarea>` and `<input>` (including Undo in most browsers)", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
12511
84