feat(editor): Hide focus panel while node panel is open (no-changelog) (#17333)

This commit is contained in:
Daria
2025-07-15 18:35:49 +03:00
committed by GitHub
parent 8232d7f1d4
commit f888b3353b
3 changed files with 42 additions and 17 deletions

View File

@@ -62,6 +62,7 @@ const resolvedParameter = computed(() =>
); );
const focusPanelActive = computed(() => focusPanelStore.focusPanelActive); const focusPanelActive = computed(() => focusPanelStore.focusPanelActive);
const focusPanelHidden = computed(() => focusPanelStore.focusPanelHidden);
const focusPanelWidth = computed(() => focusPanelStore.focusPanelWidth); const focusPanelWidth = computed(() => focusPanelStore.focusPanelWidth);
const isDisabled = computed(() => { const isDisabled = computed(() => {
@@ -302,7 +303,7 @@ const onResizeThrottle = useThrottleFn(onResize, 10);
</script> </script>
<template> <template>
<div v-if="focusPanelActive" :class="$style.wrapper" @keydown.stop> <div v-if="focusPanelActive" v-show="!focusPanelHidden" :class="$style.wrapper" @keydown.stop>
<N8nResizeWrapper <N8nResizeWrapper
:width="focusPanelWidth" :width="focusPanelWidth"
:supported-directions="['left']" :supported-directions="['left']"

View File

@@ -59,6 +59,7 @@ export const useFocusPanelStore = defineStore(STORES.FOCUS_PANEL, () => {
const lastFocusTimestamp = ref(0); const lastFocusTimestamp = ref(0);
const focusPanelActive = computed(() => currentFocusPanelData.value.isActive); const focusPanelActive = computed(() => currentFocusPanelData.value.isActive);
const focusPanelHidden = ref(false);
const focusPanelWidth = computed(() => currentFocusPanelData.value.width ?? DEFAULT_PANEL_WIDTH); const focusPanelWidth = computed(() => currentFocusPanelData.value.width ?? DEFAULT_PANEL_WIDTH);
const _focusedNodeParameters = computed(() => currentFocusPanelData.value.parameters); const _focusedNodeParameters = computed(() => currentFocusPanelData.value.parameters);
@@ -101,13 +102,18 @@ export const useFocusPanelStore = defineStore(STORES.FOCUS_PANEL, () => {
[wid]: { [wid]: {
isActive: isActive ?? focusPanelActive.value, isActive: isActive ?? focusPanelActive.value,
parameters: parameters ?? _focusedNodeParameters.value, parameters: parameters ?? _focusedNodeParameters.value,
width, width: width ?? focusPanelWidth.value,
}, },
}); });
if (isActive) { if (isActive) {
lastFocusTimestamp.value = Date.now(); lastFocusTimestamp.value = Date.now();
} }
// Unhide the focus panel if it was hidden
if (focusPanelHidden.value && focusPanelActive.value) {
focusPanelHidden.value = false;
}
} }
// When a new workflow is saved, we should update the focus panel data with the new workflow ID // When a new workflow is saved, we should update the focus panel data with the new workflow ID
@@ -137,6 +143,14 @@ export const useFocusPanelStore = defineStore(STORES.FOCUS_PANEL, () => {
_setOptions({ isActive: false }); _setOptions({ isActive: false });
} }
function hideFocusPanel(hide: boolean = true) {
if (focusPanelHidden.value === hide) {
return;
}
focusPanelHidden.value = hide;
}
function toggleFocusPanel() { function toggleFocusPanel() {
_setOptions({ isActive: !focusPanelActive.value }); _setOptions({ isActive: !focusPanelActive.value });
} }
@@ -165,12 +179,14 @@ export const useFocusPanelStore = defineStore(STORES.FOCUS_PANEL, () => {
focusPanelActive, focusPanelActive,
focusedNodeParameters, focusedNodeParameters,
lastFocusTimestamp, lastFocusTimestamp,
focusPanelHidden,
focusPanelWidth,
openWithFocusedNodeParameter, openWithFocusedNodeParameter,
isRichParameter, isRichParameter,
hideFocusPanel,
closeFocusPanel, closeFocusPanel,
toggleFocusPanel, toggleFocusPanel,
onNewWorkflowSave, onNewWorkflowSave,
updateWidth, updateWidth,
focusPanelWidth,
}; };
}); });

