Consider the initialization:
function initMyTinymce() {
tinymce.init({
selector: $(this).attr("id"),
directionality: "ltr",
});
}
Is it possible to add properties to tinyMCE after init()
?
For example:
plugins: "link,code,textcolor",
relative_urls: false,
convert_urls: false,
remove_script_host: false
I'm using TinyMce 4.1.6 (2014-10-08).
Yes, this is possible, but parameters that get read on initialisation only won't have an impact if they get set later on. Example: To change the parameter plugins changes nothing because the tinymce UI has been rendered already.
To set a paramter after initialization use:
editor.settings.my_setting = 'abcd',
function Tiny_readonly(id, action) {
tinymce.get(id).remove();
if (action == 0) {
tinymce.init({
selector: 'textarea#' + id,
skin: 'dark',
height: 200,
readonly: true,
toolbar: false,
menubar: false,
statusbar: false,
init_instance_callback: function(editor) {},
});
} else {
tinymce.init({
selector: 'textarea#' + id,
height: 250,
menubar: false,
skin: 'default',
plugins: [
'advlist autolink lists link charmap print preview anchor',
'searchreplace visualblocks code fullscreen',
'insertdatetime media table paste code help wordcount'
],
toolbar: 'undo redo | formatselect | ' +
'bold italic backcolor | alignleft aligncenter ' +
'alignright alignjustify | bullist numlist outdent indent | ' +
'removeformat | table',
content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:14px }'
});
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With