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

Pranav Kant pranavk at collabora.co.uk
Fri Jan 6 09:16:50 UTC 2017


 loleaflet/dist/toolbar/toolbar.js |   16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

New commits:
commit 22b676f088b558d3ea79b14863755a931bd7c919
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Fri Jan 6 14:42:27 2017 +0530

    loleaflet: Make id of these toolbar items consistent with others
    
    We assume that id of the toolbar item is lowercase(unocommand),
    so lets keep it consistent too for alignment buttons.
    
    This also makes alignment buttons toggle except for spreadsheet
    where alignment of cell text happens via a different uno command,
    HorizontalAlignment.
    
    Change-Id: Ibacf06bd99435cd24b27c7870173a2519b167af1
    Reviewed-on: https://gerrit.libreoffice.org/32774
    Reviewed-by: pranavk <pranavk at collabora.co.uk>
    Tested-by: pranavk <pranavk at collabora.co.uk>

diff --git a/loleaflet/dist/toolbar/toolbar.js b/loleaflet/dist/toolbar/toolbar.js
index 3ef80bd..4263580 100644
--- a/loleaflet/dist/toolbar/toolbar.js
+++ b/loleaflet/dist/toolbar/toolbar.js
@@ -383,10 +383,10 @@ $(function () {
 			{type: 'html',  id: 'backcolor-html', html: '<input id="backColorPicker" style="display:none;">'},
 			{type: 'button',  id: 'backcolor', img: 'backcolor', hint: _('Highlighting')},
 			{type: 'break'},
-			{type: 'button',  id: 'alignleft',  img: 'alignleft', hint: _('Align left'), uno: 'LeftPara', unosheet: 'HorizontalAlignment {"HorizontalAlignment":{"type":"unsigned short", "value":"1"}}'},
-			{type: 'button',  id: 'alignhorizontal',  img: 'alignhorizontal', hint: _('Center horizontally'), uno: 'CenterPara', unosheet: 'HorizontalAlignment {"HorizontalAlignment":{"type":"unsigned short", "value":"2"}}'},
-			{type: 'button',  id: 'alignright',  img: 'alignright', hint: _('Align right'), uno: 'RightPara', unosheet: 'HorizontalAlignment {"HorizontalAlignment":{"type":"unsigned short", "value":"3"}}'},
-			{type: 'button',  id: 'alignblock',  img: 'alignblock', hint: _('Justified'), uno: 'JustifyPara', unosheet: 'HorizontalAlignment {"HorizontalAlignment":{"type":"unsigned short", "value":"4"}}'},
+			{type: 'button',  id: 'leftpara',  img: 'alignleft', hint: _('Align left'), uno: 'LeftPara', unosheet: 'HorizontalAlignment {"HorizontalAlignment":{"type":"unsigned short", "value":"1"}}'},
+			{type: 'button',  id: 'centerpara',  img: 'alignhorizontal', hint: _('Center horizontally'), uno: 'CenterPara', unosheet: 'HorizontalAlignment {"HorizontalAlignment":{"type":"unsigned short", "value":"2"}}'},
+			{type: 'button',  id: 'rightpara',  img: 'alignright', hint: _('Align right'), uno: 'RightPara', unosheet: 'HorizontalAlignment {"HorizontalAlignment":{"type":"unsigned short", "value":"3"}}'},
+			{type: 'button',  id: 'justifypara',  img: 'alignblock', hint: _('Justified'), uno: 'JustifyPara', unosheet: 'HorizontalAlignment {"HorizontalAlignment":{"type":"unsigned short", "value":"4"}}'},
 			{type: 'break',  id: 'wraptextseparator'},
 			{type: 'button',  id: 'wraptext',  img: 'wraptext', hint: _('Wrap Text'), uno: 'WrapText'},
 			{type: 'button',  id: 'togglemergecells',  img: 'togglemergecells', hint: _('Merge and Center Cells'), uno: 'ToggleMergeCells'},
@@ -606,6 +606,11 @@ function toLocalePattern (pattern, regex, text, sub1, sub2) {
 	return text;
 }
 
+function unoCmdToToolbarId(commandname)
+{
+	return commandname.toLowerCase().substr(5);
+}
+
 function selectItem(item, func)
 {
 	var index = -1;
@@ -898,6 +903,7 @@ map.on('commandstatechanged', function (e) {
 	var found = false;
 	var value, color, div;
 	var matches;
+
 	if (commandName === '.uno:AssignLayout') {
 		$('.styles-select').val(state).trigger('change');
 	} else if (commandName === '.uno:StyleApply') {
@@ -1041,7 +1047,7 @@ map.on('commandstatechanged', function (e) {
 		$('#PageStatus').html(state ? state : '    &nbsp');
 	}
 
-	var id = commandName.toLowerCase().substr(5);
+	var id = unoCmdToToolbarId(commandName);
 	if (typeof formatButtons[id] !== 'undefined') {
 		if (state === 'true') {
 			toolbar.enable(id);


More information about the Libreoffice-commits mailing list