Mercurial > hg > rr-repo
comparison sites/all/modules/wysiwyg/editors/js/markitup.js @ 0:ff03f76ab3fe
initial version
author | danieleb <danielebarchiesi@me.com> |
---|---|
date | Wed, 21 Aug 2013 18:51:11 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:ff03f76ab3fe |
---|---|
1 (function($) { | |
2 | |
3 /** | |
4 * Attach this editor to a target element. | |
5 */ | |
6 Drupal.wysiwyg.editor.attach.markitup = function(context, params, settings) { | |
7 $('#' + params.field, context).markItUp(settings); | |
8 | |
9 // Adjust CSS for editor buttons. | |
10 $.each(settings.markupSet, function (button) { | |
11 $('.' + settings.nameSpace + ' .' + this.className + ' a') | |
12 .css({ backgroundImage: 'url(' + settings.root + 'sets/default/images/' + button + '.png' + ')' }) | |
13 .parents('li').css({ backgroundImage: 'none' }); | |
14 }); | |
15 }; | |
16 | |
17 /** | |
18 * Detach a single or all editors. | |
19 */ | |
20 Drupal.wysiwyg.editor.detach.markitup = function (context, params, trigger) { | |
21 if (trigger == 'serialize') { | |
22 return; | |
23 } | |
24 if (typeof params != 'undefined') { | |
25 $('#' + params.field, context).markItUpRemove(); | |
26 } | |
27 else { | |
28 $('.markItUpEditor', context).markItUpRemove(); | |
29 } | |
30 }; | |
31 | |
32 Drupal.wysiwyg.editor.instance.markitup = { | |
33 insert: function (content) { | |
34 $.markItUp({ replaceWith: content }); | |
35 }, | |
36 | |
37 setContent: function (content) { | |
38 $('#' + this.field).val(content); | |
39 }, | |
40 | |
41 getContent: function () { | |
42 return $('#' + this.field).val(); | |
43 } | |
44 }; | |
45 | |
46 })(jQuery); |