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

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Fri May 1 16:27:41 UTC 2020


 loleaflet/src/control/Control.NotebookbarBuilder.js |   38 +++++++++++++++++++-
 1 file changed, 37 insertions(+), 1 deletion(-)

New commits:
commit 89ca66f84636abd3cba5d3eb00d748f98c079c07
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Apr 28 08:29:16 2020 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Fri May 1 18:27:32 2020 +0200

    notebookbar: hide shortcuts toolbox from tab content
    
    Change-Id: I74c1c5825a05c7c1a16275a72da764bc68e0febb
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93283
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/loleaflet/src/control/Control.NotebookbarBuilder.js b/loleaflet/src/control/Control.NotebookbarBuilder.js
index 0dfed2a51..ed3a86417 100644
--- a/loleaflet/src/control/Control.NotebookbarBuilder.js
+++ b/loleaflet/src/control/Control.NotebookbarBuilder.js
@@ -153,6 +153,10 @@ L.Control.NotebookbarBuilder = L.Control.JSDialogBuilder.extend({
 			if (!childData)
 				continue;
 
+			var childType = childData.type;
+			if (childType === 'toolbox' && !childData.id)
+				continue;
+
 			if (parentHasManyChildren) {
 				if (!hasVerticalParent)
 					var td = L.DomUtil.create('td', '', containerToInsert);
@@ -167,7 +171,6 @@ L.Control.NotebookbarBuilder = L.Control.JSDialogBuilder.extend({
 			var isVertical = childData.vertical === 'true' ? true : false;
 
 			this._parentize(childData);
-			var childType = childData.type;
 			var processChildren = true;
 
 			if ((childData.id === undefined || childData.id === '' || childData.id === null)
commit 82f5268ee14e2d15e93fe757726063141b65a2f8
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Apr 28 13:07:52 2020 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Fri May 1 18:27:24 2020 +0200

    notebookbar: handle selection in comboboxes
    
    Change-Id: Idf3f7cdbe7a437f8996669eee8cc6474408c3c4a
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93285
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/loleaflet/src/control/Control.NotebookbarBuilder.js b/loleaflet/src/control/Control.NotebookbarBuilder.js
index 981ed1af2..0dfed2a51 100644
--- a/loleaflet/src/control/Control.NotebookbarBuilder.js
+++ b/loleaflet/src/control/Control.NotebookbarBuilder.js
@@ -29,6 +29,37 @@ L.Control.NotebookbarBuilder = L.Control.JSDialogBuilder.extend({
 		this._toolitemHandlers['vnd.sun.star.findbar:FocusToFindbar'] = function() {};
 	},
 
+	_setupComboboxSelectionHandler: function(combobox, id, builder) {
+		if (id === 'fontnamecombobox') {
+			$(combobox).on('select2:select', function (e) {
+				var font = e.target.value;
+				builder.map.applyFont(font);
+				builder.map.focus();
+			});
+		} else if (id === 'fontsizecombobox') {
+			$(combobox).on('select2:select', function (e) {
+				builder.map.applyFontSize(e.target.value);
+				builder.map.focus();
+			});
+		} else if (id === 'applystyle') {
+			$(combobox).on('select2:select', function (e) {
+				var style = e.target.value;
+				var docType = builder.map.getDocType();
+
+				if (style.startsWith('.uno:'))
+					builder.map.sendUnoCommand(style);
+				else if (docType === 'text')
+					builder.map.applyStyle(style, 'ParagraphStyles');
+				else if (docType === 'spreadsheet')
+					builder.map.applyStyle(style, 'CellStyles');
+				else if (docType === 'presentation' || docType === 'drawing')
+					builder.map.applyLayout(style);
+
+				builder.map.focus();
+			});
+		}
+	},
+
 	_comboboxControl: function(parentContainer, data, builder) {
 		if (!data.entries || data.entries.length === 0)
 			return false;
@@ -41,6 +72,8 @@ L.Control.NotebookbarBuilder = L.Control.JSDialogBuilder.extend({
 			placeholder: _(builder._cleanText(data.text))
 		});
 
+		builder._setupComboboxSelectionHandler(select, data.id, builder);
+
 		return false;
 	},
 


More information about the Libreoffice-commits mailing list