Initial commit. State 04.2021.

This commit is contained in:
2021-04-22 17:57:16 +02:00
commit 82781cca41
2974 changed files with 975656 additions and 0 deletions

View File

@@ -0,0 +1,120 @@
/**
* plugin.js
*
* Released under LGPL License.
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
*
* 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) {
if (e.keyCode === 9 && !e.ctrlKey && !e.altKey && !e.metaKey) {
e.preventDefault();
}
}
function tabHandler(e) {
var x, el, v, i;
if (e.keyCode !== 9 || 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) && tinymce.get(e.id) && el.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;
}
v = explode(editor.getParam('tab_focus', editor.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) {
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();
}
}
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);
}
});
});

View File

@@ -0,0 +1 @@
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(c){function f(a){return"BODY"===a.nodeName||"hidden"!=a.type&&"none"!=a.style.display&&"hidden"!=a.style.visibility&&f(a.parentNode)}function i(a){return/INPUT|TEXTAREA|BUTTON/.test(a.tagName)&&tinymce.get(b.id)&&-1!=a.tabIndex&&f(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}),c>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||b.isDefaultPrevented())&&(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)})});