2022-01-28 22:00:11 +01:00
|
|
|
import $ from 'jquery';
|
2022-12-23 17:03:11 +01:00
|
|
|
import {createColorPicker} from '../colorpicker.js';
|
2021-10-16 19:28:04 +02:00
|
|
|
|
|
|
|
export function initCompColorPicker() {
|
2024-03-19 17:28:46 +01:00
|
|
|
(async () => {
|
|
|
|
await createColorPicker(document.querySelectorAll('.color-picker'));
|
2021-10-16 19:28:04 +02:00
|
|
|
|
2024-03-19 17:28:46 +01:00
|
|
|
for (const el of document.querySelectorAll('.precolors .color')) {
|
|
|
|
el.addEventListener('click', (e) => {
|
|
|
|
const color = e.target.getAttribute('data-color-hex');
|
|
|
|
const parent = e.target.closest('.color.picker');
|
|
|
|
$(parent.querySelector('.color-picker')).minicolors('value', color);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
})();
|
2021-10-16 19:28:04 +02:00
|
|
|
}
|