]>
git.immae.eu Git - perso/Immae/Projets/packagist/ludivine-ckeditor-component.git/blob - sources/plugins/colordialog/plugin.js
2 * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
3 * For licensing, see LICENSE.md or http://ckeditor.com/license
6 CKEDITOR
.plugins
.colordialog
= {
8 // jscs:disable maximumLineLength
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,es-mx,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%
10 // jscs:enable maximumLineLength
11 init: function( editor
) {
12 var cmd
= new CKEDITOR
.dialogCommand( 'colordialog' );
13 cmd
.editorFocus
= false;
15 editor
.addCommand( 'colordialog', cmd
);
17 CKEDITOR
.dialog
.add( 'colordialog', this.path
+ 'dialogs/colordialog.js' );
20 * Open up color dialog and to receive the selected color.
22 * @param {Function} callback The callback when color dialog is closed
23 * @param {String} callback.color The color value received if selected on the dialog.
24 * @param [scope] The scope in which the callback will be bound.
25 * @member CKEDITOR.editor
27 editor
.getColorFromDialog = function( callback
, scope
) {
28 var onClose = function( evt
) {
29 releaseHandlers( this );
30 var color
= evt
.name
== 'ok' ? this.getValueOf( 'picker', 'selectedColor' ) : null;
31 callback
.call( scope
, color
);
33 var releaseHandlers = function( dialog
) {
34 dialog
.removeListener( 'ok', onClose
);
35 dialog
.removeListener( 'cancel', onClose
);
37 var bindToDialog = function( dialog
) {
38 dialog
.on( 'ok', onClose
);
39 dialog
.on( 'cancel', onClose
);
42 editor
.execCommand( 'colordialog' );
44 if ( editor
._
.storedDialogs
&& editor
._
.storedDialogs
.colordialog
)
45 bindToDialog( editor
._
.storedDialogs
.colordialog
);
47 CKEDITOR
.on( 'dialogDefinition', function( e
) {
48 if ( e
.data
.name
!= 'colordialog' )
51 var definition
= e
.data
.definition
;
54 definition
.onLoad
= CKEDITOR
.tools
.override( definition
.onLoad
,
58 definition
.onLoad
= orginal
;
59 if ( typeof orginal
== 'function' )
71 CKEDITOR
.plugins
.add( 'colordialog', CKEDITOR
.plugins
.colordialog
);