PluginProbe
WpStream – Live Streaming, Video on Demand, Pay Per View / 4.14.0
WpStream – Live Streaming, Video on Demand, Pay Per View v4.14.0
4.14.1 4.14.0 4.13.2 4.13.1 4.13 4.12.5 4.12.4 4.12.3 4.12.2 4.12.1 4.12 4.4.4 4.4.5 4.4.6 4.4.7 4.4.8 4.4.9 4.5 4.5.1 4.5.11 4.5.11.1 4.5.11.2 4.5.11.4 4.5.11.5 4.5.11.6 All 181 releases
wpstream / public / js / shortcodes.js

shortcodes.js in WpStream – Live Streaming, Video on Demand, Pay Per View 4.14.0, at public/js/shortcodes.js

43 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /*
2 * WpStream TinyMCE shortcode buttons.
3 *
4 * Registers the player toolbar button for the WordPress Classic Editor.
5 */
6
7 // Register the "WpStream Player" shortcode button.
8 (function () {
9 "use strict";
10 // Define the TinyMCE plugin that provides the player-insertion button.
11 tinymce.create('tinymce.plugins.wpstream_player', {
12 /**
13 * TinyMCE plugin init: add the toolbar button to the editor.
14 *
15 * @param {object} ed The TinyMCE editor instance.
16 * @param {string} url Base URL of this plugin's asset folder (for images).
17 */
18 init: function (ed, url) {
19 // Register the toolbar button and its click behaviour.
20 ed.addButton('wpstream_player', {
21 title: 'WpStream Player', // tooltip shown on hover
22 image: url + '/button.png', // button icon, resolved against the asset URL
23 onclick: function () {
24 // Insert an empty player shortcode skeleton at the cursor.
25 ed.selection.setContent('[wpstream_player id="Add here the live stream id or the video id" ][/wpstream_player]');
26 }
27 });
28 },
29 /**
30 * TinyMCE plugin createControl hook: no custom control is provided.
31 *
32 * @param {string} n Control name requested by TinyMCE.
33 * @param {object} cm Control manager.
34 * @return {null} Always null (this plugin only adds a button).
35 */
36 createControl: function (n, cm) {
37 return null;
38 }
39 });
40 // Register the completed plugin definition with TinyMCE.
41 tinymce.PluginManager.add('wpstream_player', tinymce.plugins.wpstream_player);
42 })();
43