/
editor_plugin.js
61 lines (60 loc) · 1.72 KB
/
editor_plugin.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
(function() {
tinymce.create('tinymce.plugins.CT_YouTubeButton', {
init : function(ed, url) {
ed.addButton('ct_youtube_button', {
title : 'Add YouTube Video',
image : url+'/youtube.png',
onclick : function() {
idPattern = /(?:(?:[^v]+)+v.)?([^&=]{11})(?=&|$)/;
var vidId = prompt("Embed YouTube Video", "Enter the ID of your video");
var m = idPattern.exec(vidId);
if (m != null && m != 'undefined')
ed.execCommand('mceInsertContent', false, '[youtube id="'+m[1]+'"]');
}
});
},
createControl : function(n, cm) {
return null;
},
getInfo : function() {
return {
longname : "YouTube Shortcode",
author : 'ChurchThemes',
authorurl : 'http://churchthemes.net',
infourl : 'http://churchthemes.net',
version : "1.2"
};
}
});
tinymce.PluginManager.add('ct_youtube_button', tinymce.plugins.CT_YouTubeButton);
})();
(function() {
tinymce.create('tinymce.plugins.CT_VimeoButton', {
init : function(ed, url) {
ed.addButton('ct_vimeo_button', {
title : 'Add Vimeo Video',
image : url+'/vimeo.png',
onclick : function() {
idPattern = /(^\s*\d+\s*$)/;
var vidId = prompt("Embed Vimeo Video", "Enter the ID of your video");
var m = idPattern.exec(vidId);
if (m != null && m != 'undefined')
ed.execCommand('mceInsertContent', false, '[vimeo id="'+m[1]+'"]');
}
});
},
createControl : function(n, cm) {
return null;
},
getInfo : function() {
return {
longname : "Vimeo Shortcode",
author : 'ChurchThemes',
authorurl : 'http://churchthemes.net',
infourl : 'http://churchthemes.net',
version : "1.2"
};
}
});
tinymce.PluginManager.add('ct_vimeo_button', tinymce.plugins.CT_VimeoButton);
})();