Skip to content

Commit

Permalink
refactor(editor): Rename event
Browse files Browse the repository at this point in the history
  • Loading branch information
tomi committed Aug 21, 2024
1 parent 7f8cb11 commit b4796c9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ const i18n = useI18n();
const telemetry = useTelemetry();
onMounted(() => {
if (!props.isReadOnly) codeNodeEditorEventBus.on('error-line-number', highlightLine);
if (!props.isReadOnly) codeNodeEditorEventBus.on('highlightLine', highlightLine);
codeNodeEditorEventBus.on('codeDiffApplied', diffApplied);
Expand Down Expand Up @@ -188,7 +188,7 @@ onMounted(() => {
onBeforeUnmount(() => {
codeNodeEditorEventBus.off('codeDiffApplied', diffApplied);
if (!props.isReadOnly) codeNodeEditorEventBus.off('error-line-number', highlightLine);
if (!props.isReadOnly) codeNodeEditorEventBus.off('highlightLine', highlightLine);
});
const aiEnabled = computed(() => {
Expand Down
4 changes: 2 additions & 2 deletions packages/editor-ui/src/components/SqlEditor/SqlEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,15 @@ watch(segments, () => {
});
onMounted(() => {
codeNodeEditorEventBus.on('error-line-number', highlightLine);
codeNodeEditorEventBus.on('highlightLine', highlightLine);
if (props.fullscreen) {
focus();
}
});
onBeforeUnmount(() => {
codeNodeEditorEventBus.off('error-line-number', highlightLine);
codeNodeEditorEventBus.off('highlightLine', highlightLine);
});
function line(lineNumber: number): Line | null {
Expand Down
2 changes: 1 addition & 1 deletion packages/editor-ui/src/composables/usePushConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ export function usePushConnection({ router }: { router: ReturnType<typeof useRou

const lineNumber = runDataExecuted?.data?.resultData?.error?.lineNumber;

codeNodeEditorEventBus.emit('error-line-number', lineNumber || 'final');
codeNodeEditorEventBus.emit('highlightLine', lineNumber ?? 'final');

const workflow = workflowHelpers.getCurrentWorkflow();
if (runDataExecuted.waitTill !== undefined) {
Expand Down
4 changes: 2 additions & 2 deletions packages/editor-ui/src/event-bus/code-node-editor.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { createEventBus } from 'n8n-design-system/utils';

export type ErrorLineNumberEvent = number | 'final';
export type HighlightLineEvent = number | 'final';

export interface CodeNodeEditorEventBusEvents {
/** Event that a diff have been applied to the code node editor */
codeDiffApplied: never;

/** Command to highlight a specific line in the code node editor */
'error-line-number': ErrorLineNumberEvent;
highlightLine: HighlightLineEvent;
}

export const codeNodeEditorEventBus = createEventBus<CodeNodeEditorEventBusEvents>();

0 comments on commit b4796c9

Please sign in to comment.