TinyMCE 4.0.12, first run.
- Removes wp-tinymce-schema.js and mark-loaded.js, no longer needed.
- Removes the inlinepopups and most of the wpdialogs plugins; wpdialog.js is moved to wp-includes/js.
- Adds charmap, compat3x, image, link and textcolor plugins, previously contained in /themes/advanced.
- Updates the wordpress, wpeditimage, wpfullscreen, wpgallery and wplink plugins.
- Updates DFW, wp-admin/js/wp-fullscreen.js.
See #24067.
Built from https://develop.svn.wordpress.org/trunk@26876
git-svn-id: http://core.svn.wordpress.org/trunk@26759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-28 18:53:15 -05:00
|
|
|
/**
|
|
|
|
* plugin.js
|
|
|
|
*
|
|
|
|
* Copyright, Moxiecode Systems AB
|
|
|
|
* Released under LGPL License.
|
|
|
|
*
|
|
|
|
* License: http://www.tinymce.com/license
|
|
|
|
* Contributing: http://www.tinymce.com/contributing
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*global tinymce:true */
|
|
|
|
|
|
|
|
tinymce.PluginManager.add('tabfocus', function(editor) {
|
|
|
|
var DOM = tinymce.DOM, each = tinymce.each, explode = tinymce.explode;
|
|
|
|
|
|
|
|
function tabCancel(e) {
|
2014-01-25 19:29:12 -05:00
|
|
|
if (e.keyCode === 9 && !e.ctrlKey && !e.altKey && !e.metaKey) {
|
TinyMCE 4.0.12, first run.
- Removes wp-tinymce-schema.js and mark-loaded.js, no longer needed.
- Removes the inlinepopups and most of the wpdialogs plugins; wpdialog.js is moved to wp-includes/js.
- Adds charmap, compat3x, image, link and textcolor plugins, previously contained in /themes/advanced.
- Updates the wordpress, wpeditimage, wpfullscreen, wpgallery and wplink plugins.
- Updates DFW, wp-admin/js/wp-fullscreen.js.
See #24067.
Built from https://develop.svn.wordpress.org/trunk@26876
git-svn-id: http://core.svn.wordpress.org/trunk@26759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-28 18:53:15 -05:00
|
|
|
e.preventDefault();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function tabHandler(e) {
|
|
|
|
var x, el, v, i;
|
|
|
|
|
2014-01-25 19:29:12 -05:00
|
|
|
if (e.keyCode !== 9 || e.ctrlKey || e.altKey || e.metaKey) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
TinyMCE 4.0.12, first run.
- Removes wp-tinymce-schema.js and mark-loaded.js, no longer needed.
- Removes the inlinepopups and most of the wpdialogs plugins; wpdialog.js is moved to wp-includes/js.
- Adds charmap, compat3x, image, link and textcolor plugins, previously contained in /themes/advanced.
- Updates the wordpress, wpeditimage, wpfullscreen, wpgallery and wplink plugins.
- Updates DFW, wp-admin/js/wp-fullscreen.js.
See #24067.
Built from https://develop.svn.wordpress.org/trunk@26876
git-svn-id: http://core.svn.wordpress.org/trunk@26759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-28 18:53:15 -05:00
|
|
|
function find(direction) {
|
|
|
|
el = DOM.select(':input:enabled,*[tabindex]:not(iframe)');
|
|
|
|
|
|
|
|
function canSelectRecursive(e) {
|
2014-03-19 00:46:15 -04:00
|
|
|
return e.nodeName === "BODY" || (e.type != 'hidden' &&
|
TinyMCE 4.0.12, first run.
- Removes wp-tinymce-schema.js and mark-loaded.js, no longer needed.
- Removes the inlinepopups and most of the wpdialogs plugins; wpdialog.js is moved to wp-includes/js.
- Adds charmap, compat3x, image, link and textcolor plugins, previously contained in /themes/advanced.
- Updates the wordpress, wpeditimage, wpfullscreen, wpgallery and wplink plugins.
- Updates DFW, wp-admin/js/wp-fullscreen.js.
See #24067.
Built from https://develop.svn.wordpress.org/trunk@26876
git-svn-id: http://core.svn.wordpress.org/trunk@26759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-28 18:53:15 -05:00
|
|
|
e.style.display != "none" &&
|
|
|
|
e.style.visibility != "hidden" && canSelectRecursive(e.parentNode));
|
|
|
|
}
|
|
|
|
|
|
|
|
function canSelectInOldIe(el) {
|
|
|
|
return el.tabIndex || el.nodeName == "INPUT" || el.nodeName == "TEXTAREA";
|
|
|
|
}
|
|
|
|
|
|
|
|
function canSelect(el) {
|
|
|
|
return ((!canSelectInOldIe(el))) && el.getAttribute("tabindex") != '-1' && canSelectRecursive(el);
|
|
|
|
}
|
|
|
|
|
|
|
|
each(el, function(e, i) {
|
|
|
|
if (e.id == editor.id) {
|
|
|
|
x = i;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
if (direction > 0) {
|
|
|
|
for (i = x + 1; i < el.length; i++) {
|
|
|
|
if (canSelect(el[i])) {
|
|
|
|
return el[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
for (i = x - 1; i >= 0; i--) {
|
|
|
|
if (canSelect(el[i])) {
|
|
|
|
return el[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2014-01-25 19:29:12 -05:00
|
|
|
v = explode(editor.getParam('tab_focus', editor.getParam('tabfocus_elements', ':prev,:next')));
|
TinyMCE 4.0.12, first run.
- Removes wp-tinymce-schema.js and mark-loaded.js, no longer needed.
- Removes the inlinepopups and most of the wpdialogs plugins; wpdialog.js is moved to wp-includes/js.
- Adds charmap, compat3x, image, link and textcolor plugins, previously contained in /themes/advanced.
- Updates the wordpress, wpeditimage, wpfullscreen, wpgallery and wplink plugins.
- Updates DFW, wp-admin/js/wp-fullscreen.js.
See #24067.
Built from https://develop.svn.wordpress.org/trunk@26876
git-svn-id: http://core.svn.wordpress.org/trunk@26759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-28 18:53:15 -05:00
|
|
|
|
2014-01-25 19:29:12 -05:00
|
|
|
if (v.length == 1) {
|
|
|
|
v[1] = v[0];
|
|
|
|
v[0] = ':prev';
|
|
|
|
}
|
TinyMCE 4.0.12, first run.
- Removes wp-tinymce-schema.js and mark-loaded.js, no longer needed.
- Removes the inlinepopups and most of the wpdialogs plugins; wpdialog.js is moved to wp-includes/js.
- Adds charmap, compat3x, image, link and textcolor plugins, previously contained in /themes/advanced.
- Updates the wordpress, wpeditimage, wpfullscreen, wpgallery and wplink plugins.
- Updates DFW, wp-admin/js/wp-fullscreen.js.
See #24067.
Built from https://develop.svn.wordpress.org/trunk@26876
git-svn-id: http://core.svn.wordpress.org/trunk@26759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-28 18:53:15 -05:00
|
|
|
|
2014-01-25 19:29:12 -05:00
|
|
|
// Find element to focus
|
|
|
|
if (e.shiftKey) {
|
|
|
|
if (v[0] == ':prev') {
|
|
|
|
el = find(-1);
|
TinyMCE 4.0.12, first run.
- Removes wp-tinymce-schema.js and mark-loaded.js, no longer needed.
- Removes the inlinepopups and most of the wpdialogs plugins; wpdialog.js is moved to wp-includes/js.
- Adds charmap, compat3x, image, link and textcolor plugins, previously contained in /themes/advanced.
- Updates the wordpress, wpeditimage, wpfullscreen, wpgallery and wplink plugins.
- Updates DFW, wp-admin/js/wp-fullscreen.js.
See #24067.
Built from https://develop.svn.wordpress.org/trunk@26876
git-svn-id: http://core.svn.wordpress.org/trunk@26759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-28 18:53:15 -05:00
|
|
|
} else {
|
2014-01-25 19:29:12 -05:00
|
|
|
el = DOM.get(v[0]);
|
TinyMCE 4.0.12, first run.
- Removes wp-tinymce-schema.js and mark-loaded.js, no longer needed.
- Removes the inlinepopups and most of the wpdialogs plugins; wpdialog.js is moved to wp-includes/js.
- Adds charmap, compat3x, image, link and textcolor plugins, previously contained in /themes/advanced.
- Updates the wordpress, wpeditimage, wpfullscreen, wpgallery and wplink plugins.
- Updates DFW, wp-admin/js/wp-fullscreen.js.
See #24067.
Built from https://develop.svn.wordpress.org/trunk@26876
git-svn-id: http://core.svn.wordpress.org/trunk@26759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-28 18:53:15 -05:00
|
|
|
}
|
2014-01-25 19:29:12 -05:00
|
|
|
} else {
|
|
|
|
if (v[1] == ':next') {
|
|
|
|
el = find(1);
|
|
|
|
} else {
|
|
|
|
el = DOM.get(v[1]);
|
|
|
|
}
|
|
|
|
}
|
TinyMCE 4.0.12, first run.
- Removes wp-tinymce-schema.js and mark-loaded.js, no longer needed.
- Removes the inlinepopups and most of the wpdialogs plugins; wpdialog.js is moved to wp-includes/js.
- Adds charmap, compat3x, image, link and textcolor plugins, previously contained in /themes/advanced.
- Updates the wordpress, wpeditimage, wpfullscreen, wpgallery and wplink plugins.
- Updates DFW, wp-admin/js/wp-fullscreen.js.
See #24067.
Built from https://develop.svn.wordpress.org/trunk@26876
git-svn-id: http://core.svn.wordpress.org/trunk@26759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-28 18:53:15 -05:00
|
|
|
|
2014-01-25 19:29:12 -05:00
|
|
|
if (el) {
|
|
|
|
var focusEditor = tinymce.get(el.id || el.name);
|
TinyMCE 4.0.12, first run.
- Removes wp-tinymce-schema.js and mark-loaded.js, no longer needed.
- Removes the inlinepopups and most of the wpdialogs plugins; wpdialog.js is moved to wp-includes/js.
- Adds charmap, compat3x, image, link and textcolor plugins, previously contained in /themes/advanced.
- Updates the wordpress, wpeditimage, wpfullscreen, wpgallery and wplink plugins.
- Updates DFW, wp-admin/js/wp-fullscreen.js.
See #24067.
Built from https://develop.svn.wordpress.org/trunk@26876
git-svn-id: http://core.svn.wordpress.org/trunk@26759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-28 18:53:15 -05:00
|
|
|
|
2014-01-25 19:29:12 -05:00
|
|
|
if (el.id && focusEditor) {
|
|
|
|
focusEditor.focus();
|
|
|
|
} else {
|
|
|
|
window.setTimeout(function() {
|
|
|
|
if (!tinymce.Env.webkit) {
|
|
|
|
window.focus();
|
|
|
|
}
|
TinyMCE 4.0.12, first run.
- Removes wp-tinymce-schema.js and mark-loaded.js, no longer needed.
- Removes the inlinepopups and most of the wpdialogs plugins; wpdialog.js is moved to wp-includes/js.
- Adds charmap, compat3x, image, link and textcolor plugins, previously contained in /themes/advanced.
- Updates the wordpress, wpeditimage, wpfullscreen, wpgallery and wplink plugins.
- Updates DFW, wp-admin/js/wp-fullscreen.js.
See #24067.
Built from https://develop.svn.wordpress.org/trunk@26876
git-svn-id: http://core.svn.wordpress.org/trunk@26759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-28 18:53:15 -05:00
|
|
|
|
2014-01-25 19:29:12 -05:00
|
|
|
el.focus();
|
|
|
|
}, 10);
|
TinyMCE 4.0.12, first run.
- Removes wp-tinymce-schema.js and mark-loaded.js, no longer needed.
- Removes the inlinepopups and most of the wpdialogs plugins; wpdialog.js is moved to wp-includes/js.
- Adds charmap, compat3x, image, link and textcolor plugins, previously contained in /themes/advanced.
- Updates the wordpress, wpeditimage, wpfullscreen, wpgallery and wplink plugins.
- Updates DFW, wp-admin/js/wp-fullscreen.js.
See #24067.
Built from https://develop.svn.wordpress.org/trunk@26876
git-svn-id: http://core.svn.wordpress.org/trunk@26759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-28 18:53:15 -05:00
|
|
|
}
|
2014-01-25 19:29:12 -05:00
|
|
|
|
|
|
|
e.preventDefault();
|
TinyMCE 4.0.12, first run.
- Removes wp-tinymce-schema.js and mark-loaded.js, no longer needed.
- Removes the inlinepopups and most of the wpdialogs plugins; wpdialog.js is moved to wp-includes/js.
- Adds charmap, compat3x, image, link and textcolor plugins, previously contained in /themes/advanced.
- Updates the wordpress, wpeditimage, wpfullscreen, wpgallery and wplink plugins.
- Updates DFW, wp-admin/js/wp-fullscreen.js.
See #24067.
Built from https://develop.svn.wordpress.org/trunk@26876
git-svn-id: http://core.svn.wordpress.org/trunk@26759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-28 18:53:15 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
editor.on('init', function() {
|
|
|
|
if (editor.inline) {
|
|
|
|
// Remove default tabIndex in inline mode
|
|
|
|
tinymce.DOM.setAttrib(editor.getBody(), 'tabIndex', null);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
editor.on('keyup', tabCancel);
|
|
|
|
|
|
|
|
if (tinymce.Env.gecko) {
|
|
|
|
editor.on('keypress keydown', tabHandler);
|
|
|
|
} else {
|
|
|
|
editor.on('keydown', tabHandler);
|
|
|
|
}
|
|
|
|
});
|