bachy 7884444ec6 update 2.2 + precedent custom commits
Signed-off-by: bachy <git@g-u-i.net>
2012-10-27 15:06:38 +02:00

47 lines
1.1 KiB
JavaScript

(function($) {
/**
* Attach this editor to a target element.
*/
Drupal.wysiwyg.editor.attach.markitup = function(context, params, settings) {
$('#' + params.field, context).markItUp(settings);
// Adjust CSS for editor buttons.
$.each(settings.markupSet, function (button) {
$('.' + settings.nameSpace + ' .' + this.className + ' a')
.css({ backgroundImage: 'url(' + settings.root + 'sets/default/images/' + button + '.png' + ')' })
.parents('li').css({ backgroundImage: 'none' });
});
};
/**
* Detach a single or all editors.
*/
Drupal.wysiwyg.editor.detach.markitup = function (context, params, trigger) {
if (trigger == 'serialize') {
return;
}
if (typeof params != 'undefined') {
$('#' + params.field, context).markItUpRemove();
}
else {
$('.markItUpEditor', context).markItUpRemove();
}
};
Drupal.wysiwyg.editor.instance.markitup = {
insert: function (content) {
$.markItUp({ replaceWith: content });
},
setContent: function (content) {
$('#' + this.field).val(content);
},
getContent: function () {
return $('#' + this.field).val();
}
};
})(jQuery);