-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy patheditor_plugin.js
80 lines (75 loc) · 2.96 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
(function() {
tinymce.PluginManager.requireLangPack( 'photonav' );
tinymce.create( 'tinymce.plugins.PhotoNav', {
init : function( ed, url ) {
ed.addButton( 'photonav', {
title : 'WP-PhotoNav shortcode',
cmd : 'photonav_dlg',
image : url + '/media-button-fullscreen.gif',
});
ed.addCommand( 'photonav_dlg', function() {
ed.windowManager.open({
title: 'WP-PhotoNav',
body: [
{ type: 'textbox', name: 'url', label: ed.getLang( 'photonav.image_url' ) },
{ type: 'listbox', name: 'mode', label: ed.getLang( 'photonav.mode' ), values: [
{ text: ed.getLang( 'photonav.mode_move' ), value: 'move' },
{ text: ed.getLang( 'photonav.mode_drag' ), value: 'drag' },
{ text: ed.getLang( 'photonav.mode_360' ), value: 'drag360' },
] },
{ type: 'listbox', name: 'popup', label: ed.getLang( 'photonav.popup' ), values: [
{ text: ed.getLang( 'photonav.pop_none' ), value: 'none' },
{ text: ed.getLang( 'photonav.pop_colorbox' ), value: 'colorbox' },
] },
{ type: 'listbox', name: 'animate', label: ed.getLang( 'photonav.animation' ), values: [
{ text: ed.getLang( 'photonav.ani_none' ), value: 'none' },
{ text: ed.getLang( 'photonav.ani_left' ), value: 'left' },
{ text: ed.getLang( 'photonav.ani_right' ), value: 'right' },
{ text: ed.getLang( 'photonav.ani_zoom' ), value: 'zoom' },
] },
{ type: 'listbox', name: 'position', label: ed.getLang( 'photonav.position' ), values: [
{ text: ed.getLang( 'photonav.pos_center' ), value: 'center' },
{ text: ed.getLang( 'photonav.pos_left' ), value: 'left' },
{ text: ed.getLang( 'photonav.pos_right' ), value: 'right' },
] },
{ type: 'checkbox', name: 'label', label: ed.getLang( 'photonav.label' )},
{ type: 'textbox', name: 'width', label: ed.getLang( 'photonav.width' )},
{ type: 'textbox', name: 'height', label: ed.getLang( 'photonav.height' )},
],
onSubmit: function( e ) {
var output = '';
// setup the output of our shortcode
output = '[photonav ';
output += 'url=' + e.data.url + ' ';
output += 'mode=' + e.data.mode + ' ';
output += 'popup=' + e.data.popup + ' ';
output += 'animate=' + e.data.animate + ' ';
output += 'position=' + e.data.position + ' ';
if ( e.data.label === true ) {
output += 'label=true ';
}
output += 'container_width=' + e.data.width + ' ';
output += 'container_height=' + e.data.height + ']';
ed.execCommand( 'mceInsertContent', false, output );
},
}, {
plugin_url : url,
});
});
},
createControl : function( n, cm ) {
return null;
},
getInfo : function() {
return {
longname : 'WP-PhotoNav plugin',
author : 'Fabian Stanke',
authorurl : 'http://fmos.at',
infourl : 'http://fmos.at/wp-photonav',
version : "1.2"
};
}
});
// Register plugin
tinymce.PluginManager.add( 'photonav', tinymce.plugins.PhotoNav );
})();