| Server IP : 209.209.40.120 / Your IP : 216.73.217.112 Web Server : Microsoft-IIS/10.0 System : Windows NT NEWWWW 10.0 build 17763 (Windows Server 2019) i586 User : NEWWWW$ ( 0) PHP Version : 8.3.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /SolidCP/Portal/tinymce/plugins/htmlchar_count/ |
Upload File : |
tinymce.PluginManager.add('htmlchar_count', function (editor) {
var self = this;
function update() {
editor.theme.panel.find('#htmlchar_count').text(['HTML Characters: {0}', editor.getContent().length + ' / ' + editor.settings.max_chars]);
}
editor.on('init', function () {
var statusbar = editor.theme.panel && editor.theme.panel.find('#statusbar')[0];
if (statusbar) {
window.setTimeout(function () {
statusbar.insert({
type: 'label',
name: 'htmlchar_count',
text: ['HTML Characters: {0}', editor.getContent().length + ' / ' + editor.settings.max_chars],
classes: 'wordcount',
disabled: editor.settings.readonly
}, 0);
editor.on('setcontent beforeaddundo', update);
editor.on('keyup', function (e) {
update();
});
var allowedKeys = [8, 37, 38, 39, 40, 46]; // backspace, delete and cursor keys
editor.on('keydown', function (e) {
if (allowedKeys.indexOf(e.keyCode) != -1) return true;
if ((tinymce.get(tinymce.activeEditor.id).getContent().length + 1) > editor.settings.max_chars) {
e.preventDefault();
e.stopPropagation();
return false;
}
return true;
});
}, 0);
}
});
});