mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
refactor(editor): Add types to codeNodeEditorEventBus (no-changelog) (#10501)
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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(() => {
|
||||
|
||||
@@ -154,7 +154,7 @@ watch(segments, () => {
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
codeNodeEditorEventBus.on('error-line-number', highlightLine);
|
||||
codeNodeEditorEventBus.on('highlightLine', highlightLine);
|
||||
|
||||
if (props.fullscreen) {
|
||||
focus();
|
||||
@@ -162,7 +162,7 @@ onMounted(() => {
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
codeNodeEditorEventBus.off('error-line-number', highlightLine);
|
||||
codeNodeEditorEventBus.off('highlightLine', highlightLine);
|
||||
});
|
||||
|
||||
function line(lineNumber: number): Line | null {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
import { createEventBus } from 'n8n-design-system/utils';
|
||||
|
||||
export const codeNodeEditorEventBus = createEventBus();
|
||||
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 */
|
||||
highlightLine: HighlightLineEvent;
|
||||
}
|
||||
|
||||
export const codeNodeEditorEventBus = createEventBus<CodeNodeEditorEventBusEvents>();
|
||||
|
||||
Reference in New Issue
Block a user