umbraco中的TinyMCE插件

umbraco中的TinyMCE插件

本文介绍了umbraco中的TinyMCE插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图为umbraco richtext数据类型添加一个自定义按钮,所以我为TinyMCE创建了一个简单的插件...但是我似乎无法使其正常工作,它显示在数据类型中,但是当我打开某些页面的编辑器...

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);
})();

已将以下内容添加到tinyMceConfig.config(/config/文件夹)

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)相同的名称即可解决问题.

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.

这篇关于umbraco中的TinyMCE插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 20:46