简体   繁体   中英

TinyMCE plugin in umbraco

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>

似乎是错误的插件文件夹命名问题……不知道这有影响,但是将文件夹重命名为与插件相同的名称(mceAddArrowHeader)解决了该问题。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM