From af32a2f5ece250427aa753b236e48784ffa07aba Mon Sep 17 00:00:00 2001
From: Thomas Bruederli <thomas@roundcube.net>
Date: Fri, 06 Jul 2012 06:57:03 -0400
Subject: [PATCH] Improve iframe form buttons display: fix iframe heights and make footer buttons float if scrolling is active

---
 program/js/tiny_mce/plugins/tabfocus/editor_plugin_src.js |   32 ++++++++++++++++++++------------
 1 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/program/js/tiny_mce/plugins/tabfocus/editor_plugin_src.js b/program/js/tiny_mce/plugins/tabfocus/editor_plugin_src.js
index f4545e1..f9df7de 100644
--- a/program/js/tiny_mce/plugins/tabfocus/editor_plugin_src.js
+++ b/program/js/tiny_mce/plugins/tabfocus/editor_plugin_src.js
@@ -16,19 +16,28 @@
 			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) {
-					el = DOM.select(':input:enabled,*[tabindex]');
-					function canSelect(e) {
-						return e.type != 'hidden' && 
-						e.tabIndex != '-1' && 
-							!(el[i].style.display == "none") && 
-							!(el[i].style.visibility == "hidden");
-				    }
+					el = DOM.select(':input:enabled,*[tabindex]:not(iframe)');
+
+					function canSelectRecursive(e) {
+						return e.nodeName==="BODY" || (e.type != 'hidden' &&
+							!(e.style.display == "none") &&
+							!(e.style.visibility == "hidden") && canSelectRecursive(e.parentNode));
+					}
+					function canSelectInOldIe(el) {
+						return el.attributes["tabIndex"].specified || el.nodeName == "INPUT" || el.nodeName == "TEXTAREA";
+					}
+					function isOldIe() {
+						return tinymce.isIE6 || tinymce.isIE7;
+					}
+					function canSelect(el) {
+						return ((!isOldIe() || canSelectInOldIe(el))) && el.getAttribute("tabindex") != '-1' && canSelectRecursive(el);
+					}
 
 					each(el, function(e, i) {
 						if (e.id == ed.id) {
@@ -36,7 +45,6 @@
 							return false;
 						}
 					});
-
 					if (d > 0) {
 						for (i = x + 1; i < el.length; i++) {
 							if (canSelect(el[i]))
@@ -50,7 +58,7 @@
 					}
 
 					return null;
-				};
+				}
 
 				if (e.keyCode === 9) {
 					v = explode(ed.getParam('tab_focus', ed.getParam('tabfocus_elements', ':prev,:next')));
@@ -86,7 +94,7 @@
 						return Event.cancel(e);
 					}
 				}
-			};
+			}
 
 			ed.onKeyUp.add(tabCancel);
 
@@ -111,4 +119,4 @@
 
 	// Register plugin
 	tinymce.PluginManager.add('tabfocus', tinymce.plugins.TabFocusPlugin);
-})();
\ No newline at end of file
+})();

--
Gitblit v1.9.1