首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >CKEditor :在页中定义配置

CKEditor :在页中定义配置
EN

Stack Overflow用户
提问于 2015-06-12 04:33:52
回答 2查看 287关注 0票数 0

我有一个具有以下CKEditor的ASP.net用户控件

代码语言:javascript
复制
<%@ Register Assembly="CKEditor.NET" Namespace="CKEditor.NET" TagPrefix="CKEditor" %>

<CKEditor:CKEditorControl ID="txtHtmlText" BasePath="~/Scripts/ckeditor/" 
        Toolbar="Bold|Italic|Underline|Strike|Subscript|Superscript|-    |TextColor|BGColor|Font|FontSize
JustifyLeft|JustifyCenter|JustifyRight|Justify|-|Outdent|Indent|-    |NumberedList|BulletedList
Cut|Copy|Paste|PasteText|PasteFromWord|-|HorizontalRule|Link|Unlink|-    |Source|About"runat="server"></CKEditor:CKEditorControl>

我正在尝试覆盖CKEditor的config.js中定义的字数限制。我在.ascx文件中使用了以下代码,并得到了错误

“未捕获ReferenceError:未定义检查器”。请帮帮忙

代码语言:javascript
复制
<script type="text/javascript">

    CKEDITOR.replace('txtHtmlText',
{
    wordcount: {
        // Whether or not you want to show the Paragraphs Count
        showParagraphs: false,

        // Whether or not you want to show the Word Count
        showWordCount: false,

        // Whether or not you want to show the Char Count
        showCharCount: true,

        // Whether or not you want to count Spaces as Chars
        countSpacesAsChars: false,

        // Whether or not to include Html chars in the Char Count
        countHTML: false,

        // Maximum allowed Word Count, -1 is default for unlimited
        maxWordCount: 500,

        // Maximum allowed Char Count, -1 is default for unlimited
        maxCharCount: 500
    }
});
</script>
EN

回答 2

Stack Overflow用户

发布于 2015-06-25 20:52:52

我今天尝试了我的需求,我能够成功地添加功能。

如果我处在你的位置,我会检查几件事

  1. 是对CKEditor的引用已添加(我知道这很明显)
  2. 添加extraPlugins:'wordcount',就在wordcount:{
  3. 查看开发人员控制台以获取任何进一步的wordcount

这个链接帮助我解决了我的问题@ https://github.com/w8tcha/CKEditor-WordCount-Plugin/blob/master/wordcount/samples/wordcountWithMaxCount.html

票数 1
EN

Stack Overflow用户

发布于 2015-06-25 21:02:14

@Vinayak Prabha,

按照Vikram的建议进行尝试。然而,这是一个问题?

客户端Id "txtHtmlText“是服务器id,如果必须在java脚本中使用,则应使用CKEditor ID。

试着这样做

var ckEditorClientID = "#<%=txtHtmlText.ClientID %>";

CKEDITOR.replace(ckEditorClientID、

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30790907

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档