diff --git a/frappe/public/js/frappe/form/controls/code.js b/frappe/public/js/frappe/form/controls/code.js index 0648ad6e22..bdf36b706a 100644 --- a/frappe/public/js/frappe/form/controls/code.js +++ b/frappe/public/js/frappe/form/controls/code.js @@ -9,6 +9,12 @@ frappe.ui.form.ControlCode = frappe.ui.form.ControlText.extend({ this.ace_editor_target = $('
') .appendTo(this.input_area); + this.expanded = false; + this.$expand_button = $(``).click(() => { + this.expanded = !this.expanded; + this.refresh_height(); + }).insertAfter(this.ace_editor_target); + // styling this.ace_editor_target.addClass('border rounded'); this.ace_editor_target.css('height', 300); @@ -26,6 +32,11 @@ frappe.ui.form.ControlCode = frappe.ui.form.ControlText.extend({ }, 300)); }, + refresh_height() { + this.ace_editor_target.css('height', this.expanded ? 600 : 300); + this.editor.resize(); + }, + set_language() { const language_map = { 'Javascript': 'ace/mode/javascript',