function setCount(editor,ui) {
editor.setOpt({
wordCount:true,
maximumWords:500,
wordCountMsg:editor.options.wordCountMsg || editor.getLang("wordCountMsg"),
wordOverFlowMsg:editor.options.wordOverFlowMsg || editor.getLang("wordOverFlowMsg")
});
var opt = editor.options,
max = opt.maximumWords,
msg = opt.wordCountMsg ,
errMsg = opt.wordOverFlowMsg,
countDom = ui.getDom('wordcount');
if (!opt.wordCount) {
return;
}
var count = editor.getContentLength(true);
if (count > max) {
// debugger;
var content = editor.getContentTxt();
editor.setContent(content.substring(0,max));
editor.focus(true);
} else {
countDom.innerHTML = msg.replace("{#leave}", max - count).replace("{#count}", count);
}
}