问题
I would like to replace bold tag, , with strong tag, in TinyMCE. How to do it in Plone using Products.TinyMCE?
I read TinyMCE document, http://www.tinymce.com/wiki.php/Configuration:valid_elements. Below is how to do it in TinyMCE:
tinyMCE.init({
...
valid_elements : "strong/b"
});
Thanks.
回答1:
I never tested this change, however you can try what you learned patching "tiny_mce_init.js".
To do this I suggest to use z3c.jbot (see also http://blog.keul.it/2011/06/z3cjbot-magical-with-your-skins.html).
回答2:
You may do this using the tinymce configuration:
tinyMCE.init({
...
extended_valid_elements : "strong/b",
....
// Override internal formats
formats: {
bold : {inline : 'strong' }
},
...
});
In case you have editor content already saved in the database with b-tags it might be needed to replace those tags on serverside with strong-tags.
回答3:
Both keul and Thariama answers are correct. I have to combine both answers in order for TinyMCE working in Plone.
Here is how I do it, - patching/overriding "tiny_mce_init.js" with the name "Products.TinyMCE.skins.tinymce.tiny_mce_init.js" using z3c.jbot.
function TinyMCEConfig(id) {
...
this.init = function() {
...
var init_dict = {
...
fix_list_elements : false,
extended_valid_elements : "strong/b",
// Override internal formats
formats: {
bold : {inline : 'strong' }
}
};
...
};
...
}
来源:https://stackoverflow.com/questions/10394205/how-to-replace-b-with-strong-in-tinymce-for-plone