TinyMCE 4.0.12, first run.

- Removes wp-tinymce-schema.js and mark-loaded.js, no longer needed.
- Removes the inlinepopups and most of the wpdialogs plugins; wpdialog.js is moved to wp-includes/js.
- Adds charmap, compat3x, image, link and textcolor plugins, previously contained in /themes/advanced.
- Updates the wordpress, wpeditimage, wpfullscreen, wpgallery and wplink plugins.
- Updates DFW, wp-admin/js/wp-fullscreen.js.
See #24067.

git-svn-id: https://develop.svn.wordpress.org/trunk@26876 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz
2013-12-28 23:52:04 +00:00
parent 3852dd4936
commit 14ace125ee
201 changed files with 43129 additions and 17630 deletions

View File

@@ -4315,7 +4315,7 @@ td.plugin-title p {
}
.autosave-info {
padding: 2px 15px;
padding: 2px;
text-align: right;
}
@@ -4323,43 +4323,20 @@ td.plugin-title p {
border: none;
}
#content-resize-handle,
#post-body .wp_themeSkin .mceStatusbar a.mceResize {
#content-resize-handle {
background: transparent url('../images/resize.gif') no-repeat scroll right bottom;
width: 12px;
height: 12px;
cursor: se-resize;
cursor: n-resize;
}
.rtl #content-resize-handle,
.rtl #post-body .wp_themeSkin .mceStatusbar a.mceResize {
background: transparent url('../images/resize-rtl.gif') no-repeat scroll right bottom;
}
#post-body .wp_themeSkin .mceStatusbar a.mceResize {
bottom: 3px;
position: absolute;
right: 3px;
}
#post-body .postarea .wp_themeSkin .mceStatusbar a.mceResize {
bottom: -20px;
}
#content-resize-handle {
position: absolute;
right: 3px;
bottom: -20px;
.rtl #content-resize-handle {
background: transparent url('../images/resize-rtl.gif') no-repeat scroll left bottom;
}
.press-this #content-resize-handle {
bottom: 2px;
}
.tmce-active #content-resize-handle {
display: none;
}
#wp-word-count {
display: block;
padding: 2px 10px;

View File

@@ -483,6 +483,9 @@ if ( post_type_supports($post_type, 'editor') ) {
'dfw' => true,
'tabfocus_elements' => 'insert-media-button,save-post',
'editor_height' => 360,
'tinymce' => array(
'resize' => false,
),
) ); ?>
<table id="post-status-info" cellspacing="0"><tbody><tr>
<td id="wp-word-count"><?php printf( __( 'Word count: %s' ), '<span class="word-count">0</span>' ); ?></td>
@@ -499,6 +502,7 @@ if ( post_type_supports($post_type, 'editor') ) {
echo '</span>';
} ?>
</td>
<td id="content-resize-handle" class="hide-if-no-js"><br /></td>
</tr></tbody></table>
</div>

View File

