문제

내 asp.net 및 vb.net 웹 응용 프로그램에 ckeditor를 통합했습니다.이전에 이 웹 애플리케이션은 bootstrap-wysihtml5를 사용했습니다.하지만 이제 클라이언트는 ckeditor를 사용해야 합니다.

ckeditor를 통합하기 위해 다음을 수행했습니다.

나는 ckeditor_4.4.1 을 사용하고 있습니다.루트 디렉토리에 ckeditor 폴더를 복사했습니다.다음과 같이 마스터 페이지에 연결했습니다.

   <%@ Master Language="VB" CodeFile="E4.master.vb" Inherits="_resx_E4" %>
   <!doctype html>
   <html lang="en">
   <head runat="server">
       <title></title>
       <meta name="robots" content="noindex, nofollow">
       <meta name="googlebot" content="noindex, nofollow">
       <link href='https://fonts.googleapis.com/css?family=Roboto:400,300,100' rel='stylesheet' type='text/css'>
       <script src="/ckeditor/ckeditor.js" type="text/javascript"></script>
   </head>

콘텐츠 페이지의 헤더를 변경하지 않았습니다.그것은 다음과 같다

<%@ Page Page Title="" Language="VB" MasterPageFile="~/_resx/E4.master" AutoEventWireup="false" CodeFile="new.aspx.vb" Inherits="E4_Jobs_new" ValidateRequest="false" %>
<%@ Page    <%@ Register Src="~/_controls/ucApplicationQuestions.ascx" TagPrefix="Application"
TagName="Questions" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="Server">

마지막으로 콘텐츠 페이지의 텍스트 영역 코드

<div><label>Description (required)</label>
  <div>
    <textarea runat="server" id="txtDescription" name="txtDescription" class="ckeditor" style="width: 98%; height: 250px;"  ></textarea>
  </div>
</div>

ckeditor 도구 모음이 텍스트 영역에 표시됩니다.그러나 웹사이트는 ckeditor 필드에 기록된 값을 인식할 수 없으며 해당 값을 데이터베이스에 저장하지도 않습니다.텍스트 영역에 작성한 후 양식을 제출하더라도 설명 필드에 텍스트가 있어야 하기 때문에 양식 제출이 허용되지 않습니다.하지만 실제로는 텍스트 영역에 글을 쓰거나 워드 파일에서 복사하여 붙여넣었습니다.그러나 여전히 아무런 가치도 얻지 못합니다.

코드를 도와주세요.

도움이 되었습니까?

해결책

나는 답을 찾았다.그리고 나는 그것을 공유해야 한다고 생각합니다.다른 사람이 같은 문제에 직면하는 경우.

내가 따라온 단계는 다음과 같습니다.

  1. 링크에서 ckeditor를 다운로드했습니다.http://ckeditor.com/download

  2. 프로젝트 폴더 아래에 전체 폴더를 복사했습니다.

  3. 마스터 페이지에 ckeditor의 참조를 추가하기 위해 다음 줄을 추가했습니다.

    <script src="/ckeditor/ckeditor.js" type="text/javascript"></script>
    <script src="/ckeditor/adapters/jquery.js" type="text/javascript"></script>
    <script src="/ckeditor/ckeditor_custom.js" type="text/javascript"></script>
    
  4. 특정 텍스트 영역의 클래스를 변경했습니다.

    <textarea runat="server" id="txtDescription" name="txtDescription" class="ckeditor" style="width: 98%; height: 250px;"   ></textarea>
    
  5. 콘텐츠 페이지 하단에 다음 자바스크립트 기능을 추가했습니다.

    $('#' + '<%= btnSave.ClientID%>').mousedown(function () {
     for (var i in CKEDITOR.instances) {
         CKEDITOR.instances[i].updateElement();
     }
    });
    

그게 다야.

여기서 btn.save는 데이터를 제출하는 버튼입니다.

감사해요

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top