Editor: Add the replace_editor
filter.
This filter allows the Core editor to be replaced by an entirely different editor (coughcoughGUTENBERGcough). Props azaozz, who is supposed to be on sabbatical right now. Fixes #42119. git-svn-id: https://develop.svn.wordpress.org/trunk@41829 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
4a23f58215
commit
3b734f0e65
@ -17,6 +17,17 @@ if ( !defined('ABSPATH') )
|
||||
*/
|
||||
global $post_type, $post_type_object, $post;
|
||||
|
||||
if ( is_multisite() ) {
|
||||
add_action( 'admin_footer', '_admin_notice_post_locked' );
|
||||
} else {
|
||||
$check_users = get_users( array( 'fields' => 'ID', 'number' => 2 ) );
|
||||
|
||||
if ( count( $check_users ) > 1 )
|
||||
add_action( 'admin_footer', '_admin_notice_post_locked' );
|
||||
|
||||
unset( $check_users );
|
||||
}
|
||||
|
||||
wp_enqueue_script('post');
|
||||
$_wp_editor_expand = $_content_editor_dfw = false;
|
||||
|
||||
|
@ -63,24 +63,17 @@ if ( ! current_user_can( $post_type_object->cap->edit_posts ) || ! current_user_
|
||||
}
|
||||
|
||||
// Schedule auto-draft cleanup
|
||||
if ( ! wp_next_scheduled( 'wp_scheduled_auto_draft_delete' ) )
|
||||
if ( ! wp_next_scheduled( 'wp_scheduled_auto_draft_delete' ) ) {
|
||||
wp_schedule_event( time(), 'daily', 'wp_scheduled_auto_draft_delete' );
|
||||
|
||||
wp_enqueue_script( 'autosave' );
|
||||
|
||||
if ( is_multisite() ) {
|
||||
add_action( 'admin_footer', '_admin_notice_post_locked' );
|
||||
} else {
|
||||
$check_users = get_users( array( 'fields' => 'ID', 'number' => 2 ) );
|
||||
|
||||
if ( count( $check_users ) > 1 )
|
||||
add_action( 'admin_footer', '_admin_notice_post_locked' );
|
||||
|
||||
unset( $check_users );
|
||||
}
|
||||
|
||||
// Show post form.
|
||||
$post = get_default_post_to_edit( $post_type, true );
|
||||
$post_ID = $post->ID;
|
||||
include( ABSPATH . 'wp-admin/edit-form-advanced.php' );
|
||||
|
||||
/** This filter is documented in wp-admin/post.php */
|
||||
if ( apply_filters( 'replace_editor', false, $post ) !== true ) {
|
||||
wp_enqueue_script( 'autosave' );
|
||||
include( ABSPATH . 'wp-admin/edit-form-advanced.php' );
|
||||
}
|
||||
|
||||
include( ABSPATH . 'wp-admin/admin-footer.php' );
|
||||
|
@ -144,6 +144,18 @@ case 'edit':
|
||||
$post_new_file = "post-new.php?post_type=$post_type";
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows replacement of the editor.
|
||||
*
|
||||
* @since 4.9.0
|
||||
*
|
||||
* @param boolean Whether to replace the editor. Default false.
|
||||
* @param object $post Post object.
|
||||
*/
|
||||
if ( apply_filters( 'replace_editor', false, $post ) === true ) {
|
||||
break;
|
||||
}
|
||||
|
||||
if ( ! wp_check_post_lock( $post->ID ) ) {
|
||||
$active_post_lock = wp_set_post_lock( $post->ID );
|
||||
|
||||
@ -151,17 +163,6 @@ case 'edit':
|
||||
wp_enqueue_script('autosave');
|
||||
}
|
||||
|
||||
if ( is_multisite() ) {
|
||||
add_action( 'admin_footer', '_admin_notice_post_locked' );
|
||||
} else {
|
||||
$check_users = get_users( array( 'fields' => 'ID', 'number' => 2 ) );
|
||||
|
||||
if ( count( $check_users ) > 1 )
|
||||
add_action( 'admin_footer', '_admin_notice_post_locked' );
|
||||
|
||||
unset( $check_users );
|
||||
}
|
||||
|
||||
$title = $post_type_object->labels->edit_item;
|
||||
$post = get_post($post_id, OBJECT, 'edit');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user