Distraction Free Writing mode, see #17136

git-svn-id: http://svn.automattic.com/wordpress/trunk@17695 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2011-04-25 01:01:34 +00:00
parent a69059331c
commit 258a8f6844
23 changed files with 1232 additions and 63 deletions

View File

@ -1468,6 +1468,68 @@ case 'date_format' :
case 'time_format' :
die( date_i18n( sanitize_option( 'time_format', $_POST['date'] ) ) );
break;
case 'wp-fullscreen-save-post' :
if ( isset($_POST['post_ID']) )
$post_id = (int) $_POST['post_ID'];
else
$post_id = 0;
$post = null;
$post_type_object = null;
$post_type = null;
if ( $post_id ) {
$post = get_post($post_id);
if ( $post ) {
$post_type_object = get_post_type_object($post->post_type);
if ( $post_type_object ) {
$post_type = $post->post_type;
$current_screen->post_type = $post->post_type;
$current_screen->id = $current_screen->post_type;
}
}
} elseif ( isset($_POST['post_type']) ) {
$post_type_object = get_post_type_object($_POST['post_type']);
if ( $post_type_object ) {
$post_type = $post_type_object->name;
$current_screen->post_type = $post_type;
$current_screen->id = $current_screen->post_type;
}
}
check_ajax_referer('update-' . $post_type . '_' . $post_id, '_wpnonce');
$post_id = edit_post();
if ( is_wp_error($post_id) ) {
if ( $post_id->get_error_message() )
$message = $post_id->get_error_message();
else
$message = __('Save failed');
echo json_encode( array( 'message' => $message, 'last_edited' => '' ) );
die();
} else {
$message = __('Saved.');
}
if ( $post ) {
$last_date = mysql2date( get_option('date_format'), $post->post_modified );
$last_time = mysql2date( get_option('time_format'), $post->post_modified );
} else {
$last_date = date_i18n( get_option('date_format') );
$last_time = date_i18n( get_option('time_format') );
}
if ( $last_id = get_post_meta($post_id, '_edit_last', true) ) {
$last_user = get_userdata($last_id);
$last_edited = sprintf( __('Last edited by %1$s on %2$s at %3$s'), esc_html( $last_user->display_name ), $last_date, $last_time );
} else {
$last_edited = sprintf( __('Last edited on %1$s at %2$s'), $last_date, $last_time );
}
echo json_encode( array( 'message' => $message, 'last_edited' => $last_edited ) );
die();
break;
default :
do_action( 'wp_ajax_' . $_POST['action'] );
die('0');

View File

@ -68,8 +68,6 @@ var userSettings = {
<?php
if ( in_array( $pagenow, array('post.php', 'post-new.php') ) ) {
add_action( 'admin_print_footer_scripts', 'wp_tiny_mce', 25 );
add_action( 'admin_print_footer_scripts', 'wp_tiny_mce_preload_dialogs', 30 );
wp_enqueue_script('quicktags');
}

File diff suppressed because one or more lines are too long

View File

@ -512,3 +512,34 @@ div.error p {
.wrap h2.long-header {
padding-right: 0;
}
/* =CSS 3 transitions
-------------------------------------------------------------- */
.fade-600 {
opacity: 0;
-moz-transition-property: opacity;
-moz-transition-duration: 0.6s;
-webkit-transition-property: opacity;
-webkit-transition-duration: 0.6s;
-o-transition-property: opacity;
-o-transition-duration: 0.6s;
transition-property: opacity;
transition-duration: 0.6s;
}
.fade-400 {
opacity: 0;
-moz-transition-property: opacity;
-moz-transition-duration: 0.4s;
-webkit-transition-property: opacity;
-webkit-transition-duration: 0.4s;
-o-transition-property: opacity;
-o-transition-duration: 0.4s;
transition-property: opacity;
transition-duration: 0.4s;
}
.fade-trigger {
opacity: 1;
}

File diff suppressed because one or more lines are too long

View File

@ -574,6 +574,167 @@ form.upgrade .hint {
border-radius: 3px;
}
/* Distraction Free Writing mode
* =Overlay Styles
-------------------------------------------------------------- */
.fullscreen-overlay {
z-index: 149999;
display: none;
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: #f9f9f9;
filter: inherit;
}
.fullscreen-active .fullscreen-overlay {
display: block;
}
.fullscreen-fader {
z-index: 200000;
}
.fullscreen-active .fullscreen-fader {
display: none;
}
/* =Overlay Body
-------------------------------------------------------------- */
#wp-fullscreen-body {
width: 100%;
z-index: 150005;
display: none;
position: absolute;
top: 0;
left: 0;
}
#wp-fullscreen-wrap {
margin: 75px auto 50px;
position: relative;
}
#wp-fullscreen-title {
font-size: 1.7em;
line-height: 100%;
outline: medium none;
padding: 6px 7px;
width: 100%;
margin-bottom: 30px;
}
#wp-fullscreen-container {
padding: 2px 7px;
}
#wp-fullscreen-title,
#wp-fullscreen-container {
-moz-border-radius: 0;
-khtml-border-radius: 0;
-webkit-border-radius: 0;
border-radius: 0;
border: 1px dashed transparent;
background: transparent;
-moz-transition-property: border-color;
-moz-transition-duration: 0.6s;
-webkit-transition-property: border-color;
-webkit-transition-duration: 0.6s;
-o-transition-property: border-color;
-o-transition-duration: 0.6s;
transition-property: border-color;
transition-duration: 0.6s;
}
.wp-fullscreen-focus #wp-fullscreen-title,
.wp-fullscreen-focus #wp-fullscreen-container {
border-color: #ccc;
}
#wp_mce_fullscreen {
width: 100%;
min-height: 300px;
border: 0;
}
/* =Top bar
-------------------------------------------------------------- */
#fullscreen-topbar {
position: fixed;
display: none;
filter: inherit;
top: 0;
left: 0;
z-index: 150050;
border-bottom: 1px solid #C6C6C6;
min-width: 800px;
width: 100%;
height: 62px;
background: #d9d9d9;
background: -moz-linear-gradient(bottom, #d7d7d7, #e4e4e4);
background: -webkit-gradient(linear, left bottom, left top, from(#d7d7d7), to(#e4e4e4));
}
#wp-fullscreen-toolbar {
padding: 6px 12px 0;
clear: both;
}
#wp-fullscreen-close {
float: left;
}
#wp-fullscreen-save,
#wp-fullscreen-buttons #wp-fullscreen-count {
float: right;
}
#wp-fullscreen-count,
#wp-fullscreen-close {
padding-top: 5px;
}
#wp-fullscreen-info {
float: right;
padding: 3px 10px;
}
#wp-fullscreen-buttons {
margin: auto;
padding: 0;
}
#wp-fullscreen-buttons > div {
float: left;
}
/* =Thickbox Adjustments
-------------------------------------------------------------- */
.fullscreen-active #TB_overlay {
z-index: 150100;
}
.fullscreen-active #TB_window {
z-index: 150102;
}
/* =TinyMCS Adjustments
-------------------------------------------------------------- */
#wp_mce_fullscreen_ifr {
background: transparent;
}
#wp_mce_fullscreen_parent div:first-child,
#wp_mce_fullscreen_parent #wp_mce_fullscreen_external_close {
display : none;
}
#wp-fullscreen-container .wp_themeSkin table td {
vertical-align: top;
}
/*------------------------------------------------------------------------------
6.0 - Admin Header
@ -1866,13 +2027,19 @@ table .inline-edit-row fieldset ul.cat-hover {
outline: none;
}
#titlediv #title-prompt-text {
#titlediv #title-prompt-text,
#wp-fullscreen-title-prompt-text {
color: #bbb;
position: absolute;
font-size: 1.7em;
padding: 8px;
}
#wp-fullscreen-title-prompt-text {
top: 3px;
left: 0;
}
#poststuff .inside-submitbox,
#side-sortables .inside-submitbox {
margin: 0 3px;

View File

@ -12,12 +12,6 @@ if ( !defined('ABSPATH') )
wp_enqueue_script('post');
if ( post_type_supports($post_type, 'editor') ) {
if ( user_can_richedit() )
wp_enqueue_script('editor');
wp_enqueue_script('word-count');
}
if ( post_type_supports($post_type, 'editor') || post_type_supports($post_type, 'thumbnail') ) {
add_thickbox();
wp_enqueue_script('media-upload');

View File

@ -1410,7 +1410,7 @@ function wp_tiny_mce( $teeny = false, $settings = false ) {
$plugins = apply_filters( 'teeny_mce_plugins', array('inlinepopups', 'fullscreen', 'wordpress', 'wplink', 'wpdialogs') );
$ext_plugins = '';
} else {
$plugins = array( 'inlinepopups', 'spellchecker', 'paste', 'wordpress', 'fullscreen', 'media', 'wpeditimage', 'wpgallery', 'tabfocus', 'wplink', 'wpdialogs' );
$plugins = array( 'inlinepopups', 'spellchecker', 'tabfocus', 'paste', 'media', 'wordpress', 'wpfullscreen', 'wpeditimage', 'wpgallery', 'wplink', 'wpdialogs' );
/*
The following filter takes an associative array of external plugins for TinyMCE in the form 'plugin_name' => 'url'.
@ -1561,6 +1561,7 @@ function wp_tiny_mce( $teeny = false, $settings = false ) {
'paste_text_use_dialog' => true,
'extended_valid_elements' => 'article[*],aside[*],audio[*],canvas[*],command[*],datalist[*],details[*],embed[*],figcaption[*],figure[*],footer[*],header[*],hgroup[*],keygen[*],mark[*],meter[*],nav[*],output[*],progress[*],section[*],source[*],summary,time[*],video[*],wbr',
'wpeditimage_disable_captions' => $no_captions,
'wp_fullscreen_content_css' => "$baseurl/plugins/wpfullscreen/css/content.css",
'plugins' => implode( ',', $plugins ),
);
@ -1644,7 +1645,9 @@ function wp_tiny_mce( $teeny = false, $settings = false ) {
$mce_options .= $k . ':"' . $v . '", ';
}
$mce_options = rtrim( trim($mce_options), '\n\r,' ); ?>
$mce_options = rtrim( trim($mce_options), '\n\r,' );
wp_print_scripts('editor'); ?>
<script type="text/javascript">
/* <![CDATA[ */
@ -1685,20 +1688,135 @@ tinyMCE.init(tinyMCEPreInit.mceInit);
</script>
<?php
// Load additional inline scripts based on active plugins.
if ( in_array( 'wpdialogs', $plugins ) ) {
wp_print_scripts( array( 'wpdialogs-popup' ) );
do_action('tiny_mce_preload_dialogs', $plugins);
}
// Load additional inline scripts based on active plugins.
function wp_preload_dialogs($plugins) {
if ( in_array( 'wpdialogs', $plugins, true ) ) {
wp_print_scripts('wpdialogs-popup');
wp_print_styles('wp-jquery-ui-dialog');
}
if ( in_array( 'wplink', $plugins ) ) {
if ( in_array( 'wplink', $plugins, true ) ) {
require_once ABSPATH . 'wp-admin/includes/internal-linking.php';
add_action('tiny_mce_preload_dialogs', 'wp_link_dialog');
?><div style="display:none;"><?php wp_link_dialog(); ?></div><?php
wp_print_scripts('wplink');
wp_print_styles('wplink');
}
// Distraction Free Writing mode
if ( in_array( 'wpfullscreen', $plugins, true ) ) {
wp_fullscreen_html();
wp_print_scripts('wp-fullscreen');
}
wp_print_scripts('word-count');
}
function wp_tiny_mce_preload_dialogs() { ?>
<div id="preloaded-dialogs" style="display:none;">
<?php do_action('tiny_mce_preload_dialogs'); ?>
function wp_quicktags() {
wp_preload_dialogs( array( 'wpdialogs', 'wplink', 'wp_fullscreen' ) );
}
function wp_fullscreen_html() {
global $content_width, $post;
$width = isset($content_width) && 800 > $content_width ? $content_width : 800;
$width = $width + 10; // compensate for the padding
$save = $post->post_status == 'publish' ? __('Update') : __('Save');
?>
<div id="wp-fullscreen-body">
<div id="fullscreen-topbar" class="fade-600">
<div id="wp-fullscreen-info">
<span id="wp-fullscreen-saved"> </span>
<span class="autosave-message">&nbsp;</span>
<span id="wp-fullscreen-last-edit"> </span>
</div>
<?php }
<div id="wp-fullscreen-toolbar">
<div id="wp-fullscreen-close"><a href="#" onclick="fullscreen.off();return false;"><?php _e('Back'); ?></a></div>
<div id="wp-fullscreen-save"><input type="button" class="button-primary" value="<?php echo $save; ?>" onclick="fullscreen.save();" /></div>
<div id="wp-fullscreen-buttons" style="width:<?php echo $width; ?>px;" 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">
<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">
<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>
</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">
<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">
<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>
</div>
<div>
<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">
<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>
<span tabindex="-1" aria-orientation="vertical" role="separator" class="mceSeparator"></span>
</div>
<div>
<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">
<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">
<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 id="wp-fullscreen-count"><?php _e('Word Count:'); ?> <span class="word-count">0</span></div>
</div>
</div>
</div>
<div id="wp-fullscreen-wrap" style="width:<?php echo $width; ?>px;">
<label id="wp-fullscreen-title-prompt-text" for="wp-fullscreen-title"><?php echo apply_filters( 'enter_title_here', __( 'Enter title here' ), $post ); ?></label>
<input type="text" id="wp-fullscreen-title" value="" autocomplete="off" />
<div id="wp-fullscreen-container">
<textarea id="wp_mce_fullscreen"></textarea>
</div>
</div>
</div>
<div class="fullscreen-overlay" id="fullscreen-overlay"></div>
<div class="fullscreen-overlay fullscreen-fader fade-600" id="fullscreen-fader"></div>
<?php
}

View File

@ -1,4 +1,4 @@
var tagBox, commentsBox, editPermalink, makeSlugeditClickable, WPSetThumbnailHTML, WPSetThumbnailID, WPRemoveThumbnail;
var tagBox, commentsBox, editPermalink, makeSlugeditClickable, WPSetThumbnailHTML, WPSetThumbnailID, WPRemoveThumbnail, wptitlehint;
// return an array with any duplicate, whitespace or values removed
function array_unique_noempty(a) {
@ -600,18 +600,29 @@ jQuery(document).ready( function($) {
makeSlugeditClickable();
}
if ( $('#title').val() == '' )
$('#title').siblings('#title-prompt-text').css('visibility', '');
$('#title-prompt-text').click(function(){
$(this).css('visibility', 'hidden').siblings('#title').focus();
wptitlehint = function(id) {
id = id || 'title';
var title = $('#' + id), titleprompt = $('#' + id + '-prompt-text');
if ( title.val() == '' )
titleprompt.css('visibility', '');
titleprompt.click(function(){
$(this).css('visibility', 'hidden');
title.focus();
});
$('#title').blur(function(){
if (this.value == '')
$(this).siblings('#title-prompt-text').css('visibility', '');
title.blur(function(){
if ( this.value == '' )
titleprompt.css('visibility', '');
}).focus(function(){
$(this).siblings('#title-prompt-text').css('visibility', 'hidden');
titleprompt.css('visibility', 'hidden');
}).keydown(function(e){
$(this).siblings('#title-prompt-text').css('visibility', 'hidden');
titleprompt.css('visibility', 'hidden');
$(this).unbind(e);
});
}
wptitlehint();
});

File diff suppressed because one or more lines are too long

View File

@ -5,7 +5,7 @@
init : function() {
var t = this, last = 0, co = $('#content');
$('#wp-word-count').html( wordCountL10n.count.replace( /%d/, '<span id="word-count">0</span>' ) );
$('#wp-word-count').html( wordCountL10n.count.replace( /%d/, '<span class="word-count">0</span>' ) );
t.block = 0;
t.wc(co.val());
co.keyup( function(e) {
@ -17,7 +17,7 @@
},
wc : function(tx) {
var t = this, w = $('#word-count'), tc = 0;
var t = this, w = $('.word-count'), tc = 0;
if ( t.block ) return;
t.block = 1;

View File

@ -1 +1 @@
(function(a){wpWordCount={init:function(){var b=this,c=0,d=a("#content");a("#wp-word-count").html(wordCountL10n.count.replace(/%d/,'<span id="word-count">0</span>'));b.block=0;b.wc(d.val());d.keyup(function(f){if(f.keyCode==c){return true}if(13==f.keyCode||8==c||46==c){b.wc(d.val())}c=f.keyCode;return true})},wc:function(d){var e=this,c=a("#word-count"),b=0;if(e.block){return}e.block=1;setTimeout(function(){if(d){d=d.replace(/<.[^<>]*?>/g," ").replace(/&nbsp;|&#160;/gi," ");d=d.replace(/[0-9.(),;:!?%#$¿'"_+=\\/-]*/g,"");d.replace(/\S\s+/g,function(){b++})}c.html(b.toString());setTimeout(function(){e.block=0},2000)},1)}};a(document).ready(function(){wpWordCount.init()})}(jQuery));
(function(a){wpWordCount={init:function(){var b=this,c=0,d=a("#content");a("#wp-word-count").html(wordCountL10n.count.replace(/%d/,'<span class="word-count">0</span>'));b.block=0;b.wc(d.val());d.keyup(function(f){if(f.keyCode==c){return true}if(13==f.keyCode||8==c||46==c){b.wc(d.val())}c=f.keyCode;return true})},wc:function(d){var e=this,c=a(".word-count"),b=0;if(e.block){return}e.block=1;setTimeout(function(){if(d){d=d.replace(/<.[^<>]*?>/g," ").replace(/&nbsp;|&#160;/gi," ");d=d.replace(/[0-9.(),;:!?%#$¿'"_+=\\/-]*/g,"");d.replace(/\S\s+/g,function(){b++})}c.html(b.toString());setTimeout(function(){e.block=0},2000)},1)}};a(document).ready(function(){wpWordCount.init()})}(jQuery));

View File

@ -0,0 +1,314 @@
/**
* PubSub -- A lightweight publish/subscribe implementation. Private use only!
*/
var PubSub = function() {
this.topics = {};
};
PubSub.prototype.subscribe = function( topic, callback ) {
if ( ! this.topics[ topic ] )
this.topics[ topic ] = [];
this.topics[ topic ].push( callback );
return callback;
};
PubSub.prototype.unsubscribe = function( topic, callback ) {
var i, l,
topics = this.topics[ topic ];
if ( ! topics )
return callback || [];
// Clear matching callbacks
if ( callback ) {
for ( i = 0, l = topics.length; i < l; i++ ) {
if ( callback == topics[i] )
topics.splice( i, 1 );
}
return callback;
// Clear all callbacks
} else {
this.topics[ topic ] = [];
return topics;
}
};
PubSub.prototype.publish = function( topic, args ) {
var i, l,
topics = this.topics[ topic ];
if ( ! topics )
return;
args = args || [];
for ( i = 0, l = topics.length; i < l; i++ ) {
topics[i].apply( null, args );
}
};
// Distraction Free Writing (wp-fullscreen) access the API globally using the fullscreen variable.
var fullscreen, wp_fullscreen_enabled = false;
(function($){
var api, ps, bounder;
// Initialize the fullscreen/api object
fullscreen = api = {};
// Create the PubSub (publish/subscribe) interface.
ps = api.pubsub = new PubSub();
api.timer = 0;
api.block = false;
/**
* BOUNDER
*
* Creates a function that publishes start/stop topics.
* Use to throttle events.
*/
bounder = function( start, stop, delay ) {
delay = delay || 1250;
if ( api.block )
return;
api.block = true;
setTimeout( function() {
api.block = false;
}, 500 );
if ( api.timer )
clearTimeout( api.timer );
else
ps.publish( start );
function timed() {
ps.publish( stop );
api.timer = 0;
}
api.timer = setTimeout( timed, delay );
};
/**
* ON / OFF API
*/
api.on = function() {
if ( ! api.ui.element )
api.ui.init();
if ( ! api.visible )
api.ui.fade( 'show', 'showing', 'shown' );
};
api.off = function() {
if ( api.ui.element && api.visible )
api.ui.fade( 'hide', 'hiding', 'hidden' );
};
/**
* GENERAL
*/
api.save = function() {
$('#title').val( $('#wp-fullscreen-title').val() );
tinyMCE.execCommand('wpFullScreenSaveContent');
$('#hiddenaction').val('wp-fullscreen-save-post');
$.post( ajaxurl, $('form#post').serialize(), function(r){
if ( r.message )
$('#wp-fullscreen-saved').html(r.message);
if ( r.last_edited )
$('#wp-fullscreen-last-edit').html(r.last_edited);
}, 'json');
}
set_title_hint = function(title) {
if ( !title.val().length )
title.siblings('label').css( 'visibility', '' );
else
title.siblings('label').css( 'visibility', 'hidden' );
}
ps.subscribe( 'showToolbar', function() {
api.fade.fadein( api.ui.topbar, 600 );
$('#wp-fullscreen-body').addClass('wp-fullscreen-focus');
});
ps.subscribe( 'hideToolbar', function() {
api.fade.fadeout( api.ui.topbar, 600 );
$('#wp-fullscreen-body').removeClass('wp-fullscreen-focus');
});
ps.subscribe( 'show', function() {
var title = $('#wp-fullscreen-title').val( $('#title').val() );
this.set_title_hint(title);
$( document ).bind( 'mousemove.fullscreen', function(e) { bounder( 'showToolbar', 'hideToolbar', 3000 ); } );
});
ps.subscribe( 'hide', function() {
var title = $('#title').val( $('#wp-fullscreen-title').val() );
this.set_title_hint(title);
tinyMCE.execCommand('wpFullScreenSave');
$( document ).unbind( '.fullscreen' );
});
ps.subscribe( 'showing', function() {
$('#wp-fullscreen-body').show();
$( document.body ).addClass( 'fullscreen-active' );
bounder( 'showToolbar', 'hideToolbar', 3000 );
$('#wp-fullscreen-last-edit').html( $('#last-edit').html() );
});
ps.subscribe( 'hiding', function() {
$('#wp-fullscreen-body').hide();
$( document.body ).removeClass( 'fullscreen-active' );
$('#last-edit').html( $('#wp-fullscreen-last-edit').html() );
});
ps.subscribe( 'shown', function() {
api.visible = wp_fullscreen_enabled = true;
});
ps.subscribe( 'hidden', function() {
api.visible = wp_fullscreen_enabled = false;
$('#wp_mce_fullscreen').removeAttr('style');
tinyMCE.execCommand('wpFullScreenClose');
});
/**
* Buttons
*/
api.b = function() {
tinyMCE.execCommand('Bold');
}
api.i = function() {
tinyMCE.execCommand('Italic');
}
api.ul = function() {
tinyMCE.execCommand('InsertUnorderedList');
}
api.ol = function() {
tinyMCE.execCommand('InsertOrderedList');
}
api.link = function() {
tinyMCE.execCommand('WP_Link');
}
api.unlink = function() {
tinyMCE.execCommand('unlink');
}
/**
* UI elements (used for transitioning)
*/
api.ui = {
/**
* Undefined api.ui properties:
* element, topbar
*/
init: function() {
api.ui.element = $('#fullscreen-fader');
api.ui.topbar = $('#fullscreen-topbar');
if ( 'undefined' != wptitlehint )
wptitlehint('wp-fullscreen-title');
},
fade: function( before, during, after ) {
if ( before )
ps.publish( before );
api.fade.fadein( api.ui.element, 600, function() {
if ( during )
ps.publish( during );
api.fade.fadeout( api.ui.element, 600, function() {
if ( after )
ps.publish( after );
})
});
}
};
api.fade = {
transitionend: 'transitionend webkitTransitionEnd OTransitionEnd',
// Sensitivity to allow browsers to render the blank element before animating.
sensitivity: 100,
fadein: function( element, speed, callback ) {
callback = callback || $.noop;
speed = speed || 400;
if ( api.fade.transitions ) {
if ( element.is(':visible') ) {
element.addClass( 'fade-trigger' );
return element;
}
element.show();
setTimeout( function() { element.addClass( 'fade-trigger' ); }, this.sensitivity );
element.one( this.transitionend, function() {
callback();
});
} else {
element.css( 'opacity', 1 ).fadeIn( speed, callback );
}
return element;
},
fadeout: function( element, speed, callback ) {
callback = callback || $.noop;
speed = speed || 400;
if ( ! element.is(':visible') )
return element;
if ( api.fade.transitions ) {
element.removeClass( 'fade-trigger' );
element.one( api.fade.transitionend, function() {
if ( element.hasClass('fade-trigger') )
return;
element.hide();
callback();
});
} else {
element.fadeOut( speed, callback );
}
return element;
},
transitions: (function() {
var s = document.documentElement.style;
return ( typeof ( s.WebkitTransition ) == 'string' ||
typeof ( s.MozTransition ) == 'string' ||
typeof ( s.OTransition ) == 'string' ||
typeof ( s.transition ) == 'string' );
})()
};
/*
api.editor = function() {
return $('#content, #content_ifr').filter(':visible');
};
*/
})(jQuery);

View File

@ -0,0 +1 @@
var PubSub=function(){this.topics={}};PubSub.prototype.subscribe=function(a,b){if(!this.topics[a]){this.topics[a]=[]}this.topics[a].push(b);return b};PubSub.prototype.unsubscribe=function(b,e){var c,a,d=this.topics[b];if(!d){return e||[]}if(e){for(c=0,a=d.length;c<a;c++){if(e==d[c]){d.splice(c,1)}}return e}else{this.topics[b]=[];return d}};PubSub.prototype.publish=function(c,b){var d,a,e=this.topics[c];if(!e){return}b=b||[];for(d=0,a=e.length;d<a;d++){e[d].apply(null,b)}};var fullscreen,wp_fullscreen_enabled=false;(function(b){var a,d,c;fullscreen=a={};d=a.pubsub=new PubSub();a.timer=0;a.block=false;c=function(h,g,f){f=f||1250;if(a.block){return}a.block=true;setTimeout(function(){a.block=false},500);if(a.timer){clearTimeout(a.timer)}else{d.publish(h)}function e(){d.publish(g);a.timer=0}a.timer=setTimeout(e,f)};a.on=function(){if(!a.ui.element){a.ui.init()}if(!a.visible){a.ui.fade("show","showing","shown")}};a.off=function(){if(a.ui.element&&a.visible){a.ui.fade("hide","hiding","hidden")}};a.save=function(){b("#title").val(b("#wp-fullscreen-title").val());tinyMCE.execCommand("wpFullScreenSaveContent");b("#hiddenaction").val("wp-fullscreen-save-post");b.post(ajaxurl,b("form#post").serialize(),function(e){if(e.message){b("#wp-fullscreen-saved").html(e.message)}if(e.last_edited){b("#wp-fullscreen-last-edit").html(e.last_edited)}},"json")};set_title_hint=function(e){if(!e.val().length){e.siblings("label").css("visibility","")}else{e.siblings("label").css("visibility","hidden")}};d.subscribe("showToolbar",function(){a.fade.fadein(a.ui.topbar,600);b("#wp-fullscreen-body").addClass("wp-fullscreen-focus")});d.subscribe("hideToolbar",function(){a.fade.fadeout(a.ui.topbar,600);b("#wp-fullscreen-body").removeClass("wp-fullscreen-focus")});d.subscribe("show",function(){var e=b("#wp-fullscreen-title").val(b("#title").val());this.set_title_hint(e);b(document).bind("mousemove.fullscreen",function(f){c("showToolbar","hideToolbar",3000)})});d.subscribe("hide",function(){var e=b("#title").val(b("#wp-fullscreen-title").val());this.set_title_hint(e);tinyMCE.execCommand("wpFullScreenSave");b(document).unbind(".fullscreen")});d.subscribe("showing",function(){b("#wp-fullscreen-body").show();b(document.body).addClass("fullscreen-active");c("showToolbar","hideToolbar",3000);b("#wp-fullscreen-last-edit").html(b("#last-edit").html())});d.subscribe("hiding",function(){b("#wp-fullscreen-body").hide();b(document.body).removeClass("fullscreen-active");b("#last-edit").html(b("#wp-fullscreen-last-edit").html())});d.subscribe("shown",function(){a.visible=wp_fullscreen_enabled=true});d.subscribe("hidden",function(){a.visible=wp_fullscreen_enabled=false;b("#wp_mce_fullscreen").removeAttr("style");tinyMCE.execCommand("wpFullScreenClose")});a.b=function(){tinyMCE.execCommand("Bold")};a.i=function(){tinyMCE.execCommand("Italic")};a.ul=function(){tinyMCE.execCommand("InsertUnorderedList")};a.ol=function(){tinyMCE.execCommand("InsertOrderedList")};a.link=function(){tinyMCE.execCommand("WP_Link")};a.unlink=function(){tinyMCE.execCommand("unlink")};a.ui={init:function(){a.ui.element=b("#fullscreen-fader");a.ui.topbar=b("#fullscreen-topbar");if("undefined"!=wptitlehint){wptitlehint("wp-fullscreen-title")}},fade:function(f,e,g){if(f){d.publish(f)}a.fade.fadein(a.ui.element,600,function(){if(e){d.publish(e)}a.fade.fadeout(a.ui.element,600,function(){if(g){d.publish(g)}})})}};a.fade={transitionend:"transitionend webkitTransitionEnd OTransitionEnd",sensitivity:100,fadein:function(e,f,g){g=g||b.noop;f=f||400;if(a.fade.transitions){if(e.is(":visible")){e.addClass("fade-trigger");return e}e.show();setTimeout(function(){e.addClass("fade-trigger")},this.sensitivity);e.one(this.transitionend,function(){g()})}else{e.css("opacity",1).fadeIn(f,g)}return e},fadeout:function(e,f,g){g=g||b.noop;f=f||400;if(!e.is(":visible")){return e}if(a.fade.transitions){e.removeClass("fade-trigger");e.one(a.fade.transitionend,function(){if(e.hasClass("fade-trigger")){return}e.hide();g()})}else{e.fadeOut(f,g)}return e},transitions:(function(){var e=document.documentElement.style;return(typeof(e.WebkitTransition)=="string"||typeof(e.MozTransition)=="string"||typeof(e.OTransition)=="string"||typeof(e.transition)=="string")})()}})(jQuery);

View File

@ -345,7 +345,7 @@ var photostorage = false;
if ( user_can_richedit() ) {
wp_tiny_mce( true, array( 'height' => '370' ) );
add_action( 'admin_print_footer_scripts', 'wp_tiny_mce_preload_dialogs', 30 );
add_action( 'admin_print_footer_scripts', 'wp_preload_dialogs', 30 );
}
?>
<script type="text/javascript">

View File

@ -246,6 +246,7 @@ add_action( 'save_post', '_save_post_hook', 5, 2 );
add_action( 'transition_post_status', '_transition_post_status', 5, 3 );
add_action( 'comment_form', 'wp_comment_form_unfiltered_html_nonce' );
add_action( 'wp_scheduled_delete', 'wp_scheduled_delete' );
add_action( 'tiny_mce_preload_dialogs', 'wp_preload_dialogs', 10, 1 );
// Navigation menu actions
add_action( 'delete_post', '_wp_delete_post_menu_item' );

View File

@ -1841,6 +1841,12 @@ function the_editor($content, $id = 'content', $prev_id = 'title', $media_button
edCanvas = document.getElementById('<?php echo $id; ?>');
</script>
<?php
// queue scripts
if ( $richedit )
add_action( 'admin_print_footer_scripts', 'wp_tiny_mce', 25 );
else
add_action( 'admin_print_footer_scripts', 'wp_quicktags', 25 );
}
/**

View File

@ -1,4 +1,4 @@
var autosave, autosaveLast = '', autosavePeriodical, autosaveOldMessage = '', autosaveDelayPreview = false, notSaved = true, blockSave = false;
var autosave, autosaveLast = '', autosavePeriodical, autosaveOldMessage = '', autosaveDelayPreview = false, notSaved = true, blockSave = false, wp_fullscreen_enabled;
jQuery(document).ready( function($) {
var dotabkey = true;
@ -34,7 +34,14 @@ jQuery(document).ready( function($) {
if ( mce.isDirty() )
return autosaveL10n.saveAlert;
} else {
title = $('#post #title').val(), content = $('#post #content').val();
if ( wp_fullscreen_enabled ) {
title = $('#wp-fullscreen-title').val();
content = $("#wp_mce_fullscreen").val();
} else {
title = $('#post #title').val();
content = $('#post #content').val();
}
if ( ( title || content ) && title + content != autosaveLast )
return autosaveL10n.saveAlert;
}
@ -116,8 +123,11 @@ function autosave_parse_response(response) {
}
}
}
if ( message ) { jQuery('#autosave').html(message); } // update autosave message
else if ( autosaveOldMessage && res ) { jQuery('#autosave').html( autosaveOldMessage ); }
if ( message ) { // update autosave message
jQuery('.autosave-message').html(message);
} else if ( autosaveOldMessage && res ) {
jQuery('.autosave-message').html( autosaveOldMessage );
}
return res;
}
@ -152,12 +162,10 @@ function autosave_saved_new(response) {
function autosave_update_slug(post_id) {
// create slug area only if not already there
if ( 'undefined' != makeSlugeditClickable && jQuery.isFunction(makeSlugeditClickable) && !jQuery('#edit-slug-box > *').size() ) {
jQuery.post(
ajaxurl,
{
jQuery.post( ajaxurl, {
action: 'sample-permalink',
post_id: post_id,
new_title: jQuery('#title').val(),
new_title: wp_fullscreen_enabled ? jQuery('#wp-fullscreen-title').val() : jQuery('#title').val(),
samplepermalinknonce: jQuery('#samplepermalinknonce').val()
},
function(data) {
@ -171,7 +179,7 @@ function autosave_update_slug(post_id) {
}
function autosave_loading() {
jQuery('#autosave').html(autosaveL10n.savingText);
jQuery('.autosave-message').html(autosaveL10n.savingText);
}
function autosave_enable_buttons() {
@ -199,14 +207,14 @@ function delayed_autosave() {
autosave = function() {
// (bool) is rich editor enabled and active
blockSave = true;
var rich = (typeof tinyMCE != "undefined") && tinyMCE.activeEditor && !tinyMCE.activeEditor.isHidden(), post_data, doAutoSave, ed, origStatus, successCallback;
var rich = (typeof tinyMCE != "undefined") && tinyMCE.activeEditor && !tinyMCE.activeEditor.isHidden(),
post_data, doAutoSave, ed, origStatus, successCallback;
autosave_disable_buttons();
post_data = {
action: "autosave",
post_ID: jQuery("#post_ID").val() || 0,
post_title: jQuery("#title").val() || "",
autosavenonce: jQuery('#autosavenonce').val(),
post_type: jQuery('#post_type').val() || "",
autosave: 1
@ -231,13 +239,20 @@ autosave = function() {
if ( ed.plugins.spellchecker && ed.plugins.spellchecker.active ) {
doAutoSave = false;
} else {
if ( 'mce_fullscreen' == ed.id )
if ( 'mce_fullscreen' == ed.id || 'wp_mce_fullscreen' == ed.id )
tinyMCE.get('content').setContent(ed.getContent({format : 'raw'}), {format : 'raw'});
tinyMCE.get('content').save();
tinyMCE.triggerSave();
}
}
if ( wp_fullscreen_enabled ) {
post_data["post_title"] = jQuery('#wp-fullscreen-title').val();
post_data["content"] = jQuery("#wp_mce_fullscreen").val();
} else {
post_data["post_title"] = jQuery("#title").val()
post_data["content"] = jQuery("#content").val();
}
if ( jQuery('#post_name').val() )
post_data["post_name"] = jQuery('#post_name').val();
@ -269,7 +284,7 @@ autosave = function() {
post_data["auto_draft"] = '1';
if ( doAutoSave ) {
autosaveLast = jQuery("#title").val() + jQuery("#content").val();
autosaveLast = post_data["post_title"] + post_data["content"];
} else {
post_data['autosave'] = 0;
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,295 @@
/*
Distraction Free Writing mode TinyMCE Styles
*/
html, body.mceContentBody {
background: transparent;
margin: 0;
padding: 0;
}
* {
color: #444;
font-family: Georgia, "Bitstream Charter", serif;
line-height: 1.5;
}
p,
dl,
td,
th,
ul,
ol,
blockquote {
font-size: 16px;
}
tr th,
thead th,
label,
tr th,
thead th {
font-family: "Helvetica Neue", Arial, Helvetica, "Nimbus Sans L", sans-serif;
}
pre {
font-family: "Courier 10 Pitch", Courier, monospace;
}
code, code var {
font-family: Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace;
}
body, input, textarea {
font-size: 12px;
line-height: 18px;
}
hr {
background-color: #e7e7e7;
border: 0;
clear: both;
height: 1px;
margin-bottom: 18px;
}
/* Text elements */
p {
margin-bottom: 18px;
}
ul {
list-style: square;
margin: 0 0 18px 1.5em;
}
ol {
list-style: decimal;
margin: 0 0 18px 1.5em;
}
ol ol {
list-style: upper-alpha;
}
ol ol ol {
list-style: lower-roman;
}
ol ol ol ol {
list-style: lower-alpha;
}
ul ul,
ol ol,
ul ol,
ol ul {
margin-bottom: 0;
}
dl {
margin: 0 0 24px 0;
}
dt {
font-weight: bold;
}
dd {
margin-bottom: 18px;
}
strong {
color: #000;
font-weight: bold;
}
cite,
em,
i {
border: none;
font-style: italic;
}
big {
font-size: 131.25%;
}
ins {
background: #ffc;
border: none;
color: #333;
}
del {
text-decoration: line-through;
color: #555;
}
blockquote {
font-style: italic;
padding: 0 3em;
}
blockquote cite,
blockquote em,
blockquote i {
font-style: normal;
}
pre {
background: #f7f7f7;
color: #222;
line-height: 18px;
margin-bottom: 18px;
padding: 1.5em;
}
abbr,
acronym {
border-bottom: 1px dotted #666;
cursor: help;
}
ins {
text-decoration: none;
}
sup,
sub {
font-size: 10px;
height: 0;
line-height: 1;
position: relative;
vertical-align: baseline;
}
sup {
bottom: 1ex;
}
sub {
top: .5ex;
}
a:link {
color: #06c;
}
a:visited {
color: #743399;
}
a:active,
a:hover {
color: #ff4b33;
}
p,
ul,
ol,
dd,
pre,
hr {
margin-bottom: 24px;
}
ul ul,
ol ol,
ul ol,
ol ul {
margin-bottom: 0;
}
pre,
kbd,
tt,
var {
font-size: 15px;
line-height: 21px;
}
code {
font-size: 13px;
}
strong,
b,
dt,
th {
color: #000;
}
h1,
h2,
h3,
h4,
h5,
h6 {
color: #000;
font-weight: normal;
line-height: 1.5em;
margin: 0 0 20px 0;
}
h1 {
font-size: 2.4em;
}
h2 {
font-size: 1.8em;
}
h3 {
font-size: 1.4em;
}
h4 {
font-size: 1.2em;
}
h5 {
font-size: 1em;
}
h6 {
font-size: 0.9em;
}
table {
border: 1px solid #e7e7e7 !important;
border-collapse: collapse;
border-spacing: 0;
margin: 0 -1px 24px 0;
text-align: left;
width: 100%;
}
tr th,
thead th {
border: none !important;
color: #888;
font-size: 12px;
font-weight: bold;
line-height: 18px;
padding: 9px 24px;
}
tr td {
border: none !important;
border-top: 1px solid #e7e7e7 !important;
padding: 6px 24px;
}
img {
margin: 0;
}
img.size-auto,
img.size-large,
img.size-full,
img.size-medium {
max-width: 100%;
height: auto;
}
.alignleft,
img.alignleft {
display: inline;
float: left;
margin-right: 24px;
margin-top: 4px;
}
.alignright,
img.alignright {
display: inline;
float: right;
margin-left: 24px;
margin-top: 4px;
}
.aligncenter,
img.aligncenter {
clear: both;
display: block;
margin-left: auto;
margin-right: auto;
}
img.alignleft,
img.alignright,
img.aligncenter {
margin-bottom: 12px;
}
.wp-caption {
background: #f1f1f1;
border: none;
-khtml-border-radius: 0;
-moz-border-radius: 0;
-webkit-border-radius: 0;
border-radius: 0;
color: #888;
font-size: 12px;
line-height: 18px;
margin-bottom: 20px;
max-width: 632px !important; /* prevent too-wide images from breaking layout */
padding: 4px;
text-align: center;
}
.wp-caption img {
margin: 5px;
}
.wp-caption p.wp-caption-text {
margin: 0 0 4px;
}
.wp-smiley {
margin: 0;
}

View File

@ -0,0 +1,151 @@
/**
* WP Fullscreen TinyMCE plugin
*
* Contains code from Moxiecode Systems AB released under LGPL License http://tinymce.moxiecode.com/license
*/
(function() {
tinymce.create('tinymce.plugins.wpFullscreenPlugin', {
init : function(ed, url) {
var t = this, oldHeight = 0, s = {}, DOM = tinymce.DOM;
// Register commands
ed.addCommand('wpFullScreenClose', function() {
// this removes the editor, content has to be saved first with tinyMCE.execCommand('wpFullScreenSave');
if ( ed.getParam('wp_fullscreen_is_enabled') ) {
DOM.win.setTimeout(function() {
tinyMCE.remove(ed);
DOM.remove('wp_mce_fullscreen_parent');
tinyMCE.settings = tinyMCE.oldSettings; // Restore old settings
}, 10);
}
});
ed.addCommand('wpFullScreenSave', function() {
var ed = tinyMCE.get('wp_mce_fullscreen'), edd;
ed.focus();
edd = tinyMCE.get( ed.getParam('wp_fullscreen_editor_id') );
edd.setContent( ed.getContent({format : 'raw'}), {format : 'raw'} );
});
ed.addCommand('wpFullScreenSaveContent', function() {
ed.execCommand('wpFullScreenSave');
tinyMCE.triggerSave();
});
ed.addCommand('wpFullScreenOpen', function() {
var d = ed.getDoc(), b = d.body;
tinyMCE.oldSettings = tinyMCE.settings; // Store old settings
tinymce.each(ed.settings, function(v, n) {
s[n] = v;
});
s.id = 'wp_mce_fullscreen';
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.wp_fullscreen_content_css || '';
s.height = tinymce.isIE ? b.scrollHeight : b.offsetHeight;
s.save_onsavecallback = function() {
ed.setContent(tinyMCE.get(s.id).getContent({format : 'raw'}), {format : 'raw'});
ed.execCommand('mceSave');
};
tinymce.each(ed.getParam('wp_fullscreen_settings'), function(v, k) {
s[k] = v;
});
t.fullscreenEditor = new tinymce.Editor('wp_mce_fullscreen', s);
t.fullscreenEditor.onInit.add(function() {
t.fullscreenEditor.setContent(ed.getContent());
t.fullscreenEditor.focus();
});
fullscreen.on();
t.fullscreenEditor.render();
});
// Register buttons
ed.addButton('fullscreen', {title : 'fullscreen.desc', cmd : 'wpFullScreenOpen'});
// END fullscreen
//----------------------------------------------------------------
// START autoresize
if ( ed.getParam('fullscreen_is_enabled') || !ed.getParam('wp_fullscreen_is_enabled') )
return;
/**
* This method gets executed each time the editor needs to resize.
*/
function resize() {
var d = ed.getDoc(), b = d.body, de = d.documentElement, DOM = tinymce.DOM, resizeHeight, myHeight;
// Get height differently depending on the browser used
if ( tinymce.isIE )
myHeight = b.scrollHeight;
else if ( tinymce.isWebKit )
myHeight = b.offsetHeight;
else
myHeight = de.offsetHeight;
// Don't make it smaller than the minimum height
resizeHeight = (myHeight > 300) ? myHeight : 300;
// Resize content element
if ( oldHeight != resizeHeight ) {
oldHeight = resizeHeight;
DOM.setStyle(DOM.get(ed.id + '_ifr'), 'height', resizeHeight + 'px');
}
};
// Add appropriate listeners for resizing content area
ed.onInit.add(function(ed, l) {
ed.onChange.add(resize);
ed.onSetContent.add(resize);
ed.onPaste.add(resize);
ed.onKeyUp.add(resize);
ed.onPostRender.add(resize);
ed.getBody().style.overflowY = "hidden";
ed.dom.setStyle( ed.getBody(), 'paddingBottom', ed.getParam('autoresize_bottom_margin', 50) + 'px' );
});
if (ed.getParam('autoresize_on_init', true)) {
ed.onLoadContent.add(function(ed, l) {
// resize(); // runs before onInit, useless?
// Because the content area resizes when its content CSS loads,
// and we can't easily add a listener to its onload event,
// we'll just trigger a resize after a short loading period
setTimeout(function() {
resize();
}, 1200);
});
}
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
ed.addCommand('mceAutoResize', resize);
},
getInfo : function() {
return {
longname : 'WP Fullscreen',
author : 'WordPress',
authorurl : 'http://wordpress.org',
infourl : '',
version : '1.0'
};
}
});
// Register plugin
tinymce.PluginManager.add('wpfullscreen', tinymce.plugins.wpFullscreenPlugin);
})();

View File

@ -0,0 +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("wpFullScreenSaveContent",function(){a.execCommand("wpFullScreenSave");tinyMCE.triggerSave()});a.addCommand("wpFullScreenOpen",function(){var i=a.getDoc(),h=i.body;tinyMCE.oldSettings=tinyMCE.settings;tinymce.each(a.settings,function(j,k){e[k]=j});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.wp_fullscreen_content_css||"";e.height=tinymce.isIE?h.scrollHeight:h.offsetHeight;e.save_onsavecallback=function(){a.setContent(tinyMCE.get(e.id).getContent({format:"raw"}),{format:"raw"});a.execCommand("mceSave")};tinymce.each(a.getParam("wp_fullscreen_settings"),function(l,j){e[j]=l});d.fullscreenEditor=new tinymce.Editor("wp_mce_fullscreen",e);d.fullscreenEditor.onInit.add(function(){d.fullscreenEditor.setContent(a.getContent());d.fullscreenEditor.focus()});fullscreen.on();d.fullscreenEditor.render()});a.addButton("fullscreen",{title:"fullscreen.desc",cmd:"wpFullScreenOpen"});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";i.dom.setStyle(i.getBody(),"paddingBottom",i.getParam("autoresize_bottom_margin",50)+"px")});if(a.getParam("autoresize_on_init",true)){a.onLoadContent.add(function(i,h){setTimeout(function(){b()},1200)})}a.addCommand("mceAutoResize",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

@ -92,6 +92,10 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'colorpicker', "/wp-includes/js/colorpicker$suffix.js", array('prototype'), '3517m' );
$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'), '20110424' );
$scripts->add_data( 'wp-fullscreen', 'group', 1 );
$scripts->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.6.1');
@ -103,7 +107,7 @@ function wp_default_scripts( &$scripts ) {
'l10n_print_after' => 'try{convertEntities(wpAjax);}catch(e){};'
) );
$scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array('schedule', 'wp-ajax-response'), '20110415' );
$scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array('schedule', 'wp-ajax-response'), '20110424' );
$scripts->add_data( 'autosave', 'group', 1 );
$scripts->add( 'wp-lists', "/wp-includes/js/wp-lists$suffix.js", array('wp-ajax-response'), '20101222' );
@ -320,7 +324,7 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), '20091012' );
$scripts->add_data( 'postbox', 'group', 1 );
$scripts->add( 'post', "/wp-admin/js/post$suffix.js", array('suggest', 'wp-lists', 'postbox'), '20110203' );
$scripts->add( 'post', "/wp-admin/js/post$suffix.js", array('suggest', 'wp-lists', 'postbox'), '20110424' );
$scripts->add_data( 'post', 'group', 1 );
$scripts->localize( 'post', 'postL10n', array(
'tagsUsed' => __('Tags used on this post:'),
@ -369,7 +373,7 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'admin-widgets', "/wp-admin/js/widgets$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable' ), '20101007' );
$scripts->add_data( 'admin-widgets', 'group', 1 );
$scripts->add( 'word-count', "/wp-admin/js/word-count$suffix.js", array( 'jquery' ), '20090422' );
$scripts->add( 'word-count', "/wp-admin/js/word-count$suffix.js", array( 'jquery' ), '20110424' );
$scripts->add_data( 'word-count', 'group', 1 );
$scripts->localize( 'word-count', 'wordCountL10n', array(
'count' => __('Word count: %d'),
@ -479,7 +483,7 @@ function wp_default_styles( &$styles ) {
// Any rtl stylesheets that don't have a .dev version for ltr
$no_suffix = array( 'farbtastic' );
$styles->add( 'wp-admin', "/wp-admin/css/wp-admin$suffix.css", array(), '20110419' );
$styles->add( 'wp-admin', "/wp-admin/css/wp-admin$suffix.css", array(), '20110424' );
$styles->add( 'ie', "/wp-admin/css/ie$suffix.css", array(), '20101102' );
$styles->add_data( 'ie', 'conditional', 'lte IE 7' );
@ -495,7 +499,7 @@ function wp_default_styles( &$styles ) {
$styles->add( 'colors-classic', "/wp-admin/css/colors-classic$suffix.css", array(), $colors_version );
$styles->add( 'ms', "/wp-admin/css/ms$suffix.css", array(), '20101213' );
$styles->add( 'global', "/wp-admin/css/global$suffix.css", array(), '20110121' );
$styles->add( 'global', "/wp-admin/css/global$suffix.css", array(), '20110424' );
$styles->add( 'media', "/wp-admin/css/media$suffix.css", array(), '20110121' );
$styles->add( 'widgets', "/wp-admin/css/widgets$suffix.css", array(), '20110104' );
$styles->add( 'dashboard', "/wp-admin/css/dashboard$suffix.css", array(), '20110121' );