내가 그것을 neccessary.Here 내 현재 시작 구현 경우 데이터베이스에 HTML을 결과를 저장하고 다시로드해야 times.So 내 컨텐츠를 편집 할 것이다 번호 :CKEditor HTML 콘텐츠 라이프 사이클 : ASP 닷넷 MVC 경우
@using (@Html.BeginForm("EditArticle", "Admin", new { id = ViewData["id"] }))
{
<div id="editor"> </div>
<input type="submit" value="save changes" onclick = "setValue()" />
<input type ="hidden" id="value" name="html" />
}
<script>
var editor, html = 'Model.Text';
function createEditor() {
if (editor)
return;
var config = { width:"900px"};
editor = CKEDITOR.appendTo('editor', config,html);
}
function setValue() {
$("#value").val(editor.getData());
}
createEditor();
</script>
하지만 초기화 HTML 변수와 함께 eror가 나타납니다. 아무도 올바른 인코딩/디코딩 html을 보여줄 수 있습니까? 데이터베이스에서이 I 저장소와 같은
html = <p>ARTICLE 3</p>\r\n
값 다시 삽입 해보십시오 : 여기
편집 데이터 컨트롤러가 수신입니다.
var editor, html = '@Html.Raw(Model.Text)';
그러나, 왜 안 대신 자바 스크립트의 마크 업을 처리하고 탈출 언 이스케이프 할 필요없이, 그것을 덤프 :
여기 내 해결책은 다음과 같습니다. Text.Replace (System.Environment.NewLine, ""); @ Html.Row와 함께 해 주셔서 감사합니다 .. –