-
Notifications
You must be signed in to change notification settings - Fork 3
/
youtube.js
38 lines (31 loc) · 1.11 KB
/
youtube.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*global window */
(function (window) {
'use strict';
window.tinymce.create('tinymce.plugins.YouTubeShortCodePlugin', {
init: function (ed, url) {
var t = this;
t.editor = ed;
ed.addCommand('insertYouTubeShortCode', function () {
var str = '[youtube id=][/youtube]';
ed.execCommand('mceInsertContent', false, str);
});
// Register button
ed.addButton('youtube', {
title: 'Insert YouTube ShortCode',
image: 'shortcodes/images/youtube.png',
cmd: 'insertYouTubeShortCode'
});
},
getInfo: function () {
return {
longname: 'ShortCodes Module - YouTube',
author: 'Studio Bonito Ltd',
authorurl: 'http://www.studiobonito.co.uk',
infourl: 'http://www.studiobonito.co.uk',
version: '1.0.0'
};
}
});
// Register plugins
window.tinymce.PluginManager.add('youtube', window.tinymce.plugins.YouTubeShortCodePlugin);
}(window));