PluginProbe
wpForo Forum / 3.1.6
wpForo Forum v3.1.6
3.1.6 3.1.5 3.1.4 3.1.2 3.1.1 3.1.0 3.0.9 3.0.8 3.0.7 trunk 1.0.0 1.0.1 1.0.2 1.1.0 1.1.1 1.1.2 1.2.0 1.3.0 1.3.1 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 1.4.13 All 138 releases
wpforo / assets / js / tinymce-spoiler.js

tinymce-spoiler.js in wpForo Forum 3.1.6, at assets/js/tinymce-spoiler.js

41 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (function () {
2 tinymce.create('tinymce.plugins.wpforo_spoiler_button', {
3 /**
4 * Initializes the plugin, this will be executed after the plugin has been created.
5 * This call is done before the editor instance has finished it's initialization so use the onInit event
6 * of the editor instance to intercept that event.
7 *
8 * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
9 * @param {string} url Absolute URL to where the plugin is located.
10 */
11 init: function (ed, url) {
12
13 function showDialog() {
14 var data = {text: ed.selection.getContent({format: 'raw'})};
15
16 ed.windowManager.open({
17 title: 'Insert Spoiler',
18 data: data,
19 body: [{
20 name: 'title',
21 type: 'textbox',
22 label: 'Title'
23 }],
24 onSubmit: function (e) {
25 data = tinymce.extend(data, e.data);
26 ed.insertContent('[spoiler' + (data.title ? ' title="' + data.title + '"' : '') + ']' + data.text + '[/spoiler]', {format: 'bbcode'});
27 }
28 });
29 }
30
31 ed.addButton('wpf_spoil', {
32 icon: 'pluscircle',
33 tooltip: 'Spoiler',
34 onclick: showDialog
35 });
36 }
37 });
38
39 // Register plugin
40 tinymce.PluginManager.add('wpforo_spoiler_button', tinymce.plugins.wpforo_spoiler_button);
41 })();