loleaflet/src/control/Control.LokDialog.js | 38 +++++++++++++++++++---------- 1 file changed, 25 insertions(+), 13 deletions(-)
New commits: commit f089599742fbccf0324cfac1fe4563342889fce4 Author: Marco Cecchetti <marco.cecche...@collabora.com> AuthorDate: Mon Apr 20 13:51:46 2020 +0200 Commit: Marco Cecchetti <marco.cecche...@collabora.com> CommitDate: Wed Apr 29 13:29:05 2020 +0200 leaflet: calc: add inputbar_multiline class when input bar is expanded Change-Id: I4d9ac5480af37b42402f5597d3500754655055ab Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92692 Tested-by: Marco Cecchetti <marco.cecche...@collabora.com> Reviewed-by: Marco Cecchetti <marco.cecche...@collabora.com> diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js index 42e3fdbc8..bcdf1f4fa 100644 --- a/loleaflet/src/control/Control.LokDialog.js +++ b/loleaflet/src/control/Control.LokDialog.js @@ -282,6 +282,8 @@ L.Control.LokDialog = L.Control.extend({ top = parseInt(e.position.split(',')[1]); } + var lines = 0; + if (e.title && typeof brandProductName !== 'undefined') { e.title = e.title.replace('Collabora Office', brandProductName); } @@ -291,7 +293,8 @@ L.Control.LokDialog = L.Control.extend({ // When left/top are invalid, the dialog shows in the center. this._launchDialog(e.id, left, top, width, height, e.title); } else if (e.winType === 'calc-input-win') { - this._launchCalcInputBar(e.id, width, height); + lines = parseInt(e.lines); + this._launchCalcInputBar(e.id, width, height, lines); } else if (e.winType === 'deck') { if (!window.mode.isMobile()) { this._launchSidebar(e.id, width, height); @@ -360,11 +363,13 @@ L.Control.LokDialog = L.Control.extend({ } else if (e.action === 'size_changed') { // FIXME: we don't really have to destroy and launch the dialog again but do it for // now because the size sent to us previously in 'created' cb is not correct - if (e.winType === 'deck' || this._isSidebar(e.id)) { + if (e.winType === 'deck' || this._isSidebar(e.id)) { $('#' + strId).remove(); this._launchSidebar(e.id, width, height); - } else if (e.winType === 'calc-input-win' || this.isCalcInputBar(e.id)) - this._launchCalcInputBar(e.id, width, height); + } else if (e.winType === 'calc-input-win' || this.isCalcInputBar(e.id)) { + lines = parseInt(e.lines); + this._launchCalcInputBar(e.id, width, height, lines); + } else { $('#' + strId).remove(); this._launchDialog(e.id, null, null, width, height, this._dialogs[parseInt(e.id)].title); @@ -799,21 +804,21 @@ L.Control.LokDialog = L.Control.extend({ this._sendPaintWindow(id, this._createRectStr(id)); }, - _launchCalcInputBar: function(id, width, height) { - console.log('_launchCalcInputBar: start: id: ' + id + ', width: ' + width + ', height: ' + height); - if (!this._calcInputBar || this._calcInputBar.id != id) { + _launchCalcInputBar: function(id, width, height, textLines) { + console.log('_launchCalcInputBar: start: id: ' + id + ', width: ' + width + ', height: ' + height + ', textLines: ' + textLines); + if (!this._calcInputBar || this._calcInputBar.id !== id) { if (this._calcInputBar) $('#' + this._calcInputBar.strId).remove(); - this._createCalcInputbar(id, width, height); + this._createCalcInputbar(id, width, height, textLines); } else { // Update in-place. We will resize during rendering. - this._adjustCalcInputBar(id, width, height); + this._adjustCalcInputBar(id, width, height, textLines); } console.log('_launchCalcInputBar: end'); }, - _adjustCalcInputBar: function(id, width, height) { + _adjustCalcInputBar: function(id, width, height, textLines) { if (this._calcInputBar) { var oldHeight = this._calcInputBar.height; var delta = height - oldHeight; @@ -822,7 +827,7 @@ L.Control.LokDialog = L.Control.extend({ // Recreate the input-bar. $('#' + this._calcInputBar.strId).remove(); - this._createCalcInputbar(id, width, height); + this._createCalcInputbar(id, width, height, textLines); // Resize the container. var documentContainer = L.DomUtil.get('document-container'); @@ -886,8 +891,8 @@ L.Control.LokDialog = L.Control.extend({ } }, - _createCalcInputbar: function(id, width, height) { - console.log('_createCalcInputBar: start: id: ' + id + ', width: ' + width + ', height: ' + height); + _createCalcInputbar: function(id, width, height, textLines) { + console.log('_createCalcInputBar: start: id: ' + id + ', width: ' + width + ', height: ' + height + ', textLines: ' + textLines); var strId = this._toStrId(id); $('#calc-inputbar-wrapper').css({display: 'block'}); @@ -897,6 +902,12 @@ L.Control.LokDialog = L.Control.extend({ L.DomUtil.setStyle(container, 'width', '100%'); L.DomUtil.setStyle(container, 'height', height + 'px'); + if (textLines > 1) { + $('#formulabar').addClass('inputbar_multiline'); + } else { + $('#formulabar').removeClass('inputbar_multiline'); + } + //var eventLayer = L.DomUtil.create('div', '', container); // Create the canvas. var canvas = L.DomUtil.create('canvas', 'inputbar_canvas', container); @@ -942,6 +953,7 @@ L.Control.LokDialog = L.Control.extend({ top: 0, width: width, height: height, + textLines: textLines, cursor: null, textSelection: {rectangles: selections, handles: handles, startHandle: startHandle, endHandle: endHandle}, child: null, // never used for inputbar _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits