Skip to content

Commit

Permalink
Fix lost focus (#132)
Browse files Browse the repository at this point in the history
  • Loading branch information
olddeda authored and evgeny-boger committed Jul 3, 2019
1 parent 640b09f commit 7a0f8b5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions app/scripts/services/handle-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,25 @@

export default function handleDataService() {
this.copyToClipboard = (val)=> {
var activeElement = document.activeElement;

var selBox = document.createElement('textarea');
selBox.style.position = 'fixed';
selBox.style.left = '0';
selBox.style.top = '0';
selBox.style.opacity = '0';
selBox.value = val;

document.body.appendChild(selBox);
selBox.focus();
selBox.select();

document.execCommand('copy');
document.body.removeChild(selBox);

if (activeElement) {
activeElement.focus();
}
};

// разница дат. при start=='now' считает от сегодня
Expand Down

0 comments on commit 7a0f8b5

Please sign in to comment.