📄 editor_template_src.js
字号:
});
me = Event.add(DOM.doc, 'mouseup', function(e) {
var ifr;
// Stop listening
Event.remove(DOM.doc, 'mousemove', mf);
Event.remove(DOM.doc, 'mouseup', me);
c.style.display = '';
DOM.remove(p);
if (r.dx === null)
return;
ifr = DOM.get(ed.id + '_ifr');
if (s.theme_advanced_resize_horizontal)
c.style.width = Math.max(10, r.w + r.dx) + 'px';
c.style.height = Math.max(10, r.h + r.dy) + 'px';
ifr.style.height = Math.max(10, ifr.clientHeight + r.dy) + 'px';
if (s.theme_advanced_resizing_use_cookie) {
Cookie.setHash("TinyMCE_" + ed.id + "_size", {
cw : r.w + r.dx,
ch : r.h + r.dy
});
}
});
return Event.cancel(e);
});
});
}
o.deltaHeight -= 21;
n = tb = null;
},
_nodeChanged : function(ed, cm, n, co) {
var t = this, p, de = 0, v, c, s = t.settings;
tinymce.each(t.stateControls, function(c) {
cm.setActive(c, ed.queryCommandState(t.controls[c][1]));
});
cm.setActive('visualaid', ed.hasVisual);
cm.setDisabled('undo', !ed.undoManager.hasUndo() && !ed.typing);
cm.setDisabled('redo', !ed.undoManager.hasRedo());
cm.setDisabled('outdent', !ed.queryCommandState('Outdent'));
p = DOM.getParent(n, 'A');
if (c = cm.get('link')) {
if (!p || !p.name) {
c.setDisabled(!p && co);
c.setActive(!!p);
}
}
if (c = cm.get('unlink')) {
c.setDisabled(!p && co);
c.setActive(!!p && !p.name);
}
if (c = cm.get('anchor')) {
c.setActive(!!p && p.name);
if (tinymce.isWebKit) {
p = DOM.getParent(n, 'IMG');
c.setActive(!!p && DOM.getAttrib(p, 'mce_name') == 'a');
}
}
p = DOM.getParent(n, 'IMG');
if (c = cm.get('image'))
c.setActive(!!p && n.className.indexOf('mceItem') == -1);
if (c = cm.get('styleselect')) {
if (n.className) {
t._importClasses();
c.select(n.className);
} else
c.select();
}
if (c = cm.get('formatselect')) {
p = DOM.getParent(n, DOM.isBlock);
if (p)
c.select(p.nodeName.toLowerCase());
}
if (c = cm.get('fontselect'))
c.select(ed.queryCommandValue('FontName'));
if (c = cm.get('fontsizeselect'))
c.select('' + ed.queryCommandValue('FontSize'));
if (s.theme_advanced_path && s.theme_advanced_statusbar_location) {
p = DOM.get(ed.id + '_path') || DOM.add(ed.id + '_path_row', 'span', {id : ed.id + '_path'});
DOM.setHTML(p, '');
ed.dom.getParent(n, function(n) {
var na = n.nodeName.toLowerCase(), u, pi, ti = '';
// Ignore non element and hidden elements
if (n.nodeType != 1 || (DOM.hasClass(n, 'mceItemHidden') || DOM.hasClass(n, 'mceItemRemoved')))
return;
// Fake name
if (v = DOM.getAttrib(n, 'mce_name'))
na = v;
// Handle prefix
if (tinymce.isIE && n.scopeName !== 'HTML')
na = n.scopeName + ':' + na;
// Remove internal prefix
na = na.replace(/mce\:/g, '');
// Handle node name
switch (na) {
case 'b':
na = 'strong';
break;
case 'i':
na = 'em';
break;
case 'img':
if (v = DOM.getAttrib(n, 'src'))
ti += 'src: ' + v + ' ';
break;
case 'a':
if (v = DOM.getAttrib(n, 'name')) {
ti += 'name: ' + v + ' ';
na += '#' + v;
}
if (v = DOM.getAttrib(n, 'href'))
ti += 'href: ' + v + ' ';
break;
case 'font':
if (s.convert_fonts_to_spans)
na = 'span';
if (v = DOM.getAttrib(n, 'face'))
ti += 'font: ' + v + ' ';
if (v = DOM.getAttrib(n, 'size'))
ti += 'size: ' + v + ' ';
if (v = DOM.getAttrib(n, 'color'))
ti += 'color: ' + v + ' ';
break;
case 'span':
if (v = DOM.getAttrib(n, 'style'))
ti += 'style: ' + v + ' ';
break;
}
if (v = DOM.getAttrib(n, 'id'))
ti += 'id: ' + v + ' ';
if (v = n.className) {
v = v.replace(/(webkit-[\w\-]+|Apple-[\w\-]+|mceItem\w+|mceVisualAid)/g, '');
if (v && v.indexOf('mceItem') == -1) {
ti += 'class: ' + v + ' ';
if (DOM.isBlock(n) || na == 'img' || na == 'span')
na += '.' + v;
}
}
na = na.replace(/(html:)/g, '');
na = {name : na, node : n, title : ti};
t.onResolveName.dispatch(t, na);
ti = na.title;
na = na.name;
//u = "javascript:tinymce.EditorManager.get('" + ed.id + "').theme._sel('" + (de++) + "');";
pi = DOM.create('a', {'href' : "javascript:;", onmousedown : "return false;", title : ti, 'class' : 'mcePath_' + (de++)}, na);
if (p.hasChildNodes()) {
p.insertBefore(DOM.doc.createTextNode(' \u00bb '), p.firstChild);
p.insertBefore(pi, p.firstChild);
} else
p.appendChild(pi);
}, ed.getBody());
}
},
// Commands gets called by execCommand
_sel : function(v) {
this.editor.execCommand('mceSelectNodeDepth', false, v);
},
_mceInsertAnchor : function(ui, v) {
var ed = this.editor;
ed.windowManager.open({
url : tinymce.baseURL + '/themes/advanced/anchor.htm',
width : 320 + parseInt(ed.getLang('advanced.anchor_delta_width', 0)),
height : 90 + parseInt(ed.getLang('advanced.anchor_delta_height', 0)),
inline : true
}, {
theme_url : this.url
});
},
_mceCharMap : function() {
var ed = this.editor;
ed.windowManager.open({
url : tinymce.baseURL + '/themes/advanced/charmap.htm',
width : 550 + parseInt(ed.getLang('advanced.charmap_delta_width', 0)),
height : 250 + parseInt(ed.getLang('advanced.charmap_delta_height', 0)),
inline : true
}, {
theme_url : this.url
});
},
_mceHelp : function() {
var ed = this.editor;
ed.windowManager.open({
url : tinymce.baseURL + '/themes/advanced/about.htm',
width : 480,
height : 380,
inline : true
}, {
theme_url : this.url
});
},
_mceColorPicker : function(u, v) {
var ed = this.editor;
v = v || {};
ed.windowManager.open({
url : tinymce.baseURL + '/themes/advanced/color_picker.htm',
width : 375 + parseInt(ed.getLang('advanced.colorpicker_delta_width', 0)),
height : 250 + parseInt(ed.getLang('advanced.colorpicker_delta_height', 0)),
close_previous : false,
inline : true
}, {
input_color : v.color,
func : v.func,
theme_url : this.url
});
},
_mceCodeEditor : function(ui, val) {
var ed = this.editor;
ed.windowManager.open({
url : tinymce.baseURL + '/themes/advanced/source_editor.htm',
width : parseInt(ed.getParam("theme_advanced_source_editor_width", 720)),
height : parseInt(ed.getParam("theme_advanced_source_editor_height", 580)),
inline : true,
resizable : true,
maximizable : true
}, {
theme_url : this.url
});
},
_mceImage : function(ui, val) {
var ed = this.editor;
// Internal image object like a flash placeholder
if (ed.dom.getAttrib(ed.selection.getNode(), 'class').indexOf('mceItem') != -1)
return;
ed.windowManager.open({
url : tinymce.baseURL + '/themes/advanced/image.htm',
width : 405 + parseInt(ed.getLang('advanced.image_delta_width', 0)),
height : 285 + parseInt(ed.getLang('advanced.image_delta_height', 0)),
inline : true
}, {
theme_url : this.url
});
},
_mceLink : function(ui, val) {
var ed = this.editor;
ed.windowManager.open({
url : tinymce.baseURL + '/themes/advanced/link.htm',
width : 310 + parseInt(ed.getLang('advanced.link_delta_width', 0)),
height : 200 + parseInt(ed.getLang('advanced.link_delta_height', 0)),
inline : true
}, {
theme_url : this.url
});
},
_mceNewDocument : function() {
var ed = this.editor;
ed.windowManager.confirm('advanced.newdocument', function(s) {
if (s)
ed.execCommand('mceSetContent', false, '');
});
},
_mceForeColor : function() {
var t = this;
this._mceColorPicker(0, {
color: t.fgColor,
func : function(co) {
t.fgColor = co;
t.editor.execCommand('ForeColor', false, co);
}
});
},
_mceBackColor : function() {
var t = this;
this._mceColorPicker(0, {
color: t.bgColor,
func : function(co) {
t.bgColor = co;
t.editor.execCommand('HiliteColor', false, co);
}
});
},
_ufirst : function(s) {
return s.substring(0, 1).toUpperCase() + s.substring(1);
}
});
tinymce.ThemeManager.add('advanced', tinymce.themes.AdvancedTheme);
}());
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -