DFW: import editor-style.css, fine-tune transition times, add width resizing setting, some cleanup, see #17136

git-svn-id: http://svn.automattic.com/wordpress/trunk@17837 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2011-05-08 02:01:53 +00:00
parent 69ea469e12
commit 8267ff9aae
13 changed files with 146 additions and 61 deletions

File diff suppressed because one or more lines are too long

View File

@ -540,6 +540,18 @@ div.error p {
/* =CSS 3 transitions
-------------------------------------------------------------- */
.fade-1000 {
opacity: 0;
-moz-transition-property: opacity;
-moz-transition-duration: 1s;
-webkit-transition-property: opacity;
-webkit-transition-duration: 1s;
-o-transition-property: opacity;
-o-transition-duration: 1s;
transition-property: opacity;
transition-duration: 1s;
}
.fade-600 {
opacity: 0;
-moz-transition-property: opacity;
@ -564,6 +576,18 @@ div.error p {
transition-duration: 0.4s;
}
.fade-300 {
opacity: 0;
-moz-transition-property: opacity;
-moz-transition-duration: 0.3s;
-webkit-transition-property: opacity;
-webkit-transition-duration: 0.3s;
-o-transition-property: opacity;
-o-transition-duration: 0.3s;
transition-property: opacity;
transition-duration: 0.3s;
}
.fade-trigger {
opacity: 1;
}

File diff suppressed because one or more lines are too long

View File

@ -672,8 +672,11 @@ form.upgrade .hint {
}
#wp-fullscreen-toolbar {
padding: 6px 2% 0;
padding: 6px 10px 0;
clear: both;
max-width: 1100px;
min-width: 820px;
margin: 0 auto;
}
#wp-fullscreen-mode-bar,
@ -688,7 +691,7 @@ form.upgrade .hint {
}
#wp-fullscreen-save {
padding-top: 2px;
padding: 2px 2px 0 5px;
}
#wp-fullscreen-count,
@ -696,13 +699,6 @@ form.upgrade .hint {
padding-top: 5px;
}
#wp-fullscreen-info {
float: right;
padding: 3px 10px;
display: none;
}
#wp-fullscreen-central-toolbar {
margin: auto;
padding: 0;
@ -798,6 +794,15 @@ form.upgrade .hint {
display: none;
}
#wp-fullscreen-plus,
#wp-fullscreen-minus,
#wp-fullscreen-reset {
font-size: 14px;
border: 1px solid #aaa;
padding: 0 4px;
cursor: default;
}
/* =Thickbox Adjustments
-------------------------------------------------------------- */
.fullscreen-active #TB_overlay {

View File

