Merge pull request #9995 from netchampfaris/code-resize
feat: Ability to resize expand/collapse code field
This commit is contained in:
commit
30705290fb
1 changed files with 11 additions and 0 deletions
|
|
@ -9,6 +9,12 @@ frappe.ui.form.ControlCode = frappe.ui.form.ControlText.extend({
|
|||
this.ace_editor_target = $('<div class="ace-editor-target"></div>')
|
||||
.appendTo(this.input_area);
|
||||
|
||||
this.expanded = false;
|
||||
this.$expand_button = $(`<button class="margin-top btn btn-xs btn-default">${__('Expand / Collapse')}</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',
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue