This plugin has still some serious flaws! A list can be found on the bottom of this readme.
This is a Redactor plugin which introduces a new button in the interface for adding Github Gists.
Simply follow the instructions on the official documentation or take a look at the following minimal example.
<!DOCTYPE html>
<html>
<head>
<title>Redactor Gist plugin is awesome!</title>
<meta charset="utf-8">
<link rel="stylesheet" href="http://imperavi.com/js/redactor/redactor.css" />
<link rel="stylesheet" href="https://raw.github.com/1up-lab/redactorjs-gist-plugin/master/gist.css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
<script src="http://imperavi.com/js/redactor/redactor.js"></script>
<script src="https://raw.github.com/1up-lab/redactorjs-gist-plugin/master/gist.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$('#redactor').redactor(
{
plugins: ['gist']
});
});
</script>
</head>
<body>
<div id="page">
<textarea id="redactor" name="content"></textarea>
</div>
</body>
</html>
That's all! No additional assets like images needed. They are integrated inline in the CSS file.
- This plugin does not work on the current community-version of RedactorJS as it does not support plugins.
- There is still a bug when loading the editor with gist script-tags in the content, as they will be stripped. Hey RedactorJS-devs: post-submit hooks would be nice. Consider that.
- When pasting a Gist-URL to the editor and forget to unlink the element, the gist itself will be clickable, because the surrounding link is not removed. If you have an idea how to work around this flaw, drop me line!
- Templating could be nicer. Working with DOM-Elements instead of string-values for example.
You're welcome.
Jim Schmid for 1up.io