fix: keyboard shortcuts from firing when editing text

This commit is contained in:
Johannes Millan 2018-03-23 19:31:58 +01:00
parent c55b65b2d5
commit 9a9ae6185e
2 changed files with 16 additions and 0 deletions

View file

@ -66,6 +66,12 @@
modelCopy = vm.editOnClick;
$timeout(function() {
inputEl = $element.find('input');
// prevent keyboard shortcuts from firing when here
inputEl[0].addEventListener('keydown', (ev) => {
ev.stopPropagation();
});
inputEl[0].focus();
inputEl[0].value = modelCopy;
setTimeout(() => {

View file

@ -59,6 +59,12 @@
}
}
function stopPropagation(ev) {
console.log('STOP');
ev.stopPropagation();
}
if (IS_ELECTRON) {
waitForMarkedTimeOut = $timeout(() => {
makeLinksWorkForElectron();
@ -77,8 +83,12 @@
textareaEl[0].focus();
textareaEl.on('keypress', keypressHandler);
// prevent keyboard shortcuts from firing when here
textareaEl.on('keydown', stopPropagation);
textareaEl.on('$destroy', () => {
textareaEl.off('keypress', keypressHandler);
textareaEl.off('keydown', stopPropagation);
});
});
}