I am using TinyMCE and loading it dynamically. The issue I am having is I want to be able to specify different parameters depending on the textarea. I have created a function, but I am stuck on the removeformat parameter as I am not sure how to set it as “default” if I don’t pass in anything for it. A stripped down version of the function is:
function initTinyMCE(sel,lang) {
tinyMCE.init({
mode : "specific_textareas",
editor_selector : sel,
language : lang,
removeformat : [
{selector : 'p,b,strong,em,i,span,ins', remove : 'all', split : true, expand : false, block_expand : true, deep : true}
]
});
}
So I pass in the selector (sel) and the language (lang) and I would like to pass in the removeformat parameter, but it needs to be an object and I am not sure what to do to make it as if the parameter wasn’t added. I know I could add a conditional statement and declare 2 different tinyMCE.init, but I am hoping and wondering if there is another option to either remove that parameter before initialization or make it pull from the default as if it wasn’t declared?
Any help would be appreciated.
Thanks.
That depends on the use case. In your case i think this would make sense. You may apply a tinymce configuration setting/parameter after initialization using something like
Be aware that some tinymce settings will be used during initialization and changing that setting will change nothing after tinymce is initialized (
removeformatdoes not belong to those).