mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-09-08 17:03:44 +00:00
Tested all functionality. There is a [pre-existing bug](https://github.com/go-gitea/gitea/issues/29853) when moving a project panels which is not caused by this refactoring. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> (cherry picked from commit fa100618c4b644346bf5666f92d33dce0747d0a2)
16 lines
548 B
JavaScript
16 lines
548 B
JavaScript
import $ from 'jquery';
|
|
import {createColorPicker} from '../colorpicker.js';
|
|
|
|
export function initCompColorPicker() {
|
|
(async () => {
|
|
await createColorPicker(document.querySelectorAll('.color-picker'));
|
|
|
|
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);
|
|
});
|
|
}
|
|
})();
|
|
}
|