Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion jetpack/lib/markdown/gfm.php
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ public function _doFencedCodeBlocks_callback( $matches ) {
if ( $classname{0} == '.' )
$classname = substr( $classname, 1 );

$codeblock = esc_html( $codeblock );
// $codeblock = esc_html( $codeblock );
$codeblock = sprintf( $this->shortcode_start, $classname ) . "\n{$codeblock}" . $this->shortcode_end;
return "\n\n" . $this->hashBlock( $codeblock ). "\n\n";
}
Expand Down
4 changes: 3 additions & 1 deletion jetpack/markdown/easy-markdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ public function load_markdown_for_posts() {
add_action( 'wp_restore_post_revision', array( $this, 'wp_restore_post_revision' ), 10, 2 );
add_filter( '_wp_post_revision_fields', array( $this, '_wp_post_revision_fields' ) );
add_action( 'xmlrpc_call', array( $this, 'xmlrpc_actions' ) );
add_filter( 'content_save_pre', array( $this, 'preserve_code_blocks' ), 1 );
if ( ! class_exists( 'SyntaxHighlighter' ) ) {
add_filter( 'content_save_pre', array( $this, 'preserve_code_blocks' ), 1 );
}
if ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) {
$this->check_for_early_methods();
}
Expand Down
25 changes: 20 additions & 5 deletions wp-markdown-editor.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Plugin Name: WP Markdown Editor
* Plugin Name: DO NOT UPDATE - WP Markdown Editor
* Plugin URI: https://github.com/hoducha/wp-markdown-editor
* Description: WP Markdown Editor replaces the default editor with a WYSIWYG Markdown Editor for your posts and pages.
* Version: 2.0.3
Expand Down Expand Up @@ -33,8 +33,8 @@ class WpMarkdownEditor
private function __construct()
{
// Activation / Deactivation hooks
register_activation_hook(__FILE__, array($this, 'plugin_activation'));
register_deactivation_hook(__FILE__, array($this, 'plugin_deactivation'));
// register_activation_hook(__FILE__, array($this, 'plugin_activation'));
// register_deactivation_hook(__FILE__, array($this, 'plugin_deactivation'));

// Load markdown editor
add_action('admin_enqueue_scripts', array($this, 'enqueue_stuffs'));
Expand Down Expand Up @@ -68,7 +68,11 @@ function enqueue_stuffs()
return;
}

wp_enqueue_script('simplemde-js', $this->plugin_url('/simplemde/simplemde.min.js'));
if (!post_type_supports( get_post_type(), WPCom_Markdown::POST_TYPE_SUPPORT )){
return;
}

wp_enqueue_script('simplemde-js', $this->plugin_url('/simplemde/simplemde.min.js'));
wp_enqueue_style('simplemde-css', $this->plugin_url('/simplemde/simplemde.min.css'));
wp_enqueue_style('custom-css', $this->plugin_url('/style.css'));
}
Expand Down Expand Up @@ -111,6 +115,10 @@ function init_editor()
return;
}

if (!post_type_supports( get_post_type(), WPCom_Markdown::POST_TYPE_SUPPORT )){
return;
}

echo '<script type="text/javascript">
// Init the editor
var simplemde = new SimpleMDE({
Expand Down Expand Up @@ -165,7 +173,14 @@ function init_editor()

function quicktags_settings($qtInit)
{
$qtInit['buttons'] = ' ';
if (function_exists('get_current_screen')) {
if ( get_current_screen()->base === 'post' &&
post_type_supports( get_post_type(), WPCom_Markdown::POST_TYPE_SUPPORT )
) {
$qtInit['buttons'] = ' ';
}
}

return $qtInit;
}

Expand Down