我正在使用 Summernote 添加图像、视频、文本。另外,我将图像或视频保存为 Html 代码,该代码是字符串类型到数据库中。当我从数据库中检索视频或图像以在 Summernote 上显示时,需要将近 5 分钟,我不知道为什么。但是,当我从数据库检索文本以显示在 Summernote 上时,没有问题。
这是模型
public class Article
{
[AllowHtml]
[Column(TypeName = "varchar(MAX)")]
public string Content { get; set; }
}
这是 Summernote 编辑器的视图
@Html.TextAreaFor(x => Model.Content, new { @class = "", placeholder = @Blog.Helper.Resources.Content, @id = "summernote_1" })
另外,如果我在视图中使用下面的代码
<div id="summernote_1">@Html.Raw(Model.Content)</div>
显示视频或图像没有问题,但无法编辑 Summernote。当我编辑 Summernote 时,Model.Content 变为空。
如果我在视图中使用下面的代码
@Html.TextAreaFor(x => Model.Content, new { @class = "", placeholder = @Blog.Helper.Resources.Content, @id = "summernote_1" })
编辑summernote没有问题,但显示视频或图像需要近5分钟。
由于这些原因,我尝试在视图中使用下面的代码,但是下面的代码出现错误。
@Html.TextAreaFor(x => Html.Raw(Model.Content), new { @class = "", placeholder = @Blog.Helper.Resources.Content, @id = "summernote_1" })
我可以在 html.TextAreaFor 中使用 html.raw 吗?或者我可以为此问题做些什么来显示视频或图像并编辑 Summernote。
抱歉我的英语不好,我希望有人可以帮助我。