2 * Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
\r
6 // Load plugin specific language pack
\r
7 tinymce.PluginManager.requireLangPack('example');
\r
9 tinymce.create('tinymce.plugins.ExamplePlugin', {
\r
11 * Initializes the plugin, this will be executed after the plugin has been created.
\r
12 * This call is done before the editor instance has finished it's initialization so use the onInit event
\r
13 * of the editor instance to intercept that event.
\r
15 * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
\r
16 * @param {string} url Absolute URL to where the plugin is located.
\r
18 init : function(ed, url) {
\r
19 // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
\r
20 ed.addCommand('mceExample', function() {
\r
21 ed.windowManager.open({
\r
22 file : url + '/dialog.htm',
\r
23 width : 320 + parseInt(ed.getLang('example.delta_width', 0)),
\r
24 height : 120 + parseInt(ed.getLang('example.delta_height', 0)),
\r
27 plugin_url : url, // Plugin absolute URL
\r
28 some_custom_arg : 'custom arg' // Custom argument
\r
32 // Register example button
\r
33 ed.addButton('example', {
\r
34 title : 'example.desc',
\r
36 image : url + '/img/example.gif'
\r
39 // Add a node change handler, selects the button in the UI when a image is selected
\r
40 ed.onNodeChange.add(function(ed, cm, n) {
\r
41 cm.setActive('example', n.nodeName == 'IMG');
\r
46 * Creates control instances based in the incomming name. This method is normally not
\r
47 * needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons
\r
48 * but you sometimes need to create more complex controls like listboxes, split buttons etc then this
\r
49 * method can be used to create those.
\r
51 * @param {String} n Name of the control to create.
\r
52 * @param {tinymce.ControlManager} cm Control manager to use inorder to create new control.
\r
53 * @return {tinymce.ui.Control} New control instance or null if no control was created.
\r
55 createControl : function(n, cm) {
\r
60 * Returns information about the plugin as a name/value array.
\r
61 * The current keys are longname, author, authorurl, infourl and version.
\r
63 * @return {Object} Name/value array containing information about the plugin.
\r
65 getInfo : function() {
\r
67 longname : 'Example plugin',
\r
68 author : 'Some author',
\r
69 authorurl : 'http://tinymce.moxiecode.com',
\r
70 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/example',
\r
77 tinymce.PluginManager.add('example', tinymce.plugins.ExamplePlugin);
\r