console.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /**
  2. * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md or http://ckeditor.com/license
  4. */
  5. /* global CKCONSOLE */
  6. 'use strict';
  7. ( function() {
  8. var pasteType, pasteValue;
  9. CKCONSOLE.add( 'paste', {
  10. panels: [
  11. {
  12. type: 'box',
  13. content:
  14. '<ul class="ckconsole_list">' +
  15. '<li>type: <span class="ckconsole_value" data-value="type"></span></li>' +
  16. '<li>value: <span class="ckconsole_value" data-value="value"></span></li>' +
  17. '</ul>',
  18. refresh: function() {
  19. return {
  20. header: 'Paste',
  21. type: pasteType,
  22. value: pasteValue
  23. };
  24. },
  25. refreshOn: function( editor, refresh ) {
  26. editor.on( 'paste', function( evt ) {
  27. pasteType = evt.data.type;
  28. pasteValue = CKEDITOR.tools.htmlEncode( evt.data.dataValue );
  29. refresh();
  30. } );
  31. }
  32. },
  33. {
  34. type: 'log',
  35. on: function( editor, log, logFn ) {
  36. editor.on( 'paste', function( evt ) {
  37. logFn( 'paste; type:' + evt.data.type )();
  38. } );
  39. }
  40. }
  41. ]
  42. } );
  43. } )();