TinyMCE: do not run preventDefault() on the tab key when Ctrl, Alt or Command key is also pressed. Ctrl + Tab is used to switch between browser tabs. See #24067, fixes #17261.
Built from https://develop.svn.wordpress.org/trunk@27034 git-svn-id: http://core.svn.wordpress.org/trunk@26910 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
496c05f1e9
commit
07ae13e432
|
@ -14,7 +14,7 @@ tinymce.PluginManager.add('tabfocus', function(editor) {
|
||||||
var DOM = tinymce.DOM, each = tinymce.each, explode = tinymce.explode;
|
var DOM = tinymce.DOM, each = tinymce.each, explode = tinymce.explode;
|
||||||
|
|
||||||
function tabCancel(e) {
|
function tabCancel(e) {
|
||||||
if (e.keyCode === 9) {
|
if (e.keyCode === 9 && !e.ctrlKey && !e.altKey && !e.metaKey) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,10 @@ tinymce.PluginManager.add('tabfocus', function(editor) {
|
||||||
function tabHandler(e) {
|
function tabHandler(e) {
|
||||||
var x, el, v, i;
|
var x, el, v, i;
|
||||||
|
|
||||||
|
if (e.keyCode !== 9 || e.ctrlKey || e.altKey || e.metaKey) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
function find(direction) {
|
function find(direction) {
|
||||||
el = DOM.select(':input:enabled,*[tabindex]:not(iframe)');
|
el = DOM.select(':input:enabled,*[tabindex]:not(iframe)');
|
||||||
|
|
||||||
|
@ -62,46 +66,44 @@ tinymce.PluginManager.add('tabfocus', function(editor) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.keyCode === 9) {
|
v = explode(editor.getParam('tab_focus', editor.getParam('tabfocus_elements', ':prev,:next')));
|
||||||
v = explode(editor.getParam('tab_focus', editor.getParam('tabfocus_elements', ':prev,:next')));
|
|
||||||
|
|
||||||
if (v.length == 1) {
|
if (v.length == 1) {
|
||||||
v[1] = v[0];
|
v[1] = v[0];
|
||||||
v[0] = ':prev';
|
v[0] = ':prev';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find element to focus
|
// Find element to focus
|
||||||
if (e.shiftKey) {
|
if (e.shiftKey) {
|
||||||
if (v[0] == ':prev') {
|
if (v[0] == ':prev') {
|
||||||
el = find(-1);
|
el = find(-1);
|
||||||
} else {
|
|
||||||
el = DOM.get(v[0]);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (v[1] == ':next') {
|
el = DOM.get(v[0]);
|
||||||
el = find(1);
|
}
|
||||||
} else {
|
} else {
|
||||||
el = DOM.get(v[1]);
|
if (v[1] == ':next') {
|
||||||
}
|
el = find(1);
|
||||||
|
} else {
|
||||||
|
el = DOM.get(v[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (el) {
|
||||||
|
var focusEditor = tinymce.get(el.id || el.name);
|
||||||
|
|
||||||
|
if (el.id && focusEditor) {
|
||||||
|
focusEditor.focus();
|
||||||
|
} else {
|
||||||
|
window.setTimeout(function() {
|
||||||
|
if (!tinymce.Env.webkit) {
|
||||||
|
window.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
el.focus();
|
||||||
|
}, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (el) {
|
e.preventDefault();
|
||||||
var focusEditor = tinymce.get(el.id || el.name);
|
|
||||||
|
|
||||||
if (el.id && focusEditor) {
|
|
||||||
focusEditor.focus();
|
|
||||||
} else {
|
|
||||||
window.setTimeout(function() {
|
|
||||||
if (!tinymce.Env.webkit) {
|
|
||||||
window.focus();
|
|
||||||
}
|
|
||||||
|
|
||||||
el.focus();
|
|
||||||
}, 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
e.preventDefault();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
tinymce.PluginManager.add("tabfocus",function(e){function n(e){9===e.keyCode&&e.preventDefault()}function t(n){function t(n){function t(e){return"BODY"===e.nodeName||"hidden"!=e.type&&"none"!=e.style.display&&"hidden"!=e.style.visibility&&t(e.parentNode)}function r(e){return e.tabIndex||"INPUT"==e.nodeName||"TEXTAREA"==e.nodeName}function a(e){return!r(e)&&"-1"!=e.getAttribute("tabindex")&&t(e)}if(d=i.select(":input:enabled,*[tabindex]:not(iframe)"),o(d,function(n,t){return n.id==e.id?(u=t,!1):void 0}),n>0){for(c=u+1;c<d.length;c++)if(a(d[c]))return d[c]}else for(c=u-1;c>=0;c--)if(a(d[c]))return d[c];return null}var u,d,a,c;if(9===n.keyCode&&(a=r(e.getParam("tab_focus",e.getParam("tabfocus_elements",":prev,:next"))),1==a.length&&(a[1]=a[0],a[0]=":prev"),d=n.shiftKey?":prev"==a[0]?t(-1):i.get(a[0]):":next"==a[1]?t(1):i.get(a[1]))){var f=tinymce.get(d.id||d.name);d.id&&f?f.focus():window.setTimeout(function(){tinymce.Env.webkit||window.focus(),d.focus()},10),n.preventDefault()}}var i=tinymce.DOM,o=tinymce.each,r=tinymce.explode;e.on("init",function(){e.inline&&tinymce.DOM.setAttrib(e.getBody(),"tabIndex",null)}),e.on("keyup",n),tinymce.Env.gecko?e.on("keypress keydown",t):e.on("keydown",t)});
|
tinymce.PluginManager.add("tabfocus",function(a){function b(a){9!==a.keyCode||a.ctrlKey||a.altKey||a.metaKey||a.preventDefault()}function c(b){function c(b){function c(a){return"BODY"===a.nodeName||"hidden"!=a.type&&"none"!=a.style.display&&"hidden"!=a.style.visibility&&c(a.parentNode)}function f(a){return a.tabIndex||"INPUT"==a.nodeName||"TEXTAREA"==a.nodeName}function i(a){return!f(a)&&"-1"!=a.getAttribute("tabindex")&&c(a)}if(h=d.select(":input:enabled,*[tabindex]:not(iframe)"),e(h,function(b,c){return b.id==a.id?(g=c,!1):void 0}),b>0){for(j=g+1;j<h.length;j++)if(i(h[j]))return h[j]}else for(j=g-1;j>=0;j--)if(i(h[j]))return h[j];return null}var g,h,i,j;if(!(9!==b.keyCode||b.ctrlKey||b.altKey||b.metaKey)&&(i=f(a.getParam("tab_focus",a.getParam("tabfocus_elements",":prev,:next"))),1==i.length&&(i[1]=i[0],i[0]=":prev"),h=b.shiftKey?":prev"==i[0]?c(-1):d.get(i[0]):":next"==i[1]?c(1):d.get(i[1]))){var k=tinymce.get(h.id||h.name);h.id&&k?k.focus():window.setTimeout(function(){tinymce.Env.webkit||window.focus(),h.focus()},10),b.preventDefault()}}var d=tinymce.DOM,e=tinymce.each,f=tinymce.explode;a.on("init",function(){a.inline&&tinymce.DOM.setAttrib(a.getBody(),"tabIndex",null)}),a.on("keyup",b),tinymce.Env.gecko?a.on("keypress keydown",c):a.on("keydown",c)});
|
Binary file not shown.
|
@ -18,7 +18,7 @@ $wp_db_version = 26691;
|
||||||
*
|
*
|
||||||
* @global string $tinymce_version
|
* @global string $tinymce_version
|
||||||
*/
|
*/
|
||||||
$tinymce_version = '4012-20140124';
|
$tinymce_version = '4012-20140125';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the required PHP version
|
* Holds the required PHP version
|
||||||
|
|
Loading…
Reference in New Issue