You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
761 B
21 lines
761 B
(function() {
|
|
tinymce.PluginManager.add('polls', function(editor) {
|
|
editor.addCommand('WP-Polls-Insert_Poll', function() {
|
|
var poll_id = jQuery.trim(prompt(tinymce.translate('Enter Poll ID')));
|
|
while(isNaN(poll_id)) {
|
|
poll_id = jQuery.trim(prompt(tinymce.translate('Error: Poll ID must be numeric') + "\n\n" + tinymce.translate('Please enter Poll ID again')));
|
|
}
|
|
if (poll_id >= -1 && poll_id != null && poll_id != "") {
|
|
editor.insertContent('[poll id="' + poll_id + '"]');
|
|
}
|
|
});
|
|
editor.addButton('polls', {
|
|
text: false,
|
|
tooltip: tinymce.translate('Insert Poll'),
|
|
icon: 'polls dashicons-before dashicons-chart-bar',
|
|
onclick: function() {
|
|
tinyMCE.activeEditor.execCommand('WP-Polls-Insert_Poll')
|
|
}
|
|
});
|
|
});
|
|
})(); |