This is a migrated thread and some comments may be shown as answers.

Character Limit In RadEditor

3 Answers 323 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Rodney
Top achievements
Rank 2
Rodney asked on 18 May 2017, 04:42 PM

I need to provide character limit functionality in RadEditor and have been having a significant number of issues getting a comprehensive solution. I've read a number of items on the Forum that sometimes give conflicting and incomplete solutions.

Requirement:

  • Prevent typing of more than n Number of characters
  • Prevent of more than n Number of characters
  • Ability to strip formatting from pasted content
  • Multiple Editors on the same page or AJAX Modal Popup

The last article I was looking at was: http://www.telerik.com/forums/charector-limit-in-rad-editor#662718 which is pretty close in functionality to what I need, but when determining the length of the content on the clipboard the formatting from Word, or wherever you picked the text up from is included in that length.

If you could provide some code snippets or point me to an article that will correctly work I would appreciate it.

Rodney

3 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 23 May 2017, 11:37 AM
Hi Rodney,

RadEditor officially supports only the MaxTextLength and MaxHtmlLength properties/features.

The custom solutions shared and discussed in the Character limit in Rad:Editor forum cover almost everything asked over the years for this scenario, but they are not part of the supported features of RadEditor. You can use them as a base to proceed with your custom scenario and modifying them depending on your needs and used browser.

Best regards,
Rumen
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Rodney
Top achievements
Rank 2
answered on 02 Jun 2017, 05:24 PM

Here's my problem. We use the RadEditorStatistics for all of our RedEditors. This only counts visible characters, not actual characters which the MaxHtmlLength does. So if I have a text box that allows 4000 characters and my DB field is 4000 characters and there is any formatting at all in the text the MaxTexLegth won't give a message, but the MaxHtmlWill, but the statistics say there are 4000 characters and my users don't understand why they are getting an error.

Isn't there some way to come up with a unified approach to this? Something that would get all of the options of the control to work together instead of against each other?

Thanks

Rodney

0
Rumen
Telerik team
answered on 05 Jun 2017, 02:26 PM

Hello Rodney,

You can modify the default behavior of the statistics module of RadEditor as shown in this thread: http://www.telerik.com/forums/how-to-make-statistics-module-fire-for-every-keystroke#PfHC1gThR0OejXkCDFCUtg and remove the reg expressions which strip the special symbols and the markup:

 

punctRegX = /[!\.?;,:&_\-\-\{\}\[\]\(\)~#'"]/g;
//content = content.replace(punctRegX, "");
trimRegX = /(^\s+)|(\s+$)/g;
//content = content.replace(trimRegX, "");

 

Best regards,
Rumen
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Editor
Asked by
Rodney
Top achievements
Rank 2
Answers by
Rumen
Telerik team
Rodney
Top achievements
Rank 2
Share this question
or