Skip to content

Instantly share code, notes, and snippets.

$.sceditor.plugins.undomanager = function() {
var base = this;
base.init = function() {
// The this variable will be set to the instance of the editor calling it,
// hence why the plugins "this" is saved to the base variable.
// addShortcut is the easiest way to add handlers to specific shortcuts
this.addShortcut('ctrl+z', base.undo);
this.addShortcut('ctrl+shift+z', base.redo);
@samclarke
samclarke / headlines.js
Last active December 23, 2015 07:39 — forked from tscolari/headlines.js
Update [h1] and [h2] BBCodes
/**
* H1 BBCode
*/
$.sceditor.command.set('h1', {
tooltip: 'Heading 1',
state: function(parent, firstBlock) {
var $firstBlock = $(firstBlock);
// < 0 is disabled
// == 0 is enabled but not active
@samclarke
samclarke / gist:4355569
Last active December 10, 2015 00:59
Update SCEditor [size] tag to work with percentages.
$.sceditorBBCodePlugin.bbcode.set('size', {
format: function($elm, content) {
var size = $elm.data('scefontsize');
if(!size)
{
size = $elm.css('fontSize').replace("px", "") - 0;
if(!this.baseFontSizePx)
this.baseFontSizePx = $elm.parents('body').css('fontSize').replace("px", "") - 0;