| 1 |
tinymce.PluginManager.add('pilotpress', function(editor, url) |
| 2 |
{ |
| 3 |
|
| 4 |
editor.addButton('merge_fields', { |
| 5 |
type: 'listbox', |
| 6 |
|
| 7 |
text: 'Merge Fields', |
| 8 |
icon: false, |
| 9 |
classes: 'fixed-width btn widget', |
| 10 |
onselect: function(e) { |
| 11 |
if (this.value() != "" ) |
| 12 |
{ |
| 13 |
editor.insertContent("[pilotpress_field name='"+this.value()+"']"); |
| 14 |
} |
| 15 |
}, |
| 16 |
values: |
| 17 |
pilotpress_tiny_mce_plugin_default_fields |
| 18 |
, |
| 19 |
onPostRender: function() { |
| 20 |
// Select the second item by default |
| 21 |
} |
| 22 |
}); |
| 23 |
|
| 24 |
editor.addButton('short_codes', { |
| 25 |
type: 'listbox', |
| 26 |
|
| 27 |
text: 'Short Codes', |
| 28 |
icon: false, |
| 29 |
classes: 'fixed-width btn widget', |
| 30 |
onselect: function(e) { |
| 31 |
if (this.value() != "") |
| 32 |
{ |
| 33 |
if (this.value() == "pilotpress_sync_contact") |
| 34 |
{ |
| 35 |
editor.insertContent("["+this.value()+"]"); |
| 36 |
} |
| 37 |
else |
| 38 |
{ |
| 39 |
editor.insertContent("[show_if "+this.value()+"]content[/show_if]"); |
| 40 |
} |
| 41 |
} |
| 42 |
}, |
| 43 |
values: |
| 44 |
pilotpress_tiny_mce_plugin_shortcodes |
| 45 |
, |
| 46 |
onPostRender: function() { |
| 47 |
|
| 48 |
} |
| 49 |
}); |
| 50 |
}); |