# wpforo/3.2.0/assets/js/tinymce-spoiler.js

wpForo Forum, version 3.2.0. 41 lines.

- Page: https://pluginprobe.com/plugins/wpforo/3.2.0/code/assets/js/tinymce-spoiler.js
- Raw: https://pluginprobe.com/plugins/wpforo/3.2.0/raw/assets/js/tinymce-spoiler.js
- Modified: 2026-09-25T08:24:48+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/wpforo/3.2.0/code/assets/js/tinymce-spoiler.js#L10-L20`.

```javascript
(function () {
    tinymce.create('tinymce.plugins.wpforo_spoiler_button', {
        /**
         * Initializes the plugin, this will be executed after the plugin has been created.
         * This call is done before the editor instance has finished it's initialization so use the onInit event
         * of the editor instance to intercept that event.
         *
         * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
         * @param {string} url Absolute URL to where the plugin is located.
         */
        init: function (ed, url) {

            function showDialog() {
                var data = {text: ed.selection.getContent({format: 'raw'})};

                ed.windowManager.open({
                    title: 'Insert Spoiler',
                    data: data,
                    body: [{
                        name: 'title',
                        type: 'textbox',
                        label: 'Title'
                    }],
                    onSubmit: function (e) {
                        data = tinymce.extend(data, e.data);
                        ed.insertContent('[spoiler' + (data.title ? ' title="' + data.title + '"' : '') + ']' + data.text + '[/spoiler]', {format: 'bbcode'});
                    }
                });
            }

            ed.addButton('wpf_spoil', {
                icon: 'pluscircle',
                tooltip: 'Spoiler',
                onclick: showDialog
            });
        }
    });

    // Register plugin
    tinymce.PluginManager.add('wpforo_spoiler_button', tinymce.plugins.wpforo_spoiler_button);
})();
```
