Fix issue with copying from unfocused text input

Keyframes can now be copied while preview is focused
This commit is contained in:
JannisX11 2020-08-30 13:41:50 +02:00
parent e013ea4dff
commit 27b399621d
2 changed files with 7 additions and 3 deletions

View File

@ -16,7 +16,7 @@ const Clipbench = {
let p = Prop.active_panel;
let text;
if (!check) {
text = window.getSelection()+'';
text = getFocusedTextInput() && window.getSelection()+'';
}
if (text) {
return Clipbench.types.text;
@ -30,7 +30,7 @@ const Clipbench = {
if (display_mode) {
return Clipbench.types.display_slot
}
if (Animator.open && Timeline.animators.length && (Timeline.selected.length || mode === 2) && ['keyframe', 'timeline'].includes(p)) {
if (Animator.open && Timeline.animators.length && (Timeline.selected.length || mode === 2) && ['keyframe', 'timeline', 'preview'].includes(p)) {
return Clipbench.types.keyframe
}
if ((p == 'uv' || p == 'preview') && Modes.edit) {

View File

@ -347,6 +347,10 @@ setInterval(() => {
}
}, 100)
function getFocusedTextInput() {
return $('input[type="text"]:focus, input[type="number"]:focus, *[contenteditable="true"]:focus, textarea:focus').get(0)
}
$(document).on('keydown mousedown', function(e) {
if (Keybinds.recording || e.which < 4) return;
//Shift
@ -358,7 +362,7 @@ $(document).on('keydown mousedown', function(e) {
}
var used = false;
var input_focus = $('input[type="text"]:focus, input[type="number"]:focus, *[contenteditable="true"]:focus, textarea:focus').get(0)
var input_focus = getFocusedTextInput()
if (input_focus) {
//User Editing Anything