Add files via upload

Paypal plugin for TinyMCE
This commit is contained in:
Andrius Pratusis 2018-02-25 13:47:56 +02:00 committed by GitHub
parent fc3c4e5bc9
commit 5bcef9123e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -0,0 +1,28 @@
tinymce.PluginManager.add('paypal', function(editor, url) {
// Add a button that opens a window
editor.addButton('paypal', {
text: 'Paypal',
icon: false,
onclick: function() {
// Open window
editor.windowManager.open({
title: 'Paypal Bludit plugin',
body: [
{type: 'textbox', name: 'email', label: 'Your Paypal email'},
{type: 'textbox', name: 'title', label: 'Title'},
{type: 'textbox', name: 'price', label: 'Price'},
{type: 'textbox', name: 'currency', label: 'Currency'},
{type: 'textbox', name: 'url', label: 'Redirect to url after payment'}
],
onsubmit: function(e) {
// Insert content when the window form is submitted
var button="<form action='https://www.paypal.com/cgi-bin/webscr' method='post'><input type='hidden' name='business' value='"+e.data.email+"'><input type='hidden' name='cmd' value='_xclick'><input type='hidden' name='item_name' value='"+e.data.title+"'><input type='hidden' name='amount' value='"+e.data.price+"'><input type='hidden' name='currency_code' value='"+e.data.currency+"'><input type='hidden' name='return' value='"+e.data.url+"'><input type='image' name='submit' border='0'src='https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif' alt='Buy Now'>";
editor.insertContent(button);
}
});
}
});
});