TinyMCE: minify the custom plugins, remove unneeded CSS, load in the footer
git-svn-id: http://svn.automattic.com/wordpress/trunk@10337 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
80b08e3a29
commit
7cf1bbfcc7
|
@ -54,7 +54,7 @@ function convertEntities(o) {
|
|||
<?php
|
||||
|
||||
if ( in_array( $pagenow, array('post.php', 'post-new.php', 'page.php', 'page-new.php') ) ) {
|
||||
add_action( 'admin_head', 'wp_tiny_mce' );
|
||||
add_action( 'admin_footer', 'wp_tiny_mce' );
|
||||
}
|
||||
|
||||
$hook_suffix = '';
|
||||
|
|
|
@ -190,10 +190,9 @@ header( 'Content-Type: application/x-javascript; charset=UTF-8' );
|
|||
{ "url" : "images/xit.gif" },
|
||||
{ "url" : "images/yes.png" },
|
||||
|
||||
<?php if ( is_file('../wp-includes/js/tinymce/tiny_mce.js') ) { ?>
|
||||
<?php if ( @is_file('../wp-includes/js/tinymce/tiny_mce.js') ) { ?>
|
||||
{ "url" : "../wp-includes/js/tinymce/tiny_mce.js", "src" : "../wp-includes/js/tinymce/tiny_mce.js?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
|
||||
{ "url" : "../wp-includes/js/tinymce/langs/wp-langs-en.js", "src" : "../wp-includes/js/tinymce/langs/wp-langs-en.js?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
|
||||
{ "url" : "../wp-includes/js/tinymce/wordpress.css", "src" : "../wp-includes/js/tinymce/wordpress.css?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
|
||||
{ "url" : "../wp-includes/js/tinymce/utils/mctabs.js", "src" : "../wp-includes/js/tinymce/utils/mctabs.js?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
|
||||
{ "url" : "../wp-includes/js/tinymce/utils/validate.js", "src" : "../wp-includes/js/tinymce/utils/validate.js?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
|
||||
{ "url" : "../wp-includes/js/tinymce/utils/form_utils.js", "src" : "../wp-includes/js/tinymce/utils/form_utils.js?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
|
||||
|
|
|
@ -3,12 +3,11 @@
|
|||
.clearlooks2, .clearlooks2 div, .clearlooks2 span, .clearlooks2 a {vertical-align:baseline; text-align:left; position:absolute; border:0; padding:0; margin:0; background:transparent; font-family:Arial,Verdana; font-size:11px; color:#000; text-decoration:none; font-weight:normal; width:auto; height:auto; overflow:hidden; display:block;}
|
||||
|
||||
/* General */
|
||||
.clearlooks2 div, .clearlooks2 span, .clearlooks2 a {position:absolute; border:0; padding:0; margin:0; background:transparent; font-family:Arial,Verdana; font-size:11px; color:#000; text-decoration:none; font-weight:normal; width:auto; height:auto; overflow:hidden; display:block;}
|
||||
.clearlooks2 {position:absolute;}
|
||||
.clearlooks2 {position:absolute; direction:ltr}
|
||||
.clearlooks2 .mceWrapper {position:static}
|
||||
.mceEventBlocker {position:absolute; left:0; top:0; background:url(img/horizontal.gif) no-repeat 0 -75px; width:100%; height:100%;}
|
||||
.clearlooks2 .mcePlaceHolder {border:1px solid #000; background:#888; top:0; left:0; opacity:0.5; filter:alpha(opacity=50);}
|
||||
.clearlooks2_modalBlocker {position:absolute; left:0; top:0; width:100%; height:100%; background:#FFF; opacity:0.6; filter:alpha(opacity=60); display:none}
|
||||
.mceEventBlocker {position:fixed; left:0; top:0; background:url(img/horizontal.gif) no-repeat 0 -75px; width:100%; height:100%}
|
||||
.clearlooks2 .mcePlaceHolder {border:1px solid #000; background:#888; top:0; left:0; opacity:0.5; -ms-filter:'alpha(opacity=50)'; filter:alpha(opacity=50)}
|
||||
.clearlooks2_modalBlocker {position:fixed; left:0; top:0; width:100%; height:100%; background:#FFF; opacity:0.6; -ms-filter:'alpha(opacity=60)'; filter:alpha(opacity=60); display:none}
|
||||
|
||||
/* Top */
|
||||
.clearlooks2 .mceTop,
|
||||
|
|
|
@ -0,0 +1,296 @@
|
|||
/**
|
||||
* WordPress plugin.
|
||||
*/
|
||||
|
||||
(function() {
|
||||
var DOM = tinymce.DOM;
|
||||
|
||||
tinymce.create('tinymce.plugins.WordPress', {
|
||||
init : function(ed, url) {
|
||||
var t = this, tbId = ed.getParam('wordpress_adv_toolbar', 'toolbar2'), last = 0, moreHTML, nextpageHTML;
|
||||
moreHTML = '<img src="' + url + '/img/trans.gif" class="mceWPmore mceItemNoResize" title="'+ed.getLang('wordpress.wp_more_alt')+'" />';
|
||||
nextpageHTML = '<img src="' + url + '/img/trans.gif" class="mceWPnextpage mceItemNoResize" title="'+ed.getLang('wordpress.wp_page_alt')+'" />';
|
||||
|
||||
if ( getUserSetting('hidetb', '0') == '1' )
|
||||
ed.settings.wordpress_adv_hidden = 0;
|
||||
|
||||
// Hides the specified toolbar and resizes the iframe
|
||||
ed.onPostRender.add(function() {
|
||||
if ( ed.getParam('wordpress_adv_hidden', 1) ) {
|
||||
DOM.hide(ed.controlManager.get(tbId).id);
|
||||
t._resizeIframe(ed, tbId, 28);
|
||||
}
|
||||
});
|
||||
|
||||
// Register commands
|
||||
ed.addCommand('WP_More', function() {
|
||||
ed.execCommand('mceInsertContent', 0, moreHTML);
|
||||
});
|
||||
|
||||
ed.addCommand('WP_Page', function() {
|
||||
ed.execCommand('mceInsertContent', 0, nextpageHTML);
|
||||
});
|
||||
|
||||
ed.addCommand('WP_Help', function() {
|
||||
ed.windowManager.open({
|
||||
url : tinymce.baseURL + '/wp-mce-help.php',
|
||||
width : 450,
|
||||
height : 420,
|
||||
inline : 1
|
||||
});
|
||||
});
|
||||
|
||||
ed.addCommand('WP_Adv', function() {
|
||||
var id = ed.controlManager.get(tbId).id, cm = ed.controlManager;
|
||||
|
||||
if (DOM.isHidden(id)) {
|
||||
cm.setActive('wp_adv', 1);
|
||||
DOM.show(id);
|
||||
t._resizeIframe(ed, tbId, -28);
|
||||
ed.settings.wordpress_adv_hidden = 0;
|
||||
setUserSetting('hidetb', '1');
|
||||
} else {
|
||||
cm.setActive('wp_adv', 0);
|
||||
DOM.hide(id);
|
||||
t._resizeIframe(ed, tbId, 28);
|
||||
ed.settings.wordpress_adv_hidden = 1;
|
||||
setUserSetting('hidetb', '0');
|
||||
}
|
||||
});
|
||||
|
||||
// Register buttons
|
||||
ed.addButton('wp_more', {
|
||||
title : 'wordpress.wp_more_desc',
|
||||
image : url + '/img/more.gif',
|
||||
cmd : 'WP_More'
|
||||
});
|
||||
|
||||
ed.addButton('wp_page', {
|
||||
title : 'wordpress.wp_page_desc',
|
||||
image : url + '/img/page.gif',
|
||||
cmd : 'WP_Page'
|
||||
});
|
||||
|
||||
ed.addButton('wp_help', {
|
||||
title : 'wordpress.wp_help_desc',
|
||||
image : url + '/img/help.gif',
|
||||
cmd : 'WP_Help'
|
||||
});
|
||||
|
||||
ed.addButton('wp_adv', {
|
||||
title : 'wordpress.wp_adv_desc',
|
||||
image : url + '/img/toolbars.gif',
|
||||
cmd : 'WP_Adv'
|
||||
});
|
||||
|
||||
// Add Media buttons
|
||||
ed.addButton('add_media', {
|
||||
title : 'wordpress.add_media',
|
||||
image : url + '/img/media.gif',
|
||||
onclick : function() {
|
||||
tb_show('', tinymce.DOM.get('add_media').href);
|
||||
tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' );
|
||||
}
|
||||
});
|
||||
|
||||
ed.addButton('add_image', {
|
||||
title : 'wordpress.add_image',
|
||||
image : url + '/img/image.gif',
|
||||
onclick : function() {
|
||||
tb_show('', tinymce.DOM.get('add_image').href);
|
||||
tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' );
|
||||
}
|
||||
});
|
||||
|
||||
ed.addButton('add_video', {
|
||||
title : 'wordpress.add_video',
|
||||
image : url + '/img/video.gif',
|
||||
onclick : function() {
|
||||
tb_show('', tinymce.DOM.get('add_video').href);
|
||||
tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' );
|
||||
}
|
||||
});
|
||||
|
||||
ed.addButton('add_audio', {
|
||||
title : 'wordpress.add_audio',
|
||||
image : url + '/img/audio.gif',
|
||||
onclick : function() {
|
||||
tb_show('', tinymce.DOM.get('add_audio').href);
|
||||
tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' );
|
||||
}
|
||||
});
|
||||
|
||||
// Add Media buttons to fullscreen
|
||||
ed.onBeforeExecCommand.add(function(ed, cmd, ui, val) {
|
||||
if ( 'mceFullScreen' != cmd ) return;
|
||||
if ( 'mce_fullscreen' != ed.id )
|
||||
ed.settings.theme_advanced_buttons1 += ',|,add_image,add_video,add_audio,add_media';
|
||||
});
|
||||
|
||||
// Add class "alignleft", "alignright" and "aligncenter" when selecting align for images.
|
||||
ed.addCommand('JustifyLeft', function() {
|
||||
var n = ed.selection.getNode();
|
||||
|
||||
if ( n.nodeName != 'IMG' )
|
||||
ed.editorCommands.mceJustify('JustifyLeft', 'left');
|
||||
else ed.plugins.wordpress.do_align(n, 'alignleft');
|
||||
});
|
||||
|
||||
ed.addCommand('JustifyRight', function() {
|
||||
var n = ed.selection.getNode();
|
||||
|
||||
if ( n.nodeName != 'IMG' )
|
||||
ed.editorCommands.mceJustify('JustifyRight', 'right');
|
||||
else ed.plugins.wordpress.do_align(n, 'alignright');
|
||||
});
|
||||
|
||||
ed.addCommand('JustifyCenter', function() {
|
||||
var n = ed.selection.getNode(), P = ed.dom.getParent(n, 'p'), DL = ed.dom.getParent(n, 'dl');
|
||||
|
||||
if ( n.nodeName == 'IMG' && ( P || DL ) )
|
||||
ed.plugins.wordpress.do_align(n, 'aligncenter');
|
||||
else ed.editorCommands.mceJustify('JustifyCenter', 'center');
|
||||
});
|
||||
|
||||
// Word count if script is loaded
|
||||
if ( 'undefined' != typeof wpWordCount ) {
|
||||
ed.onKeyUp.add(function(ed, e) {
|
||||
if ( e.keyCode == last ) return;
|
||||
if ( 13 == e.keyCode || 8 == last || 46 == last ) wpWordCount.wc( ed.getContent({format : 'raw'}) );
|
||||
last = e.keyCode;
|
||||
});
|
||||
};
|
||||
|
||||
// Add listeners to handle more break
|
||||
t._handleMoreBreak(ed, url);
|
||||
|
||||
// Add custom shortcuts
|
||||
ed.addShortcut('alt+shift+c', ed.getLang('justifycenter_desc'), 'JustifyCenter');
|
||||
ed.addShortcut('alt+shift+r', ed.getLang('justifyright_desc'), 'JustifyRight');
|
||||
ed.addShortcut('alt+shift+l', ed.getLang('justifyleft_desc'), 'JustifyLeft');
|
||||
ed.addShortcut('alt+shift+j', ed.getLang('justifyfull_desc'), 'JustifyFull');
|
||||
ed.addShortcut('alt+shift+q', ed.getLang('blockquote_desc'), 'mceBlockQuote');
|
||||
ed.addShortcut('alt+shift+u', ed.getLang('bullist_desc'), 'InsertUnorderedList');
|
||||
ed.addShortcut('alt+shift+o', ed.getLang('numlist_desc'), 'InsertOrderedList');
|
||||
ed.addShortcut('alt+shift+d', ed.getLang('striketrough_desc'), 'Strikethrough');
|
||||
ed.addShortcut('alt+shift+n', ed.getLang('spellchecker.desc'), 'mceSpellCheck');
|
||||
ed.addShortcut('alt+shift+a', ed.getLang('link_desc'), 'mceLink');
|
||||
ed.addShortcut('alt+shift+s', ed.getLang('unlink_desc'), 'unlink');
|
||||
ed.addShortcut('alt+shift+m', ed.getLang('image_desc'), 'mceImage');
|
||||
ed.addShortcut('alt+shift+g', ed.getLang('fullscreen.desc'), 'mceFullScreen');
|
||||
ed.addShortcut('alt+shift+z', ed.getLang('wp_adv_desc'), 'WP_Adv');
|
||||
ed.addShortcut('alt+shift+h', ed.getLang('help_desc'), 'WP_Help');
|
||||
ed.addShortcut('alt+shift+t', ed.getLang('wp_more_desc'), 'WP_More');
|
||||
ed.addShortcut('alt+shift+p', ed.getLang('wp_page_desc'), 'WP_Page');
|
||||
|
||||
if ( tinymce.isWebKit ) {
|
||||
ed.addShortcut('alt+shift+b', ed.getLang('bold_desc'), 'Bold');
|
||||
ed.addShortcut('alt+shift+i', ed.getLang('italic_desc'), 'Italic');
|
||||
}
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'WordPress Plugin',
|
||||
author : 'WordPress', // add Moxiecode?
|
||||
authorurl : 'http://wordpress.org',
|
||||
infourl : 'http://wordpress.org',
|
||||
version : '3.0'
|
||||
};
|
||||
},
|
||||
|
||||
// Internal functions
|
||||
do_align : function(n, a) {
|
||||
var P, DL, DIV, cls, c, ed = tinyMCE.activeEditor;
|
||||
|
||||
if ( /^(mceItemFlash|mceItemShockWave|mceItemWindowsMedia|mceItemQuickTime|mceItemRealMedia)$/.test(n.className) )
|
||||
return;
|
||||
|
||||
P = ed.dom.getParent(n, 'p');
|
||||
DL = ed.dom.getParent(n, 'dl');
|
||||
DIV = ed.dom.getParent(n, 'div');
|
||||
|
||||
if ( DL && DIV ) {
|
||||
cls = ed.dom.hasClass(DL, a) ? 'alignnone' : a;
|
||||
DL.className = DL.className.replace(/align[^ '"]+\s?/g, '');
|
||||
ed.dom.addClass(DL, cls);
|
||||
c = (cls == 'aligncenter') ? ed.dom.addClass(DIV, 'mceIEcenter') : ed.dom.removeClass(DIV, 'mceIEcenter');
|
||||
} else if ( P ) {
|
||||
cls = ed.dom.hasClass(n, a) ? 'alignnone' : a;
|
||||
n.className = n.className.replace(/align[^ '"]+\s?/g, '');
|
||||
ed.dom.addClass(n, cls);
|
||||
if ( cls == 'aligncenter' )
|
||||
ed.dom.setStyle(P, 'textAlign', 'center');
|
||||
else if (P.style && P.style.textAlign == 'center')
|
||||
ed.dom.setStyle(P, 'textAlign', '');
|
||||
}
|
||||
|
||||
ed.execCommand('mceRepaint');
|
||||
},
|
||||
|
||||
// Resizes the iframe by a relative height value
|
||||
_resizeIframe : function(ed, tb_id, dy) {
|
||||
var ifr = ed.getContentAreaContainer().firstChild;
|
||||
|
||||
DOM.setStyle(ifr, 'height', ifr.clientHeight + dy); // Resize iframe
|
||||
ed.theme.deltaHeight += dy; // For resize cookie
|
||||
},
|
||||
|
||||
_handleMoreBreak : function(ed, url) {
|
||||
var moreHTML, nextpageHTML;
|
||||
|
||||
moreHTML = '<img src="' + url + '/img/trans.gif" alt="$1" class="mceWPmore mceItemNoResize" title="'+ed.getLang('wordpress.wp_more_alt')+'" />';
|
||||
nextpageHTML = '<img src="' + url + '/img/trans.gif" class="mceWPnextpage mceItemNoResize" title="'+ed.getLang('wordpress.wp_page_alt')+'" />';
|
||||
|
||||
// Load plugin specific CSS into editor
|
||||
ed.onInit.add(function() {
|
||||
ed.dom.loadCSS(url + '/css/content.css');
|
||||
});
|
||||
|
||||
// Display morebreak instead if img in element path
|
||||
ed.onPostRender.add(function() {
|
||||
if (ed.theme.onResolveName) {
|
||||
ed.theme.onResolveName.add(function(th, o) {
|
||||
if (o.node.nodeName == 'IMG') {
|
||||
if ( ed.dom.hasClass(o.node, 'mceWPmore') )
|
||||
o.name = 'wpmore';
|
||||
if ( ed.dom.hasClass(o.node, 'mceWPnextpage') )
|
||||
o.name = 'wppage';
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Replace morebreak with images
|
||||
ed.onBeforeSetContent.add(function(ed, o) {
|
||||
o.content = o.content.replace(/<!--more(.*?)-->/g, moreHTML);
|
||||
o.content = o.content.replace(/<!--nextpage-->/g, nextpageHTML);
|
||||
});
|
||||
|
||||
// Replace images with morebreak
|
||||
ed.onPostProcess.add(function(ed, o) {
|
||||
if (o.get)
|
||||
o.content = o.content.replace(/<img[^>]+>/g, function(im) {
|
||||
if (im.indexOf('class="mceWPmore') !== -1) {
|
||||
var m, moretext = (m = im.match(/alt="(.*?)"/)) ? m[1] : '';
|
||||
im = '<!--more'+moretext+'-->';
|
||||
}
|
||||
if (im.indexOf('class="mceWPnextpage') !== -1)
|
||||
im = '<!--nextpage-->';
|
||||
|
||||
return im;
|
||||
});
|
||||
});
|
||||
|
||||
// Set active buttons if user selected pagebreak or more break
|
||||
ed.onNodeChange.add(function(ed, cm, n) {
|
||||
cm.setActive('wp_page', n.nodeName === 'IMG' && ed.dom.hasClass(n, 'mceWPnextpage'));
|
||||
cm.setActive('wp_more', n.nodeName === 'IMG' && ed.dom.hasClass(n, 'mceWPmore'));
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('wordpress', tinymce.plugins.WordPress);
|
||||
})();
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,243 @@
|
|||
|
||||
(function() {
|
||||
tinymce.create('tinymce.plugins.wpEditImage', {
|
||||
|
||||
init : function(ed, url) {
|
||||
var t = this;
|
||||
|
||||
t.url = url;
|
||||
t._createButtons();
|
||||
|
||||
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('...');
|
||||
ed.addCommand('WP_EditImage', function() {
|
||||
var el = ed.selection.getNode(), vp = tinymce.DOM.getViewPort(), H = vp.h, W = ( 720 < vp.w ) ? 720 : vp.w, cls = ed.dom.getAttrib(el, 'class');
|
||||
|
||||
if ( cls.indexOf('mceItem') != -1 || cls.indexOf('wpGallery') != -1 || el.nodeName != 'IMG' )
|
||||
return;
|
||||
|
||||
tb_show('', url + '/editimage.html?ver=321&TB_iframe=true');
|
||||
tinymce.DOM.setStyles('TB_window', {
|
||||
'width':( W - 50 )+'px',
|
||||
'height':( H - 45 )+'px',
|
||||
'margin-left':'-'+parseInt((( W - 50 ) / 2),10) + 'px'
|
||||
});
|
||||
|
||||
if ( ! tinymce.isIE6 ) {
|
||||
tinymce.DOM.setStyles('TB_window', {
|
||||
'top':'20px',
|
||||
'marginTop':'0'
|
||||
});
|
||||
}
|
||||
|
||||
tinymce.DOM.setStyles('TB_iframeContent', {
|
||||
'width':( W - 50 )+'px',
|
||||
'height':( H - 75 )+'px'
|
||||
});
|
||||
tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' );
|
||||
});
|
||||
|
||||
ed.onInit.add(function(ed) {
|
||||
tinymce.dom.Event.add(ed.getWin(), 'scroll', function(e) {
|
||||
ed.plugins.wpeditimage.hideButtons();
|
||||
});
|
||||
});
|
||||
|
||||
ed.onBeforeExecCommand.add(function(ed, cmd, ui, val) {
|
||||
ed.plugins.wpeditimage.hideButtons();
|
||||
});
|
||||
|
||||
ed.onSaveContent.add(function(ed, o) {
|
||||
ed.plugins.wpeditimage.hideButtons();
|
||||
});
|
||||
|
||||
ed.onMouseUp.add(function(ed, e) {
|
||||
var n, DL;
|
||||
|
||||
if ( tinymce.isOpera ) {
|
||||
if ( e.target.nodeName == 'IMG' )
|
||||
ed.plugins.wpeditimage.showButtons(e.target);
|
||||
} else if ( ! tinymce.isWebKit ) {
|
||||
n = ed.selection.getNode();
|
||||
|
||||
if ( n.nodeName == 'IMG' && (DL = ed.dom.getParent(n, 'DL')) ) {
|
||||
window.setTimeout(function(){
|
||||
var ed = tinyMCE.activeEditor, n = ed.selection.getNode(), DL = ed.dom.getParent(n, 'DL');
|
||||
|
||||
if ( n.width != (parseInt(ed.dom.getStyle(DL, 'width')) - 10) ) {
|
||||
ed.dom.setStyle(DL, 'width', parseInt(n.width)+10);
|
||||
ed.execCommand('mceRepaint');
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
ed.onMouseDown.add(function(ed, e) {
|
||||
if ( tinymce.isOpera || e.target.nodeName != 'IMG' ) {
|
||||
t.hideButtons();
|
||||
return;
|
||||
}
|
||||
ed.plugins.wpeditimage.showButtons(e.target);
|
||||
});
|
||||
|
||||
ed.onKeyPress.add(function(ed, e) {
|
||||
var DL, DIV, P;
|
||||
|
||||
if ( e.keyCode == 13 && (DL = ed.dom.getParent(ed.selection.getNode(), 'DL')) ) {
|
||||
P = ed.dom.create('p', {}, ' ');
|
||||
if ( (DIV = DL.parentNode) && DIV.nodeName == 'DIV' )
|
||||
ed.dom.insertAfter( P, DIV );
|
||||
else ed.dom.insertAfter( P, DL );
|
||||
|
||||
tinymce.dom.Event.cancel(e);
|
||||
ed.selection.select(P);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
ed.onBeforeSetContent.add(function(ed, o) {
|
||||
o.content = t._do_shcode(o.content);
|
||||
});
|
||||
|
||||
ed.onPostProcess.add(function(ed, o) {
|
||||
if (o.get)
|
||||
o.content = t._get_shcode(o.content);
|
||||
});
|
||||
},
|
||||
|
||||
_do_shcode : function(co) {
|
||||
return co.replace(/\[(?:wp_)?caption([^\]]+)\]([\s\S]+?)\[\/(?:wp_)?caption\][\s\u00a0]*/g, function(a,b,c){
|
||||
var id, cls, w, cap, div_cls;
|
||||
|
||||
b = b.replace(/\\'|\\'|\\'/g, ''').replace(/\\"|\\"/g, '"');
|
||||
c = c.replace(/\\'|\\'/g, ''').replace(/\\"/g, '"');
|
||||
id = b.match(/id=['"]([^'"]+)/i);
|
||||
cls = b.match(/align=['"]([^'"]+)/i);
|
||||
w = b.match(/width=['"]([0-9]+)/);
|
||||
cap = b.match(/caption=['"]([^'"]+)/i);
|
||||
|
||||
id = ( id && id[1] ) ? id[1] : '';
|
||||
cls = ( cls && cls[1] ) ? cls[1] : 'alignnone';
|
||||
w = ( w && w[1] ) ? w[1] : '';
|
||||
cap = ( cap && cap[1] ) ? cap[1] : '';
|
||||
if ( ! w || ! cap ) return c;
|
||||
|
||||
div_cls = (cls == 'aligncenter') ? 'mceTemp mceIEcenter' : 'mceTemp';
|
||||
|
||||
return '<div class="'+div_cls+'"><dl id="'+id+'" class="wp-caption '+cls+'" style="width: '+(10+parseInt(w))+
|
||||
'px"><dt class="wp-caption-dt">'+c+'</dt><dd class="wp-caption-dd">'+cap+'</dd></dl></div>';
|
||||
});
|
||||
},
|
||||
|
||||
_get_shcode : function(co) {
|
||||
return co.replace(/<div class="mceTemp[^"]*">\s*<dl([^>]+)>\s*<dt[^>]+>([\s\S]+?)<\/dt>\s*<dd[^>]+>(.+?)<\/dd>\s*<\/dl>\s*<\/div>\s*/gi, function(a,b,c,cap){
|
||||
var id, cls, w;
|
||||
|
||||
id = b.match(/id=['"]([^'"]+)/i);
|
||||
cls = b.match(/class=['"]([^'"]+)/i);
|
||||
w = c.match(/width=['"]([0-9]+)/);
|
||||
|
||||
id = ( id && id[1] ) ? id[1] : '';
|
||||
cls = ( cls && cls[1] ) ? cls[1] : 'alignnone';
|
||||
w = ( w && w[1] ) ? w[1] : '';
|
||||
|
||||
if ( ! w || ! cap ) return c;
|
||||
cls = cls.match(/align[^ '"]+/) || 'alignnone';
|
||||
cap = cap.replace(/<\S[^<>]*>/gi, '').replace(/'/g, ''').replace(/"/g, '"');
|
||||
|
||||
return '[caption id="'+id+'" align="'+cls+'" width="'+w+'" caption="'+cap+'"]'+c+'[/caption]';
|
||||
});
|
||||
},
|
||||
|
||||
showButtons : function(n) {
|
||||
var t = this, ed = tinyMCE.activeEditor, p1, p2, vp, DOM = tinymce.DOM, X, Y, cls = ed.dom.getAttrib(n, 'class');
|
||||
|
||||
if ( cls.indexOf('mceItem') != -1 || cls.indexOf('wpGallery') != -1 )
|
||||
return;
|
||||
|
||||
vp = ed.dom.getViewPort(ed.getWin());
|
||||
p1 = DOM.getPos(ed.getContentAreaContainer());
|
||||
p2 = ed.dom.getPos(n);
|
||||
|
||||
X = Math.max(p2.x - vp.x, 0) + p1.x;
|
||||
Y = Math.max(p2.y - vp.y, 0) + p1.y;
|
||||
|
||||
DOM.setStyles('wp_editbtns', {
|
||||
'top' : Y+5+'px',
|
||||
'left' : X+5+'px',
|
||||
'display' : 'block'
|
||||
});
|
||||
|
||||
t.btnsTout = window.setTimeout( function(){ed.plugins.wpeditimage.hideButtons();}, 5000 );
|
||||
},
|
||||
|
||||
hideButtons : function() {
|
||||
if ( tinymce.DOM.isHidden('wp_editbtns') ) return;
|
||||
|
||||
tinymce.DOM.hide('wp_editbtns');
|
||||
window.clearTimeout(this.btnsTout);
|
||||
},
|
||||
|
||||
_createButtons : function() {
|
||||
var t = this, ed = tinyMCE.activeEditor, DOM = tinymce.DOM, wp_editbtns, wp_editimgbtn, wp_delimgbtn;
|
||||
|
||||
DOM.remove('wp_editbtns');
|
||||
|
||||
wp_editbtns = DOM.add(document.body, 'div', {
|
||||
id : 'wp_editbtns',
|
||||
style : 'display:none;'
|
||||
});
|
||||
|
||||
wp_editimgbtn = DOM.add('wp_editbtns', 'img', {
|
||||
src : t.url+'/img/image.png',
|
||||
id : 'wp_editimgbtn',
|
||||
width : '24',
|
||||
height : '24',
|
||||
title : ed.getLang('wpeditimage.edit_img')
|
||||
});
|
||||
|
||||
wp_editimgbtn.onmousedown = function(e) {
|
||||
var ed = tinyMCE.activeEditor;
|
||||
ed.windowManager.bookmark = ed.selection.getBookmark('simple');
|
||||
ed.execCommand("WP_EditImage");
|
||||
this.parentNode.style.display = 'none';
|
||||
};
|
||||
|
||||
wp_delimgbtn = DOM.add('wp_editbtns', 'img', {
|
||||
src : t.url+'/img/delete.png',
|
||||
id : 'wp_delimgbtn',
|
||||
width : '24',
|
||||
height : '24',
|
||||
title : ed.getLang('wpeditimage.del_img')
|
||||
});
|
||||
|
||||
wp_delimgbtn.onmousedown = function(e) {
|
||||
var ed = tinyMCE.activeEditor, el = ed.selection.getNode(), p;
|
||||
|
||||
if ( el.nodeName == 'IMG' && ed.dom.getAttrib(el, 'class').indexOf('mceItem') == -1 ) {
|
||||
if ( (p = ed.dom.getParent(el, 'div')) && ed.dom.hasClass(p, 'mceTemp') )
|
||||
ed.dom.remove(p);
|
||||
else if ( (p = ed.dom.getParent(el, 'A')) && p.childNodes.length == 1 )
|
||||
ed.dom.remove(p);
|
||||
else ed.dom.remove(el);
|
||||
|
||||
this.parentNode.style.display = 'none';
|
||||
ed.execCommand('mceRepaint');
|
||||
return false;
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Edit Image',
|
||||
author : 'WordPress',
|
||||
authorurl : 'http://wordpress.org',
|
||||
infourl : '',
|
||||
version : "1.0"
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
tinymce.PluginManager.add('wpeditimage', tinymce.plugins.wpEditImage);
|
||||
})();
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,174 @@
|
|||
|
||||
(function() {
|
||||
tinymce.create('tinymce.plugins.wpGallery', {
|
||||
|
||||
init : function(ed, url) {
|
||||
var t = this;
|
||||
|
||||
t.url = url;
|
||||
t._createButtons();
|
||||
|
||||
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('...');
|
||||
ed.addCommand('WP_Gallery', function() {
|
||||
var el = ed.selection.getNode(), post_id, vp = tinymce.DOM.getViewPort(), H = vp.h - 80, W = ( 640 < vp.w ) ? 640 : vp.w;
|
||||
|
||||
if ( el.nodeName != 'IMG' ) return;
|
||||
if ( ed.dom.getAttrib(el, 'class').indexOf('wpGallery') == -1 ) return;
|
||||
|
||||
post_id = tinymce.DOM.get('post_ID').value;
|
||||
tb_show('', tinymce.documentBaseURL + '/media-upload.php?post_id='+post_id+'&tab=gallery&TB_iframe=true&width='+W+'&height='+H);
|
||||
|
||||
tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' );
|
||||
});
|
||||
|
||||
ed.onInit.add(function(ed) {
|
||||
tinymce.dom.Event.add(ed.getWin(), 'scroll', function(e) {
|
||||
ed.plugins.wpgallery.hideButtons();
|
||||
});
|
||||
});
|
||||
|
||||
ed.onBeforeExecCommand.add(function(ed, cmd, ui, val) {
|
||||
ed.plugins.wpgallery.hideButtons();
|
||||
});
|
||||
|
||||
ed.onSaveContent.add(function(ed, o) {
|
||||
ed.plugins.wpgallery.hideButtons();
|
||||
});
|
||||
|
||||
ed.onMouseUp.add(function(ed, e) {
|
||||
if ( tinymce.isOpera ) {
|
||||
if ( e.target.nodeName == 'IMG' )
|
||||
ed.plugins.wpgallery.showButtons(e.target);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
ed.onMouseDown.add(function(ed, e) {
|
||||
if ( tinymce.isOpera || e.target.nodeName != 'IMG' ) {
|
||||
t.hideButtons();
|
||||
return;
|
||||
}
|
||||
ed.plugins.wpgallery.showButtons(e.target);
|
||||
});
|
||||
|
||||
ed.onBeforeSetContent.add(function(ed, o) {
|
||||
o.content = t._do_gallery(o.content);
|
||||
});
|
||||
|
||||
ed.onPostProcess.add(function(ed, o) {
|
||||
if (o.get)
|
||||
o.content = t._get_gallery(o.content);
|
||||
});
|
||||
},
|
||||
|
||||
_do_gallery : function(co) {
|
||||
return co.replace(/\[gallery([^\]]*)\]/g, function(a,b){
|
||||
return '<img src="'+tinymce.baseURL+'/plugins/wpgallery/img/t.gif" class="wpGallery mceItem" title="gallery'+tinymce.DOM.encode(b)+'" />';
|
||||
});
|
||||
},
|
||||
|
||||
_get_gallery : function(co) {
|
||||
|
||||
function getAttr(s, n) {
|
||||
n = new RegExp(n + '=\"([^\"]+)\"', 'g').exec(s);
|
||||
return n ? tinymce.DOM.decode(n[1]) : '';
|
||||
};
|
||||
|
||||
return co.replace(/(?:<p[^>]*>)*(<img[^>]+>)(?:<\/p>)*/g, function(a,im) {
|
||||
var cls = getAttr(im, 'class');
|
||||
|
||||
if ( cls.indexOf('wpGallery') != -1 )
|
||||
return '<p>['+tinymce.trim(getAttr(im, 'title'))+']</p>';
|
||||
|
||||
return a;
|
||||
});
|
||||
},
|
||||
|
||||
showButtons : function(n) {
|
||||
var t = this, ed = tinyMCE.activeEditor, p1, p2, vp, DOM = tinymce.DOM, X, Y;
|
||||
|
||||
if (ed.dom.getAttrib(n, 'class').indexOf('wpGallery') == -1)
|
||||
return;
|
||||
|
||||
vp = ed.dom.getViewPort(ed.getWin());
|
||||
p1 = DOM.getPos(ed.getContentAreaContainer());
|
||||
p2 = ed.dom.getPos(n);
|
||||
|
||||
X = Math.max(p2.x - vp.x, 0) + p1.x;
|
||||
Y = Math.max(p2.y - vp.y, 0) + p1.y;
|
||||
|
||||
DOM.setStyles('wp_gallerybtns', {
|
||||
'top' : Y+5+'px',
|
||||
'left' : X+5+'px',
|
||||
'display' : 'block'
|
||||
});
|
||||
|
||||
t.btnsTout = window.setTimeout( function(){ed.plugins.wpgallery.hideButtons();}, 5000 );
|
||||
},
|
||||
|
||||
hideButtons : function() {
|
||||
if ( tinymce.DOM.isHidden('wp_gallerybtns') ) return;
|
||||
|
||||
tinymce.DOM.hide('wp_gallerybtns');
|
||||
window.clearTimeout(this.btnsTout);
|
||||
},
|
||||
|
||||
_createButtons : function() {
|
||||
var t = this, ed = tinyMCE.activeEditor, DOM = tinymce.DOM, wp_gallerybtns, wp_editgallery, wp_delgallery;
|
||||
|
||||
DOM.remove('wp_gallerybtns');
|
||||
|
||||
wp_gallerybtns = DOM.add(document.body, 'div', {
|
||||
id : 'wp_gallerybtns',
|
||||
style : 'display:none;'
|
||||
});
|
||||
|
||||
wp_editgallery = DOM.add('wp_gallerybtns', 'img', {
|
||||
src : t.url+'/img/edit.png',
|
||||
id : 'wp_editgallery',
|
||||
width : '24',
|
||||
height : '24',
|
||||
title : ed.getLang('wordpress.editgallery')
|
||||
});
|
||||
|
||||
wp_editgallery.onmousedown = function(e) {
|
||||
var ed = tinyMCE.activeEditor;
|
||||
ed.windowManager.bookmark = ed.selection.getBookmark('simple');
|
||||
ed.execCommand("WP_Gallery");
|
||||
this.parentNode.style.display = 'none';
|
||||
};
|
||||
|
||||
wp_delgallery = DOM.add('wp_gallerybtns', 'img', {
|
||||
src : t.url+'/img/delete.png',
|
||||
id : 'wp_delgallery',
|
||||
width : '24',
|
||||
height : '24',
|
||||
title : ed.getLang('wordpress.delgallery')
|
||||
});
|
||||
|
||||
wp_delgallery.onmousedown = function(e) {
|
||||
var ed = tinyMCE.activeEditor, el = ed.selection.getNode();
|
||||
|
||||
if ( el.nodeName == 'IMG' && ed.dom.getAttrib(el, 'class').indexOf('wpGallery') != -1 ) {
|
||||
ed.dom.remove(el);
|
||||
|
||||
this.parentNode.style.display = 'none';
|
||||
ed.execCommand('mceRepaint');
|
||||
return false;
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Gallery Settings',
|
||||
author : 'WordPress',
|
||||
authorurl : 'http://wordpress.org',
|
||||
infourl : '',
|
||||
version : "1.0"
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
tinymce.PluginManager.add('wpgallery', tinymce.plugins.wpGallery);
|
||||
})();
|
|
@ -1,174 +1 @@
|
|||
|
||||
(function() {
|
||||
tinymce.create('tinymce.plugins.wpGallery', {
|
||||
|
||||
init : function(ed, url) {
|
||||
var t = this;
|
||||
|
||||
t.url = url;
|
||||
t._createButtons();
|
||||
|
||||
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('...');
|
||||
ed.addCommand('WP_Gallery', function() {
|
||||
var el = ed.selection.getNode(), vp = tinymce.DOM.getViewPort(), W = ( 720 < vp.w ) ? 720 : vp.w;
|
||||
|
||||
if ( el.nodeName != 'IMG' ) return;
|
||||
if ( ed.dom.getAttrib(el, 'class').indexOf('wpGallery') == -1 ) return;
|
||||
|
||||
var post_id = tinymce.DOM.get('post_ID').value;
|
||||
tb_show('', tinymce.documentBaseURL + '/media-upload.php?post_id='+post_id+'&tab=gallery&TB_iframe=true');
|
||||
|
||||
tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' );
|
||||
});
|
||||
|
||||
ed.onInit.add(function(ed) {
|
||||
tinymce.dom.Event.add(ed.getWin(), 'scroll', function(e) {
|
||||
ed.plugins.wpgallery.hideButtons();
|
||||
});
|
||||
});
|
||||
|
||||
ed.onBeforeExecCommand.add(function(ed, cmd, ui, val) {
|
||||
ed.plugins.wpgallery.hideButtons();
|
||||
});
|
||||
|
||||
ed.onSaveContent.add(function(ed, o) {
|
||||
ed.plugins.wpgallery.hideButtons();
|
||||
});
|
||||
|
||||
ed.onMouseUp.add(function(ed, e) {
|
||||
if ( tinymce.isOpera ) {
|
||||
if ( e.target.nodeName == 'IMG' )
|
||||
ed.plugins.wpgallery.showButtons(e.target);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
ed.onMouseDown.add(function(ed, e) {
|
||||
if ( tinymce.isOpera || e.target.nodeName != 'IMG' ) {
|
||||
t.hideButtons();
|
||||
return;
|
||||
}
|
||||
ed.plugins.wpgallery.showButtons(e.target);
|
||||
});
|
||||
|
||||
ed.onBeforeSetContent.add(function(ed, o) {
|
||||
o.content = t._do_gallery(o.content);
|
||||
});
|
||||
|
||||
ed.onPostProcess.add(function(ed, o) {
|
||||
if (o.get)
|
||||
o.content = t._get_gallery(o.content);
|
||||
});
|
||||
},
|
||||
|
||||
_do_gallery : function(co) {
|
||||
return co.replace(/\[gallery([^\]]*)\]/g, function(a,b){
|
||||
return '<img src="'+tinymce.baseURL+'/plugins/wpgallery/img/t.gif" class="wpGallery mceItem" title="gallery'+tinymce.DOM.encode(b)+'" />';
|
||||
});
|
||||
},
|
||||
|
||||
_get_gallery : function(co) {
|
||||
|
||||
function getAttr(s, n) {
|
||||
n = new RegExp(n + '=\"([^\"]+)\"', 'g').exec(s);
|
||||
return n ? tinymce.DOM.decode(n[1]) : '';
|
||||
};
|
||||
|
||||
return co.replace(/(?:<p[^>]*>)*(<img[^>]+>)(?:<\/p>)*/g, function(a,im) {
|
||||
var cls = getAttr(im, 'class');
|
||||
|
||||
if ( cls.indexOf('wpGallery') != -1 )
|
||||
return '<p>['+tinymce.trim(getAttr(im, 'title'))+']</p>';
|
||||
|
||||
return a;
|
||||
});
|
||||
},
|
||||
|
||||
showButtons : function(n) {
|
||||
var t = this, ed = tinyMCE.activeEditor, p1, p2, vp, DOM = tinymce.DOM, X, Y;
|
||||
|
||||
if (ed.dom.getAttrib(n, 'class').indexOf('wpGallery') == -1)
|
||||
return;
|
||||
|
||||
vp = ed.dom.getViewPort(ed.getWin());
|
||||
p1 = DOM.getPos(ed.getContentAreaContainer());
|
||||
p2 = ed.dom.getPos(n);
|
||||
|
||||
X = Math.max(p2.x - vp.x, 0) + p1.x;
|
||||
Y = Math.max(p2.y - vp.y, 0) + p1.y;
|
||||
|
||||
DOM.setStyles('wp_gallerybtns', {
|
||||
'top' : Y+5+'px',
|
||||
'left' : X+5+'px',
|
||||
'display' : 'block'
|
||||
});
|
||||
|
||||
t.btnsTout = window.setTimeout( function(){ed.plugins.wpgallery.hideButtons();}, 5000 );
|
||||
},
|
||||
|
||||
hideButtons : function() {
|
||||
if ( tinymce.DOM.isHidden('wp_gallerybtns') ) return;
|
||||
|
||||
tinymce.DOM.hide('wp_gallerybtns');
|
||||
window.clearTimeout(this.btnsTout);
|
||||
},
|
||||
|
||||
_createButtons : function() {
|
||||
var t = this, ed = tinyMCE.activeEditor, DOM = tinymce.DOM;
|
||||
|
||||
DOM.remove('wp_gallerybtns');
|
||||
|
||||
var wp_gallerybtns = DOM.add(document.body, 'div', {
|
||||
id : 'wp_gallerybtns',
|
||||
style : 'display:none;'
|
||||
});
|
||||
|
||||
var wp_editgallery = DOM.add('wp_gallerybtns', 'img', {
|
||||
src : t.url+'/img/edit.png',
|
||||
id : 'wp_editgallery',
|
||||
width : '24',
|
||||
height : '24',
|
||||
title : ed.getLang('wordpress.editgallery')
|
||||
});
|
||||
|
||||
wp_editgallery.onmousedown = function(e) {
|
||||
var ed = tinyMCE.activeEditor;
|
||||
ed.windowManager.bookmark = ed.selection.getBookmark('simple');
|
||||
ed.execCommand("WP_Gallery");
|
||||
this.parentNode.style.display = 'none';
|
||||
};
|
||||
|
||||
var wp_delgallery = DOM.add('wp_gallerybtns', 'img', {
|
||||
src : t.url+'/img/delete.png',
|
||||
id : 'wp_delgallery',
|
||||
width : '24',
|
||||
height : '24',
|
||||
title : ed.getLang('wordpress.delgallery')
|
||||
});
|
||||
|
||||
wp_delgallery.onmousedown = function(e) {
|
||||
var ed = tinyMCE.activeEditor, el = ed.selection.getNode();
|
||||
|
||||
if ( el.nodeName == 'IMG' && ed.dom.getAttrib(el, 'class').indexOf('wpGallery') != -1 ) {
|
||||
ed.dom.remove(el);
|
||||
|
||||
this.parentNode.style.display = 'none';
|
||||
ed.execCommand('mceRepaint');
|
||||
return false;
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Gallery Settings',
|
||||
author : 'WordPress',
|
||||
authorurl : 'http://wordpress.org',
|
||||
infourl : '',
|
||||
version : "1.0"
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
tinymce.PluginManager.add('wpgallery', tinymce.plugins.wpGallery);
|
||||
})();
|
||||
(function(){tinymce.create("tinymce.plugins.wpGallery",{init:function(a,b){var c=this;c.url=b;c._createButtons();a.addCommand("WP_Gallery",function(){var h=a.selection.getNode(),f,e=tinymce.DOM.getViewPort(),g=e.h-80,d=(640<e.w)?640:e.w;if(h.nodeName!="IMG"){return}if(a.dom.getAttrib(h,"class").indexOf("wpGallery")==-1){return}f=tinymce.DOM.get("post_ID").value;tb_show("",tinymce.documentBaseURL+"/media-upload.php?post_id="+f+"&tab=gallery&TB_iframe=true&width="+d+"&height="+g);tinymce.DOM.setStyle(["TB_overlay","TB_window","TB_load"],"z-index","999999")});a.onInit.add(function(d){tinymce.dom.Event.add(d.getWin(),"scroll",function(f){d.plugins.wpgallery.hideButtons()})});a.onBeforeExecCommand.add(function(d,f,e,g){d.plugins.wpgallery.hideButtons()});a.onSaveContent.add(function(d,e){d.plugins.wpgallery.hideButtons()});a.onMouseUp.add(function(d,f){if(tinymce.isOpera){if(f.target.nodeName=="IMG"){d.plugins.wpgallery.showButtons(f.target)}}});a.onMouseDown.add(function(d,f){if(tinymce.isOpera||f.target.nodeName!="IMG"){c.hideButtons();return}d.plugins.wpgallery.showButtons(f.target)});a.onBeforeSetContent.add(function(d,e){e.content=c._do_gallery(e.content)});a.onPostProcess.add(function(d,e){if(e.get){e.content=c._get_gallery(e.content)}})},_do_gallery:function(a){return a.replace(/\[gallery([^\]]*)\]/g,function(d,c){return'<img src="'+tinymce.baseURL+'/plugins/wpgallery/img/t.gif" class="wpGallery mceItem" title="gallery'+tinymce.DOM.encode(c)+'" />'})},_get_gallery:function(b){function a(c,d){d=new RegExp(d+'="([^"]+)"',"g").exec(c);return d?tinymce.DOM.decode(d[1]):""}return b.replace(/(?:<p[^>]*>)*(<img[^>]+>)(?:<\/p>)*/g,function(e,d){var c=a(d,"class");if(c.indexOf("wpGallery")!=-1){return"<p>["+tinymce.trim(a(d,"title"))+"]</p>"}return e})},showButtons:function(d){var i=this,e=tinyMCE.activeEditor,g,f,a,h=tinymce.DOM,c,b;if(e.dom.getAttrib(d,"class").indexOf("wpGallery")==-1){return}a=e.dom.getViewPort(e.getWin());g=h.getPos(e.getContentAreaContainer());f=e.dom.getPos(d);c=Math.max(f.x-a.x,0)+g.x;b=Math.max(f.y-a.y,0)+g.y;h.setStyles("wp_gallerybtns",{top:b+5+"px",left:c+5+"px",display:"block"});i.btnsTout=window.setTimeout(function(){e.plugins.wpgallery.hideButtons()},5000)},hideButtons:function(){if(tinymce.DOM.isHidden("wp_gallerybtns")){return}tinymce.DOM.hide("wp_gallerybtns");window.clearTimeout(this.btnsTout)},_createButtons:function(){var d=this,b=tinyMCE.activeEditor,e=tinymce.DOM,c,f,a;e.remove("wp_gallerybtns");c=e.add(document.body,"div",{id:"wp_gallerybtns",style:"display:none;"});f=e.add("wp_gallerybtns","img",{src:d.url+"/img/edit.png",id:"wp_editgallery",width:"24",height:"24",title:b.getLang("wordpress.editgallery")});f.onmousedown=function(h){var g=tinyMCE.activeEditor;g.windowManager.bookmark=g.selection.getBookmark("simple");g.execCommand("WP_Gallery");this.parentNode.style.display="none"};a=e.add("wp_gallerybtns","img",{src:d.url+"/img/delete.png",id:"wp_delgallery",width:"24",height:"24",title:b.getLang("wordpress.delgallery")});a.onmousedown=function(i){var g=tinyMCE.activeEditor,h=g.selection.getNode();if(h.nodeName=="IMG"&&g.dom.getAttrib(h,"class").indexOf("wpGallery")!=-1){g.dom.remove(h);this.parentNode.style.display="none";g.execCommand("mceRepaint");return false}}},getInfo:function(){return{longname:"Gallery Settings",author:"WordPress",authorurl:"http://wordpress.org",infourl:"",version:"1.0"}}});tinymce.PluginManager.add("wpgallery",tinymce.plugins.wpGallery)})();
|
|
@ -1,4 +1,4 @@
|
|||
body, td {color:#000; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; margin:8px;}
|
||||
/* default styles */
|
||||
body {background:#FFF;}
|
||||
body.mceForceColors {background:#FFF; color:#000;}
|
||||
h1 {font-size: 2em}
|
||||
|
@ -17,3 +17,76 @@ ins {border-bottom:1px solid green; text-decoration: none; color:green}
|
|||
del {color:red; text-decoration:line-through}
|
||||
cite {border-bottom:1px dashed blue}
|
||||
acronym {border-bottom:1px dotted #CCC; cursor:help}
|
||||
abbr, html\:abbr {border-bottom:1px dashed #CCC; cursor:help}
|
||||
|
||||
/* WordPress styles */
|
||||
html {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.aligncenter,
|
||||
dl.aligncenter {
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.alignleft {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.alignright {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.wp-caption {
|
||||
border: 1px solid #ddd;
|
||||
text-align: center;
|
||||
background-color: #f3f3f3;
|
||||
padding-top: 4px;
|
||||
margin: 10px;
|
||||
-moz-border-radius: 3px;
|
||||
-khtml-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.wp-caption img {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0 none;
|
||||
}
|
||||
|
||||
.wp-caption-dd {
|
||||
font-size: 11px;
|
||||
line-height: 17px;
|
||||
padding: 0 4px 5px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
img.wpGallery {
|
||||
border: 1px dotted #cc0000;
|
||||
background: #ffffcc url("../../../../plugins/wpgallery/img/gallery.png") no-repeat scroll center center;
|
||||
width: 99%;
|
||||
height: 250px;
|
||||
}
|
||||
|
||||
body.mceContentBody {
|
||||
font: 13px/19px Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
|
||||
padding: 0.6em;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
pre {
|
||||
font: 12px/18px Consolas, Monaco, "Courier New", Courier, monospace;
|
||||
}
|
||||
|
||||
td {
|
||||
color: #000;
|
||||
font-size: 11px;
|
||||
margin: 8px;
|
||||
}
|
||||
|
||||
.mceIEcenter {
|
||||
text-align: center;
|
||||
}
|
||||
|
|
|
@ -1,89 +0,0 @@
|
|||
/* This file contains the CSS data for the editable area(iframe) of TinyMCE */
|
||||
html {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.aligncenter,
|
||||
dl.aligncenter {
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.alignleft {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.alignright {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.wp-caption {
|
||||
border: 1px solid #ddd;
|
||||
text-align: center;
|
||||
background-color: #f3f3f3;
|
||||
padding-top: 4px;
|
||||
margin: 10px;
|
||||
-moz-border-radius: 3px;
|
||||
-khtml-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.wp-caption img {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0 none;
|
||||
}
|
||||
|
||||
.wp-caption-dd {
|
||||
font-size: 11px;
|
||||
line-height: 17px;
|
||||
padding: 0 4px 5px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
img.wpGallery {
|
||||
border: 1px dotted #cc0000;
|
||||
background: #ffffcc url("plugins/wpgallery/img/gallery.png") no-repeat scroll center center;
|
||||
width: 99%;
|
||||
height: 250px;
|
||||
}
|
||||
|
||||
body.mceContentBody {
|
||||
font: 13px/19px Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
|
||||
padding: 0.6em;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
body.mceForceColors {
|
||||
background:#fff;
|
||||
color:#000;
|
||||
}
|
||||
|
||||
h1 {font-size: 2em}
|
||||
h2 {font-size: 1.5em}
|
||||
h3 {font-size: 1.17em}
|
||||
h4 {font-size: 1em}
|
||||
h5 {font-size: .83em}
|
||||
h6 {font-size: .75em}
|
||||
|
||||
.mceItemTable, .mceItemTable td, .mceItemTable th, .mceItemTable caption, .mceItemVisualAid {
|
||||
border: 1px dashed #BBB;
|
||||
}
|
||||
|
||||
img {
|
||||
border:0;
|
||||
}
|
||||
|
||||
td {
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
pre {
|
||||
font: 12px/18px "Courier New", monospace;
|
||||
}
|
||||
|
||||
.mceIEcenter {
|
||||
text-align: center;
|
||||
}
|
|
@ -64,7 +64,7 @@ function wp_default_scripts( &$scripts ) {
|
|||
|
||||
// Modify this version when tinyMCE plugins are changed.
|
||||
function mce_version() {
|
||||
return '20081129';
|
||||
return '20090108';
|
||||
}
|
||||
add_filter( 'tiny_mce_version', 'mce_version' );
|
||||
|
||||
|
|
Loading…
Reference in New Issue