Skip to content

Commit 5c0c59a

Browse files
authored
Merge pull request #7 from devex-web-frontend/global-change-colorlist
new argument. palette model based on emitter
2 parents 842b23b + 11ac9aa commit 5c0c59a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/js/colorpicker.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ var Colorpicker = (function(DX) {
8383
* @param {Array} colorList
8484
* @param {Object} customTemplateConfig
8585
*/
86-
return function Colorpicker(input, colorList, customTemplateConfig) {
86+
return function Colorpicker(input, colorList, customTemplateConfig, paletteModel) {
8787
var block, valueElement, dropDown, config, disabled = input.disabled;
8888

8989
function init() {
@@ -117,6 +117,9 @@ var Colorpicker = (function(DX) {
117117

118118
input.addEventListener(Colorpicker.E_SET_COLOR_LIST, setColorListHandler);
119119
input.addEventListener(Colorpicker.E_SET_COLOR, setColorByInputValue);
120+
if (paletteModel) {
121+
paletteModel.on('E_PALETTE_COLOPICKER_MODEL:CHANGE_COLOR_LIST', setColorList);
122+
}
120123
}
121124

122125
function initAppearance() {
@@ -159,6 +162,10 @@ var Colorpicker = (function(DX) {
159162

160163
input.removeEventListener(Colorpicker.E_SET_COLOR_LIST, setColorListHandler);
161164
input.removeEventListener(Colorpicker.E_SET_COLOR, setColorByInputValue);
165+
166+
if (paletteModel) {
167+
paletteModel.off('E_PALETTE_COLOPICKER_MODEL:CHANGE_COLOR_LIST', setColorList);
168+
}
162169
}
163170

164171

0 commit comments

Comments
 (0)