@@ -6995,8 +6995,13 @@ var BaseColorPicker = function (_UIElement) {
69956995 _this2 . callbackColorValue ( ) ;
69966996 } ;
69976997
6998+ this . callbackLastUpdate = function ( ) {
6999+ _this2 . callbackLastUpdateColorValue ( ) ;
7000+ } ;
7001+
69987002 this . colorpickerShowCallback = function ( ) { } ;
69997003 this . colorpickerHideCallback = function ( ) { } ;
7004+ this . colorpickerLastUpdateCallback = function ( ) { } ;
70007005
70017006 this . $body = new Dom ( this . getContainer ( ) ) ;
70027007 this . $root = new Dom ( 'div' , 'codemirror-colorpicker' ) ;
@@ -7057,14 +7062,15 @@ var BaseColorPicker = function (_UIElement) {
70577062
70587063 } , {
70597064 key : 'show' ,
7060- value : function show ( opt , color , showCallback , hideCallback ) {
7065+ value : function show ( opt , color , showCallback , hideCallback , lastUpdateCallback ) {
70617066
70627067 // 매번 이벤트를 지우고 다시 생성할 필요가 없어서 초기화 코드는 지움.
70637068 // this.destroy();
70647069 // this.initializeEvent();
70657070 // define colorpicker callback
70667071 this . colorpickerShowCallback = showCallback ;
70677072 this . colorpickerHideCallback = hideCallback ;
7073+ this . colorpickerLastUpdateCallback = lastUpdateCallback ;
70687074 this . $root . css ( this . getInitalizePosition ( ) ) . show ( ) ;
70697075
70707076 this . isColorPickerShow = true ;
@@ -7321,6 +7327,19 @@ var BaseColorPicker = function (_UIElement) {
73217327 this . colorpickerShowCallback ( color ) ;
73227328 }
73237329 }
7330+ } , {
7331+ key : 'callbackLastUpdateColorValue' ,
7332+ value : function callbackLastUpdateColorValue ( color ) {
7333+ color = color || this . getCurrentColor ( ) ;
7334+
7335+ if ( typeof this . opt . onLastUpdate == 'function' ) {
7336+ this . opt . onLastUpdate . call ( this , color ) ;
7337+ }
7338+
7339+ if ( typeof this . colorpickerLastUpdateCallback == 'function' ) {
7340+ this . colorpickerLastUpdateCallback ( color ) ;
7341+ }
7342+ }
73247343 } , {
73257344 key : 'callbackHideColorValue' ,
73267345 value : function callbackHideColorValue ( color ) {
@@ -7361,6 +7380,7 @@ var BaseColorPicker = function (_UIElement) {
73617380 get ( BaseColorPicker . prototype . __proto__ || Object . getPrototypeOf ( BaseColorPicker . prototype ) , 'initializeStoreEvent' , this ) . call ( this ) ;
73627381
73637382 this . $store . on ( 'changeColor' , this . callbackChange ) ;
7383+ this . $store . on ( 'lastUpdateColor' , this . callbackLastUpdate ) ;
73647384 this . $store . on ( 'changeFormat' , this . callbackChange ) ;
73657385 }
73667386 } , {
@@ -7369,9 +7389,11 @@ var BaseColorPicker = function (_UIElement) {
73697389 get ( BaseColorPicker . prototype . __proto__ || Object . getPrototypeOf ( BaseColorPicker . prototype ) , 'destroy' , this ) . call ( this ) ;
73707390
73717391 this . $store . off ( 'changeColor' , this . callbackChange ) ;
7392+ this . $store . off ( 'lastUpdateColor' , this . callbackLastUpdate ) ;
73727393 this . $store . off ( 'changeFormat' , this . callbackChange ) ;
73737394
73747395 this . callbackChange = undefined ;
7396+ this . callbackLastUpdate = undefined ;
73757397
73767398 // remove color picker callback
73777399 this . colorpickerShowCallback = undefined ;
@@ -7474,7 +7496,10 @@ var BaseBox = function (_UIElement) {
74747496 } , {
74757497 key : 'onDragEnd' ,
74767498 value : function onDragEnd ( e ) {
7477- this . isDown = false ;
7499+ if ( this . isDown ) {
7500+ this . $store . emit ( 'lastUpdateColor' ) ;
7501+ this . isDown = false ;
7502+ }
74787503 }
74797504 } , {
74807505 key : '@changeColor' ,
@@ -8015,7 +8040,10 @@ var ColorWheel = function (_UIElement) {
80158040 } , {
80168041 key : 'mouseup document' ,
80178042 value : function mouseupDocument ( e ) {
8018- this . isDown = false ;
8043+ if ( this . isDown ) {
8044+ this . isDown = false ;
8045+ this . $store . emit ( 'lastUpdateColor' ) ;
8046+ }
80198047 }
80208048 } , {
80218049 key : 'mousemove document' ,
@@ -8039,7 +8067,10 @@ var ColorWheel = function (_UIElement) {
80398067 } , {
80408068 key : 'touchend document' ,
80418069 value : function touchendDocument ( e ) {
8042- this . isDown = false ;
8070+ if ( this . isDown ) {
8071+ this . isDown = false ;
8072+ this . $store . emit ( 'lastUpdateColor' ) ;
8073+ }
80438074 }
80448075 } , {
80458076 key : 'touchmove document' ,
@@ -8120,6 +8151,7 @@ var ColorInformation = function (_UIElement) {
81208151 this . format = next_format ;
81218152
81228153 this . $store . dispatch ( '/changeFormat' , this . format ) ;
8154+ this . $store . emit ( 'lastUpdateColor' ) ;
81238155 }
81248156 } , {
81258157 key : 'getFormat' ,
@@ -8129,12 +8161,19 @@ var ColorInformation = function (_UIElement) {
81298161 } , {
81308162 key : 'checkNumberKey' ,
81318163 value : function checkNumberKey ( e ) {
8132- return Event . checkNumberKey ( e ) ;
8164+ var code = e . which ,
8165+ isExcept = false ;
8166+
8167+ if ( code == 37 || code == 39 || code == 8 || code == 46 || code == 9 ) isExcept = true ;
8168+
8169+ if ( ! isExcept && ( code < 48 || code > 57 ) ) return false ;
8170+
8171+ return true ;
81338172 }
81348173 } , {
81358174 key : 'checkNotNumberKey' ,
81368175 value : function checkNotNumberKey ( e ) {
8137- return ! Event . checkNumberKey ( e ) ;
8176+ return ! this . checkNumberKey ( e ) ;
81388177 }
81398178 } , {
81408179 key : 'changeRgbColor' ,
@@ -8147,6 +8186,7 @@ var ColorInformation = function (_UIElement) {
81478186 a : this . refs . $rgb_a . float ( ) ,
81488187 source : source$2
81498188 } ) ;
8189+ this . $store . emit ( 'lastUpdateColor' ) ;
81508190 }
81518191 } , {
81528192 key : 'changeHslColor' ,
@@ -8159,6 +8199,7 @@ var ColorInformation = function (_UIElement) {
81598199 a : this . refs . $hsl_a . float ( ) ,
81608200 source : source$2
81618201 } ) ;
8202+ this . $store . emit ( 'lastUpdateColor' ) ;
81628203 }
81638204 } , {
81648205 key : '@changeColor' ,
@@ -8226,6 +8267,7 @@ var ColorInformation = function (_UIElement) {
82268267
82278268 if ( code . charAt ( 0 ) == '#' && code . length == 7 ) {
82288269 this . $store . dispatch ( '/changeColor' , code , source$2 ) ;
8270+ this . $store . emit ( 'lastUpdateColor' ) ;
82298271 }
82308272 }
82318273 } , {
@@ -8433,6 +8475,7 @@ var CurrentColorSets = function (_UIElement) {
84338475 key : 'click $colorSetsColorList .color-item' ,
84348476 value : function click$colorSetsColorListColorItem ( e ) {
84358477 this . $store . dispatch ( '/changeColor' , e . $delegateTarget . attr ( 'data-color' ) ) ;
8478+ this . $store . emit ( 'lastUpdateColor' ) ;
84368479 }
84378480 } ] ) ;
84388481 return CurrentColorSets ;
@@ -8726,7 +8769,10 @@ var ColorPalette = function (_UIElement) {
87268769 } , {
87278770 key : 'mouseup document' ,
87288771 value : function mouseupDocument ( e ) {
8729- this . isDown = false ;
8772+ if ( this . isDown ) {
8773+ this . isDown = false ;
8774+ this . $store . emit ( 'lastUpdateColor' ) ;
8775+ }
87308776 }
87318777 } , {
87328778 key : 'mousemove document' ,
@@ -8741,15 +8787,13 @@ var ColorPalette = function (_UIElement) {
87418787 this . isDown = true ;
87428788 this . setMainColor ( e ) ;
87438789 }
8744- } , {
8745- key : 'mouseup' ,
8746- value : function mouseup ( e ) {
8747- this . isDown = false ;
8748- }
87498790 } , {
87508791 key : 'touchend document' ,
87518792 value : function touchendDocument ( e ) {
8752- this . isDown = false ;
8793+ if ( this . isDown ) {
8794+ this . isDown = false ;
8795+ this . $store . emit ( 'lastUpdateColor' ) ;
8796+ }
87538797 }
87548798 } , {
87558799 key : 'touchmove document' ,
@@ -8765,11 +8809,6 @@ var ColorPalette = function (_UIElement) {
87658809 this . isDown = true ;
87668810 this . setMainColor ( e ) ;
87678811 }
8768- } , {
8769- key : 'touchend' ,
8770- value : function touchend ( e ) {
8771- this . isDown = false ;
8772- }
87738812 } ] ) ;
87748813 return ColorPalette ;
87758814} ( UIElement ) ;
0 commit comments