我正在使用 Orchard 的 TinyMCE Deluxe 模块来支持站点的其他编辑选项。我的客户需要的一件事是能够进行文本对齐,这与 Word 的工作方式相同。我看到 TinyMCE 有一个实用程序确实支持这些选项作为“核心”控件集的一部分(参见此处),但是当我尝试编辑 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 并将其改为“core”。当我这样做时,我在第一行的 tiny_mce.js 中收到一个错误,上面写着:“未捕获的类型错误:无法读取未定义的属性‘按钮’。”