How to turn on visualchars on startup in tinyMCE 4 -
i want have visualchars button , functionality turned on editor initiated. tiny mce version 4 only, non jquery version.
why? don't know nbsp bad?
no, not trying offend god of html correctness. non breaking spaces compulsory in french text in several common instances (before question marks, exclamation marks, colons, semi colons name few occasions).
i want see non-breaking spaces are...
... , missing because review content created else (e.g. copy/pasted pdf or word), , speaking check text proper french typography.
here how call editor:
var ed = new tinymce.editor('tinymce1', { plugins: [ 'advlist link image charmap pagebreak', 'searchreplace wordcount visualblocks visualchars code fullscreen media nonbreaking', 'table template paste' ], language: 'fr_fr', element_format: 'html', keep_styles: false, paste_as_text: true, content_css: '/admin/css/tinymce.css', browser_spellcheck: false, toolbar1: "bold italic | styleselect formatselect | link unlink | bullist numlist | charmap subscript superscript | visualchars visualblocks nonbreaking", toolbar2: "image media | cut copy paste | searchreplace | undo redo | code | fullscreen | removeformat | spellchecker", menubar: false, toolbar_items_size: 'normal', style_formats: [ {title:'signature', block:'p', classes:'signature'} ], block_formats: 'paragraphe=p;titre 3=h3;titre 4=h4;div=div', setup: function(ed) { ed.on('keyup', function(e) { console.log('keyup: you, captured keyup event!'); }); ed.on('init', function(e) { console.log('init: nothing see here, kinda works.'); }); } // setup }, tinymce.editormanager); ed.render();
this works far, don't know how activate visualchars on startup.
additionally i'd able force visualchars every time insert nbsp, because default tinymce's behavior have turn off , on again.
and last not least, if there better editor tinymce or 1 better documentation noobs, i'd happy try it.
important: tinymce version 4 only
you need add oninit (then editor initialized , ready) activation of plugin.
additionally i'd able force visualchars every time insert nbsp, because default tinymce's behavior have turn off , on again.
you can check inserted character onkeydown , activate plugin (and button).
Comments
Post a Comment