Ticket #692: 692.2.diff
File 692.2.diff, 3.0 KB (added by , 10 years ago) |
---|
-
comments.php
58 58 <p id="add-user-note" style="display:none;"><a href=""><?php _e( 'Have a note to contribute?', 'wporg' ); ?></a></p> 59 59 60 60 <?php comment_form( array( 61 'comment_field' => '<p class="comment-form-comment"><label for="comment">' . _x( 'Add Note', 'noun', 'wporg' ) . '</label> <textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>',61 'comment_field' => DevHub_User_Submitted_Content::wp_editor_comments(), 62 62 'comment_notes_after' => '<p>' . 63 63 __( 'Notes should supplement code reference entries, for example examples, tips, explanations, use-cases, and best practices.', 'wporg' ) . 64 64 '</p><p>' . -
inc/user-content.php
66 66 wp_enqueue_style( 'syntaxhighlighter-core' ); 67 67 wp_enqueue_style( 'syntaxhighlighter-theme-default' ); 68 68 69 wp_enqueue_script( 'wporg-developer-user-notes', get_template_directory_uri() . '/js/user-notes.js', array( ), '20140912', true );69 wp_enqueue_script( 'wporg-developer-user-notes', get_template_directory_uri() . '/js/user-notes.js', array( 'quicktags' ), '20140912', true ); 70 70 if ( get_option( 'thread_comments' ) ) { 71 71 wp_enqueue_script( 'comment-reply' ); 72 72 } … … 108 108 return str_replace( 'Wordpress', 'Wordpress', $code ); 109 109 } 110 110 111 /** 112 * Capture an {@see wp_editor()} instance as the 'User Contributed Notes' comment form. 113 * 114 * Uses output buffering to capture the editor instance for use with the {@see comments_form()}. 115 * 116 * @return string HTML output for the wp_editor-ized comment form. 117 */ 118 public static function wp_editor_comments() { 119 ob_start(); 120 echo '<p class="comment-form-comment"><label for="comment">' . _x( 'Add Note', 'noun', 'wporg' ) . '</label>'; 121 wp_editor( '', 'comment', array( 122 'media_buttons' => false, 123 'textarea_name' => 'comment', 124 'textarea_rows' => 8, 125 'quicktags' => array( 126 'buttons' => 'strong,em,ul,ol,li,wporg_php,js' 127 ), 128 'teeny' => true, 129 'tinymce' => false, 130 ) ); 131 echo '</p>'; 132 return ob_get_clean(); 133 } 134 135 public static function mce_buttons( $buttons ) { 136 $buttons = array_merge( $buttons, array( 'wporg_php' ) ); 137 return $buttons; 138 } 139 140 public static function mce_plugins( $plugins ) { 141 $plugins['wporg_php'] = get_stylesheet_directory_uri() . '/js/user-notes.js'; 142 return $plugins; 143 } 111 144 } // DevHub_User_Submitted_Content 112 145 113 146 DevHub_User_Submitted_Content::init(); -
js/user-notes.js
20 20 } 21 21 } 22 22 } ); 23 24 // Add php and js buttons to QuickTags. 25 QTags.addButton( 'php', 'php', '[php]', '[/php]' ); 26 QTags.addButton( 'js', 'js', '[js]', '[/js]' ); 27 23 28 } )( jQuery );