问题
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