[Svn] r3909 - in trunk/roundcubemail: . program/js program/js/tiny_mce/plugins program/js/tiny_mce/plugins/tabfocus

trac at roundcube.net trac at roundcube.net
Fri Aug 27 12:35:37 CEST 2010


Author: alec
Date: 2010-08-27 05:35:37 -0500 (Fri, 27 Aug 2010)
New Revision: 3909

Added:
   trunk/roundcubemail/program/js/tiny_mce/plugins/tabfocus/
   trunk/roundcubemail/program/js/tiny_mce/plugins/tabfocus/editor_plugin.js
   trunk/roundcubemail/program/js/tiny_mce/plugins/tabfocus/editor_plugin_src.js
Modified:
   trunk/roundcubemail/CHANGELOG
   trunk/roundcubemail/program/js/editor.js
Log:
- Fix Tab key doesn't work in HTML editor in Google Chrome (#1486925)


Modified: trunk/roundcubemail/CHANGELOG
===================================================================
--- trunk/roundcubemail/CHANGELOG	2010-08-27 10:21:19 UTC (rev 3908)
+++ trunk/roundcubemail/CHANGELOG	2010-08-27 10:35:37 UTC (rev 3909)
@@ -9,6 +9,7 @@
 - Fix contacts list page controls when a group is selected (#1486946)
 - Fix SMTP test in Installer (#1486952)
 - Fix "Select all" causes message to be opened in folder with exactly one message (#1486913)
+- Fix Tab key doesn't work in HTML editor in Google Chrome (#1486925)
 
 RELEASE 0.4
 -----------

Modified: trunk/roundcubemail/program/js/editor.js
===================================================================
--- trunk/roundcubemail/program/js/editor.js	2010-08-27 10:21:19 UTC (rev 3908)
+++ trunk/roundcubemail/program/js/editor.js	2010-08-27 10:35:37 UTC (rev 3909)
@@ -24,7 +24,7 @@
       theme : 'advanced',
       language : editor_lang,
       content_css : skin_path + '/editor_content.css',
-      plugins: 'paste',
+      plugins: 'paste,tabfocus',
       theme_advanced_toolbar_location : 'top',
       theme_advanced_toolbar_align : 'left',
       theme_advanced_buttons1 : 'bold,italic,underline,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,separator,outdent,indent,charmap,hr,link,unlink,code,forecolor',
@@ -42,7 +42,7 @@
       apply_source_formatting : true,
       theme : 'advanced',
       language : editor_lang,
-      plugins : 'paste,emotions,media,nonbreaking,table,searchreplace,visualchars,directionality' + (spellcheck ? ',spellchecker' : ''),
+      plugins : 'paste,emotions,media,nonbreaking,table,searchreplace,visualchars,directionality,tabfocus' + (spellcheck ? ',spellchecker' : ''),
       theme_advanced_buttons1 : 'bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,bullist,numlist,outdent,indent,ltr,rtl,blockquote,|,forecolor,backcolor,fontselect,fontsizeselect',
       theme_advanced_buttons2 : 'link,unlink,code,|,emotions,charmap,image,media,|,search' + (spellcheck ? ',spellchecker' : '') + ',undo,redo',
       theme_advanced_buttons3 : '',

Added: trunk/roundcubemail/program/js/tiny_mce/plugins/tabfocus/editor_plugin.js
===================================================================
--- trunk/roundcubemail/program/js/tiny_mce/plugins/tabfocus/editor_plugin.js	                        (rev 0)
+++ trunk/roundcubemail/program/js/tiny_mce/plugins/tabfocus/editor_plugin.js	2010-08-27 10:35:37 UTC (rev 3909)
@@ -0,0 +1 @@
+(function(){var c=tinymce.DOM,a=tinymce.dom.Event,d=tinymce.each,b=tinymce.explode;tinymce.create("tinymce.plugins.TabFocusPlugin",{init:function(f,g){function e(i,j){if(j.keyCode===9){return a.cancel(j)}}function h(l,p){var j,m,o,n,k;function q(i){o=c.getParent(l.id,"form");n=o.elements;if(o){d(n,function(s,r){if(s.id==l.id){j=r;return false}});if(i>0){for(m=j+1;m<n.length;m++){if(n[m].type!="hidden"){return n[m]}}}else{for(m=j-1;m>=0;m--){if(n[m].type!="hidden"){return n[m]}}}}return null}if(p.keyCode===9){k=b(l.getParam("tab_focus",l.getParam("tabfocus_elements",":prev,:next")));if(k.length==1){k[1]=k[0];k[0]=":prev"}if(p.shiftKey){if(k[0]==":prev"){n=q(-1)}else{n=c.get(k[0])}}else{if(k[1]==":next"){n=q(1)}else{n=c.get(k[1])}}if(n){if(l=tinymce.get(n.id||n.name)){l.focus()}else{window.setTimeout(function(){window.focus();n.focus()},10)}return a.cancel(p)}}}f.onKeyUp.add(e);if(tinymce.isGecko){f.onKeyPress.add(h);f.onKeyDown.add(e)}else{f.onKeyDown.add(h)}f.onInit.add(func
 tion(){d(c.select("a:first,a:last",f.getContainer()),function(i){a.add(i,"focus",function(){f.focus()})})})},getInfo:function(){return{longname:"Tabfocus",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/tabfocus",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("tabfocus",tinymce.plugins.TabFocusPlugin)})();
\ No newline at end of file

Added: trunk/roundcubemail/program/js/tiny_mce/plugins/tabfocus/editor_plugin_src.js
===================================================================
--- trunk/roundcubemail/program/js/tiny_mce/plugins/tabfocus/editor_plugin_src.js	                        (rev 0)
+++ trunk/roundcubemail/program/js/tiny_mce/plugins/tabfocus/editor_plugin_src.js	2010-08-27 10:35:37 UTC (rev 3909)
@@ -0,0 +1,112 @@
+/**
+ * editor_plugin_src.js
+ *
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+(function() {
+	var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, explode = tinymce.explode;
+
+	tinymce.create('tinymce.plugins.TabFocusPlugin', {
+		init : function(ed, url) {
+			function tabCancel(ed, e) {
+				if (e.keyCode === 9)
+					return Event.cancel(e);
+			};
+
+			function tabHandler(ed, e) {
+				var x, i, f, el, v;
+
+				function find(d) {
+					f = DOM.getParent(ed.id, 'form');
+					el = f.elements;
+
+					if (f) {
+						each(el, function(e, i) {
+							if (e.id == ed.id) {
+								x = i;
+								return false;
+							}
+						});
+
+						if (d > 0) {
+							for (i = x + 1; i < el.length; i++) {
+								if (el[i].type != 'hidden')
+									return el[i];
+							}
+						} else {
+							for (i = x - 1; i >= 0; i--) {
+								if (el[i].type != 'hidden')
+									return el[i];
+							}
+						}
+					}
+
+					return null;
+				};
+
+				if (e.keyCode === 9) {
+					v = explode(ed.getParam('tab_focus', ed.getParam('tabfocus_elements', ':prev,:next')));
+
+					if (v.length == 1) {
+						v[1] = v[0];
+						v[0] = ':prev';
+					}
+
+					// Find element to focus
+					if (e.shiftKey) {
+						if (v[0] == ':prev')
+							el = find(-1);
+						else
+							el = DOM.get(v[0]);
+					} else {
+						if (v[1] == ':next')
+							el = find(1);
+						else
+							el = DOM.get(v[1]);
+					}
+
+					if (el) {
+						if (ed = tinymce.get(el.id || el.name))
+							ed.focus();
+						else
+							window.setTimeout(function() {window.focus();el.focus();}, 10);
+
+						return Event.cancel(e);
+					}
+				}
+			};
+
+			ed.onKeyUp.add(tabCancel);
+
+			if (tinymce.isGecko) {
+				ed.onKeyPress.add(tabHandler);
+				ed.onKeyDown.add(tabCancel);
+			} else
+				ed.onKeyDown.add(tabHandler);
+
+			ed.onInit.add(function() {
+				each(DOM.select('a:first,a:last', ed.getContainer()), function(n) {
+					Event.add(n, 'focus', function() {ed.focus();});
+				});
+			});
+		},
+
+		getInfo : function() {
+			return {
+				longname : 'Tabfocus',
+				author : 'Moxiecode Systems AB',
+				authorurl : 'http://tinymce.moxiecode.com',
+				infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/tabfocus',
+				version : tinymce.majorVersion + "." + tinymce.minorVersion
+			};
+		}
+	});
+
+	// Register plugin
+	tinymce.PluginManager.add('tabfocus', tinymce.plugins.TabFocusPlugin);
+})();
\ No newline at end of file

_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn



More information about the Svn mailing list