| 1 |
(function() { |
| 2 |
|
| 3 |
tinymce.create('tinymce.plugins.wpforo_pre_button', { |
| 4 |
/** |
| 5 |
* Initializes the plugin, this will be executed after the plugin has been created. |
| 6 |
* This call is done before the editor instance has finished it's initialization so use the onInit event |
| 7 |
* of the editor instance to intercept that event. |
| 8 |
* |
| 9 |
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in. |
| 10 |
* @param {string} url Absolute URL to where the plugin is located. |
| 11 |
*/ |
| 12 |
init : function(ed, url) { |
| 13 |
ed.addCommand('preFormat', function() { |
| 14 |
ed.formatter.toggle('pre'); |
| 15 |
}); |
| 16 |
|
| 17 |
ed.addButton('pre', { |
| 18 |
title : 'Code', |
| 19 |
cmd : 'preFormat', |
| 20 |
icon: 'code' |
| 21 |
}); |
| 22 |
|
| 23 |
ed.addShortcut('ctrl+0','pre','preFormat') |
| 24 |
}, |
| 25 |
}); |
| 26 |
|
| 27 |
// Register plugin |
| 28 |
tinymce.PluginManager.add('wpforo_pre_button', tinymce.plugins.wpforo_pre_button); |
| 29 |
|
| 30 |
})(); |