aboutsummaryrefslogtreecommitdiff
path: root/srcs/wordpress/wp-includes/js/tinymce/plugins/tabfocus
diff options
context:
space:
mode:
Diffstat (limited to 'srcs/wordpress/wp-includes/js/tinymce/plugins/tabfocus')
-rw-r--r--srcs/wordpress/wp-includes/js/tinymce/plugins/tabfocus/plugin.js124
-rw-r--r--srcs/wordpress/wp-includes/js/tinymce/plugins/tabfocus/plugin.min.js1
2 files changed, 125 insertions, 0 deletions
diff --git a/srcs/wordpress/wp-includes/js/tinymce/plugins/tabfocus/plugin.js b/srcs/wordpress/wp-includes/js/tinymce/plugins/tabfocus/plugin.js
new file mode 100644
index 0000000..44cf944
--- /dev/null
+++ b/srcs/wordpress/wp-includes/js/tinymce/plugins/tabfocus/plugin.js
@@ -0,0 +1,124 @@
+(function () {
+var tabfocus = (function (domGlobals) {
+ 'use strict';
+
+ var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
+
+ var global$1 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
+
+ var global$2 = tinymce.util.Tools.resolve('tinymce.EditorManager');
+
+ var global$3 = tinymce.util.Tools.resolve('tinymce.Env');
+
+ var global$4 = tinymce.util.Tools.resolve('tinymce.util.Delay');
+
+ var global$5 = tinymce.util.Tools.resolve('tinymce.util.Tools');
+
+ var global$6 = tinymce.util.Tools.resolve('tinymce.util.VK');
+
+ var getTabFocusElements = function (editor) {
+ return editor.getParam('tabfocus_elements', ':prev,:next');
+ };
+ var getTabFocus = function (editor) {
+ return editor.getParam('tab_focus', getTabFocusElements(editor));
+ };
+ var Settings = { getTabFocus: getTabFocus };
+
+ var DOM = global$1.DOM;
+ var tabCancel = function (e) {
+ if (e.keyCode === global$6.TAB && !e.ctrlKey && !e.altKey && !e.metaKey) {
+ e.preventDefault();
+ }
+ };
+ var setup = function (editor) {
+ function tabHandler(e) {
+ var x, el, v, i;
+ if (e.keyCode !== global$6.TAB || e.ctrlKey || e.altKey || e.metaKey || e.isDefaultPrevented()) {
+ return;
+ }
+ function find(direction) {
+ 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 canSelect(el) {
+ return /INPUT|TEXTAREA|BUTTON/.test(el.tagName) && global$2.get(e.id) && el.tabIndex !== -1 && canSelectRecursive(el);
+ }
+ global$5.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;
+ }
+ v = global$5.explode(Settings.getTabFocus(editor));
+ if (v.length === 1) {
+ v[1] = v[0];
+ v[0] = ':prev';
+ }
+ 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) {
+ var focusEditor = global$2.get(el.id || el.name);
+ if (el.id && focusEditor) {
+ focusEditor.focus();
+ } else {
+ global$4.setTimeout(function () {
+ if (!global$3.webkit) {
+ domGlobals.window.focus();
+ }
+ el.focus();
+ }, 10);
+ }
+ e.preventDefault();
+ }
+ }
+ editor.on('init', function () {
+ if (editor.inline) {
+ DOM.setAttrib(editor.getBody(), 'tabIndex', null);
+ }
+ editor.on('keyup', tabCancel);
+ if (global$3.gecko) {
+ editor.on('keypress keydown', tabHandler);
+ } else {
+ editor.on('keydown', tabHandler);
+ }
+ });
+ };
+ var Keyboard = { setup: setup };
+
+ global.add('tabfocus', function (editor) {
+ Keyboard.setup(editor);
+ });
+ function Plugin () {
+ }
+
+ return Plugin;
+
+}(window));
+})();
diff --git a/srcs/wordpress/wp-includes/js/tinymce/plugins/tabfocus/plugin.min.js b/srcs/wordpress/wp-includes/js/tinymce/plugins/tabfocus/plugin.min.js
new file mode 100644
index 0000000..8c460ec
--- /dev/null
+++ b/srcs/wordpress/wp-includes/js/tinymce/plugins/tabfocus/plugin.min.js
@@ -0,0 +1 @@
+!function(c){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),s=tinymce.util.Tools.resolve("tinymce.EditorManager"),a=tinymce.util.Tools.resolve("tinymce.Env"),y=tinymce.util.Tools.resolve("tinymce.util.Delay"),f=tinymce.util.Tools.resolve("tinymce.util.Tools"),d=tinymce.util.Tools.resolve("tinymce.util.VK"),m=function(e){return e.getParam("tab_focus",e.getParam("tabfocus_elements",":prev,:next"))},v=t.DOM,n=function(e){e.keyCode!==d.TAB||e.ctrlKey||e.altKey||e.metaKey||e.preventDefault()},i=function(r){function e(n){var i,o,e,l;if(!(n.keyCode!==d.TAB||n.ctrlKey||n.altKey||n.metaKey||n.isDefaultPrevented())&&(1===(e=f.explode(m(r))).length&&(e[1]=e[0],e[0]=":prev"),o=n.shiftKey?":prev"===e[0]?u(-1):v.get(e[0]):":next"===e[1]?u(1):v.get(e[1]))){var t=s.get(o.id||o.name);o.id&&t?t.focus():y.setTimeout(function(){a.webkit||c.window.focus(),o.focus()},10),n.preventDefault()}function u(e){function t(t){return/INPUT|TEXTAREA|BUTTON/.test(t.tagName)&&s.get(n.id)&&-1!==t.tabIndex&&function e(t){return"BODY"===t.nodeName||"hidden"!==t.type&&"none"!==t.style.display&&"hidden"!==t.style.visibility&&e(t.parentNode)}(t)}if(o=v.select(":input:enabled,*[tabindex]:not(iframe)"),f.each(o,function(e,t){if(e.id===r.id)return i=t,!1}),0<e){for(l=i+1;l<o.length;l++)if(t(o[l]))return o[l]}else for(l=i-1;0<=l;l--)if(t(o[l]))return o[l];return null}}r.on("init",function(){r.inline&&v.setAttrib(r.getBody(),"tabIndex",null),r.on("keyup",n),a.gecko?r.on("keypress keydown",e):r.on("keydown",e)})};e.add("tabfocus",function(e){i(e)})}(window); \ No newline at end of file