我对 TinyMCE 有疑问。我在网络表单中工作。客户端环境中的图标丢失。在我的本地机器上一切正常。我使用最新版本的 TinyMCE 4.0.2。在服务器上有 IIS 7.0。我已经为许多不同的方式设置了这个。我也尝试过将编辑器放在<head>
部分中。效果总是一样的。这是我目前的实现:
public static string GetTinyMce4JS(string path, string control, int width, int height, bool enableXmlEncoding = false)
{
StringBuilder sb = new StringBuilder();
sb.Append(string.Format("<script src=\"{0}tinymce/js/tinymce/tinymce.min.js\" type=\"text/javascript\"></script>", path));
sb.Append("<script type=\"text/javascript\">");
sb.Append("tinymce.init({");
sb.Append("selector : \".tinymce\",");
sb.Append("theme : \"modern\",");
sb.Append(" menubar: false,");
sb.Append("plugins : [ \"lists hr anchor pagebreak\",");
sb.Append("\"wordcount visualblocks visualchars \",");
sb.Append("\"insertdatetime nonbreaking directionality\",");
sb.Append("\"paste textcolor moxiemanager\"],");
sb.Append("toolbar1: \"newdocument fullpage | bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | styleselect formatselect fontselect fontsizeselect\",");
sb.Append("toolbar2: \"cut copy paste | searchreplace | bullist numlist | outdent indent blockquote | undo redo | link unlink anchor image media code | inserttime preview | forecolor backcolor\",");
sb.Append("toolbar3: \"table | hr removeformat | subscript superscript | charmap emoticons | print fullscreen | ltr rtl | spellchecker | visualchars visualblocks nonbreaking template pagebreak restoredraft\",");
sb.Append("});");
sb.Append("</script>");
return sb.ToString();
}
然后我在后面的代码中使用这个函数(在 Page_Load 上调用):
string tinyJS = ApplicationHelper.GetTinyMce4JS(ResolveUrl("~"), this.TinyMCEEditor.ClientID, 800, 600, false);
this.TinyMCEJS.Text = tinyJS;
和 aspx 文件:
<asp:Literal ID="TinyMCEJS" runat="server" />
<asp:TextBox ID="TinyMCEEditor" runat="server" TextMode="MultiLine" Height="600px" ClientIDMode="Static" CssClass="tinymce" z-index="200"
Visible="true"></asp:TextBox>
这是它在客户端环境中的样子:
在我的本地机器上也是如此: