NuclearDispersionSystem/ant-design-vue-jeecg/node_modules/@simonwep/pickr/EXAMPLES.md
2023-09-14 14:47:11 +08:00

899 B

Requested features - immediately brought to life by a bit of code

Saving the current color and closing the popup on Enter (#187)

pickr.on('init', instance => {

    // Grab actual input-element
    const {result} = instance.getRoot().interaction;

    // Listen to any key-events
    result.addEventListener('keydown', e => {

        // Detect whever the user pressed "Enter" on their keyboard
        if (e.key === 'Enter') {
            instance.applyColor(); // Save the currently selected color
            instance.hide(); // Hide modal
        }
    }, {capture: true});
});

Feel free to submit a PR or create an issue if you got any ideas for more examples!