kode-team / codemirror-colorpicker

colorpicker with codemirror
https://colorpicker.easylogic.studio/
MIT License
137 stars 13 forks source link

Picker immediately closes after opening #40

Closed hamedbaatour closed 4 years ago

hamedbaatour commented 4 years ago

Describe the bug picker closes as soon as it is clicked

To Reproduce

Expected behavior picker should stay open

Screenshots picker opens and immediately the 'onchange' handler gets called and closes it.

ezgif com-resize (1)

Potential Fix / Additional Context

fixed the issue by removing cm.state.colorpicker.close_color_picker(); in side the OnChange function


function onChange(cm, evt) {
    if (evt.origin == 'setValue') {
       //  cm.state.colorpicker.close_color_picker();  // <========= removed this line
        cm.state.colorpicker.init_color_update();
        cm.state.colorpicker.style_color_update();
    } else {
        cm.state.colorpicker.style_color_update(cm.getCursor().line);
    }
}

Desktop

easylogic commented 4 years ago

hi @hamedbaatour

I fixed your issue. please try to test it on v1.9.72

hamedbaatour commented 4 years ago

@easylogic thanks for the quick fix. Really appreciate it 👍