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

Henry Castro hcastro at collabora.com
Thu Apr 5 19:09:32 UTC 2018


 loleaflet/debug/document/loleaflet.html |    1 
 loleaflet/dist/loleaflet.css            |    9 ---
 loleaflet/dist/loleaflet.html.m4        |    1 
 loleaflet/dist/toolbar.css              |    2 
 loleaflet/dist/toolbar/toolbar.js       |   94 --------------------------------
 5 files changed, 1 insertion(+), 106 deletions(-)

New commits:
commit 826592458c2c08255c0aeaefa620f1d6b2f97dac
Author: Henry Castro <hcastro at collabora.com>
Date:   Thu Apr 5 15:04:31 2018 -0400

    loleaflet: remove toolbar button "more"
    
    Replace with new feature
    
    w2toolbar:
    "If toolbar has too many button that it does not fit the screen the overflow buttons will show up.
    No need to set any property, the overflow buttons will just appear"
    
    Change-Id: I6217203f9e2502baffa7bfc4cd68e2a1e7a27d15

diff --git a/loleaflet/debug/document/loleaflet.html b/loleaflet/debug/document/loleaflet.html
index 2d7a6a758..17244e7ef 100644
--- a/loleaflet/debug/document/loleaflet.html
+++ b/loleaflet/debug/document/loleaflet.html
@@ -79,7 +79,6 @@
         <div id="toolbar" style="visibility: hidden;"></div>
         <div id="toolbar-up"></div>
         <div id="formulabar"></div>
-        <div id="toolbar-up-more"></div>
     </div>
     <input id="insertgraphic" type="file" onchange="onInsertFile()" style="position: fixed; top: -100em">
 
diff --git a/loleaflet/dist/loleaflet.css b/loleaflet/dist/loleaflet.css
index 8f67261c0..30db2df72 100644
--- a/loleaflet/dist/loleaflet.css
+++ b/loleaflet/dist/loleaflet.css
@@ -90,15 +90,6 @@ body {
     #spreadsheet-row-column-frame.readonly {
 	top: 30px !important;
     }
-    /* There seems to be some bug in w2ui library -
-     * when we are in very low screen width, the toolbar-up-more
-     * toolbar's width doesn't adjust according to its children toolbar
-     * items and truncate all items but one. Lets override the width in
-     * mobile mode to prevent that.
-     */
-    #toolbar-up-more {
-	width: auto !important;
-    }
     /* We need to give space for options menu */
     #tb_toolbar-up_item_rightmenupadding {
 	padding-right: 40px;
