DFW: add Blockquote button, enable After the Deadline button if plugin is installed, set button state, see #17136

git-svn-id: https://develop.svn.wordpress.org/trunk@17852 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2011-05-10 23:21:34 +00:00
parent 0cfe07e299
commit 6b810b990f
10 changed files with 78 additions and 29 deletions

File diff suppressed because one or more lines are too long

View File

@ -810,8 +810,7 @@ form.upgrade .hint {
background: transparent;
}
#wp_mce_fullscreen_parent div:first-child,
#wp_mce_fullscreen_parent #wp_mce_fullscreen_external_close {
#wp_mce_fullscreen_parent #wp_mce_fullscreen_tbl tr.mceFirst {
display : none;
}

View File

@ -1709,7 +1709,12 @@ function wp_preload_dialogs($init) {
// Distraction Free Writing mode
if ( in_array( 'wpfullscreen', $plugins, true ) ) {
wp_fullscreen_html();
$enable = array();
if ( in_array( 'AtD', $plugins, true ) )
$enable[] = 'AtD';
wp_fullscreen_html($enable);
wp_print_scripts('wp-fullscreen');
}
@ -1731,7 +1736,7 @@ function wp_print_editor_js() {
wp_print_scripts('editor');
}
function wp_fullscreen_html() {
function wp_fullscreen_html( $extra = array() ) {
global $content_width, $post;
$width = isset($content_width) && 800 > $content_width ? $content_width : 800;
@ -1758,63 +1763,80 @@ function wp_fullscreen_html() {
<div id="wp-fullscreen-button-bar"><div id="wp-fullscreen-buttons" class="wp_themeSkin">
<div>
<a title="<?php _e('Bold (Ctrl + B)'); ?>" aria-labelledby="wp_fs_bold_voice" onclick="fullscreen.b();return false;" class="mceButton mceButtonEnabled mce_bold" href="javascript:;" id="wp_fs_bold" role="button" tabindex="-1" aria-pressed="false">
<a title="<?php _e('Bold (Ctrl + B)'); ?>" onclick="fullscreen.b();return false;" class="mceButton mceButtonEnabled mce_bold" href="#" id="wp_fs_bold" role="button" aria-pressed="false">
<span class="mceIcon mce_bold"></span>
<span id="wp_fs_bold_voice" style="display: none;" class="mceVoiceLabel mceIconOnly"><?php _e('Bold (Ctrl + B)'); ?></span>
</a>
</div>
<div>
<a title="<?php _e('Italic (Ctrl + I)'); ?>" aria-labelledby="wp_fs_italic_voice" onclick="fullscreen.i();return false;" class="mceButton mceButtonEnabled mce_italic" href="javascript:;" id="wp_fs_italic" role="button" tabindex="-1" aria-pressed="false">
<a title="<?php _e('Italic (Ctrl + I)'); ?>" onclick="fullscreen.i();return false;" class="mceButton mceButtonEnabled mce_italic" href="#" id="wp_fs_italic" role="button" aria-pressed="false">
<span class="mceIcon mce_italic"></span>
<span id="wp_fs_italic_voice" style="display: none;" class="mceVoiceLabel mceIconOnly"><?php _e('Italic (Ctrl + I)'); ?></span>
</a>
</div>
<div>
<span tabindex="-1" aria-orientation="vertical" role="separator" class="mceSeparator"></span>
<span aria-orientation="vertical" role="separator" class="mceSeparator"></span>
</div>
<div>
<a title="<?php _e('Unordered list (Alt + Shift + U)'); ?>" aria-labelledby="wp_fs_bullist_voice" onclick="fullscreen.ul();return false;" onmousedown="return false;" class="mceButton mceButtonEnabled mce_bullist" href="javascript:;" id="wp_fs_bullist" role="button" tabindex="-1" aria-pressed="false">
<a title="<?php _e('Unordered list (Alt + Shift + U)'); ?>" onclick="fullscreen.ul();return false;" onmousedown="return false;" class="mceButton mceButtonEnabled mce_bullist" href="#" id="wp_fs_bullist" role="button" aria-pressed="false">
<span class="mceIcon mce_bullist"></span>
<span id="wp_fs_bullist_voice" style="display: none;" class="mceVoiceLabel mceIconOnly"><?php _e('Unordered list (Alt + Shift + U)'); ?></span>
</a>
</div>
<div>
<a title="<?php _e('Ordered list (Alt + Shift + O)'); ?>" aria-labelledby="wp_fs_numlist_voice" onclick="fullscreen.ol();return false;" class="mceButton mceButtonEnabled mce_numlist" href="javascript:;" id="wp_fs_numlist" role="button" tabindex="-1" aria-pressed="false">
<a title="<?php _e('Ordered list (Alt + Shift + O)'); ?>" onclick="fullscreen.ol();return false;" class="mceButton mceButtonEnabled mce_numlist" href="#" id="wp_fs_numlist" role="button" aria-pressed="false">
<span class="mceIcon mce_numlist"></span>
<span id="wp_fs_numlist_voice" style="display: none;" class="mceVoiceLabel mceIconOnly"><?php _e('Ordered list (Alt + Shift + O)'); ?></span>
</a>
</div>
<div>
<span tabindex="-1" aria-orientation="vertical" role="separator" class="mceSeparator"></span>
<span aria-orientation="vertical" role="separator" class="mceSeparator"></span>
</div>
<div>
<a title="<?php _e('Blockquote (Alt+Shift+Q)'); ?>" onclick="fullscreen.blockquote();return false;" class="mceButton mceButtonEnabled mce_blockquote" href="#" id="wp_fs_blockquote" role="button" tabindex="-1">
<span class="mceIcon mce_blockquote"></span>
</a>
</div>
<div class="wp-fullscreen-both">
<a title="<?php _e('Insert/edit image (Alt + Shift + M)'); ?>" aria-labelledby="wp_fs_image_voice" onclick="jQuery('#add_image').click();return false;" class="mceButton mceButtonEnabled mce_image" href="javascript:;" id="wp_fs_image" role="button" tabindex="-1">
<a title="<?php _e('Insert/edit image (Alt + Shift + M)'); ?>" onclick="jQuery('#add_image').click();return false;" class="mceButton mceButtonEnabled mce_image" href="#" id="wp_fs_image" role="button" tabindex="-1">
<span class="mceIcon mce_image"></span>
<span id="wp_fs_image_voice" style="display: none;" class="mceVoiceLabel mceIconOnly"><?php _e('Insert/edit image (Alt + Shift + M)'); ?></span>
</a>
</div>
<div class="wp-fullscreen-both">
<span tabindex="-1" aria-orientation="vertical" role="separator" class="mceSeparator"></span>
<span aria-orientation="vertical" role="separator" class="mceSeparator"></span>
</div>
<div class="wp-fullscreen-both">
<a title="<?php _e('Insert/edit link (Alt + Shift + A)'); ?>" aria-labelledby="wp_fs_link_voice" onclick="fullscreen.link();return false;" class="mceButton mce_link mceButtonEnabled" href="javascript:;" id="wp_fs_link" role="button" tabindex="-1" aria-pressed="false">
<a title="<?php _e('Insert/edit link (Alt + Shift + A)'); ?>" onclick="fullscreen.link();return false;" class="mceButton mce_link mceButtonEnabled" href="#" id="wp_fs_link" role="button" aria-pressed="false">
<span class="mceIcon mce_link"></span>
<span id="wp_fs_link_voice" style="display: none;" class="mceVoiceLabel mceIconOnly"><?php _e('Insert/edit link (Alt + Shift + A)'); ?></span>
</a>
</div>
<div>
<a title="<?php _e('Unlink (Alt + Shift + S)'); ?>" aria-labelledby="wp_fs_unlink_voice" onclick="fullscreen.unlink();return false;" class="mceButton mce_unlink mceButtonEnabled" href="javascript:;" id="wp_fs_unlink" role="button" tabindex="-1" aria-pressed="false">
<a title="<?php _e('Unlink (Alt + Shift + S)'); ?>" onclick="fullscreen.unlink();return false;" class="mceButton mce_unlink mceButtonEnabled" href="#" id="wp_fs_unlink" role="button" aria-pressed="false">
<span class="mceIcon mce_unlink"></span>
<span id="wp_fs_unlink_voice" style="display: none;" class="mceVoiceLabel mceIconOnly"><?php _e('Unlink (Alt + Shift + S)'); ?></span>
</a>
</div>
<div>
<span aria-orientation="vertical" role="separator" class="mceSeparator"></span>
</div>
<?php if ( in_array( 'AtD', $extra, true ) ) { ?>
<div>
<a title="<?php _e('Proofread Writing'); ?>" onclick="fullscreen.atd();return false;" class="mceButton mceButtonEnabled" href="#" id="wp_fs_spellchecker" role="button" aria-pressed="false">
<span class="mceIcon mce_spellchecker"></span>
</a>
</div>
<?php } ?>
<div>
<a title="<?php _e('Help (Alt + Shift + H)'); ?>" onclick="fullscreen.help();return false;" class="mceButton mce_help mceButtonEnabled" href="#" id="wp_fs_help" role="button" aria-pressed="false">
<span class="mceIcon mce_help"></span>
</a>
</div>
</div></div>

View File

@ -419,6 +419,21 @@ PubSub.prototype.publish = function( topic, args ) {
tinyMCE.execCommand('unlink');
}
api.atd = function() {
if ( s.has_tinymce && 'tinymce' === s.mode )
tinyMCE.execCommand('mceWritingImprovementTool');
}
api.help = function() {
if ( s.has_tinymce && 'tinymce' === s.mode )
tinyMCE.execCommand('WP_Help');
}
api.blockquote = function() {
if ( s.has_tinymce && 'tinymce' === s.mode )
tinyMCE.execCommand('mceBlockQuote');
}
api.refresh_buttons = function( fade ) {
fade = fade || false;

File diff suppressed because one or more lines are too long

View File

@ -48,12 +48,9 @@
s.wp_fullscreen_is_enabled = true;
s.wp_fullscreen_editor_id = ed.id;
s.theme_advanced_resizing = false;
s.theme_advanced_toolbar_location = 'external';
s.theme_advanced_statusbar_location = 'none';
s.content_css = s.content_css + ',' + s.wp_fullscreen_content_css;
s.height = tinymce.isIE ? b.scrollHeight : b.offsetHeight;
// s.setup = function(ed) {
// }
tinymce.each(ed.getParam('wp_fullscreen_settings'), function(v, k) {
s[k] = v;
@ -61,12 +58,28 @@
fsed = new tinymce.Editor('wp_mce_fullscreen', s);
fsed.onInit.add(function(edd) {
var DOM = tinymce.DOM, buttons = DOM.select('a.mceButton', DOM.get('wp-fullscreen-buttons'));
if ( !ed.isHidden() )
edd.setContent( ed.getContent() );
else
edd.setContent( switchEditors.wpautop( edd.getElement().value ) );
setTimeout(function(){ // add last
edd.onNodeChange.add(function(ed, cm, e){
tinymce.each(buttons, function(c) {
var btn, cls;
if ( btn = DOM.get( 'wp_mce_fullscreen_' + c.id.substr(6) ) ) {
cls = btn.className;
if ( cls )
c.className = cls;
}
});
});
}, 1000);
edd.focus();
});

View File

@ -1 +1 @@
(function(){tinymce.create("tinymce.plugins.wpFullscreenPlugin",{init:function(a,c){var d=this,g=0,e={},f=tinymce.DOM;a.addCommand("wpFullScreenClose",function(){if(a.getParam("wp_fullscreen_is_enabled")){f.win.setTimeout(function(){tinyMCE.remove(a);f.remove("wp_mce_fullscreen_parent");tinyMCE.settings=tinyMCE.oldSettings},10)}});a.addCommand("wpFullScreenSave",function(){var h=tinyMCE.get("wp_mce_fullscreen"),i;h.focus();i=tinyMCE.get(h.getParam("wp_fullscreen_editor_id"));i.setContent(h.getContent({format:"raw"}),{format:"raw"})});a.addCommand("wpFullScreenInit",function(){var j=a.getDoc(),h=j.body,i;if(a.id=="wp_mce_fullscreen"){return}tinyMCE.oldSettings=tinyMCE.settings;tinymce.each(a.settings,function(k,l){e[l]=k});e.id="wp_mce_fullscreen";e.wp_fullscreen_is_enabled=true;e.wp_fullscreen_editor_id=a.id;e.theme_advanced_resizing=false;e.theme_advanced_toolbar_location="external";e.theme_advanced_statusbar_location="none";e.content_css=e.content_css+","+e.wp_fullscreen_content_css;e.height=tinymce.isIE?h.scrollHeight:h.offsetHeight;tinymce.each(a.getParam("wp_fullscreen_settings"),function(m,l){e[l]=m});i=new tinymce.Editor("wp_mce_fullscreen",e);i.onInit.add(function(k){if(!a.isHidden()){k.setContent(a.getContent())}else{k.setContent(switchEditors.wpautop(k.getElement().value))}k.focus()});i.render()});if("undefined"!=fullscreen){a.addButton("fullscreen",{title:"fullscreen.desc",onclick:function(){fullscreen.on()}})}if(a.getParam("fullscreen_is_enabled")||!a.getParam("wp_fullscreen_is_enabled")){return}function b(){var k=a.getDoc(),h=k.body,m=k.documentElement,j=tinymce.DOM,l,i;if(tinymce.isIE){i=h.scrollHeight}else{if(tinymce.isWebKit){i=h.offsetHeight}else{i=m.offsetHeight}}l=(i>300)?i:300;if(g!=l){g=l;j.setStyle(j.get(a.id+"_ifr"),"height",l+"px")}}a.onInit.add(function(i,h){i.onChange.add(b);i.onSetContent.add(b);i.onPaste.add(b);i.onKeyUp.add(b);i.onPostRender.add(b);i.getBody().style.overflowY="hidden"});if(a.getParam("autoresize_on_init",true)){a.onLoadContent.add(function(i,h){setTimeout(function(){b()},1200)})}a.addCommand("wpAutoResize",b)},getInfo:function(){return{longname:"WP Fullscreen",author:"WordPress",authorurl:"http://wordpress.org",infourl:"",version:"1.0"}}});tinymce.PluginManager.add("wpfullscreen",tinymce.plugins.wpFullscreenPlugin)})();
(function(){tinymce.create("tinymce.plugins.wpFullscreenPlugin",{init:function(a,c){var d=this,g=0,e={},f=tinymce.DOM;a.addCommand("wpFullScreenClose",function(){if(a.getParam("wp_fullscreen_is_enabled")){f.win.setTimeout(function(){tinyMCE.remove(a);f.remove("wp_mce_fullscreen_parent");tinyMCE.settings=tinyMCE.oldSettings},10)}});a.addCommand("wpFullScreenSave",function(){var h=tinyMCE.get("wp_mce_fullscreen"),i;h.focus();i=tinyMCE.get(h.getParam("wp_fullscreen_editor_id"));i.setContent(h.getContent({format:"raw"}),{format:"raw"})});a.addCommand("wpFullScreenInit",function(){var j=a.getDoc(),h=j.body,i;if(a.id=="wp_mce_fullscreen"){return}tinyMCE.oldSettings=tinyMCE.settings;tinymce.each(a.settings,function(k,l){e[l]=k});e.id="wp_mce_fullscreen";e.wp_fullscreen_is_enabled=true;e.wp_fullscreen_editor_id=a.id;e.theme_advanced_resizing=false;e.theme_advanced_statusbar_location="none";e.content_css=e.content_css+","+e.wp_fullscreen_content_css;e.height=tinymce.isIE?h.scrollHeight:h.offsetHeight;tinymce.each(a.getParam("wp_fullscreen_settings"),function(m,l){e[l]=m});i=new tinymce.Editor("wp_mce_fullscreen",e);i.onInit.add(function(k){var m=tinymce.DOM,l=m.select("a.mceButton",m.get("wp-fullscreen-buttons"));if(!a.isHidden()){k.setContent(a.getContent())}else{k.setContent(switchEditors.wpautop(k.getElement().value))}setTimeout(function(){k.onNodeChange.add(function(o,n,p){tinymce.each(l,function(s){var r,q;if(r=m.get("wp_mce_fullscreen_"+s.id.substr(6))){q=r.className;if(q){s.className=q}}})})},1000);k.focus()});i.render()});if("undefined"!=fullscreen){a.addButton("fullscreen",{title:"fullscreen.desc",onclick:function(){fullscreen.on()}})}if(a.getParam("fullscreen_is_enabled")||!a.getParam("wp_fullscreen_is_enabled")){return}function b(){var k=a.getDoc(),h=k.body,m=k.documentElement,j=tinymce.DOM,l,i;if(tinymce.isIE){i=h.scrollHeight}else{if(tinymce.isWebKit){i=h.offsetHeight}else{i=m.offsetHeight}}l=(i>300)?i:300;if(g!=l){g=l;j.setStyle(j.get(a.id+"_ifr"),"height",l+"px")}}a.onInit.add(function(i,h){i.onChange.add(b);i.onSetContent.add(b);i.onPaste.add(b);i.onKeyUp.add(b);i.onPostRender.add(b);i.getBody().style.overflowY="hidden"});if(a.getParam("autoresize_on_init",true)){a.onLoadContent.add(function(i,h){setTimeout(function(){b()},1200)})}a.addCommand("wpAutoResize",b)},getInfo:function(){return{longname:"WP Fullscreen",author:"WordPress",authorurl:"http://wordpress.org",infourl:"",version:"1.0"}}});tinymce.PluginManager.add("wpfullscreen",tinymce.plugins.wpFullscreenPlugin)})();

View File

@ -96,7 +96,7 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'editor', "/wp-admin/js/editor$suffix.js", array('utils','jquery'), '20110411' );
$scripts->add_data( 'editor', 'group', 1 );
$scripts->add( 'wp-fullscreen', "/wp-admin/js/wp-fullscreen$suffix.js", array('jquery'), '20110507a' );
$scripts->add( 'wp-fullscreen', "/wp-admin/js/wp-fullscreen$suffix.js", array('jquery'), '20110510' );
$scripts->add_data( 'wp-fullscreen', 'group', 1 );
$scripts->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.6.1');

View File

@ -36,7 +36,7 @@ $wp_db_version = 17516;
*
* @global string $tinymce_version
*/
$tinymce_version = '342-20110508';
$tinymce_version = '342-20110510';
/**
* Holds the cache manifest version