mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
fix(editor): Make sure HTML editor field is not editable when workflow is in read only mode (#17561)
This commit is contained in:
@@ -33,9 +33,15 @@ const emit = defineEmits<{
|
|||||||
finishedLoading: [];
|
finishedLoading: [];
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = withDefaults(
|
||||||
hasChanges: boolean;
|
defineProps<{
|
||||||
}>();
|
hasChanges: boolean;
|
||||||
|
isReadOnly?: boolean;
|
||||||
|
}>(),
|
||||||
|
{
|
||||||
|
isReadOnly: false,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
const { getSchemaForExecutionData, getInputDataWithPinned } = useDataSchema();
|
const { getSchemaForExecutionData, getInputDataWithPinned } = useDataSchema();
|
||||||
const i18n = useI18n();
|
const i18n = useI18n();
|
||||||
@@ -278,6 +284,7 @@ onMounted(() => {
|
|||||||
:maxlength="ASK_AI_MAX_PROMPT_LENGTH"
|
:maxlength="ASK_AI_MAX_PROMPT_LENGTH"
|
||||||
:placeholder="i18n.baseText('codeNodeEditor.askAi.placeholder')"
|
:placeholder="i18n.baseText('codeNodeEditor.askAi.placeholder')"
|
||||||
data-test-id="ask-ai-prompt-input"
|
data-test-id="ask-ai-prompt-input"
|
||||||
|
:readonly="props.isReadOnly"
|
||||||
@input="onPromptInput"
|
@input="onPromptInput"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -263,6 +263,7 @@ defineExpose({
|
|||||||
<AskAI
|
<AskAI
|
||||||
:key="activeTab"
|
:key="activeTab"
|
||||||
:has-changes="hasManualChanges"
|
:has-changes="hasManualChanges"
|
||||||
|
:is-read-only="props.isReadOnly"
|
||||||
@replace-code="onAiReplaceCode"
|
@replace-code="onAiReplaceCode"
|
||||||
@started-loading="onAiLoadStart"
|
@started-loading="onAiLoadStart"
|
||||||
@finished-loading="onAiLoadEnd"
|
@finished-loading="onAiLoadEnd"
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import {
|
|||||||
foldGutter,
|
foldGutter,
|
||||||
indentOnInput,
|
indentOnInput,
|
||||||
} from '@codemirror/language';
|
} from '@codemirror/language';
|
||||||
import { Prec } from '@codemirror/state';
|
import { Prec, EditorState } from '@codemirror/state';
|
||||||
import {
|
import {
|
||||||
dropCursor,
|
dropCursor,
|
||||||
highlightActiveLine,
|
highlightActiveLine,
|
||||||
@@ -83,6 +83,7 @@ const extensions = computed(() => [
|
|||||||
indentOnInput(),
|
indentOnInput(),
|
||||||
highlightActiveLine(),
|
highlightActiveLine(),
|
||||||
mappingDropCursor(),
|
mappingDropCursor(),
|
||||||
|
...(props.isReadOnly ? [EditorState.readOnly.of(true)] : []),
|
||||||
]);
|
]);
|
||||||
const {
|
const {
|
||||||
editor: editorRef,
|
editor: editorRef,
|
||||||
|
|||||||
Reference in New Issue
Block a user