CKEDITOR get实例不工作

CKEDITOR get instance doesnt working

本文关键字:工作 实例 get CKEDITOR      更新时间:2023-09-26

我有一个ckeditor对象,我想插入文本当前位置。所以我试图得到ckeditor对象,但页面返回错误。我的ckeditor版本是3.6.4

ASPX:

<%@ Register Assembly="CKEditor.NET" Namespace="CKEditor.NET" TagPrefix="CKEditor" %>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
    <CKEditor:CKEditorControl Width="100%" BasePath="~/Controls/Base/ckeditor" CssClass="AutoCompColumnList" ID="txtMessageBody" Height="500px" runat="server"
    </CKEditor:CKEditorControl>
    </ContentTemplate>
 </asp:UpdatePanel>

我试过了:

CKEDITOR.instances.txtMessageBody。insertttext ('some text here');

错误:

CKEDITOR没有定义!

我最近尝试使用CKEditor,但放弃了,因为它似乎需要很长时间才能进入页面,因为它不断在html中添加回车。为了去掉它,我必须这样写:

var editor;
function changeEnter()
{
if (editor)
    editor.destroy(true);
editor = CKEDITOR.replace('CKEditor1',
{
on:
{
instanceReady: function (ev)
{
//output paragraphs as <p>Text</p>
this.dataProcessor.write.setRules('p',
{
indent: false,
breakBeforeOpen: true
});
}
}
});
window.onload = changeEnter;

我从他们的一个样本页面上摘取了所有这些。我不知道它有什么用,但确实有用。在把它放在页面上之前,我一直得到CKEditor未定义的消息。

对不起,我懒得缩进代码。为什么在这个网站上发代码这么难?它将自己定位为卓越的软件论坛——然而你必须编写代码的方式是可怕的。为什么没有像其他网站那样的[代码]标签?