<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[31654] trunk/src/wp-admin: PressThis: add preview functionality.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/31654">31654</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/31654","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>azaozz</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2015-03-07 01:16:05 +0000 (Sat, 07 Mar 2015)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>PressThis: add preview functionality. Opens the preview in a new window or a tab next to the source tab.
Fixes <a href="https://core.trac.wordpress.org/ticket/31458">#31458</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadmincsspressthiscss">trunk/src/wp-admin/css/press-this.css</a></li>
<li><a href="#trunksrcwpadminincludesclasswppressthisphp">trunk/src/wp-admin/includes/class-wp-press-this.php</a></li>
<li><a href="#trunksrcwpadminjspressthisjs">trunk/src/wp-admin/js/press-this.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadmincsspressthiscss"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/css/press-this.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/css/press-this.css 2015-03-07 01:14:31 UTC (rev 31653)
+++ trunk/src/wp-admin/css/press-this.css 2015-03-07 01:16:05 UTC (rev 31654)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -351,6 +351,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> text-decoration: underline;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.preview-button {
+ margin-right: 1em;
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> .button-reset {
</span><span class="cx" style="display: block; padding: 0 10px"> margin: 0;
</span><span class="cx" style="display: block; padding: 0 10px"> padding: 0;
</span></span></pre></div>
<a id="trunksrcwpadminincludesclasswppressthisphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/includes/class-wp-press-this.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/class-wp-press-this.php 2015-03-07 01:14:31 UTC (rev 31653)
+++ trunk/src/wp-admin/includes/class-wp-press-this.php 2015-03-07 01:16:05 UTC (rev 31654)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -133,22 +133,20 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @access public
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function save_post() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( empty( $_POST['pressthis-nonce'] ) || ! wp_verify_nonce( $_POST['pressthis-nonce'], 'press-this' ) ) {
- wp_send_json_error( array( 'errorMessage' => __( 'Cheatin’ uh?' ) ) );
- }
-
</del><span class="cx" style="display: block; padding: 0 10px"> if ( empty( $_POST['post_ID'] ) || ! $post_id = (int) $_POST['post_ID'] ) {
</span><span class="cx" style="display: block; padding: 0 10px"> wp_send_json_error( array( 'errorMessage' => __( 'Missing post ID.' ) ) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! current_user_can( 'edit_post', $post_id ) ) {
- wp_send_json_error( array( 'errorMessage' => __( 'Cheatin’ uh?' ) ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( empty( $_POST['_wpnonce'] ) || ! wp_verify_nonce( $_POST['_wpnonce'], 'update-post_' . $post_id ) ||
+ ! current_user_can( 'edit_post', $post_id ) ) {
+
+ wp_send_json_error( array( 'errorMessage' => __( 'Invalid post.' ) ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $post = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'ID' => $post_id,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'post_title' => ( ! empty( $_POST['title'] ) ) ? sanitize_text_field( trim( $_POST['title'] ) ) : '',
- 'post_content' => ( ! empty( $_POST['pressthis'] ) ) ? trim( $_POST['pressthis'] ) : '',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'post_title' => ( ! empty( $_POST['post_title'] ) ) ? sanitize_text_field( trim( $_POST['post_title'] ) ) : '',
+ 'post_content' => ( ! empty( $_POST['post_content'] ) ) ? trim( $_POST['post_content'] ) : '',
</ins><span class="cx" style="display: block; padding: 0 10px"> 'post_type' => 'post',
</span><span class="cx" style="display: block; padding: 0 10px"> 'post_status' => 'draft',
</span><span class="cx" style="display: block; padding: 0 10px"> 'post_format' => ( ! empty( $_POST['post_format'] ) ) ? sanitize_text_field( $_POST['post_format'] ) : '',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -887,7 +885,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <!--[if IE 8]> <html class="lt-ie9" <?php language_attributes(); ?>> <![endif]-->
</span><span class="cx" style="display: block; padding: 0 10px"> <!--[if gt IE 8]><!--> <html <?php language_attributes(); ?>> <!--<![endif]-->
</span><span class="cx" style="display: block; padding: 0 10px"> <head>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <meta http-equiv="Content-Type" content="<?php esc_attr( bloginfo( 'html_type' ) ); ?>; charset=<?php echo esc_attr( get_option( 'blog_charset' ) ); ?>" />
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <meta http-equiv="Content-Type" content="<?php echo esc_attr( get_bloginfo( 'html_type' ) ); ?>; charset=<?php echo esc_attr( get_option( 'blog_charset' ) ); ?>" />
</ins><span class="cx" style="display: block; padding: 0 10px"> <meta name="viewport" content="width=device-width">
</span><span class="cx" style="display: block; padding: 0 10px"> <title><?php esc_html_e( 'Press This!' ) ?></title>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -954,15 +952,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><span class="cx" style="display: block; padding: 0 10px"> </head>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-$admin_body_class = 'press-this';
-$admin_body_class .= ( is_rtl() ) ? ' rtl' : '';
-$admin_body_class .= ' branch-' . str_replace( array( '.', ',' ), '-', floatval( $wp_version ) );
-$admin_body_class .= ' version-' . str_replace( '.', '-', preg_replace( '/^([.0-9]+).*/', '$1', $wp_version ) );
-$admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' );
-$admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) );
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/** This filter is documented in wp-admin/admin-header.php */
-$admin_body_classes = apply_filters( 'admin_body_class', '' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $admin_body_class = 'press-this';
+ $admin_body_class .= ( is_rtl() ) ? ' rtl' : '';
+ $admin_body_class .= ' branch-' . str_replace( array( '.', ',' ), '-', floatval( $wp_version ) );
+ $admin_body_class .= ' version-' . str_replace( '.', '-', preg_replace( '/^([.0-9]+).*/', '$1', $wp_version ) );
+ $admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' );
+ $admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) );
+
+ /** This filter is documented in wp-admin/admin-header.php */
+ $admin_body_classes = apply_filters( 'admin_body_class', '' );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><span class="cx" style="display: block; padding: 0 10px"> <body class="wp-admin wp-core-ui <?php echo $admin_body_classes . ' ' . $admin_body_class; ?>">
</span><span class="cx" style="display: block; padding: 0 10px"> <div id="adminbar" class="adminbar">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -984,15 +984,18 @@
</span><span class="cx" style="display: block; padding: 0 10px"> </form>
</span><span class="cx" style="display: block; padding: 0 10px"> </div>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <form id="pressthis-form" name="pressthis-form" method="POST" autocomplete="off">
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <form id="pressthis-form" method="post" action="post.php" autocomplete="off">
</ins><span class="cx" style="display: block; padding: 0 10px"> <input type="hidden" name="post_ID" id="post_ID" value="<?php echo $post_ID; ?>" />
</span><span class="cx" style="display: block; padding: 0 10px"> <input type="hidden" name="action" value="press-this-save-post" />
</span><span class="cx" style="display: block; padding: 0 10px"> <input type="hidden" name="post_status" id="post_status" value="draft" />
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <input type="hidden" name="wp-preview" id="wp-preview" value="" />
+ <input type="hidden" name="post_title" id="post_title" value="" />
</ins><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- wp_nonce_field( 'press-this', 'pressthis-nonce', false );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ wp_nonce_field( 'update-post_' . $post_ID, '_wpnonce', false );
</ins><span class="cx" style="display: block; padding: 0 10px"> wp_nonce_field( 'add-category', '_ajax_nonce-add-category', false );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <input type="hidden" name="title" id="title-field" value="" />
</del><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <div class="wrapper">
</span><span class="cx" style="display: block; padding: 0 10px"> <div class="editor-wrapper">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1016,6 +1019,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'drag_drop_upload' => true,
</span><span class="cx" style="display: block; padding: 0 10px"> 'editor_height' => 600,
</span><span class="cx" style="display: block; padding: 0 10px"> 'media_buttons' => false,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'textarea_name' => 'post_content',
</ins><span class="cx" style="display: block; padding: 0 10px"> 'teeny' => true,
</span><span class="cx" style="display: block; padding: 0 10px"> 'tinymce' => array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'resize' => false,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1028,7 +1032,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'toolbar1' => 'bold,italic,bullist,numlist,blockquote,link,unlink',
</span><span class="cx" style="display: block; padding: 0 10px"> 'toolbar2' => 'undo,redo',
</span><span class="cx" style="display: block; padding: 0 10px"> ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'quicktags' => false,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'quicktags' => false,
</ins><span class="cx" style="display: block; padding: 0 10px"> ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1051,14 +1055,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <button type="button" class="button-reset post-option">
</span><span class="cx" style="display: block; padding: 0 10px"> <span class="dashicons dashicons-category"></span>
</span><span class="cx" style="display: block; padding: 0 10px"> <span class="post-option-title"><?php _e( 'Categories' ); ?></span>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <span class="post-option-contents" id="post-option-category"></span>
</del><span class="cx" style="display: block; padding: 0 10px"> <span class="dashicons post-option-forward"></span>
</span><span class="cx" style="display: block; padding: 0 10px"> </button>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <button type="button" class="button-reset post-option">
</span><span class="cx" style="display: block; padding: 0 10px"> <span class="dashicons dashicons-tag"></span>
</span><span class="cx" style="display: block; padding: 0 10px"> <span class="post-option-title"><?php _e( 'Tags' ); ?></span>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <span class="post-option-contents" id="post-option-tags"></span>
</del><span class="cx" style="display: block; padding: 0 10px"> <span class="dashicons post-option-forward"></span>
</span><span class="cx" style="display: block; padding: 0 10px"> </button>
</span><span class="cx" style="display: block; padding: 0 10px"> </div>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1102,8 +1104,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> </button>
</span><span class="cx" style="display: block; padding: 0 10px"> </div>
</span><span class="cx" style="display: block; padding: 0 10px"> <div class="post-actions">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <button type="button" class="button-subtle" id="draft-field"><?php _e( 'Save Draft' ); ?></button>
- <button type="button" class="button-primary" id="publish-field"><?php _e( 'Publish' ); ?></button>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <button type="button" class="button-subtle draft-button"><?php _e( 'Save Draft' ); ?></button>
+ <button type="button" class="button preview-button"><?php _e( 'Preview' ); ?></button>
+ <button type="button" class="button-primary publish-button"><?php _e( 'Publish' ); ?></button>
</ins><span class="cx" style="display: block; padding: 0 10px"> </div>
</span><span class="cx" style="display: block; padding: 0 10px"> </div>
</span><span class="cx" style="display: block; padding: 0 10px"> </form>
</span></span></pre></div>
<a id="trunksrcwpadminjspressthisjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/js/press-this.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/js/press-this.js 2015-03-07 01:14:31 UTC (rev 31653)
+++ trunk/src/wp-admin/js/press-this.js 2015-03-07 01:16:05 UTC (rev 31654)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -303,33 +303,39 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Prepare the form data for saving.
+ */
+ function prepareFormData() {
+ editor && editor.save();
+
+ $( '#post_title' ).val( sanitizeText( $( '#title-container' ).text() ) );
+
+ // Make sure to flush out the tags with tagBox before saving
+ if ( window.tagBox ) {
+ $( 'div.tagsdiv' ).each( function() {
+ window.tagBox.flushTags( this, false, 1 );
+ } );
+ }
+ }
+
+ /**
</ins><span class="cx" style="display: block; padding: 0 10px"> * Submit the post form via AJAX, and redirect to the proper screen if published vs saved as a draft.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param action string publish|draft
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function submitPost( action ) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var data;
+
</ins><span class="cx" style="display: block; padding: 0 10px"> saveAlert = false;
</span><span class="cx" style="display: block; padding: 0 10px"> showSpinner();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var $form = $( '#pressthis-form' );
-
</del><span class="cx" style="display: block; padding: 0 10px"> if ( 'publish' === action ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $( '#post_status' ).val( 'publish' );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- editor && editor.save();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ prepareFormData();
+ data = $( '#pressthis-form' ).serialize();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $( '#title-field' ).val( sanitizeText( $( '#title-container' ).text() ) );
-
- // Make sure to flush out the tags with tagBox before saving
- if ( window.tagBox ) {
- $( 'div.tagsdiv' ).each( function() {
- window.tagBox.flushTags( this, false, 1 );
- } );
- }
-
- var data = $form.serialize();
-
</del><span class="cx" style="display: block; padding: 0 10px"> $.ajax( {
</span><span class="cx" style="display: block; padding: 0 10px"> type: 'post',
</span><span class="cx" style="display: block; padding: 0 10px"> url: window.ajaxurl,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -502,7 +508,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $title = $( '#title-container' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! hasEmptyTitleStr ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $( '#title-field' ).val( suggestedTitle );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $( '#post_title' ).val( suggestedTitle );
</ins><span class="cx" style="display: block; padding: 0 10px"> $title.text( suggestedTitle );
</span><span class="cx" style="display: block; padding: 0 10px"> $( '.post-title-placeholder' ).addClass( 'is-hidden' );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -756,15 +762,25 @@
</span><span class="cx" style="display: block; padding: 0 10px"> } );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Publish and Draft buttons and submit
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $( '#draft-field' ).on( 'click', function() {
- submitPost( 'draft' );
- } );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $( '.post-actions' ).on( 'click.press-this', function( event ) {
+ var $target = $( event.target );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $( '#publish-field' ).on( 'click', function() {
- submitPost( 'publish' );
- } );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $target.hasClass( 'draft-button' ) ) {
+ submitPost( 'draft' );
+ } else if ( $target.hasClass( 'publish-button' ) ) {
+ submitPost( 'publish' );
+ } else if ( $target.hasClass( 'preview-button' ) ) {
+ prepareFormData();
+ window.opener && window.opener.focus();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $( '#wp-preview' ).val( 'dopreview' );
+ $( '#pressthis-form' ).attr( 'target', '_blank' ).submit().attr( 'target', '' );
+ $( '#wp-preview' ).val( '' );
+ }
+ });
+
</ins><span class="cx" style="display: block; padding: 0 10px"> monitorOptionsModal();
</span><span class="cx" style="display: block; padding: 0 10px"> monitorPlaceholder();
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre>
</div>
</div>
</body>
</html>