From b4d5584fe75554e521ccf8415dd17f11bc3be4ce Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Wed, 27 Feb 2019 11:00:53 +0100 Subject: [PATCH] Make editableWidget to set height when in edit mode --- api/js/etemplate/et2_core_editableWidget.js | 5 +++++ api/js/etemplate/et2_widget_htmlarea.js | 10 +++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/api/js/etemplate/et2_core_editableWidget.js b/api/js/etemplate/et2_core_editableWidget.js index ddc8d27e72..7d0a2c386b 100644 --- a/api/js/etemplate/et2_core_editableWidget.js +++ b/api/js/etemplate/et2_core_editableWidget.js @@ -41,6 +41,11 @@ var et2_editableWidget = (function(){ "use strict"; return et2_inputWidget.exten type: "string", default: et2_no_init, description: "Additional parameters passed to save_callback" + }, + editable_height: { + name: "Editable height", + description: "Set height for widget while in edit mode", + type: "string" } }, diff --git a/api/js/etemplate/et2_widget_htmlarea.js b/api/js/etemplate/et2_widget_htmlarea.js index 80454c20fb..2320b643da 100644 --- a/api/js/etemplate/et2_widget_htmlarea.js +++ b/api/js/etemplate/et2_widget_htmlarea.js @@ -22,18 +22,18 @@ var et2_htmlarea = (function(){ "use strict"; return et2_editableWidget.extend([et2_IResizeable], { attributes: { - 'mode': { + mode: { 'name': 'Mode', 'description': 'One of {ascii|simple|extended|advanced}', 'default': '', 'type': 'string' }, - 'height': { + height: { 'name': 'Height', 'default': et2_no_init, 'type': 'string' }, - 'width': { + width: { 'name': 'Width', 'default': et2_no_init, 'type': 'string' @@ -214,7 +214,7 @@ var et2_htmlarea = (function(){ "use strict"; return et2_editableWidget.extend([ this.options.readonly = _value; if(this.options.readonly) { - this.editor.remove(); + if (this. editor) this.editor.remove(); this.htmlNode = jQuery(document.createElement(this.options.readonly ? "div" : "textarea")) .css('height', this.options.height) .addClass('et2_textbox_ro'); @@ -227,7 +227,7 @@ var et2_htmlarea = (function(){ "use strict"; return et2_editableWidget.extend([ if(!this.editor) { this.htmlNode = jQuery(document.createElement("textarea")) - .css('height', this.options.height) + .css('height', (this.options.editable_height ? this.options.editable_height : this.options.height)) .val(value); this.setDOMNode(this.htmlNode[0]); this.init_editor();