Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2014
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. ( function() {
  2. tinymce.PluginManager.add( 'dqshortcodes', function( editor, url ) {
  3. console.log(url);
  4. // Add a button that opens a window
  5. editor.addButton( 'showrecent', {
  6.  
  7. text: 'Recent posts',
  8. icon: false,
  9. onclick: function() {
  10. // Open window
  11. editor.windowManager.open({
  12. title: 'Example plugin',
  13. body: [{
  14. type: 'textbox',
  15. name: 'numberofposts',
  16. label: 'Number of posts'
  17. }
  18. ],
  19. onsubmit: function( e ) {
  20. // Insert content when the window form is submitted
  21. console.log(e.data.numberofposts);
  22. var string = "[recent-posts";
  23. if(e.data.numberofposts != ""){
  24. string += " numbers="+e.data.numberofposts;
  25. }
  26. string += "]";
  27. editor.insertContent( string );
  28. }
  29.  
  30. });
  31. }
  32.  
  33. });
  34.  
  35. });
  36.  
  37. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement