mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
fix(editor): Fix save keybind in expression editor and unfocused node details view (#13640)
This commit is contained in:
@@ -352,15 +352,19 @@ const setIsTooltipVisible = ({ isTooltipVisible }: DataPinningDiscoveryEvent) =>
|
||||
|
||||
const onKeyDown = (e: KeyboardEvent) => {
|
||||
if (e.key === 's' && deviceSupport.isCtrlKeyPressed(e)) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
|
||||
if (props.readOnly) return;
|
||||
|
||||
emit('saveKeyboardShortcut', e);
|
||||
onSaveWorkflow(e);
|
||||
}
|
||||
};
|
||||
|
||||
const onSaveWorkflow = (e: KeyboardEvent) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
|
||||
if (props.readOnly) return;
|
||||
|
||||
emit('saveKeyboardShortcut', e);
|
||||
};
|
||||
|
||||
const onInputItemHover = (e: { itemIndex: number; outputIndex: number } | null) => {
|
||||
if (e === null || !inputNodeName.value || !isPairedItemHoveringEnabled.value) {
|
||||
ndvStore.setHoveringItem(null);
|
||||
@@ -597,11 +601,25 @@ const onSearch = (search: string) => {
|
||||
isPairedItemHoveringEnabled.value = !search;
|
||||
};
|
||||
|
||||
const registerKeyboardListener = () => {
|
||||
document.addEventListener('keydown', onKeyDown, true);
|
||||
};
|
||||
|
||||
const unregisterKeyboardListener = () => {
|
||||
document.removeEventListener('keydown', onKeyDown, true);
|
||||
};
|
||||
|
||||
//watchers
|
||||
|
||||
watch(
|
||||
activeNode,
|
||||
(node, oldNode) => {
|
||||
if (node && !oldNode) {
|
||||
registerKeyboardListener();
|
||||
} else if (!node) {
|
||||
unregisterKeyboardListener();
|
||||
}
|
||||
|
||||
if (node && node.name !== oldNode?.name && !isActiveStickyNode.value) {
|
||||
runInputIndex.value = -1;
|
||||
runOutputIndex.value = -1;
|
||||
@@ -655,6 +673,7 @@ watch(
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
watch(maxOutputRun, () => {
|
||||
runOutputIndex.value = -1;
|
||||
});
|
||||
@@ -681,6 +700,7 @@ onMounted(() => {
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
dataPinningEventBus.off('data-pinning-discovery', setIsTooltipVisible);
|
||||
unregisterKeyboardListener();
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -719,8 +739,8 @@ onBeforeUnmount(() => {
|
||||
v-if="activeNode"
|
||||
ref="container"
|
||||
class="data-display"
|
||||
data-test-id="ndv-modal"
|
||||
tabindex="0"
|
||||
@keydown.capture="onKeyDown"
|
||||
>
|
||||
<div :class="$style.modalBackground" @click="close"></div>
|
||||
<NDVDraggablePanels
|
||||
|
||||
Reference in New Issue
Block a user