[Libreoffice-commits] online.git: loleaflet/src

Szymon Kłos (via logerrit) logerrit at kemper.freedesktop.org
Mon Oct 28 11:06:55 UTC 2019


 loleaflet/src/control/Control.JSDialogBuilder.js |   24 +++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

New commits:
commit 2a9c59fa0de998b05bfc4864afbc5e2d42262c3f
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Mon Oct 28 12:06:25 2019 +0100
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Mon Oct 28 12:06:34 2019 +0100

    jsdialogs: make insert -> table spinfileds work
    
    Change-Id: Ie895c3fd89a0c704c1752522f089de7b44b7a69e

diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js b/loleaflet/src/control/Control.JSDialogBuilder.js
index 9a20f2a5e..50540a893 100644
--- a/loleaflet/src/control/Control.JSDialogBuilder.js
+++ b/loleaflet/src/control/Control.JSDialogBuilder.js
@@ -471,14 +471,14 @@ L.Control.JSDialogBuilder = L.Control.extend({
 
 		plus.addEventListener('click', function() {
 			if (customCallback)
-				customCallback();
+				customCallback('spinfield', 'plus', div, this.value, builder);
 			else
 				builder.callback('spinfield', 'plus', div, this.value, builder);
 		});
 
 		minus.addEventListener('click', function() {
 			if (customCallback)
-				customCallback();
+				customCallback('spinfield', 'minus', div, this.value, builder);
 			else
 				builder.callback('spinfield', 'minus', div, this.value, builder);
 		});
@@ -838,8 +838,24 @@ L.Control.JSDialogBuilder = L.Control.extend({
 
 		var rowsData = { min: 0, id: 'rows', text: '2', label: _('Rows') };
 		var colsData = { min: 0, id: 'cols', text: '2', label: _('Columns') };
-		builder._spinfieldControl(content, rowsData, builder, function() { });
-		builder._spinfieldControl(content, colsData, builder, function() { });
+
+		var callbackFunction = function(objectType, eventType, object) {
+			if (eventType == 'plus') {
+				$(object).find('input').val(function(i, oldval) {
+					return parseInt(oldval, 10) + 1;
+				});
+			} else if (eventType == 'minus') {
+				$(object).find('input').val(function(i, oldval) {
+					if (oldval > 0)
+						return parseInt(oldval, 10) - 1;
+					else
+						return 0;
+				});
+			}
+		};
+
+		builder._spinfieldControl(content, rowsData, builder, callbackFunction);
+		builder._spinfieldControl(content, colsData, builder, callbackFunction);
 
 		var buttonData = { text: _('Insert table') };
 		builder._pushbuttonControl(content, buttonData, builder, function() {


More information about the Libreoffice-commits mailing list