我从tinyMCE中获取了一个HTML字符串,并用jQuery html()进行了包装。我现在正试图将其拆开并在视图中显示。
我得到tinyMCE内容并将其放入div。然后,我提取该div的html内容,并将其通过AJAX传递到我的数据库中。我现在正尝试将内容转换回允许我正确显示的格式。
<Autocomplete
options={top100Films}
getOptionLabel={(option: FilmOptionType) => option.title}
style={{ width: 300 }}
renderInput={params => (
<TextField {...params} label="Combo box" variant="outlined" fullWidth />
)}
/>
<textarea name="tinycontent" class="form-control"
id="textFromContentEditor" value=""></textarea>
<div id="textContent" style="display:none"></div>
我对tinyMCE的输入:Hello World
什么存储在数据库中:var sectionContent = tinyMCE.activeEditor.getcontent();
sectionContent = $('#textContent').text(sectionContent).html();
$.ajax({
url: '/Home/CreateNoteContent',async: false,type: 'POST',data: {
headerID: headerID,categoryID: categoryID,sectionContent: sectionContent
},success: function (result) {
if (result == false) {
toastr.error("Cannot create new content")
} else {
toastr.success("Successfully created new content")
$("#feed-" + releaseID).trigger('click');
jumpTo(scrollPos);
}
}
});
我希望能够仅在视图中显示文本内容。