tinymce mvc c#的两个实例 [英] two instances of tinymce mvc c#
问题描述
TinyMCE 视图模板
TinyMCE View Template
<script src="@Url.Content("~/Scripts/tinymce/tiny_mce.js")" type="text/javascript"></script>
<script type="text/javascript">
(function () {
tinyMCE.init({
mode: "textareas",
//elements: "engRichMCE,araRichMCE",
elements: "@ViewData.TemplateInfo.GetFullHtmlFieldName(string.Empty)",
theme: "simple",
height: "300",
width: "400",
verify_html: false,
theme_simple_resizing: true,
content_css: "@Url.Content("~/Content/Site.css")",
convert_urls: false
})
})();
</script>
@Html.TextArea(string.Empty, /* Name suffix */
ViewData.TemplateInfo.FormattedModelValue /* Initial value */
)
型号
[UIHint("tinymce_full_compressed"), AllowHtml]
public string eng_html { get; set; }
[UIHint("tinymce_full_compressed"), AllowHtml]
public string ara_html { get; set; }
查看
@Html.EditorFor(model => model.eng_html, new { id = "engRichMCE" })
@Html.ValidationMessageFor(model => model.eng_html)
@Html.EditorFor(model => model.ara_html, new { id = "araRichMCE" })
@Html.ValidationMessageFor(model => model.ara_html)
问题是在我看来只有一个 tinyMCE 实例正在加载,我需要两个字段才能获得 tinyMCE 编辑器,有什么建议吗?
The Problem is only one instance of tinyMCE is loading in my view, i need both fields to get tinyMCE editor, any advice ?
更新到目前为止我所做的,查看tinyMCE文档,http://www.tinymce.com/wiki.php/Configuration3x:mode模式值可以是精确的、textareas 或 specific_textareas.如果在 init 函数中设置 mode="textarea"
,所有 textareas 都会转换为 tinMCE...这不是我需要的.
Update
What i've done so far, looking at tinyMCE documentations,
http://www.tinymce.com/wiki.php/Configuration3x:mode
mode value can be exact, textareas or specific_textareas. If set mode="textarea"
in the init function, all textareas are converted to tinMCE...which is not what i need.
同样复制包含 tinyMCE 的部分视图也没有用.
Also duplicating the partial view that holds the tinyMCE didn't work.
在 tinyMCE init 函数中使用 mode="exact"
和 elements="araRichMCE,engRichMCE"
并在我的视图中添加 ID 也不起作用?
using mode="exact"
and elements="araRichMCE,engRichMCE"
in tinyMCE init function and adding IDs in my view did not work either ?
推荐答案
SOLVED
更新包 TinyMCE 下载最新的 4.0.11
Upadated Package TinyMCE downloaded latest 4.0.11
在我的模型中删除了这个
in my model deleted this
[UIHint("tinymce_simple"), AllowHtml]
并保留
[DataType(DataType.MultilineText)]
在我的编辑视图页面edit.view
<script src="@Url.Content("~/Scripts/tinymce/tinymce.min.js")" type="text/javascript"></script>
<script type="text/javascript">
(function () {
tinyMCE.init({
selector: "textarea#eng_html,textarea#ara_html",
content_css: "@Url.Content("~/Content/Site.css")",
})
})();
</script>
在视图中,tinyMCE 将选择我的两个包含文本区域的 html
in the view my two html containg textareas will be selected by tinyMCE
谢谢大家
这篇关于tinymce mvc c#的两个实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!