2
votes

I'm trying to add a custom button for umbraco richtext datatype, so i made a simple plugin for TinyMCE... But i cant seem to get it working, it shows up in the datatype, but not when i open the editor for some page...

//File: umbraco_client/tinymce3/plugins/addarrowheader/editor_plugin_src.js
//Same content in editor_plugin.js (just minified)

(function () {
tinymce.create('tinymce.plugins.mceAddArrowHeader', {
    init: function (ed, url) {
        ed.addCommand('addHeader', function () {
            alert('hello!');
        });

        ed.addButton('addArrow', { title: 'DoAdd', image: '/images/editor/umbracoTextGen.gif', cmd: 'addHeader' });
    },

    getInfo: function () {
        return {
            longname: 'mceAddArrowHeader',
            author: 'Bekker',
            authorurl: 'Eksponent.com',
            infourl: 'none',
            version: tinymce.majorVersion + "." + tinymce.minorVersion
        };
    }
});

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

Added following to tinyMceConfig.config (/config/ folder)

//in <commands>
<command>
  <umbracoAlias>mceAddArrowHeader</umbracoAlias>
  <icon>images/editor/spellchecker.gif</icon>
  <tinyMceCommand value="" userInterface="true" frontendCommand="mceAddArrowHeader">addarrowheader</tinyMceCommand>
  <priority>76</priority>
</command>

//In <plugins>
//just using spellchecker.gif for test purpose, no custom icon yet...
<plugin loadOnFrontend="false">addarrowheader</plugin>
1
Have you enabled the button in the data type being used on that document type? You have to click the checkbox. Also, make sure you're "touching" the web.config after making edits to the tinyMceConfig.config. - Douglas Ludlow
Yes its enabled in the datatype, so it makes no sense. - Christian Bekker

1 Answers

0
votes

It seemed to be a matter of wrong plugin folder naming... Didnt know that it had an impact, but renaming the folder to same name as the plugin (mceAddArrowHeader) solved the problem.