@@ -1787,16 +1787,8 @@ function wp_ajax_wp_fullscreen_save_post() {
$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' => '' ) );
wp_die();
} else {
$message = __('Saved.');
if ( is_wp_error( $post_id ) ) {
wp_send_json_error();
}
if ( $post ) {
@@ -1807,15 +1799,14 @@ function wp_ajax_wp_fullscreen_save_post() {
$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);
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 ) );
wp_die();
wp_send_json_success( array( 'last_edited' => $last_edited ) );
}
function wp_ajax_wp_remove_post_lock() {
@@ -1839,9 +1830,9 @@ function wp_ajax_wp_remove_post_lock() {
*
* @since 3.3.0
*
* @param int $interval The interval in seconds the post lock duration should last, plus 5 seconds. Default 120.
* @param int $interval The interval in seconds the post lock duration should last, plus 5 seconds. Default 150.
*/
$new_lock = ( time() - apply_filters( 'wp_check_post_lock_window', 120 ) + 5 ) . ':' . $active_lock[1];
$new_lock = ( time() - apply_filters( 'wp_check_post_lock_window', 150 ) + 5 ) . ':' . $active_lock[1];
update_post_meta( $post_id, '_edit_lock', $new_lock, implode( ':', $active_lock ) );
wp_die( 1 );
}

View File

@@ -13,15 +13,15 @@ window.switchEditors = {
// mode can be 'html', 'tmce', or 'toggle'; 'html' is used for the 'Text' editor tab.
go: function( id, mode ) {
var t = this, ed, wrap_id, txtarea_el,
dom = tinymce.DOM;
var t = this, ed, wrap_id, txtarea_el, editorHeight, toolbarHeight,
DOM = tinymce.DOM; //DOMUtils outside the editor iframe
id = id || 'content';
mode = mode || 'toggle';
ed = tinymce.get( id );
wrap_id = 'wp-' + id + '-wrap';
txtarea_el = dom.get( id );
txtarea_el = DOM.get( id );
if ( 'toggle' === mode ) {
if ( ed && ! ed.isHidden() ) {
@@ -31,6 +31,20 @@ window.switchEditors = {
}
}
function getToolbarHeight() {
var height;
try {
height = DOM.getSize( DOM.select( '.mce-toolbar-grp', ed.getContainer() )[0] );
} catch(e){}
if ( height && height.h && height.h > 10 && height.h < 100 ) {
return height.h;
}
return 0;
}
if ( 'tmce' === mode || 'tinymce' === mode ) {
if ( ed && ! ed.isHidden() ) {
return false;
@@ -40,19 +54,32 @@ window.switchEditors = {
QTags.closeAllTags( id );
}
editorHeight = txtarea_el ? parseInt( txtarea_el.style.height, 10 ) : 0;
if ( tinyMCEPreInit.mceInit[ id ] && tinyMCEPreInit.mceInit[ id ].wpautop ) {
txtarea_el.value = t.wpautop( txtarea_el.value );
}
if ( ed ) {
ed.show();
if ( editorHeight && ( toolbarHeight = getToolbarHeight() ) ) {
editorHeight = editorHeight - toolbarHeight + 11;
// height cannot be under 50 or over 5000
if ( editorHeight > 50 && editorHeight < 5000 ) {
ed.theme.resizeTo( null, editorHeight );
}
}
} else {
ed = new tinymce.Editor( id, tinyMCEPreInit.mceInit[ id ] );
ed.render();
tinymce.init( tinyMCEPreInit.mceInit[id] );
// ed = tinymce.createEditor( id, tinyMCEPreInit.mceInit[id] );
// ed.render();
}
dom.removeClass( wrap_id, 'html-active' );
dom.addClass( wrap_id, 'tmce-active' );
DOM.removeClass( wrap_id, 'html-active' );
DOM.addClass( wrap_id, 'tmce-active' );
setUserSetting( 'editor', 'tinymce' );
} else if ( 'html' === mode ) {
@@ -62,6 +89,18 @@ window.switchEditors = {
}
if ( ed ) {
editorHeight = DOM.get( id + '_ifr' );
editorHeight = editorHeight ? parseInt( editorHeight.style.height, 10 ) : 0;
if ( editorHeight && ( toolbarHeight = getToolbarHeight() ) ) {
editorHeight = editorHeight + toolbarHeight - 11;
// height cannot be under 50 or over 5000
if ( editorHeight > 50 && editorHeight < 5000 ) {
txtarea_el.style.height = editorHeight + 'px';
}
}
ed.hide();
} else {
// The TinyMCE instance doesn't exist, run the content through 'pre_wpautop()' and show the textarea
@@ -69,11 +108,11 @@ window.switchEditors = {
txtarea_el.value = t.pre_wpautop( txtarea_el.value );
}
dom.setStyles( txtarea_el, {'display': '', 'visibility': ''} );
DOM.setStyles( txtarea_el, {'display': '', 'visibility': ''} );
}
dom.removeClass( wrap_id, 'tmce-active' );
dom.addClass( wrap_id, 'html-active' );
DOM.removeClass( wrap_id, 'tmce-active' );
DOM.addClass( wrap_id, 'html-active' );
setUserSetting( 'editor', 'html' );
}
return false;
@@ -88,8 +127,9 @@ window.switchEditors = {
if ( content.indexOf( '<pre' ) !== -1 || content.indexOf( '<script' ) !== -1 ) {
preserve_linebreaks = true;
content = content.replace( /<(pre|script)[^>]*>[\s\S]+?<\/\1>/g, function( a ) {
a = a.replace( /<br ?\/?>(\r\n|\n)?/g, '<wp-temp-lb>' );
return a.replace( /<\/?p( [^>]*)?>(\r\n|\n)?/g, '<wp-temp-lb>' );
a = a.replace( /<br ?\/?>(\r\n|\n)?/g, '<wp-line-break>' );
a = a.replace( /<\/?p( [^>]*)?>(\r\n|\n)?/g, '<wp-line-break>' );
return a.replace( /\r?\n/g, '<wp-line-break>' );
});
}
@@ -149,7 +189,7 @@ window.switchEditors = {
// put back the line breaks in pre|script
if ( preserve_linebreaks ) {
content = content.replace( /<wp-temp-lb>/g, '\n' );
content = content.replace( /<wp-line-break>/g, '\n' );
}
// and the <br> tags in captions
@@ -181,7 +221,7 @@ window.switchEditors = {
if ( pee.indexOf( '<pre' ) !== -1 || pee.indexOf( '<script' ) !== -1 ) {
preserve_linebreaks = true;
pee = pee.replace( /<(pre|script)[^>]*>[\s\S]+?<\/\1>/g, function( a ) {
return a.replace( /(\r\n|\n)/g, '<wp-temp-lb>' );
return a.replace( /(\r\n|\n)/g, '<wp-line-break>' );
});
}
@@ -230,7 +270,7 @@ window.switchEditors = {
// put back the line breaks in pre|script
if ( preserve_linebreaks ) {
pee = pee.replace( /<wp-temp-lb>/g, '\n' );
pee = pee.replace( /<wp-line-break>/g, '\n' );
}
if ( preserve_br ) {

View File

@@ -6,24 +6,21 @@ var wpActiveEditor, send_to_editor;
send_to_editor = function(h) {
var ed, mce = typeof(tinymce) != 'undefined', qt = typeof(QTags) != 'undefined';
if ( !wpActiveEditor ) {
if ( ! wpActiveEditor ) {
if ( mce && tinymce.activeEditor ) {
ed = tinymce.activeEditor;
wpActiveEditor = ed.id;
} else if ( !qt ) {
} else if ( ! qt ) {
return false;
}
} else if ( mce ) {
if ( tinymce.activeEditor && (tinymce.activeEditor.id == 'mce_fullscreen' || tinymce.activeEditor.id == 'wp_mce_fullscreen') )
ed = tinymce.activeEditor;
else
ed = tinymce.get(wpActiveEditor);
ed = tinymce.get( wpActiveEditor );
}
if ( ed && !ed.isHidden() ) {
if ( ed && ! ed.isHidden() ) {
// restore caret position on IE
if ( tinymce.isIE && ed.windowManager.insertimagebookmark )
ed.selection.moveToBookmark(ed.windowManager.insertimagebookmark);
// if ( tinymce.isIE && ed.windowManager.insertimagebookmark )
// ed.selection.moveToBookmark(ed.windowManager.insertimagebookmark);
if ( h.indexOf('[caption') !== -1 ) {
if ( ed.wpSetImgCaption )
@@ -78,7 +75,7 @@ var tb_position;
};
$(window).resize(function(){ tb_position(); });
/*
// store caret position in IE
$(document).ready(function($){
$('a.thickbox').click(function(){
@@ -90,5 +87,5 @@ var tb_position;
}
});
});
*/
})(jQuery);

View File

@@ -812,114 +812,72 @@ jQuery(document).ready( function($) {
wptitlehint();
// resizable textarea#content
(function() {
var textarea = $('textarea#content'), offset = null, el;
// Resize the visual and text editors
( function() {
var editor, offset, mce,
$document = $( document ),
$textarea = $('textarea#content'),
$handle = $('#post-status-info');
// No point for touch devices
if ( !textarea.length || 'ontouchstart' in window )
if ( ! $textarea.length || 'ontouchstart' in window ) {
return;
}
function dragging(e) {
textarea.height( Math.max(50, offset + e.pageY) + 'px' );
return false;
function dragging( event ) {
if ( mce ) {
editor.theme.resizeTo( null, offset + event.pageY );
} else {
$textarea.height( Math.max( 50, offset + event.pageY ) );
}
event.preventDefault();
}
function endDrag() {
var height;
var height, toolbarHeight;
textarea.focus();
$(document).unbind('mousemove', dragging).unbind('mouseup', endDrag);
if ( mce ) {
editor.focus();
toolbarHeight = $( '#wp-content-editor-container .mce-toolbar-grp' ).height();
height = parseInt( $('#content_ifr').css('height'), 10 ) + toolbarHeight - 28;
} else {
$textarea.focus();
height = parseInt( $textarea.css('height'), 10 );
}
height = parseInt( textarea.css('height'), 10 );
$document.off( 'mousemove.wp-editor-resize mouseup.wp-editor-resize' );
// sanity check
if ( height && height > 50 && height < 5000 )
if ( height && height > 50 && height < 5000 ) {
setUserSetting( 'ed_size', height );
}
}
textarea.css('resize', 'none');
el = $('<div id="content-resize-handle"><br></div>');
$('#wp-content-wrap').append(el);
el.on('mousedown', function(e) {
offset = textarea.height() - e.pageY;
textarea.blur();
$(document).mousemove(dragging).mouseup(endDrag);
return false;
$textarea.css( 'resize', 'none' );
$handle.on( 'mousedown.wp-editor-resize', function( event ) {
if ( typeof tinymce !== 'undefined' ) {
editor = tinymce.get('content');
}
if ( editor && ! editor.isHidden() ) {
mce = true;
offset = $('#content_ifr').height() - event.pageY;
} else {
mce = false;
offset = $textarea.height() - event.pageY;
$textarea.blur();
}
$document.on( 'mousemove.wp-editor-resize', dragging )
.on( 'mouseup.wp-editor-resize', endDrag );
event.preventDefault();
});
})();
if ( typeof(tinymce) != 'undefined' ) {
tinymce.onAddEditor.add(function(mce, ed){
// iOS expands the iframe to full height and the user cannot adjust it.
if ( ed.id != 'content' || tinymce.isIOS5 )
return;
function getHeight() {
var height, node = document.getElementById('content_ifr'),
ifr_height = node ? parseInt( node.style.height, 10 ) : 0,
tb_height = $('#content_tbl tr.mceFirst').height();
if ( !ifr_height || !tb_height )
return false;
// total height including toolbar and statusbar
height = ifr_height + tb_height + 21;
// textarea height = total height - 33px toolbar
height -= 33;
return height;
}
// resize TinyMCE to match the textarea height when switching Text -> Visual
ed.onLoadContent.add( function() {
var ifr_height, node = document.getElementById('content'),
height = node ? parseInt( node.style.height, 10 ) : 0,
tb_height = $('#content_tbl tr.mceFirst').height() || 33;
// height cannot be under 50 or over 5000
if ( !height || height < 50 || height > 5000 )
height = 360; // default height for the main editor
if ( getUserSetting( 'ed_size' ) > 5000 )
setUserSetting( 'ed_size', 360 );
// compensate for padding and toolbars
ifr_height = ( height - tb_height ) + 12;
// sanity check
if ( ifr_height > 50 && ifr_height < 5000 ) {
$('#content_tbl').css('height', '' );
$('#content_ifr').css('height', ifr_height + 'px' );
}
});
// resize the textarea to match TinyMCE's height when switching Visual -> Text
ed.onSaveContent.add( function() {
var height = getHeight();
if ( !height || height < 50 || height > 5000 )
return;
$('textarea#content').css( 'height', height + 'px' );
});
// save on resizing TinyMCE
ed.onPostRender.add(function() {
$( '#content_resize' ).on( 'mousedown.wp-mce-resize', function() {
$( document ).on( 'mouseup.wp-mce-resize', function() {
var height;
$(document).off('mouseup.wp-mce-resize');
height = getHeight();
// sanity check
if ( height && height > 50 && height < 5000 )
setUserSetting( 'ed_size', height );
});
});
});
});
if ( typeof tinymce !== 'undefined' ) {
// When changing post formats, change the editor body class
$( '#post-formats-select input.post-format' ).on( 'change.set-editor-class', function() {
var editor, body, format = this.id;

File diff suppressed because it is too large Load Diff