Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
GS plugin - removes ckeditor and inserts lepture markdown editor in its place
<?php
/**
* GSEditorPatch.php
* @name GS Editor plugin
*
* removes ckeditor and inserts lepture markdown editor in its place
* https://github.com/lepture
*
* @version 0.1
* @author Shawn Alverson
* @link http://get-simple.info
* @file GSEditorPatch.php
*/
$pluginid = "GSEditorPatch";
function init_GSEditorPatch($pluginid){
$thisfile = basename(__FILE__, ".php"); // Plugin File
$name = $pluginid;
$version = "0.2";
$author = "getsimple";
$url = "http://get-simple.info";
$desc = "Overrides ckeditor 3.x with custom";
$type = "";
$func = "";
register_plugin($thisfile,$name,$version,$author,$url,$desc,$type,$func);
}
init_GSEditorPatch($pluginid);
if($HTMLEDITOR && get_filename_id() == 'edit'){
add_action("header",$pluginid.'_header',$pluginid);
add_action("edit-content",$pluginid.'_edit_content');
}
function GSEditorPatch_edit_content(){
GLOBAL $HTMLEDITOR;
$HTMLEDITOR = false;
ob_start('GSEditorPatch_obfilter');
}
function GSEditorPatch_obfilter($buffer){
return str_replace('<script type="text/javascript" src="template/js/ckeditor/ckeditor.js"></script>','',$buffer);
}
function GSEditorPatch_header($pluginid){
global $SITEURL;
// echo '<script type="text/javascript" src="'.$SITEURL.'plugins/'.$pluginid.'/js/ckeditor/ckeditor.js"></script>';
echo '<link rel="stylesheet" href="//cdn.jsdelivr.net/editor/0.1.0/editor.css">';
echo '<script src="//cdn.jsdelivr.net/editor/0.1.0/editor.js"></script>';
echo '<script src="//cdn.jsdelivr.net/editor/0.1.0/marked.js"></script>';
?>
<script type="text/javascript">
jQuery(document).ready(function () {
var editor = new Editor({
element : $('#post-content').get(0)
});
});
</script>
<?php
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.