[Libreoffice-commits] online.git: loleaflet/dist
Pranav Kant
pranavk at collabora.co.uk
Fri Dec 16 16:45:25 UTC 2016
loleaflet/dist/toolbar/toolbar.js | 33 ++++++++++++++++-----------------
1 file changed, 16 insertions(+), 17 deletions(-)
New commits:
commit d1a3d365b01400907486ee8b57884465fd3073a2
Author: Pranav Kant <pranavk at collabora.co.uk>
Date: Fri Dec 16 22:08:17 2016 +0530
loleaflet: Cleanup & fix default numbering/bullet state
Automatically initialize formatButtons internal object to
preclude the possibility of one forgetting to enter the id of the
button in formatButtons object.
Fix 'id' of default numbering/bullet button after which it is
correctly showing the state now.
Change-Id: I57247e1b0e6d462153a47d31a883ceb04ecff74b
Reviewed-on: https://gerrit.libreoffice.org/32101
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 3ae6e54..bd24fb5 100644
--- a/loleaflet/dist/toolbar/toolbar.js
+++ b/loleaflet/dist/toolbar/toolbar.js
@@ -333,6 +333,11 @@ function onColorPick(e, color) {
map.focus();
}
+// This object is used to store enabled/disabled state of each and every eligible item
+// (i.e the one having UNO command) of toolbar-up. When the permission is changed to/from
+// edit/view mode, state from this object is read and then applied on corresponding buttons
+var formatButtons = {};
+
$(function () {
$('#toolbar-up-more').w2toolbar({
name: 'toolbar-up-more',
@@ -395,8 +400,8 @@ $(function () {
{type: 'button', id: 'sortascending', img: 'sortascending', hint: _('Sort Ascending'), uno: 'SortAscending'},
{type: 'button', id: 'sortdescending', img: 'sortdescending', hint: _('Sort Descending'), uno: 'SortDescending'},
{type: 'break', id: 'break-align'},
- {type: 'button', id: 'bullet', img: 'bullet', hint: _('Bullets on/off'), uno: 'DefaultBullet'},
- {type: 'button', id: 'numbering', img: 'numbering', hint: _('Numbering on/off'), uno: 'DefaultNumbering'},
+ {type: 'button', id: 'defaultbullet', img: 'bullet', hint: _('Bullets on/off'), uno: 'DefaultBullet'},
+ {type: 'button', id: 'defaultnumbering', img: 'numbering', hint: _('Numbering on/off'), uno: 'DefaultNumbering'},
{type: 'break', id: 'break-numbering'},
{type: 'button', id: 'incrementindent', img: 'incrementindent', hint: _('Increase indent'), uno: 'IncrementIndent'},
{type: 'button', id: 'decrementindent', img: 'decrementindent', hint: _('Decrease indent'), uno: 'DecrementIndent'},
@@ -449,6 +454,15 @@ $(function () {
}
}
+ // Intialize the formatButtons object
+ if (Object.keys(formatButtons).length === 0) {
+ for (var itemIdx in w2ui['toolbar-up'].items) {
+ if (w2ui['toolbar-up'].items[itemIdx].uno) {
+ formatButtons[w2ui['toolbar-up'].items[itemIdx].id] = true;
+ }
+ }
+ }
+
insertTable();
}
});
@@ -535,21 +549,6 @@ $(function () {
});
});
-// This object is used to track enabled/disabled state when one is in view mode
-var formatButtons = {
- 'undo': true, 'redo': true, 'save': true,
- 'bold': true, 'italic': true, 'underline': true, 'strikeout': true,
- 'insertannotation': true, 'inserttable': true,
- 'fontcolor': true, 'backcolor': true, 'bullet': true, 'numbering': true,
- 'alignleft': true, 'alignhorizontal': true, 'alignright': true, 'alignblock': true,
- 'incrementindent': true, 'decrementindent': true, 'insertgraphic': true,
- 'insertfootnote': true, 'repair': true, 'specialcharacter': true,
- 'wraptext': true, 'togglemergecells': true, 'numberformatcurrency': true,
- 'numberformatpercent': true, 'numberformatdecimal': true, 'numberformatdate': true,
- 'numberformatincdecimals': true, 'numberformatdecdecimals': true,
- 'sortascending': true, 'sortdescending': true
-};
-
var userJoinedPopupMessage = '<div>' + _('%user has joined') + '</div>';
var userLeftPopupMessage = '<div>' + _('%user has left') + '</div>';
var userPopupTimeout = null;
More information about the Libreoffice-commits
mailing list