PluginProbe
Timed Content / 2.4
Timed Content v2.4
2.99 trunk 1.0 1.1 1.2 2.0 2.1 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.10 2.11 2.12 2.15 2.2 2.3 2.3.1 2.4 2.5 2.5.1 2.50 2.51 2.52 All 67 releases
timed-content / tinymce_plugin / plugin.js

plugin.js in Timed Content 2.4, at tinymce_plugin/plugin.js

82 lines 3.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * plugin.js
3 *
4 */
5
6 (function() {
7 tinymce.create('tinymce.plugins.TimedContentPlugin', {
8 /**
9 * Initializes the plugin, this will be executed after the plugin has been created.
10 * This call is done before the editor instance has finished it's initialization so use the onInit event
11 * of the editor instance to intercept that event.
12 *
13 * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
14 * @param {string} url Absolute URL to where the plugin is located.
15 */
16 init : function(ed, url) {
17 var buttonOpts = {};
18 // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
19 ed.addCommand('mceTimedContent', function() {
20 ed.windowManager.open({
21 file : ajaxurl + '?action=timedContentPluginGetTinyMCEDialog',
22 width : 640 + parseInt(ed.getLang('timed_content.delta_width', 0)),
23 height : 420 + parseInt(ed.getLang('timed_content.delta_height', 0)),
24 inline : 1
25 }, {
26 plugin_url : url, // Plugin absolute URL
27 });
28 });
29
30 if (timedContentAdminTinyMCEOptions.image.length > 0) {
31 buttonOpts.title = timedContentAdminTinyMCEOptions.desc;
32 buttonOpts.cmd = 'mceTimedContent';
33 buttonOpts.image = url + timedContentAdminTinyMCEOptions.image;
34 } else {
35 buttonOpts.title = timedContentAdminTinyMCEOptions.desc;
36 buttonOpts.cmd = 'mceTimedContent';
37 }
38 buttonOpts.stateSelector = "img";
39
40 // Register example button
41 ed.addButton('timed_content', buttonOpts);
42
43 // Add a node change handler, selects the button in the UI when a image is selected
44 // ed.on( 'NodeChange', function(ed, cm, n) {
45 // cm.setActive('timed_content', n.nodeName == 'IMG');
46 // });
47 },
48
49 /**
50 * Creates control instances based in the incoming name. This method is normally not
51 * needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons
52 * but you sometimes need to create more complex controls like list-boxes, split buttons, etc. then this
53 * method can be used to create those.
54 *
55 * @param {String} n Name of the control to create.
56 * @param {tinymce.ControlManager} cm Control manager to use in order to create new control.
57 * @return {tinymce.ui.Control} New control instance or null if no control was created.
58 */
59 createControl : function(n, cm) {
60 return null;
61 },
62
63 /**
64 * Returns information about the plugin as a name/value array.
65 * The current keys are longname, author, authorurl, infourl and version.
66 *
67 * @return {Object} Name/value array containing information about the plugin.
68 */
69 getInfo : function() {
70 return {
71 longname : 'Timed Content shortcodes plugin',
72 author : 'K. Tough',
73 authorurl : 'http://wordpress.org/plugins/timed-content/',
74 infourl : 'http://wordpress.org/plugins/timed-content/',
75 version : timedContentAdminTinyMCEOptions.version
76 };
77 }
78 });
79
80 // Register plugin
81 tinymce.PluginManager.add('timed_content', tinymce.plugins.TimedContentPlugin);
82 })();