aboutsummaryrefslogtreecommitdiff
path: root/sources/plugins/clipboard/dev/console.js
blob: f0cc92db276404ed873bb6f6930e74008b8e60e9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/**
 * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
 * For licensing, see LICENSE.md or http://ckeditor.com/license
 */

/* global CKCONSOLE */

'use strict';

( function() {
	var pasteType, pasteValue;

	CKCONSOLE.add( 'paste', {
		panels: [
			{
				type: 'box',
				content:
				'<ul class="ckconsole_list">' +
					'<li>type: <span class="ckconsole_value" data-value="type"></span></li>' +
					'<li>value: <span class="ckconsole_value" data-value="value"></span></li>' +
				'</ul>',

				refresh: function() {
					return {
						header: 'Paste',
						type: pasteType,
						value: pasteValue
					};
				},

				refreshOn: function( editor, refresh ) {
					editor.on( 'paste', function( evt ) {
						pasteType = evt.data.type;
						pasteValue = CKEDITOR.tools.htmlEncode( evt.data.dataValue );
						refresh();
					} );
				}
			},
			{
				type: 'log',
				on: function( editor, log, logFn ) {
					editor.on( 'paste', function( evt ) {
						logFn( 'paste; type:' + evt.data.type )();
					} );
				}
			}
		]
	} );
} )();