annotate static/js/tiny_mce/plugins/example/editor_plugin_src.js @ 337:b4f0980506e0 rollout

Working around a strange CSS problem when bulletins are active. This should probably be investigated later.
author Brian Neal <bgneal@gmail.com>
date Sat, 26 Feb 2011 06:46:28 +0000
parents 88b2b9cb8c1f
children
rev   line source
bgneal@312 1 /**
bgneal@312 2 * editor_plugin_src.js
bgneal@312 3 *
bgneal@312 4 * Copyright 2009, Moxiecode Systems AB
bgneal@312 5 * Released under LGPL License.
bgneal@312 6 *
bgneal@312 7 * License: http://tinymce.moxiecode.com/license
bgneal@312 8 * Contributing: http://tinymce.moxiecode.com/contributing
bgneal@312 9 */
bgneal@312 10
bgneal@312 11 (function() {
bgneal@312 12 // Load plugin specific language pack
bgneal@312 13 tinymce.PluginManager.requireLangPack('example');
bgneal@312 14
bgneal@312 15 tinymce.create('tinymce.plugins.ExamplePlugin', {
bgneal@312 16 /**
bgneal@312 17 * Initializes the plugin, this will be executed after the plugin has been created.
bgneal@312 18 * This call is done before the editor instance has finished it's initialization so use the onInit event
bgneal@312 19 * of the editor instance to intercept that event.
bgneal@312 20 *
bgneal@312 21 * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
bgneal@312 22 * @param {string} url Absolute URL to where the plugin is located.
bgneal@312 23 */
bgneal@312 24 init : function(ed, url) {
bgneal@312 25 // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
bgneal@312 26 ed.addCommand('mceExample', function() {
bgneal@312 27 ed.windowManager.open({
bgneal@312 28 file : url + '/dialog.htm',
bgneal@312 29 width : 320 + parseInt(ed.getLang('example.delta_width', 0)),
bgneal@312 30 height : 120 + parseInt(ed.getLang('example.delta_height', 0)),
bgneal@312 31 inline : 1
bgneal@312 32 }, {
bgneal@312 33 plugin_url : url, // Plugin absolute URL
bgneal@312 34 some_custom_arg : 'custom arg' // Custom argument
bgneal@312 35 });
bgneal@312 36 });
bgneal@312 37
bgneal@312 38 // Register example button
bgneal@312 39 ed.addButton('example', {
bgneal@312 40 title : 'example.desc',
bgneal@312 41 cmd : 'mceExample',
bgneal@312 42 image : url + '/img/example.gif'
bgneal@312 43 });
bgneal@312 44
bgneal@312 45 // Add a node change handler, selects the button in the UI when a image is selected
bgneal@312 46 ed.onNodeChange.add(function(ed, cm, n) {
bgneal@312 47 cm.setActive('example', n.nodeName == 'IMG');
bgneal@312 48 });
bgneal@312 49 },
bgneal@312 50
bgneal@312 51 /**
bgneal@312 52 * Creates control instances based in the incomming name. This method is normally not
bgneal@312 53 * needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons
bgneal@312 54 * but you sometimes need to create more complex controls like listboxes, split buttons etc then this
bgneal@312 55 * method can be used to create those.
bgneal@312 56 *
bgneal@312 57 * @param {String} n Name of the control to create.
bgneal@312 58 * @param {tinymce.ControlManager} cm Control manager to use inorder to create new control.
bgneal@312 59 * @return {tinymce.ui.Control} New control instance or null if no control was created.
bgneal@312 60 */
bgneal@312 61 createControl : function(n, cm) {
bgneal@312 62 return null;
bgneal@312 63 },
bgneal@312 64
bgneal@312 65 /**
bgneal@312 66 * Returns information about the plugin as a name/value array.
bgneal@312 67 * The current keys are longname, author, authorurl, infourl and version.
bgneal@312 68 *
bgneal@312 69 * @return {Object} Name/value array containing information about the plugin.
bgneal@312 70 */
bgneal@312 71 getInfo : function() {
bgneal@312 72 return {
bgneal@312 73 longname : 'Example plugin',
bgneal@312 74 author : 'Some author',
bgneal@312 75 authorurl : 'http://tinymce.moxiecode.com',
bgneal@312 76 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/example',
bgneal@312 77 version : "1.0"
bgneal@312 78 };
bgneal@312 79 }
bgneal@312 80 });
bgneal@312 81
bgneal@312 82 // Register plugin
bgneal@312 83 tinymce.PluginManager.add('example', tinymce.plugins.ExamplePlugin);
bgneal@312 84 })();