]> git.immae.eu Git - perso/Immae/Projets/packagist/ludivine-ckeditor-component.git/blame - sources/plugins/colordialog/plugin.js
Add audio, color and fonts
[perso/Immae/Projets/packagist/ludivine-ckeditor-component.git] / sources / plugins / colordialog / plugin.js
CommitLineData
eaa92715
IB
1/**\r
2 * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.\r
3 * For licensing, see LICENSE.md or http://ckeditor.com/license\r
4 */\r
5\r
6CKEDITOR.plugins.colordialog = {\r
7 requires: 'dialog',\r
8 // jscs:disable maximumLineLength\r
9 lang: 'af,ar,az,bg,bn,bs,ca,cs,cy,da,de,de-ch,el,en,en-au,en-ca,en-gb,eo,es,et,eu,fa,fi,fo,fr,fr-ca,gl,gu,he,hi,hr,hu,id,is,it,ja,ka,km,ko,ku,lt,lv,mk,mn,ms,nb,nl,no,oc,pl,pt,pt-br,ro,ru,si,sk,sl,sq,sr,sr-latn,sv,th,tr,tt,ug,uk,vi,zh,zh-cn', // %REMOVE_LINE_CORE%\r
10 // jscs:enable maximumLineLength\r
11 init: function( editor ) {\r
12 var cmd = new CKEDITOR.dialogCommand( 'colordialog' );\r
13 cmd.editorFocus = false;\r
14\r
15 editor.addCommand( 'colordialog', cmd );\r
16\r
17 CKEDITOR.dialog.add( 'colordialog', this.path + 'dialogs/colordialog.js' );\r
18\r
19 /**\r
20 * Open up color dialog and to receive the selected color.\r
21 *\r
22 * @param {Function} callback The callback when color dialog is closed\r
23 * @param {String} callback.color The color value received if selected on the dialog.\r
24 * @param [scope] The scope in which the callback will be bound.\r
25 * @member CKEDITOR.editor\r
26 */\r
27 editor.getColorFromDialog = function( callback, scope ) {\r
28 var onClose = function( evt ) {\r
29 releaseHandlers( this );\r
30 var color = evt.name == 'ok' ? this.getValueOf( 'picker', 'selectedColor' ) : null;\r
31 callback.call( scope, color );\r
32 };\r
33 var releaseHandlers = function( dialog ) {\r
34 dialog.removeListener( 'ok', onClose );\r
35 dialog.removeListener( 'cancel', onClose );\r
36 };\r
37 var bindToDialog = function( dialog ) {\r
38 dialog.on( 'ok', onClose );\r
39 dialog.on( 'cancel', onClose );\r
40 };\r
41\r
42 editor.execCommand( 'colordialog' );\r
43\r
44 if ( editor._.storedDialogs && editor._.storedDialogs.colordialog )\r
45 bindToDialog( editor._.storedDialogs.colordialog );\r
46 else {\r
47 CKEDITOR.on( 'dialogDefinition', function( e ) {\r
48 if ( e.data.name != 'colordialog' )\r
49 return;\r
50\r
51 var definition = e.data.definition;\r
52\r
53 e.removeListener();\r
54 definition.onLoad = CKEDITOR.tools.override( definition.onLoad,\r
55 function( orginal ) {\r
56 return function() {\r
57 bindToDialog( this );\r
58 definition.onLoad = orginal;\r
59 if ( typeof orginal == 'function' )\r
60 orginal.call( this );\r
61 };\r
62 } );\r
63 } );\r
64 }\r
65 };\r
66\r
67\r
68 }\r
69};\r
70\r
71CKEDITOR.plugins.add( 'colordialog', CKEDITOR.plugins.colordialog );\r