annotate media/js/tiny_mce/plugins/example/editor_plugin_src.js @ 265:1ba2c6bf6eb7

Closing #98. Animated GIFs were losing their transparency and animated properties when saved as avatars. Reworked the avatar save process to only run the avatar through PIL if it is too big. This preserves the original uploaded file if it is within the desired size settings. This may still mangle big animated gifs. If this becomes a problem, then maybe look into calling the PIL Image.resize() method directly. Moved the PIL image specific functions from bio.forms to a new module: core.image for better reusability in the future.
author Brian Neal <bgneal@gmail.com>
date Fri, 24 Sep 2010 02:12:09 +0000
parents 149c3567fec1
children
rev   line source
bgneal@45 1 /**
bgneal@183 2 * editor_plugin_src.js
bgneal@45 3 *
bgneal@183 4 * Copyright 2009, Moxiecode Systems AB
bgneal@183 5 * Released under LGPL License.
bgneal@183 6 *
bgneal@183 7 * License: http://tinymce.moxiecode.com/license
bgneal@183 8 * Contributing: http://tinymce.moxiecode.com/contributing
bgneal@45 9 */
bgneal@45 10
bgneal@45 11 (function() {
bgneal@45 12 // Load plugin specific language pack
bgneal@45 13 tinymce.PluginManager.requireLangPack('example');
bgneal@45 14
bgneal@45 15 tinymce.create('tinymce.plugins.ExamplePlugin', {
bgneal@45 16 /**
bgneal@45 17 * Initializes the plugin, this will be executed after the plugin has been created.
bgneal@45 18 * This call is done before the editor instance has finished it's initialization so use the onInit event
bgneal@45 19 * of the editor instance to intercept that event.
bgneal@45 20 *
bgneal@45 21 * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
bgneal@45 22 * @param {string} url Absolute URL to where the plugin is located.
bgneal@45 23 */
bgneal@45 24 init : function(ed, url) {
bgneal@45 25 // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
bgneal@45 26 ed.addCommand('mceExample', function() {
bgneal@45 27 ed.windowManager.open({
bgneal@45 28 file : url + '/dialog.htm',
bgneal@45 29 width : 320 + parseInt(ed.getLang('example.delta_width', 0)),
bgneal@45 30 height : 120 + parseInt(ed.getLang('example.delta_height', 0)),
bgneal@45 31 inline : 1
bgneal@45 32 }, {
bgneal@45 33 plugin_url : url, // Plugin absolute URL
bgneal@45 34 some_custom_arg : 'custom arg' // Custom argument
bgneal@45 35 });
bgneal@45 36 });
bgneal@45 37
bgneal@45 38 // Register example button
bgneal@45 39 ed.addButton('example', {
bgneal@45 40 title : 'example.desc',
bgneal@45 41 cmd : 'mceExample',
bgneal@45 42 image : url + '/img/example.gif'
bgneal@45 43 });
bgneal@45 44
bgneal@45 45 // Add a node change handler, selects the button in the UI when a image is selected
bgneal@45 46 ed.onNodeChange.add(function(ed, cm, n) {
bgneal@45 47 cm.setActive('example', n.nodeName == 'IMG');
bgneal@45 48 });
bgneal@45 49 },
bgneal@45 50
bgneal@45 51 /**
bgneal@45 52 * Creates control instances based in the incomming name. This method is normally not
bgneal@45 53 * needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons
bgneal@45 54 * but you sometimes need to create more complex controls like listboxes, split buttons etc then this
bgneal@45 55 * method can be used to create those.
bgneal@45 56 *
bgneal@45 57 * @param {String} n Name of the control to create.
bgneal@45 58 * @param {tinymce.ControlManager} cm Control manager to use inorder to create new control.
bgneal@45 59 * @return {tinymce.ui.Control} New control instance or null if no control was created.
bgneal@45 60 */
bgneal@45 61 createControl : function(n, cm) {
bgneal@45 62 return null;
bgneal@45 63 },
bgneal@45 64
bgneal@45 65 /**
bgneal@45 66 * Returns information about the plugin as a name/value array.
bgneal@45 67 * The current keys are longname, author, authorurl, infourl and version.
bgneal@45 68 *
bgneal@45 69 * @return {Object} Name/value array containing information about the plugin.
bgneal@45 70 */
bgneal@45 71 getInfo : function() {
bgneal@45 72 return {
bgneal@45 73 longname : 'Example plugin',
bgneal@45 74 author : 'Some author',
bgneal@45 75 authorurl : 'http://tinymce.moxiecode.com',
bgneal@45 76 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/example',
bgneal@45 77 version : "1.0"
bgneal@45 78 };
bgneal@45 79 }
bgneal@45 80 });
bgneal@45 81
bgneal@45 82 // Register plugin
bgneal@45 83 tinymce.PluginManager.add('example', tinymce.plugins.ExamplePlugin);
bgneal@45 84 })();