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

Henry Castro hcastro at collabora.com
Wed Oct 4 00:15:46 UTC 2017


 loleaflet/src/control/Control.Menubar.js |   32 ++++++++++++++++++++++---------
 1 file changed, 23 insertions(+), 9 deletions(-)

New commits:
commit 9edf7f0712261e4298b5c4742262b82bb736ddc9
Author: Henry Castro <hcastro at collabora.com>
Date:   Tue Oct 3 20:09:54 2017 -0400

    loleaflet: add more menus for the Writer spell checking
    
    Change-Id: I3ef19021f0cb44aa2c34c84af08f2af2d11b25a2

diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js
index 14f62e3b..0948db0e 100644
--- a/loleaflet/src/control/Control.Menubar.js
+++ b/loleaflet/src/control/Control.Menubar.js
@@ -175,7 +175,13 @@ L.Control.Menubar = L.Control.extend({
 			{name: _('Tools'), id: 'tools', type: 'menu', menu: [
 				{name: _('Automatic Spell Checking'), type: 'unocommand', uno: '.uno:SpellOnline'},
 				{name: _('Language'), type: 'menu', menu: [
-					{name: _('Reset to Default Language'), id: 'resetlanguage', type: 'unocommand', uno:'.uno:LanguageStatus?Language:string=Default_RESET_LANGUAGES'}]}
+					{name: _('For Selection'), type: 'menu', menu: [
+						{name: _('Reset to Default Language'), id: 'resetselection', type: 'unocommand', uno: '.uno:LanguageStatus?Language:string=Current_RESET_LANGUAGES'}]},
+					{name: _('For Paragraph'), type: 'menu', menu: [
+						{name: _('Reset to Default Language'), id: 'resetparagraph', type: 'unocommand', uno: '.uno:LanguageStatus?Language:string=Paragraph_RESET_LANGUAGES'}]},
+					{name: _('For all Text'), type: 'menu', menu: [
+						{name: _('Reset to Default Language'), id: 'resetlanguage', type: 'unocommand', uno:'.uno:LanguageStatus?Language:string=Default_RESET_LANGUAGES'}]}
+				]}
 			]},
 			{name: _('Help'), id: 'help', type: 'menu', menu: [
 				{name: _('Keyboard shortcuts'), id: 'keyboard-shortcuts', type: 'action'},
@@ -343,17 +349,25 @@ L.Control.Menubar = L.Control.extend({
 		this._menubarCont.insertBefore(liItem, this._menubarCont.firstChild);
 	},
 
+	_createLangMenuItem: function (lang, command) {
+		var liItem, aItem;
+		liItem = L.DomUtil.create('li', '');
+		aItem = L.DomUtil.create('a', '', liItem);
+		$(aItem).text(lang);
+		$(aItem).data('type', 'unocommand');
+		$(aItem).data('uno', '.uno:LanguageStatus?Language:string=' + command);
+		return liItem;
+	},
+
 	_onInitMenu: function (e) {
 		if (e.commandName === '.uno:LanguageStatus') {
-			var liItem, aItem;
-			$menuParent = $('#menu-resetlanguage').parent();
+			$menuSelection = $('#menu-resetselection').parent();
+			$menuParagraph = $('#menu-resetparagraph').parent();
+			$menuDefault = $('#menu-resetlanguage').parent();
 			for (var lang in e.commandValues) {
-				liItem = L.DomUtil.create('li', '');
-				aItem = L.DomUtil.create('a', '', liItem);
-				$(aItem).text(e.commandValues[lang]);
-				$(aItem).data('type', 'unocommand');
-				$(aItem).data('uno', '.uno:LanguageStatus?Language:string=' + encodeURIComponent('Default_' + e.commandValues[lang]));
-				$menuParent.append(liItem);
+				$menuSelection.append(this._createLangMenuItem(e.commandValues[lang], encodeURIComponent('Current_' + e.commandValues[lang])));
+				$menuParagraph.append(this._createLangMenuItem(e.commandValues[lang], encodeURIComponent('Paragraph_' + e.commandValues[lang])));
+				$menuDefault.append(this._createLangMenuItem(e.commandValues[lang], encodeURIComponent('Default_' + e.commandValues[lang])));
 			}
 		}
 	},


More information about the Libreoffice-commits mailing list