mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
feat: Add Ask assistant behind feature flag (#9995)
Co-authored-by: Ricardo Espinoza <ricardo@n8n.io> Co-authored-by: Milorad Filipovic <milorad@n8n.io>
This commit is contained in:
@@ -122,6 +122,8 @@ const telemetry = useTelemetry();
|
||||
onMounted(() => {
|
||||
if (!props.isReadOnly) codeNodeEditorEventBus.on('error-line-number', highlightLine);
|
||||
|
||||
codeNodeEditorEventBus.on('codeDiffApplied', diffApplied);
|
||||
|
||||
const { isReadOnly, language } = props;
|
||||
const extensions: Extension[] = [
|
||||
...readOnlyEditorExtensions,
|
||||
@@ -187,6 +189,7 @@ onMounted(() => {
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
codeNodeEditorEventBus.off('codeDiffApplied', diffApplied);
|
||||
if (!props.isReadOnly) codeNodeEditorEventBus.off('error-line-number', highlightLine);
|
||||
});
|
||||
|
||||
@@ -214,6 +217,22 @@ const languageExtensions = computed<[LanguageSupport, ...Extension[]]>(() => {
|
||||
}
|
||||
});
|
||||
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
(newValue) => {
|
||||
if (!editor.value) {
|
||||
return;
|
||||
}
|
||||
const current = editor.value.state.doc.toString();
|
||||
if (current === newValue) {
|
||||
return;
|
||||
}
|
||||
editor.value.dispatch({
|
||||
changes: { from: 0, to: getCurrentEditorContent().length, insert: newValue },
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
watch(
|
||||
() => props.mode,
|
||||
(_newMode, previousMode: CodeExecutionMode) => {
|
||||
@@ -331,6 +350,13 @@ function getLine(lineNumber: number): Line | null {
|
||||
}
|
||||
}
|
||||
|
||||
function diffApplied() {
|
||||
codeNodeEditorContainerRef.value?.classList.add('flash-editor');
|
||||
codeNodeEditorContainerRef.value?.addEventListener('animationend', () => {
|
||||
codeNodeEditorContainerRef.value?.classList.remove('flash-editor');
|
||||
});
|
||||
}
|
||||
|
||||
function highlightLine(lineNumber: number | 'final') {
|
||||
if (!editor.value) return;
|
||||
|
||||
@@ -399,6 +425,25 @@ function onAiLoadEnd() {
|
||||
border: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes backgroundAnimation {
|
||||
0% {
|
||||
background-color: none;
|
||||
}
|
||||
30% {
|
||||
background-color: rgba(41, 163, 102, 0.1);
|
||||
}
|
||||
100% {
|
||||
background-color: none;
|
||||
}
|
||||
}
|
||||
|
||||
.flash-editor {
|
||||
:deep(.cm-editor),
|
||||
:deep(.cm-gutter) {
|
||||
animation: backgroundAnimation 1.5s ease-in-out;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss" module>
|
||||
|
||||
Reference in New Issue
Block a user