Advertisement
Guest User

TinyMCE example plugin.min.js

a guest
Oct 27th, 2015
328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // plugins/example/plugin.min.js
  2.  
  3. tinymce.PluginManager.requireLangPack('example', 'de_AT');
  4. tinymce.PluginManager.add('example', function(editor, url) {
  5.     // Add a button that opens a window
  6.     editor.addButton('example', {
  7.         text: 'My button',
  8.         icon: false,
  9.         onclick: function() {
  10.             // Open window
  11.             editor.windowManager.open({
  12.                 title: 'Example plugin',
  13.                 body: [
  14.                     {type: 'textbox', name: 'title', label: 'Title'}
  15.                 ],
  16.                 onsubmit: function(e) {
  17.                     // Insert content when the window form is submitted
  18.                     editor.insertContent('Title: ' + e.data.title);
  19.                 }
  20.             });
  21.         }
  22.     });
  23.  
  24.     // Adds a menu item to the tools menu
  25.     editor.addMenuItem('example', {
  26.         text: 'Example plugin',
  27.         context: 'tools',
  28.         onclick: function() {
  29.             // Open window with a specific url
  30.             editor.windowManager.open({
  31.                 title: 'TinyMCE site',
  32.                 url: 'http://www.tinymce.com',
  33.                 width: 800,
  34.                 height: 600,
  35.                 buttons: [{
  36.                     text: 'Close',
  37.                     onclick: 'close'
  38.                 }]
  39.             });
  40.         }
  41.     });
  42. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement