Skip to content

Commit 99f384e

Browse files
authored
fix(editor): Fix read-only mode in inline expression editor (#9232)
1 parent 0b52320 commit 99f384e

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

packages/editor-ui/src/components/InlineExpressionEditor/InlineExpressionEditorInput.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ type Props = {
2525
modelValue: string;
2626
path: string;
2727
rows?: number;
28-
isReadonly?: boolean;
28+
isReadOnly?: boolean;
2929
additionalData?: IDataObject;
3030
eventBus?: EventBus;
3131
};
3232
3333
const props = withDefaults(defineProps<Props>(), {
3434
rows: 5,
35-
isReadonly: false,
35+
isReadOnly: false,
3636
additionalData: () => ({}),
3737
eventBus: () => createEventBus(),
3838
});
@@ -70,7 +70,7 @@ const {
7070
editorRef: root,
7171
editorValue,
7272
extensions,
73-
isReadOnly: props.isReadonly,
73+
isReadOnly: props.isReadOnly,
7474
autocompleteTelemetry: { enabled: true, parameterPath: props.path },
7575
additionalData: props.additionalData,
7676
});

packages/editor-ui/src/components/ParameterOptions.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ export default defineComponent({
203203
<style lang="scss" module>
204204
.container {
205205
display: flex;
206+
min-height: 22px;
206207
}
207208
208209
.loader {

packages/editor-ui/src/components/__tests__/ExpressionParameterInput.test.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,20 @@ describe('ExpressionParameterInput', () => {
4747
await userEvent.click(baseElement);
4848
expect(emitted('blur')).toHaveLength(1);
4949
});
50+
51+
describe('in read-only mode', () => {
52+
test('it should render a read-only expression input', async () => {
53+
const { container } = renderComponent({
54+
props: {
55+
modelValue: '={{$json.foo}}',
56+
isReadOnly: true,
57+
},
58+
});
59+
60+
const editor = container.querySelector('.cm-content') as HTMLDivElement;
61+
expect(editor).toBeInTheDocument();
62+
expect(editor.getAttribute('contenteditable')).toEqual('false');
63+
expect(editor.getAttribute('aria-readonly')).toEqual('true');
64+
});
65+
});
5066
});

0 commit comments

Comments
 (0)