View File

@@ -973,6 +973,10 @@ function onUpdateNodeOutputs(id: string) {
} }
function onClickNodeAdd(source: string, sourceHandle: string) { function onClickNodeAdd(source: string, sourceHandle: string) {
if (isFocusPanelFeatureEnabled.value && focusPanelStore.focusPanelActive) {
focusPanelStore.hideFocusPanel();
}
nodeCreatorStore.openNodeCreatorForConnectingNode({ nodeCreatorStore.openNodeCreatorForConnectingNode({
connection: { connection: {
source, source,
@@ -1182,7 +1186,7 @@ async function onRevertAddNode({ node }: { node: INodeUi }) {
await revertAddNode(node.name); await revertAddNode(node.name);
} }
async function onSwitchActiveNode(nodeName: string) { function onSwitchActiveNode(nodeName: string) {
const node = workflowsStore.getNodeByName(nodeName); const node = workflowsStore.getNodeByName(nodeName);
if (!node) return; if (!node) return;
@@ -1190,7 +1194,7 @@ async function onSwitchActiveNode(nodeName: string) {
selectNodes([node.id]); selectNodes([node.id]);
} }
async function onOpenSelectiveNodeCreator( function onOpenSelectiveNodeCreator(
node: string, node: string,
connectionType: NodeConnectionType, connectionType: NodeConnectionType,
connectionIndex: number = 0, connectionIndex: number = 0,
@@ -1198,24 +1202,24 @@ async function onOpenSelectiveNodeCreator(
nodeCreatorStore.openSelectiveNodeCreator({ node, connectionType, connectionIndex }); nodeCreatorStore.openSelectiveNodeCreator({ node, connectionType, connectionIndex });
} }
function onOpenNodeCreatorForTriggerNodes(source: NodeCreatorOpenSource) { function onToggleNodeCreator(options: ToggleNodeCreatorOptions) {
nodeCreatorStore.openNodeCreatorForTriggerNodes(source); nodeCreatorStore.setNodeCreatorState(options);
if (isFocusPanelFeatureEnabled.value && focusPanelStore.focusPanelActive) {
focusPanelStore.hideFocusPanel(options.createNodeActive);
}
if (!options.createNodeActive && !options.hasAddedNodes) {
uiStore.resetLastInteractedWith();
}
} }
function onOpenNodeCreatorFromCanvas(source: NodeCreatorOpenSource) { function onOpenNodeCreatorFromCanvas(source: NodeCreatorOpenSource) {
onToggleNodeCreator({ createNodeActive: true, source }); onToggleNodeCreator({ createNodeActive: true, source });
} }
function onToggleNodeCreator(options: ToggleNodeCreatorOptions) { function onOpenNodeCreatorForTriggerNodes(source: NodeCreatorOpenSource) {
nodeCreatorStore.setNodeCreatorState(options); nodeCreatorStore.openNodeCreatorForTriggerNodes(source);
if (options.createNodeActive) {
focusPanelStore.closeFocusPanel();
}
if (!options.createNodeActive && !options.hasAddedNodes) {
uiStore.resetLastInteractedWith();
}
} }
function onToggleFocusPanel() { function onToggleFocusPanel() {
@@ -1229,6 +1233,10 @@ function onToggleFocusPanel() {
function closeNodeCreator() { function closeNodeCreator() {
if (nodeCreatorStore.isCreateNodeActive) { if (nodeCreatorStore.isCreateNodeActive) {
nodeCreatorStore.isCreateNodeActive = false; nodeCreatorStore.isCreateNodeActive = false;
if (isFocusPanelFeatureEnabled.value && focusPanelStore.focusPanelActive) {
focusPanelStore.hideFocusPanel(false);
}
} }
} }