Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/frontend/@n8n/i18n/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,9 @@
"aiAssistant.coachmark.title": "Ask mode enabled",
"aiAssistant.coachmark.body": "Ask questions about n8n, get help with errors, or learn about automation. Switch to Build anytime to create workflows.",
"aiAssistant.coachmark.gotIt": "Got it",
"nodeCreator.shortcutCoachmark.title": "Press N to browse nodes",
"nodeCreator.shortcutCoachmark.body": "We changed the shortcut to improve keyboard navigation",
"nodeCreator.shortcutCoachmark.gotIt": "Got it",
"aiAssistant.askMode.emptyState.title": "Ask n8n AI",
"aiAssistant.askMode.emptyState.body1": "Ask anything about n8n, your workflow, or how to accomplish a task. This won't use any of your AI credits.",
"aiAssistant.askMode.emptyState.body2": "Look for the",
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/editor-ui/src/Interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ export type NodeCreatorOpenSource =
| 'plus_endpoint'
| 'add_input_endpoint'
| 'trigger_placeholder_button'
| 'tab'
| 'node_shortcut'
| 'replace_node_action'
| 'node_connection_action'
| 'node_connection_drop'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const NODE_CREATOR_OPEN_SOURCES: Record<
ADD_INPUT_ENDPOINT: 'add_input_endpoint',
TRIGGER_PLACEHOLDER_BUTTON: 'trigger_placeholder_button',
ADD_NODE_BUTTON: 'add_node_button',
TAB: 'tab',
NODE_SHORTCUT: 'node_shortcut',
NODE_CONNECTION_ACTION: 'node_connection_action',
REPLACE_NODE_ACTION: 'replace_node_action',
NODE_CONNECTION_DROP: 'node_connection_drop',
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/editor-ui/src/app/views/NodeView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1439,7 +1439,7 @@ function registerCustomActions() {
ndvStore.unsetActiveNodeName();

void nextTick(() => {
void onOpenNodeCreatorForTriggerNodes(NODE_CREATOR_OPEN_SOURCES.TAB);
void onOpenNodeCreatorForTriggerNodes(NODE_CREATOR_OPEN_SOURCES.NODE_SHORTCUT);
});
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export function useNodeCommands(options: {
props: {
title: i18n.baseText('commandBar.nodes.addNode'),
shortcut: {
keys: ['tab'],
keys: ['n'],
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,6 @@ registerKeyHook('NodeCreatorCloseEscape', {
keyboardKeys: ['Escape'],
handler: () => emit('closeNodeCreator'),
});
registerKeyHook('NodeCreatorCloseTab', {
keyboardKeys: ['Tab'],
handler: () => emit('closeNodeCreator'),
});

watch(
() => ({
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<script setup lang="ts">
import { useI18n } from '@n8n/i18n';
import { N8nButton, N8nPopover } from '@n8n/design-system';

defineProps<{
visible: boolean;
}>();

const emit = defineEmits<{
dismiss: [];
}>();

const i18n = useI18n();
</script>

<template>
<N8nPopover
:open="visible"
:show-arrow="true"
:enable-scrolling="false"
:suppress-auto-focus="true"
side="left"
align="center"
:side-offset="8"
:z-index="2200"
content-class="node-creator-shortcut-coachmark"
>
<template #trigger>
<slot />
</template>
<template #content>
<div class="node-creator-shortcut-coachmark__header">
<span class="node-creator-shortcut-coachmark__title">{{
i18n.baseText('nodeCreator.shortcutCoachmark.title')
}}</span>
</div>
<p class="node-creator-shortcut-coachmark__body">
{{ i18n.baseText('nodeCreator.shortcutCoachmark.body') }}
</p>
<div class="node-creator-shortcut-coachmark__footer">
<N8nButton
size="small"
:label="i18n.baseText('nodeCreator.shortcutCoachmark.gotIt')"
class="node-creator-shortcut-coachmark__button"
@click="emit('dismiss')"
/>
</div>
</template>
</N8nPopover>
</template>

<style lang="scss">
.node-creator-shortcut-coachmark {
width: 250px;
padding: var(--spacing--xs);
background: var(--color--background--shade-2);
color: var(--color--foreground--tint-2);

svg {
fill: var(--color--background--shade-2);
stroke: var(--color--background--shade-2);
}

&__header {
display: flex;
align-items: center;
justify-content: space-between;
padding-bottom: var(--spacing--4xs);
}

&__title {
font-size: var(--font-size--sm);
font-weight: var(--font-weight--bold);
line-height: 1.45;
}

&__body {
font-size: var(--font-size--sm);
line-height: var(--line-height--xl);
margin: 0;
}

&__footer {
padding-top: var(--spacing--2xs);
}

&__button {
background-color: var(--color--primary);

&:hover {
background-color: var(--color--primary--shade-1);
}
}
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,7 @@ interface KeyHook {
}

export const KEYBOARD_ID_ATTR = 'data-keyboard-nav-id';
export const WATCHED_KEYS = [
'ArrowUp',
'ArrowDown',
'ArrowLeft',
'ArrowRight',
'Enter',
'Escape',
'Tab',
];
export const WATCHED_KEYS = ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'Enter', 'Escape'];

export const useKeyboardNavigation = defineStore('nodeCreatorKeyboardNavigation', () => {
const selectableItems = ref<Array<WeakRef<Element>>>([]);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { computed, onScopeDispose, ref } from 'vue';
import { useCalloutHelpers } from '@/app/composables/useCalloutHelpers';
import { canvasEventBus } from '@/features/workflows/canvas/canvas.eventBus';

export const NODE_CREATOR_SHORTCUT_COACHMARK_KEY = 'node-creator-shortcut-coachmark';

export function useNodeCreatorShortcutCoachmark() {
const { isCalloutDismissed, dismissCallout } = useCalloutHelpers();

const isTabPressed = ref(false);

const shouldShowCoachmark = computed(() => {
return isTabPressed.value && !isCalloutDismissed(NODE_CREATOR_SHORTCUT_COACHMARK_KEY);
});

function onDeprecatedTabShortcut() {
isTabPressed.value = true;
}

canvasEventBus.on('deprecated:tab-shortcut', onDeprecatedTabShortcut);

onScopeDispose(() => {
canvasEventBus.off('deprecated:tab-shortcut', onDeprecatedTabShortcut);
});

async function onDismissCoachmark() {
isTabPressed.value = false;
await dismissCallout(NODE_CREATOR_SHORTCUT_COACHMARK_KEY);
}

return {
shouldShowCoachmark,
onDismissCoachmark,
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import type {
} from '@/Interface';
import { useActions } from '../composables/useActions';
import KeyboardShortcutTooltip from '@/app/components/KeyboardShortcutTooltip.vue';
import NodeCreatorShortcutCoachmark from '../components/NodeCreatorShortcutCoachmark.vue';
import { useNodeCreatorShortcutCoachmark } from '../composables/useNodeCreatorShortcutCoachmark';
import { useI18n } from '@n8n/i18n';
import { useTelemetry } from '@/app/composables/useTelemetry';
import { useAssistantStore } from '@/features/ai/assistant/assistant.store';
Expand Down Expand Up @@ -57,6 +59,7 @@ const builderStore = useBuilderStore();
const chatPanelStore = useChatPanelStore();

const { getAddedNodesAndConnections } = useActions();
const { shouldShowCoachmark, onDismissCoachmark } = useNodeCreatorShortcutCoachmark();

const sidePanelTooltip = computed(() => {
if (setupPanelStore.isFeatureEnabled) {
Expand Down Expand Up @@ -144,19 +147,21 @@ function openCommandBar(event: MouseEvent) {

<template>
<div v-if="!createNodeActive" :class="$style.nodeButtonsWrapper">
<KeyboardShortcutTooltip
:label="i18n.baseText('nodeView.openNodesPanel')"
:shortcut="{ keys: ['Tab'] }"
placement="left"
>
<N8nIconButton
variant="subtle"
size="large"
icon="plus"
data-test-id="node-creator-plus-button"
@click="openNodeCreator"
/>
</KeyboardShortcutTooltip>
<NodeCreatorShortcutCoachmark :visible="shouldShowCoachmark" @dismiss="onDismissCoachmark">
<KeyboardShortcutTooltip
:label="i18n.baseText('nodeView.openNodesPanel')"
:shortcut="{ keys: ['N'] }"
placement="left"
>
<N8nIconButton
variant="subtle"
size="large"
icon="plus"
data-test-id="node-creator-plus-button"
@click="openNodeCreator"
/>
</KeyboardShortcutTooltip>
</NodeCreatorShortcutCoachmark>
<KeyboardShortcutTooltip
:label="i18n.baseText('nodeView.openCommandBar')"
:shortcut="{ keys: ['k'], metaKey: true }"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ export type CanvasEventBusEvents = {
trackBulk?: boolean;
};
'create:sticky': never;
'deprecated:tab-shortcut': never;
};

export interface CanvasNodeInjectionData {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { useCanvasTraversal } from '../composables/useCanvasTraversal';
import { type KeyMap, useKeybindings } from '@/app/composables/useKeybindings';
import type { PinDataSource } from '@/app/composables/usePinnedData';
import { CanvasKey } from '@/app/constants';
import { useUsersStore } from '@/features/settings/users/users.store';
import { NODE_CREATOR_SHORTCUT_COACHMARK_KEY } from '@/features/shared/nodeCreator/composables/useNodeCreatorShortcutCoachmark';
import type { NodeCreatorOpenSource } from '@/Interface';
import type {
CanvasConnection,
Expand Down Expand Up @@ -161,6 +163,7 @@ const props = withDefaults(
);

const { isMobileDevice, controlKeyCode } = useDeviceSupport();
const usersStore = useUsersStore();
const experimentalNdvStore = useExperimentalNdvStore();
const focusedNodesStore = useFocusedNodesStore();
const chatPanelStore = useChatPanelStore();
Expand Down Expand Up @@ -366,7 +369,13 @@ const keyMap = computed(() => {
d: emitWithSelectedNodes((ids) => emit('update:nodes:enabled', ids)),
p: emitWithSelectedNodes((ids) => emit('update:nodes:pin', ids, 'keyboard-shortcut')),
f2: emitWithLastSelectedNode((id) => emit('update:node:name', id)),
tab: () => emit('create:node', 'tab'),
n: () => emit('create:node', 'node_shortcut'),
tab: {
disabled: () => usersStore.isCalloutDismissed(NODE_CREATOR_SHORTCUT_COACHMARK_KEY),
run: () => {
props.eventBus.emit('deprecated:tab-shortcut');
},
},
shift_s: () => emit('create:sticky'),
shift_f: () => emit('toggle:focus-panel'),
ctrl_alt_n: () => emit('create:workflow'),
Expand Down