github.com/insionng/yougam@v0.0.0-20170714101924-2bc18d833463/public/libs/tinymce/plugins/jbimages/editor_plugin_src.js (about)

     1  /**
     2   * Justboil.me - a TinyMCE image upload plugin
     3   * jbimages/plugin.js
     4   *
     5   * Released under Creative Commons Attribution 3.0 Unported License
     6   *
     7   * License: http://creativecommons.org/licenses/by/3.0/
     8   * Plugin info: http://justboil.me/
     9   * Author: Viktor Kuzhelnyi
    10   *
    11   * Version: 2.3 released 23/06/2013
    12   */
    13   
    14  (function() {
    15  	// Load plugin specific language pack
    16  	tinymce.PluginManager.requireLangPack('jbimages');
    17  
    18  	tinymce.create('tinymce.plugins.jbImagesPlugin', {
    19  		/**
    20  		 * Initializes the plugin, this will be executed after the plugin has been created.
    21  		 * This call is done before the editor instance has finished it's initialization so use the onInit event
    22  		 * of the editor instance to intercept that event.
    23  		 *
    24  		 * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
    25  		 * @param {string} url Absolute URL to where the plugin is located.
    26  		 */
    27  		init : function(ed, url) {
    28  			// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
    29  			ed.addCommand('jbImages', function() {
    30  				var unixtime_ms = new Date().getTime();
    31  				ed.windowManager.open({
    32  					file : url + '/dialog.htm?z' + unixtime_ms,
    33  					width : 330 + parseInt(ed.getLang('jbimages.delta_width', 0)),
    34  					height : 155 + parseInt(ed.getLang('jbimages.delta_height', 0)),
    35  					inline : 1
    36  				}, {
    37  					plugin_url : url // Plugin absolute URL
    38  				});
    39  			});
    40  
    41  			// Register example button
    42  			ed.addButton('jbimages', {
    43  				title : 'jbimages.desc',
    44  				cmd : 'jbImages',
    45  				image : url + '/img/jbimages-bw.gif'
    46  			});
    47  
    48  			// Add a node change handler, selects the button in the UI when a image is selected
    49  			ed.onNodeChange.add(function(ed, cm, n) {
    50  				cm.setActive('jbimages', n.nodeName == 'IMG');
    51  			});
    52  		},
    53  
    54  		/**
    55  		 * Creates control instances based in the incomming name. This method is normally not
    56  		 * needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons
    57  		 * but you sometimes need to create more complex controls like listboxes, split buttons etc then this
    58  		 * method can be used to create those.
    59  		 *
    60  		 * @param {String} n Name of the control to create.
    61  		 * @param {tinymce.ControlManager} cm Control manager to use inorder to create new control.
    62  		 * @return {tinymce.ui.Control} New control instance or null if no control was created.
    63  		 */
    64  		createControl : function(n, cm) {
    65  			return null;
    66  		},
    67  
    68  		/**
    69  		 * Returns information about the plugin as a name/value array.
    70  		 * The current keys are longname, author, authorurl, infourl and version.
    71  		 *
    72  		 * @return {Object} Name/value array containing information about the plugin.
    73  		 */
    74  		getInfo : function() {
    75  			return {
    76  				longname : 'JustBoil.me Images Plugin',
    77  				author : 'Viktor Kuzhelnyi',
    78  				authorurl : 'http://justboil.me/',
    79  				infourl : 'http://justboil.me/',
    80  				version : "2.3"
    81  			};
    82  		}
    83  	});
    84  
    85  	// Register plugin
    86  	tinymce.PluginManager.add('jbimages', tinymce.plugins.jbImagesPlugin);
    87  })();