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

Henry Castro hcastro at collabora.com
Mon Sep 4 20:30:58 UTC 2017


 loleaflet/src/control/Control.Menubar.js |   14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

New commits:
commit a29fa8756dbc9b0686300a0854994bf18b3ea4b6
Author: Henry Castro <hcastro at collabora.com>
Date:   Mon Sep 4 16:32:24 2017 -0400

    loleaflet: add initial menu bar before the document is loaded
    
    Change-Id: I9ab7f87e0ad3f4c9ff11670b8a2675d895a9c812

diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js
index 031bbb52..17bc8a64 100644
--- a/loleaflet/src/control/Control.Menubar.js
+++ b/loleaflet/src/control/Control.Menubar.js
@@ -6,6 +6,12 @@
 L.Control.Menubar = L.Control.extend({
 	// TODO: Some mechanism to stop the need to copy duplicate menus (eg. Help)
 	options: {
+		initial: [
+			{name: _('File'), disabled: true},
+			{name: _('Edit'), disabled: true},
+			{name: _('View'), disabled: true},
+			{name: _('Insert'), disabled: true}
+		],
 		text:  [
 			{name: _('File'), id: 'file', type: 'menu', menu: [
 				{name: _('Save'), id: 'save', type: 'action'},
@@ -298,6 +304,7 @@ L.Control.Menubar = L.Control.extend({
 	onAdd: function (map) {
 		this._initialized = false;
 		this._menubarCont = L.DomUtil.get('main-menu');
+		this._initializeMenu(this.options.initial);
 
 		map.on('doclayerinit', this._onDocLayerInit, this);
 		map.on('addmenu', this._addMenu, this);
@@ -322,6 +329,11 @@ L.Control.Menubar = L.Control.extend({
 	},
 
 	_onDocLayerInit: function() {
+		// clear initial menu
+		while (this._menubarCont.hasChildNodes()) {
+			this._menubarCont.removeChild(this._menubarCont.firstChild);
+		}
+
 		// Add document specific menu
 		var docType = this._map.getDocType();
 		if (docType === 'text') {
@@ -746,7 +758,7 @@ L.Control.Menubar = L.Control.extend({
 					L.DomUtil.addClass(liItem, 'readonly');
 				}
 			}
-			var aItem = L.DomUtil.create('a', '', liItem);
+			var aItem = L.DomUtil.create('a', menu[i].disabled ? 'disabled' : '', liItem);
 			aItem.innerHTML = menu[i].name;
 
 			if (menu[i].type === 'menu') {


More information about the Libreoffice-commits mailing list