📄 escape-fromhtmlarea.js
字号:
function EscapeFromHTMLArea(editor) {
/* plugin to remove focus from htmlarea when TAB is pressed */
this.editor = editor;
};
EscapeFromHTMLArea._pluginInfo = {
name : "EscapeFromHTMLArea",
version : "1.0",
developer : "Dennis Dam",
developer_url : "http://www.hippo.nl/",
license : "Apache 2.0"
};
EscapeFromHTMLArea.prototype.isTabbedElement = function(el){
var s = String(el.localName).toLowerCase();
if (s == 'a' || s == 'input' || s == 'button' || s == 'select' ||
s=='iframe')
return true;
return false;
}
EscapeFromHTMLArea.prototype.getFirstTabbedElement = function(el){
var result = null;
if (this.isTabbedElement(el)) return el;
var i;
for (i=0; i< el.childNodes.length; i++){
if (el.childNodes[i].localName != null && this.isTabbedElement(el.childNodes[i])){
return el.childNodes[i];
} else
if (el.childNodes[i].nodeType == document.ELEMENT_NODE){
result = this.getFirstTabbedElement(el.childNodes[i]);
if (result != null)
return result;
}
}
return null;
}
EscapeFromHTMLArea.prototype.getNextTabbedElement = function(el){
var nextEl = null;
if (el.nextSibling != null){
nextEl = this.getFirstTabbedElement(el.nextSibling);
if (nextEl != null) return nextEl;
return this.getNextTabbedElement(el.nextSibling);
} else
if (el.parentNode != null){
return this.getNextTabbedElement(el.parentNode);
}
return null;
}
EscapeFromHTMLArea.prototype.onKeyPress = function(event) {
if (!HTMLArea.is_ie && event.keyCode == 9) {
HTMLArea._stopEvent(event);
var nextLink;
var myEditor=this.editor;
var myPlugin = this;
setTimeout(function(){
try{
var nextEl = myPlugin.getNextTabbedElement(myEditor._iframe);
if (typeof nextEl != 'undefined'){
var tagName = nextEl.localName.toLowerCase();
if (tagName == 'iframe'){
nextEl.contentWindow.focus();
} else {
nextEl.focus();
}
}
else
document.focus();
} catch (e){
// do nothing
}
},200);
}
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -