[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-2-1' - loleaflet/dist loleaflet/src
Pranav Kant
pranavk at collabora.co.uk
Thu May 11 11:46:10 UTC 2017
loleaflet/dist/menubar.css | 16 +++++++++++++++-
loleaflet/src/control/Control.Menubar.js | 17 +++++++----------
2 files changed, 22 insertions(+), 11 deletions(-)
New commits:
commit ba8bcf59cdd289527e59663a625906aa7c69adc7
Author: Pranav Kant <pranavk at collabora.co.uk>
Date: Wed May 3 21:18:36 2017 +0530
tdf#106447: Support checked items in menubar
Bin the internal command state recorder to Menubar and use the global
state recorder available in the map.
Change-Id: I32e81700e38c2d544b2d874e6a30fbe58e8d43bd
Reviewed-on: https://gerrit.libreoffice.org/37505
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
Tested-by: Jan Holesovsky <kendy at collabora.com>
diff --git a/loleaflet/dist/menubar.css b/loleaflet/dist/menubar.css
index 70fdaee7..eb115d77 100644
--- a/loleaflet/dist/menubar.css
+++ b/loleaflet/dist/menubar.css
@@ -62,7 +62,7 @@
cursor: default;
}
.lo-menu a, .lo-menu a:hover, .lo-menu a:focus, .lo-menu a:active, .lo-menu a.highlighted {
- padding: 5px 15px;
+ padding: 5px 22px;
color: #000;
}
.lo-menu a:hover, .lo-menu a:focus, .lo-menu a:active, .lo-menu a.highlighted {
@@ -226,3 +226,17 @@
top: 3px; /* This is not a menu, plain action, but we want it to appear like a menu */
}
}
+
+/* Some more lo-menu specific customizations */
+
+/* The smartmenus plugin doesn't seem to have support for icons, so implement our own pseudo-elements */
+.lo-menu-item-checked::before {
+ position: absolute;
+ content: '\2713';
+ left: 5px;
+ top: 5px;
+}
+
+.lo-menu-item-checked:hover::before {
+ color: #fff;
+}
diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js
index 4cbc6b71..89048a3b 100644
--- a/loleaflet/src/control/Control.Menubar.js
+++ b/loleaflet/src/control/Control.Menubar.js
@@ -296,15 +296,6 @@ L.Control.Menubar = L.Control.extend({
this._menubarCont = L.DomUtil.get('main-menu');
map.on('doclayerinit', this._onDocLayerInit, this);
- map.on('commandstatechanged', this._onCommandStateChanged, this);
- },
-
- _onCommandStateChanged: function(e) {
- // Store information about enabled/disabled commands
- // Used later just before showing menu to enable/disable menu items
- if (e.state === 'enabled' || e.state === 'disabled') {
- this.options.commandStates[e.commandName] = e.state;
- }
},
_onDocLayerInit: function() {
@@ -382,11 +373,17 @@ L.Control.Menubar = L.Control.extend({
if (map._permission === 'edit') {
if (type === 'unocommand') { // enable all depending on stored commandStates
var unoCommand = $(aItem).data('uno');
- if (self.options.commandStates[unoCommand] === 'disabled') {
+ if (map['stateChangeHandler'].getItemValue(unoCommand) === 'disabled') {
$(aItem).addClass('disabled');
} else {
$(aItem).removeClass('disabled');
}
+
+ if (map['stateChangeHandler'].getItemValue(unoCommand) === 'true') {
+ $(aItem).addClass('lo-menu-item-checked');
+ } else {
+ $(aItem).removeClass('lo-menu-item-checked');
+ }
} else if (type === 'action') { // enable all except fullscreen on windows
if (id === 'fullscreen' && (L.Browser.ie || L.Browser.edge)) { // Full screen works weirdly on IE 11 and on Edge
$(aItem).addClass('disabled');
More information about the Libreoffice-commits
mailing list