diff --git a/addons/web/static/src/core/code_editor/code_editor.js b/addons/web/static/src/core/code_editor/code_editor.js index d7d62731dbc..dd561247335 100644 --- a/addons/web/static/src/core/code_editor/code_editor.js +++ b/addons/web/static/src/core/code_editor/code_editor.js @@ -40,6 +40,7 @@ export class CodeEditor extends Component { optional: true, validate: (theme) => CodeEditor.THEMES.includes(theme), }, + maxLines: { type: Number, optional: true }, }; static defaultProps = { readonly: false, @@ -68,7 +69,7 @@ export class CodeEditor extends Component { this.aceEditor = aceEditor; this.aceEditor.setOptions({ - maxLines: Infinity, + maxLines: this.props.maxLines, showPrintMargin: false, }); this.aceEditor.session.setOptions({ diff --git a/addons/web/static/src/views/fields/ace/ace_field.xml b/addons/web/static/src/views/fields/ace/ace_field.xml index 492c9690b25..f86d50c153b 100644 --- a/addons/web/static/src/views/fields/ace/ace_field.xml +++ b/addons/web/static/src/views/fields/ace/ace_field.xml @@ -11,6 +11,7 @@ onChange.bind="handleChange" class="'ace-view-editor'" theme="theme" + maxLines="200" /> diff --git a/addons/web/static/tests/core/code_editor_tests.js b/addons/web/static/tests/core/code_editor_tests.js index 61f409622c6..b4928ca5bce 100644 --- a/addons/web/static/tests/core/code_editor_tests.js +++ b/addons/web/static/tests/core/code_editor_tests.js @@ -99,6 +99,7 @@ QUnit.module("Web Components", (hooks) => { mode="'xml'" value="state.value" onChange.bind="onChange" + maxLines="200" /> `; setup() {