Skip to content

Commit 0a6a3b5

Browse files
committed
fix for CTRL+C after clicking select tool. keydown event target was button which is not equal to body
1 parent 41c9bae commit 0a6a3b5

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

js/main.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -872,6 +872,7 @@ class PainterroProc {
872872
let handled = false;
873873
const clipFormat = 'image/png';
874874
if (evt.keyCode === KEYS.c && (evt.ctrlKey || evt.metaKey)) {
875+
console.log('handing copy')
875876
if (!this.inserter.waitChoice && !this.select.imagePlaced && this.select.shown) {
876877
const a = this.select.area;
877878
const w = a.bottoml[0] - a.topl[0];
@@ -1019,8 +1020,12 @@ class PainterroProc {
10191020
}
10201021
},
10211022
keydown: (e) => {
1022-
if (event.target !== document.body) {
1023-
return; // ignore all focused inputs on page
1023+
console.log('event.target !== document.body', event.target, document.body);
1024+
const argetEl = event.target;
1025+
const ignoreForSelectors = ['input', 'textarea', 'div[contenteditable]'];
1026+
1027+
if (ignoreForSelectors.some(selector => argetEl.matches(selector))) {
1028+
return; // ignore all elemetents which could be focused
10241029
}
10251030
if (this.shown) {
10261031
if (this.colorPicker.handleKeyDown(e)) {

0 commit comments

Comments
 (0)