From 1cf7c3a46ce7b80164a8c16aab035e3c5156f083 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20K=C5=82os?= Date: Fri, 6 Mar 2020 12:30:35 +0100 Subject: [PATCH] jsdialog: implemented multilineedit control MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I1cda88437357f80cafbdcdbee03832af806a55d6 Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93030 Tested-by: Jenkins CollaboraOffice Reviewed-by: Szymon Kłos --- .../src/control/Control.JSDialogBuilder.js | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js b/loleaflet/src/control/Control.JSDialogBuilder.js index 5bc0ac9ba..225e92ad9 100644 --- a/loleaflet/src/control/Control.JSDialogBuilder.js +++ b/loleaflet/src/control/Control.JSDialogBuilder.js @@ -110,6 +110,7 @@ L.Control.JSDialogBuilder = L.Control.extend({ this._controlHandlers['checkbox'] = this._checkboxControl; this._controlHandlers['spinfield'] = this._spinfieldControl; this._controlHandlers['edit'] = this._editControl; + this._controlHandlers['multilineedit'] = this._multiLineEditControl; this._controlHandlers['pushbutton'] = this._pushbuttonControl; this._controlHandlers['combobox'] = this._comboboxControl; this._controlHandlers['comboboxentry'] = this._comboboxEntry; @@ -1128,6 +1129,27 @@ L.Control.JSDialogBuilder = L.Control.extend({ return false; }, + _multiLineEditControl: function(parentContainer, data, builder, callback) { + var edit = L.DomUtil.create('textarea', '', parentContainer); + edit.value = builder._cleanText(data.text); + edit.id = data.id; + + if (data.enabled == 'false') + $(edit).attr('disabled', 'disabled'); + + edit.addEventListener('change', function() { + if (callback) + callback(this.value); + else + builder.callback('edit', 'change', edit, this.value, builder); + }); + + if (data.hidden) + $(edit).hide(); + + return false; + }, + _pushbuttonControl: function(parentContainer, data, builder, customCallback) { var pushbutton = L.DomUtil.create('button', '', parentContainer); pushbutton.innerHTML = builder._cleanText(data.text);