@ -1729,19 +1729,14 @@ function wp_fullscreen_html() {
$width = isset($content_width) && 800 > $content_width ? $content_width : 800;
$width = $width + 10; // compensate for the padding
$dfw_width = get_user_setting( 'dfw_width', $width );
$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>
<div id="fullscreen-topbar">
<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-close"><a href="#" onclick="fullscreen.off();return false;"><?php _e('Close'); ?></a></div>
<div id="wp-fullscreen-save">
<span><?php if ( $post->post_status == 'publish' ) _e('Updated.'); else _e('Saved.'); ?></span>
<img src="images/wpspin_light.gif" alt="" />
@ -1817,13 +1812,17 @@ function wp_fullscreen_html() {
</div>
</div></div>
<div id="wp-fullscreen-count"><?php _e('Word Count:'); ?> <span class="word-count">0</span></div>
<div id="wp-fullscreen-count">
<span title="<?php _e('Wider'); ?>" id="wp-fullscreen-plus">+</span>
<span title="<?php _e('Narrower'); ?>" id="wp-fullscreen-minus">&ndash;</span>
<span title="<?php _e('Reset width'); ?>" id="wp-fullscreen-reset">&times;</span> &nbsp;
<?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;">
<div id="wp-fullscreen-wrap" style="width:<?php echo $dfw_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" />

View File

@ -190,7 +190,7 @@ PubSub.prototype.publish = function( topic, args ) {
message.show();
setTimeout( function(){
message.fadeOut(800);
message.fadeOut(1000);
}, 3000 );
if ( r.last_edited )
@ -222,16 +222,42 @@ PubSub.prototype.publish = function( topic, args ) {
title.siblings('label').css( 'visibility', 'hidden' );
}
api.dfw_width = function(n) {
var el = $('#wp-fullscreen-wrap'), w = el.width();
if ( !n ) { // reset to theme width
el.width( $('#wp-fullscreen-central-toolbar').width() );
deleteUserSetting('dfw_width');
return;
}
if ( w < 200 || w > 1200 ) // sanity check
return;
el.width( n + w );
setUserSetting('dfw_width', n + w);
}
ps.subscribe( 'showToolbar', function() {
api.fade.In( s.topbar, 600, function(){ ps.publish('toolbarShown'); } );
s.topbar.removeClass('fade-1000').addClass('fade-300');
api.fade.In( s.topbar, 300, function(){ ps.publish('toolbarShown'); }, true );
$('#wp-fullscreen-body').addClass('wp-fullscreen-focus');
});
ps.subscribe( 'hideToolbar', function() {
api.fade.Out( s.topbar, 600, function(){ ps.publish('toolbarHidden'); } );
s.topbar.removeClass('fade-300').addClass('fade-1000');
api.fade.Out( s.topbar, 1000, function(){ ps.publish('toolbarHidden'); }, true );
$('#wp-fullscreen-body').removeClass('wp-fullscreen-focus');
});
ps.subscribe( 'toolbarShown', function() {
s.topbar.removeClass('fade-300');
});
ps.subscribe( 'toolbarHidden', function() {
s.topbar.removeClass('fade-1000');
});
ps.subscribe( 'show', function() { // This event occurs before the overlay blocks the UI.
var title = $('#wp-fullscreen-title').val( $('#' + s.title_id).val() );
@ -255,8 +281,8 @@ PubSub.prototype.publish = function( topic, args ) {
$( document.body ).addClass( 'fullscreen-active' );
api.refresh_buttons();
$( document ).bind( 'mousemove.fullscreen', function(e) { bounder( 'showToolbar', 'hideToolbar', 2500 ); } );
bounder( 'showToolbar', 'hideToolbar', 2500 );
$( document ).bind( 'mousemove.fullscreen', function(e) { bounder( 'showToolbar', 'hideToolbar', 2000 ); } );
bounder( 'showToolbar', 'hideToolbar', 2000 );
api.bind_resize();
setTimeout( api.resize_textarea, 200 );
@ -352,7 +378,7 @@ PubSub.prototype.publish = function( topic, args ) {
});
ps.subscribe( 'switchedMode', function( from, to ) {
api.refresh_buttons();
api.refresh_buttons(true);
if ( to === 'html' )
setTimeout( api.resize_textarea, 200 );
@ -393,18 +419,28 @@ PubSub.prototype.publish = function( topic, args ) {
tinyMCE.execCommand('unlink');
}
api.refresh_buttons = function() {
api.refresh_buttons = function( fade ) {
fade = fade || false;
if ( s.mode === 'html' ) {
$('#wp-fullscreen-mode-bar').removeClass('wp-tmce-mode').addClass('wp-html-mode');
$('#wp-fullscreen-button-bar').fadeOut( 200, function(){
$(this).addClass('wp-html-mode').fadeIn( 250 );
});
if ( fade )
$('#wp-fullscreen-button-bar').fadeOut( 150, function(){
$(this).addClass('wp-html-mode').fadeIn( 150 );
});
else
$('#wp-fullscreen-button-bar').addClass('wp-html-mode');
} else if ( s.mode === 'tinymce' ) {
$('#wp-fullscreen-mode-bar').removeClass('wp-html-mode').addClass('wp-tmce-mode');
$('#wp-fullscreen-button-bar').fadeOut( 200, function(){
$(this).removeClass('wp-html-mode').fadeIn( 250 );
});
if ( fade )
$('#wp-fullscreen-button-bar').fadeOut( 150, function(){
$(this).removeClass('wp-html-mode').fadeIn( 150 );
});
else
$('#wp-fullscreen-button-bar').removeClass('wp-html-mode');
}
}
@ -426,6 +462,28 @@ PubSub.prototype.publish = function( topic, args ) {
if ( wptitlehint )
wptitlehint('wp-fullscreen-title');
$(document).keypress(function(e){
if ( 27 != e.keyCode )
return true;
if ( fullscreen.settings.visible )
fullscreen.off();
return true;
});
$('#wp-fullscreen-plus').click(function(){
fullscreen.dfw_width(25);
});
$('#wp-fullscreen-minus').click(function(){
fullscreen.dfw_width(-25);
});
$('#wp-fullscreen-reset').click(function(){
fullscreen.dfw_width(0);
});
topbar.mouseenter(function(e){
$('#fullscreen-topbar').addClass('fullscreen-make-sticky');
$( document ).unbind( '.fullscreen' );
@ -433,7 +491,7 @@ PubSub.prototype.publish = function( topic, args ) {
s.timer = 0;
}).mouseleave(function(e){
$('#fullscreen-topbar').removeClass('fullscreen-make-sticky');
$( document ).bind( 'mousemove.fullscreen', function(e) { bounder( 'showToolbar', 'hideToolbar', 2500 ); } );
$( document ).bind( 'mousemove.fullscreen', function(e) { bounder( 'showToolbar', 'hideToolbar', 2000 ); } );
});
},
@ -463,10 +521,11 @@ PubSub.prototype.publish = function( topic, args ) {
// Sensitivity to allow browsers to render the blank element before animating.
sensitivity: 100,
In: function( element, speed, callback ) {
In: function( element, speed, callback, stop ) {
callback = callback || $.noop;
speed = speed || 400;
stop = stop || false;
if ( api.fade.transitions ) {
if ( element.is(':visible') ) {
@ -480,16 +539,20 @@ PubSub.prototype.publish = function( topic, args ) {
});
setTimeout( function() { element.addClass( 'fade-trigger' ); }, this.sensitivity );
} else {
if ( stop )
element.stop();
element.css( 'opacity', 1 ).fadeIn( speed, callback );
}
return element;
},
Out: function( element, speed, callback ) {
Out: function( element, speed, callback, stop ) {
callback = callback || $.noop;
speed = speed || 400;
stop = stop || false;
if ( ! element.is(':visible') )
return element;
@ -504,6 +567,9 @@ PubSub.prototype.publish = function( topic, args ) {
});
setTimeout( function() { element.removeClass( 'fade-trigger' ); }, this.sensitivity );
} else {
if ( stop )
element.stop();
element.fadeOut( speed, callback );
}
@ -535,13 +601,12 @@ PubSub.prototype.publish = function( topic, args ) {
api.oldheight = 0;
api.resize_textarea = function() {
var txt = s.textarea_obj, newheight, scroll = document.body.scrollTop || document.documentElement.scrollTop;
var txt = s.textarea_obj, newheight;
newheight = txt.scrollHeight > 300 ? txt.scrollHeight : 300;
if ( newheight != api.oldheight ) {
txt.style.height = newheight + 'px';
// window.scrollTo(0, scroll);
api.oldheight = newheight;
}
};

File diff suppressed because one or more lines are too long

View File

@ -3,7 +3,9 @@ Distraction Free Writing mode TinyMCE Styles
*/
html, body.mceContentBody {
background: transparent;
background: transparent !important;
width: auto !important;
max-width: none !important;
margin: 0;
padding: 0;
}
@ -29,10 +31,9 @@ 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 {
pre,
code,
code var {
font-family: Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace;
}
body, input, textarea {
@ -58,15 +59,6 @@ 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,

View File

@ -34,7 +34,7 @@
ed.addCommand('wpFullScreenInit', function() {
var d = ed.getDoc(), b = d.body, fsed;
// Only init the editor if necessary. Needed?
// Only init the editor if necessary.
if ( ed.id == 'wp_mce_fullscreen' )
return;
@ -50,7 +50,7 @@
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.content_css = s.content_css + ',' + s.wp_fullscreen_content_css;
s.height = tinymce.isIE ? b.scrollHeight : b.offsetHeight;
// s.setup = function(ed) {
// }

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.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_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)})();

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'), '20110501' );
$scripts->add( 'wp-fullscreen', "/wp-admin/js/wp-fullscreen$suffix.js", array('jquery'), '20110507' );
$scripts->add_data( 'wp-fullscreen', 'group', 1 );
$scripts->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.6.1');
@ -487,7 +487,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(), '20110507b' );
$styles->add( 'wp-admin', "/wp-admin/css/wp-admin$suffix.css", array(), '20110507c' );
$styles->add( 'ie', "/wp-admin/css/ie$suffix.css", array(), '20101102' );
$styles->add_data( 'ie', 'conditional', 'lte IE 7' );

View File

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