[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-2-0' - loleaflet/dist

Pranav Kant pranavk at collabora.co.uk
Fri Jan 6 10:18:31 UTC 2017


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

New commits:
commit e2ac447b36b70c372ec3e6694ae0f20f09f2e83c
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
    (cherry picked from commit b22e52aa864c09b02e9e201367d231b442254aef)
    Reviewed-on: https://gerrit.libreoffice.org/32776
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Tested-by: Andras Timar <andras.timar at collabora.com>

diff --git a/loleaflet/dist/toolbar/toolbar.js b/loleaflet/dist/toolbar/toolbar.js
index 8b04688..d00dbb7 100644
--- a/loleaflet/dist/toolbar/toolbar.js
+++ b/loleaflet/dist/toolbar/toolbar.js
@@ -367,10 +367,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'},
@@ -587,6 +587,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;
@@ -880,6 +885,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') {
@@ -1023,7 +1029,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