Reputation: 789
I have a ASP.net user control with the below CKEditor
<%@ 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>
I'm trying to override word count limit defined in config.js of CKEditor. I used the below code int the .ascx file and is getting the Error
"Uncaught ReferenceError: CKEDITOR is not defined". Please help
<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>
Upvotes: 0
Views: 325
Reputation: 372
@Vinayak Prabha,
Try as suggested by Vikram. However a question ?
CKEditor ID "txtHtmlText" is server id, if you have to use in java script you should use client Id.
Try like this
var ckEditorClientID = "#<%=txtHtmlText.ClientID %>";
CKEDITOR.replace(ckEditorClientID,
Upvotes: 0
Reputation: 757
I tried today for my requirement and I was able to successfully add the feature.
If I would have been in your place, I would have checked couple of things
This link helped me solve my problem @ https://github.com/w8tcha/CKEditor-WordCount-Plugin/blob/master/wordcount/samples/wordcountWithMaxCount.html
Upvotes: 1