How to remove html code at the time of page loads ck editor loading the text in asp.net

若如初见. 提交于 2019-12-13 08:36:22

问题


In my wed application, I have one page it contains ck editor when i load that page ck editor showing some fraction of seconds HTML code after it will display text in ck editor. I need to stop that showing fraction of seconds HTML code how can i do this can anyone tell me.
My code is:

protected void Page_Load(object sender, EventArgs e)
    {

      if (!IsPostBack)
      {
         GetTemplate();
       }      
    }  
    Public void GetTemplate()
    {
       ShowTemplate();
    }
    Public void ShowTemplate()
    {
      //showTemplate code
      CKEditor1.Text = html;
    }

Thank you.


回答1:


CKEditorYou can use a simple javascript trick to "hide" the CKEditor until it has been initialized.

<div style="height: 400px; width: 600px;">
    <div style="display: none" id="CKPlaceHolder">
        <asp:TextBox ID="CKEditorTextBox" runat="server" TextMode="MultiLine"></asp:TextBox>
    </div>
</div>

I use 2 <div> elements. One to actually hide the editor and the first one as a placeholder to prevent the jumping of the content once the editor will be shown.

And then somewhere in JavaScript:

setTimeout(function () { document.getElementById('CKPlaceHolder').style.display = "block"; }, 500);


来源:https://stackoverflow.com/questions/40127198/how-to-remove-html-code-at-the-time-of-page-loads-ck-editor-loading-the-text-in

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!