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.

66 lines
1.2KB

  1. /* Prismatic - TinyMCE Buttons for Plain Flavor */
  2. (function() {
  3. 'use strict';
  4. tinymce.create('tinymce.plugins.PrismaticButtons', {
  5. init : function(ed, url) {
  6. ed.addButton('button_prism', {
  7. title : 'Add Preformatted Code',
  8. icon : 'code',
  9. onclick : function() {
  10. var code = {
  11. snippet : ''
  12. };
  13. ed.windowManager.open({
  14. title : 'Add Preformatted Code',
  15. tooltip : 'Add Preformatted Code',
  16. minWidth : 400,
  17. minHeight : 300,
  18. body : [
  19. {
  20. type : 'textbox',
  21. name : 'snippet',
  22. placeholder : 'Add Code Here',
  23. value : '',
  24. minWidth : 400,
  25. minHeight : 300,
  26. multiline : true,
  27. value : code.snippet,
  28. oninput : function() {
  29. code.snippet = this.value();
  30. }
  31. }
  32. ],
  33. onsubmit : function() {
  34. ed.insertContent('<pre><code>'+ tinymce.DOM.encode(code.snippet) + '</code></pre>');
  35. }
  36. });
  37. }
  38. });
  39. },
  40. createControl : function(n, cm) {
  41. return null;
  42. },
  43. });
  44. tinymce.PluginManager.add('prismatic_buttons', tinymce.plugins.PrismaticButtons);
  45. })();