Orchard TinyMCE配置

时间:2013-05-25 21:59:57

标签: tinymce orchardcms-1.6

我正在使用Orchard的TinyMCE Deluxe模块来支持网站的其他编辑选项。我的客户需要的一件事是能够进行文本对齐,与Word的工作方式相同。我看到TinyMCE有一个实用程序确实支持这些选项作为“核心”控件集(see here)的一部分,但是当我尝试编辑orchard-tinymce.js来支持核心时,我只是开始得到JS错误和工具栏没有显示。

有关如何添加对齐选项的任何建议吗?

修改

这是我的orchard-tinymce.js文件(位于/ Modules / TinyMceDeluxe / Scripts中):

$(document).ready(function () {
tinyMceDeluxe = new TinyMceDeluxe.Orchard();

// 1st arg is an array of plugin names. See plugin link above for full list of available plugins
// 2nd arg is an options object; also see TinyMce documentation for details on all available options. 
tinyMceDeluxe.init(['pagebreak', 'paste', 'table', 'template', 'syntaxhl'], {
    theme: "advanced",
    mode: "specific_textareas",
    editor_selector: "tinymce",
    plugins: "fullscreen,autoresize,searchreplace,mediapicker,inlinepopups,-table,-pagebreak,-template,-paste,-syntaxhl",
    theme_advanced_toolbar_location: "top",
    theme_advanced_toolbar_align: "left",
    theme_advanced_statusbar_location: "bottom",
    theme_advanced_resizing: "true",
    //theme_advanced_buttons1: "search,replace,|,cut,copy,paste,|,undo,redo,|,link,unlink,charmap,emoticon,codeblock,|,bold,italic,|,numlist,bullist,formatselect,fontselect,fontsizeselect,|,styleselect,|,forecolor,backcolor",
    theme_advanced_buttons1: 'core',
    theme_advanced_buttons2: "mediapicker,|,tablecontrols,|,hr,removeformat,visualaid,|,visualchars,template,blockquote,pagebreak,|,alignleft,aligncenter,alignright,alignjustify,|,syntaxhl,code,fullscreen",
    theme_advanced_buttons3: "",
    convert_urls: false,
    template_external_list_url: "/modules/tinymcedeluxe/scripts/samples/tinymce_template_list.js",
    // content_css sets the path to your site's main .css file. The styles from this file are imported into a droplist in the TinyMce editor. 
    // TinyMceDeluxe sets this path automatically to the /Styles/custom.css file in your site's theme, but you can override the path by declaring it here:
    //content_css: '/path/to/your/stylesheet.css',
    valid_elements: "*[*]",
    // shouldn't be needed due to the valid_elements setting, but TinyMCE would strip script.src without it.
    extended_valid_elements: "script[type|defer|src|language]"
});

});

我评论出了具有多个特定元素的theme_advanced_buttons1,而是将其更改为“核心”。当我这样做时,我在第一行的tiny_mce.js中收到错误:“未捕获的TypeError:无法读取未定义的'按钮'。”

1 个答案:

答案 0 :(得分:1)

在挖掘了一些回答Thariama的问题之后,我在TinyMCE网站上找到了this页面。我一直在使用“alignleft”,“alignright”(等等)按钮作为我在其网站上其他地方看到的对齐控件,但事实证明真实姓名是“justifyleft”,“justifyright”等。它给了我所需的所有对齐选项。