我正在发布这个问题的答案,但如果有人有不同的解决方案,我仍然很想听听。
基本上,我接受了 Thariama 的建议并停止使用 tinyMCE 的 jQuery 构建。相反,我做了以下事情:
tinyMCE.init({
mode: "specific_textareas",
editor_selector: "tinymce",
script_url: '@Url.Content("~/Scripts/tinymce/tiny_mce.js")',
theme: "advanced",
plugins: "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
theme_advanced_buttons1: "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2: "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
theme_advanced_buttons3: "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
theme_advanced_buttons4: "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak",
theme_advanced_toolbar_location: "top",
theme_advanced_toolbar_align: "left",
theme_advanced_statusbar_location: "bottom",
theme_advanced_resizing: true,
template_external_list_url: "lists/template_list.js",
external_link_list_url: "lists/link_list.js",
external_image_list_url: "lists/image_list.js",
media_external_list_url: "lists/media_list.js",
convert_urls: 0, // default 1
content_css: '@Url.Content("~/Content/tinymce.css")'
});
这是基于我在 StackOverflow 其他地方找到的建议解决方案。
仅供从 jQuery 版本的 tinyMCE 转换的其他人参考:您需要记住将 mode: 和 editor_selector: 参数添加到您之前使用的参数列表中。如果不这样做,您将获得将每个 textarea 控件转换为 tinyMCE 编辑器的默认行为。
您还需要在页面标题中包含 tinyMCE 库。在我的应用程序中,如下所示:
<script src="@Url.Content("~/Scripts/tinymce/tiny_mce.js")" type="text/javascript"></script>
享受!