plugin.js 965 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
  3. For licensing, see LICENSE.html or http://ckeditor.com/license
  4. */
  5. /**
  6. * @file Preview plugin.
  7. */
  8. (function()
  9. {
  10. var previewCmd =
  11. {
  12. modes : { wysiwyg:1, source:1 },
  13. canUndo : false,
  14. readOnly : 1,
  15. exec : function( editor )
  16. {
  17. var form = $('<form method="post" action="../bpmFormHandler/edit.ht" target="_blank"></form>');
  18. var input = $('<input type="hidden" name="html">').val(editor.getData());
  19. form.append(input);
  20. $('body').append(form);
  21. form.submit();
  22. form.remove();
  23. }
  24. };
  25. var pluginName = 'custPreview';
  26. // Register a plugin named "preview".
  27. CKEDITOR.plugins.add( pluginName,
  28. {
  29. init : function( editor )
  30. {
  31. editor.addCommand( pluginName, previewCmd );
  32. editor.ui.addButton( 'CustPreview',
  33. {
  34. label : editor.lang.preview,
  35. icon: 'custom/preview/cab.gif',
  36. command : pluginName
  37. });
  38. }
  39. });
  40. })();