mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-16 01:24:38 +00:00
mvc-ui - rework paste behavior introduced in 388d99cf6f to make it less aggresive. for https://github.com/opnsense/core/issues/7456
To some degree I think always trimming the data isn't the issue, but not being able to paste at cursor position is impractical. this commit re-wires the paste action after trimming the clipboard data (in stead of overwriting the target field).
This commit is contained in:
parent
d86142927e
commit
2e010a77de
@ -204,8 +204,11 @@
|
||||
|
||||
/* overwrite clipboard paste behavior and trim before paste */
|
||||
$("input").on('paste', function(e) {
|
||||
e.preventDefault();
|
||||
$(this).val(e.originalEvent.clipboardData.getData("text/plain").trim())
|
||||
let clipboard_data = e.originalEvent.clipboardData.getData("text/plain").trim();
|
||||
if (clipboard_data.length > 0) {
|
||||
e.preventDefault();
|
||||
document.execCommand('insertText', false, clipboard_data);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user