peterlu
12 years agoChampion
tinymce custom plugin
Hi Guys,
I am developing a custom plugin for tinymce. The plugin will put a button on the menu bar of tinymce. When you click on the button, it gives you the window to type some text, then you can insert the text into the editor body. Here is the code:
tinymce.PluginManager.add('echo', function(editor) {
// Add a button that opens a window
editor.addButton('echo', {
text: 'Echo',
icon: false,
onclick: function() {
// Open window
editor.windowManager.open({
title: 'insert your echo',
body: [
{type: 'textbox', name: 'echo', label: 'Your echo:'}
],
onsubmit: function(e) {
// Insert content when the window form is submitted
editor.insertContent('<h1>' + e.data.echo + '</h1>');
}
});
}
});
});
tinymce.init({
selector: "textarea",
plugins: "echo",
toolbar: "echo undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image"
});
I have test it in a local html file. It works.
Now the question is: How can I use the Lithium JS object to integration this code into Lithium tinymce. You can normally find this tinymce in new message page or reply page.