diff --git a/loleaflet/dist/loleaflet.html.m4 b/loleaflet/dist/loleaflet.html.m4
index be6ac26ff..0fd1caf07 100644
--- a/loleaflet/dist/loleaflet.html.m4
+++ b/loleaflet/dist/loleaflet.html.m4
@@ -52,7 +52,6 @@ ifelse(debug,[true],[<link rel="stylesheet" href="/loleaflet/%VERSION%/w2ui-1.5.
       <div id="toolbar-wrapper">
 	<div id="toolbar-up"></div>
 	<div id="formulabar"></div>
-	<div id="toolbar-up-more"></div>
       </div>
       <input id="insertgraphic" type="file" style="position: fixed; top: -100em">
     </div>
diff --git a/loleaflet/dist/toolbar.css b/loleaflet/dist/toolbar.css
index 8e78f2bcb..4889eb456 100644
--- a/loleaflet/dist/toolbar.css
+++ b/loleaflet/dist/toolbar.css
@@ -16,7 +16,7 @@
     z-index: 1000;
 }
 
-#toolbar-up-more,w2ui-toolbar {
+w2ui-toolbar {
     position: absolute;
     right: 10px;
     top: 40px;
diff --git a/loleaflet/dist/toolbar/toolbar.js b/loleaflet/dist/toolbar/toolbar.js
index f2ee8690f..8a35056b4 100644
--- a/loleaflet/dist/toolbar/toolbar.js
+++ b/loleaflet/dist/toolbar/toolbar.js
@@ -47,7 +47,6 @@ var nUsers, oneUser, noUser;
 
 function _mobilify() {
 	var toolbarUp = w2ui['toolbar-up'];
-	var toolbarUpMore = w2ui['toolbar-up-more'];
 	var statusbar = w2ui['toolbar-down'];
 
 	for (var itemIdx in toolbarUp.items) {
@@ -56,12 +55,6 @@ function _mobilify() {
 			toolbarUp.hide(id);
 		}
 	}
-	for (itemIdx in toolbarUpMore.items) {
-		id = toolbarUpMore.items[itemIdx].id;
-		if (toolbarUpMobileItems.indexOf(id) === -1 && toolbarUpMore.get(id) && !toolbarUpMore.get(id).hidden) {
-			toolbarUpMore.hide(id);
-		}
-	}
 
 	for (itemIdx in statusbar.items) {
 		id = statusbar.items[itemIdx].id;
@@ -80,7 +73,6 @@ function _mobilify() {
 
 function _unmobilify() {
 	var toolbarUp = w2ui['toolbar-up'];
-	var toolbarUpMore = w2ui['toolbar-up-more'];
 	var statusbar = w2ui['toolbar-down'];
 
 	for (var itemIdx in toolbarUp.items) {
@@ -89,12 +81,6 @@ function _unmobilify() {
 			toolbarUp.show(id);
 		}
 	}
-	for (itemIdx in toolbarUpMore.items) {
-		id = toolbarUpMore.items[itemIdx].id;
-		if (toolbarUpMobileItems.indexOf(id) === -1 && toolbarUpMore.get(id) && toolbarUpMore.get(id).hidden) {
-			toolbarUpMore.show(id);
-		}
-	}
 
 	for (itemIdx in statusbar.items) {
 		id = statusbar.items[itemIdx].id;
@@ -114,7 +100,6 @@ function _unmobilify() {
 function resizeToolbar() {
 	var hasMoreItems = false;
 	var toolbarUp = w2ui['toolbar-up'];
-	var toolbarUpMore = w2ui['toolbar-up-more'];
 
 	if ($(window).width() < mobileWidth) {
 		_mobilify();
@@ -123,43 +108,6 @@ function resizeToolbar() {
 	}
 
 	toolbarUp.refresh();
-	toolbarUpMore.refresh();
-	// move items from toolbar-up-more -> toolbar-up
-	while ($('#toolbar-up')[0].scrollWidth <= $(window).width()) {
-		var item = toolbarUpMore.items[0];
-		if (!item) {
-			break;
-		}
-		toolbarUpMore.items.shift();
-		toolbarUp.insert('right', item);
-	}
-
-	// move items from toolbar-up -> toolbar-up-more
-	while ($('#toolbar-up')[0].scrollWidth > Math.max($(window).width(), parseInt($('body').css('min-width')))) {
-		var itemId = toolbarUp.items[toolbarUp.items.length - 4].id;
-		item = toolbarUp.get(itemId);
-		toolbarUp.remove(itemId);
-		toolbarUpMore.insert(toolbarUpMore.items[0], item);
-		hasMoreItems = true;
-	}
-
-	if (hasMoreItems) {
-		w2ui['toolbar-up'].show('more');
-	}
-	else {
-		w2ui['toolbar-up'].hide('more');
-	}
-
-	// resize toolbar-up-more
-	var lastItem = $('#toolbar-up-more>table>tbody>tr>td[valign="middle"]').last();
-	if (lastItem.length) {
-		$('#toolbar-up-more').width($(lastItem).position().left + $(lastItem).width());
-		w2ui['toolbar-up-more'].render();
-	} else {
-		$('#toolbar-up-more').hide();
-		var toolbar = w2ui['toolbar-up'];
-		toolbar.uncheck('more');
-	}
 }
 
 function _cancelSearch() {
@@ -193,10 +141,6 @@ function onClick(id, item, subItem) {
 		toolbar = w2ui['presentation-toolbar'];
 		item = toolbar.get(id);
 	}
-	else if (w2ui['toolbar-up-more'].get(id) !== null) {
-		toolbar = w2ui['toolbar-up-more'];
-		item = toolbar.get(id);
-	}
 	else if (item && subItem)
 	{
 		var command = {
@@ -345,17 +289,6 @@ function onClick(id, item, subItem) {
 		w2ui['formulabar'].hide('acceptformula', 'cancelformula');
 		w2ui['formulabar'].show('sum', 'function');
 	}
-	else if (id === 'more') {
-		$('#toolbar-up-more').toggle();
-		if ($('#toolbar-up-more').is(':visible')) {
-			toolbar.check('more');
-		}
-		else {
-			toolbar.uncheck('more');
-		}
-		w2ui['toolbar-up-more'].render();
-		resizeToolbar();
-	}
 }
 
 function insertTable() {
@@ -451,15 +384,6 @@ var fontsSelectValue;
 var fontsizesSelectValue;
 
 $(function () {
-	$('#toolbar-up-more').w2toolbar({
-		name: 'toolbar-up-more',
-		items: [
-		],
-		onClick: function (e) {
-			onClick(e.target);
-		}
-	});
-
 	$('#toolbar-up').w2toolbar({
 		name: 'toolbar-up',
 		items: [
@@ -526,7 +450,6 @@ $(function () {
 			{type: 'button',  id: 'insertgraphic',  img: 'insertgraphic', hint: _UNO('.uno:InsertGraphic', '', true)},
 			{type: 'button',  id: 'specialcharacter', img: 'specialcharacter', hint: _UNO('.uno:InsertSymbol', '', true), uno: '.uno:InsertSymbol'},
 			{type: 'html', id: 'right'},
-			{type: 'button',  id: 'more', img: 'more', hint: _('More')},
 			{type: 'html', id: 'rightmenupadding'}
 		],
 		onClick: function (e) {
@@ -1065,14 +988,12 @@ map.on('wopiprops', function(e) {
 
 map.on('doclayerinit', function () {
 	var toolbarUp = w2ui['toolbar-up'];
-	var toolbarUpMore = w2ui['toolbar-up-more'];
 	var statusbar = w2ui['toolbar-down'];
 	var docType = map.getDocType();
 
 	switch (docType) {
 	case 'spreadsheet':
 		toolbarUp.remove('inserttable', 'styles', 'justifypara', 'defaultbullet', 'defaultnumbering', 'break-numbering');
-		toolbarUpMore.remove('inserttable', 'styles', 'justifypara', 'defaultbullet', 'defaultnumbering', 'break-numbering');
 		statusbar.disable('zoomreset', 'zoomout', 'zoomin', 'zoomlevel');
 		statusbar.insert('left', [
 			{type: 'break', id:'break1'},
@@ -1111,7 +1032,6 @@ map.on('doclayerinit', function () {
 		break;
 	case 'text':
 		toolbarUp.remove('wraptextseparator', 'wraptext', 'togglemergecells', 'break-toggle', 'numberformatcurrency', 'numberformatpercent', 'numberformatdecimal', 'numberformatdate', 'numberformatincdecimals', 'numberformatdecdecimals', 'break-number', 'sortascending', 'sortdescending');
-		toolbarUpMore.remove('wraptextseparator', 'wraptext', 'togglemergecells', 'break-toggle', 'numberformatcurrency', 'numberformatpercent', 'numberformatdecimal', 'numberformatdate', 'numberformatincdecimals', 'numberformatdecdecimals', 'break-number', 'sortascending', 'sortdescending');
 		statusbar.insert('left', [
 			{type: 'break', id: 'break1'},
 			{type: 'html',  id: 'StatePageNumber',
@@ -1143,7 +1063,6 @@ map.on('doclayerinit', function () {
 			presentationToolbar.show('presentation', 'presentationbreak');
 		}
 		toolbarUp.remove('insertannotation', 'wraptextseparator', 'wraptext', 'togglemergecells', 'break-toggle', 'numberformatcurrency', 'numberformatpercent', 'numberformatdecimal', 'numberformatdate', 'numberformatincdecimals', 'numberformatdecdecimals', 'break-number', 'sortascending', 'sortdescending');
-		toolbarUpMore.remove('insertannotation', 'wraptextseparator', 'wraptext', 'togglemergecells', 'break-toggle', 'numberformatcurrency', 'numberformatpercent', 'numberformatdecimal', 'numberformatdate', 'numberformatincdecimals', 'numberformatdecdecimals', 'break-number', 'sortascending', 'sortdescending');
 		statusbar.insert('left', [
 			{type: 'break', id:'break1'},
 			{type: 'html',  id: 'PageStatus',
@@ -1160,7 +1079,6 @@ map.on('doclayerinit', function () {
 		break;
 	case 'drawing':
 		toolbarUp.remove('insertannotation', 'wraptextseparator', 'wraptext', 'togglemergecells', 'break-toggle', 'numberformatcurrency', 'numberformatpercent', 'numberformatdecimal', 'numberformatdate', 'numberformatincdecimals', 'numberformatdecdecimals', 'break-number', 'sortascending', 'sortdescending');
-		toolbarUpMore.remove('insertannotation', 'wraptextseparator', 'wraptext', 'togglemergecells', 'break-toggle', 'numberformatcurrency', 'numberformatpercent', 'numberformatdecimal', 'numberformatdate', 'numberformatincdecimals', 'numberformatdecdecimals', 'break-number', 'sortascending', 'sortdescending');
 
 		// Remove irrelevant toolbars
 		$('#formulabar').hide();
@@ -1169,7 +1087,6 @@ map.on('doclayerinit', function () {
 		break;
 	}
 	toolbarUp.refresh();
-	toolbarUpMore.refresh();
 	statusbar.refresh();
 	resizeToolbar();
 });
@@ -1177,7 +1094,6 @@ map.on('doclayerinit', function () {
 
 map.on('commandstatechanged', function (e) {
 	var toolbar = w2ui['toolbar-up'];
-	var toolbarUpMore = w2ui['toolbar-up-more'];
 	var statusbar = w2ui['toolbar-down'];
 	var commandName = e.commandName;
 	var state = e.state;
@@ -1348,25 +1264,19 @@ map.on('commandstatechanged', function (e) {
 	if (state === 'true') {
 		toolbar.enable(id);
 		toolbar.check(id);
-		toolbarUpMore.check(id);
 	}
 	else if (state === 'false') {
 		toolbar.enable(id);
 		toolbar.uncheck(id);
-		toolbarUpMore.uncheck(id);
 	}
 	// Change the toolbar button states if we are in editmode
 	// If in non-edit mode, will be taken care of when permission is changed to 'edit'
 	else if (map._permission === 'edit' && (state === 'enabled' || state === 'disabled')) {
-		// in case some buttons are in toolbar-up-more, find
-		// them and en/dis-able them.
 		if (state === 'enabled') {
 			toolbar.enable(id);
-			toolbarUpMore.enable(id);
 		} else {
 			toolbar.uncheck(id);
 			toolbar.disable(id);
-			toolbarUpMore.disable(id);
 		}
 	}
 });
@@ -1605,22 +1515,18 @@ map.on('hyperlinkclicked', function (e) {
 
 map.on('updatepermission', function (e) {
 	var toolbar = w2ui['toolbar-up'];
-	var toolbarUpMore = w2ui['toolbar-up-more'];
 
 	// copy the first array
 	var items = toolbar.items.slice();
-	items.concat(toolbarUpMore.items);
 	for (var idx in items) {
 		var unoCmd = map.getDocType() === 'spreadsheet' ? items[idx].unosheet : items[idx].uno;
 		var keepDisabled = map['stateChangeHandler'].getItemValue(unoCmd) === 'disabled';
 		if (e.perm === 'edit') {
 			if (!keepDisabled) {
 				toolbar.enable(items[idx].id);
-				toolbarUpMore.enable(items[idx].id);
 			}
 		} else {
 			toolbar.disable(items[idx].id);
-			toolbarUpMore.disable(items[idx].id);
 		}
 	}
 


More information about the Libreoffice-commits mailing list