Fix some global event handlers interfering
parent
f7adb945de
commit
8c8d15cafc
3
TODO.md
3
TODO.md
|
@ -41,8 +41,7 @@
|
|||
* Tool options flicker... *and lag*, when they're redrawn in quick succession
|
||||
* Global event handlers interfering with stuff
|
||||
* In Image > Attributes and other places
|
||||
* You can't copy, paste, cut or drag&drop in the inputs
|
||||
* You can't click on the radio option labels when text is selected!
|
||||
* You can't drag&drop in the inputs
|
||||
* In Help > About Paint and other places
|
||||
* You can't select text
|
||||
* You can't drag links
|
||||
|
|
13
src/app.js
13
src/app.js
|
@ -283,8 +283,13 @@ $G.on("keydown", function(e){
|
|||
}
|
||||
});
|
||||
$G.on("cut copy paste", function(e){
|
||||
// @TODO: check document.activeElement for any input related elements
|
||||
if(textbox){ return; }
|
||||
if(
|
||||
document.activeElement instanceof HTMLInputElement ||
|
||||
document.activeElement instanceof HTMLTextAreaElement
|
||||
){
|
||||
// Don't prevent or interfere with cutting/copying/pasting within inputs or textareas
|
||||
return;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
var cd = e.originalEvent.clipboardData || window.clipboardData;
|
||||
|
@ -501,8 +506,8 @@ $body.on("mousedown contextmenu", function(e){
|
|||
if(
|
||||
e.target instanceof HTMLSelectElement ||
|
||||
e.target instanceof HTMLTextAreaElement ||
|
||||
e.target instanceof HTMLInputElement &&
|
||||
e.target.type !== "color"
|
||||
(e.target instanceof HTMLLabelElement && e.type !== "contextmenu") ||
|
||||
(e.target instanceof HTMLInputElement && e.target.type !== "color")
|
||||
){
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue