Reputation: 1859
I am trying to develop a custom control for Umbraco that would allow us to dynamically set the length of text allowed in TinyMCE. I have already implemented something similar for a normal text box but I am stuck on how to implement it with the RTE. I found no .dll that I could reference and although there is a little bit of code on their site; it is only concerned with the javascript.
Any ideas on where to start would be great.
Upvotes: 1
Views: 1414
Reputation: 50832
You can implement a tinymce init parameter "max_chars" yourself
tinyMCE.init({
...
max_chars : "10", // place your char limit here
setup : function(ed) {
ed.onKeyDown.add(function(ed, evt) {
if ( $(ed.getBody()).text().length > ed.getParam('max_char')){
e.preventDefault();
e.stopPropagation();
return false;
}
});
},
...
});
Upvotes: 1