简体   繁体   中英

how to use variables in tinyMCE.init tiny mce?

Can we use variables in tinyMCE.init() ? I want to decide the available set of buttons on value of formatselect. Is this possible ?

I was able to do what you were asking. Before the init() , but after the <script> be sure to declare the variable

-- var buttonToolBar="bold,italic";

Then, be sure to type the setting correctly

-- theme_advanced_disable: buttonToolBar,

(I noticed that there was no underscore between theme and advanced in your post) This worked for me, and the [Bold] and [Italic] buttons were not visible on my editor.

Yes, this is possible. You only have to make sure that this variables are accessible from the tinymce init function. For example:

var content_file = "/css/content.css";

tinyMCE.init({
        // General options
        mode : "textareas",
        theme : "advanced",
        plugins : "code,...",

        content_css: content_file,  // used here

        language : 'de'
});

You may also use a scriptlanguage liek perl or php to dynamically create your javascript code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM