Skip to content

Commit

Permalink
fix for CTRL+C after clicking select tool. keydown event target was b…
Browse files Browse the repository at this point in the history
…utton which is not equal to body
  • Loading branch information
ivictbor committed May 12, 2022
1 parent 41c9bae commit 0a6a3b5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,7 @@ class PainterroProc {
let handled = false;
const clipFormat = 'image/png';
if (evt.keyCode === KEYS.c && (evt.ctrlKey || evt.metaKey)) {
console.log('handing copy')
if (!this.inserter.waitChoice && !this.select.imagePlaced && this.select.shown) {
const a = this.select.area;
const w = a.bottoml[0] - a.topl[0];
Expand Down Expand Up @@ -1019,8 +1020,12 @@ class PainterroProc {
}
},
keydown: (e) => {
if (event.target !== document.body) {
return; // ignore all focused inputs on page
console.log('event.target !== document.body', event.target, document.body);
const argetEl = event.target;
const ignoreForSelectors = ['input', 'textarea', 'div[contenteditable]'];

if (ignoreForSelectors.some(selector => argetEl.matches(selector))) {
return; // ignore all elemetents which could be focused
}
if (this.shown) {
if (this.colorPicker.handleKeyDown(e)) {
Expand Down

0 comments on commit 0a6a3b5

Please sign in to comment.