Archived
1
0
This repository has been archived on 2020-12-10. You can view files and clone it, but cannot push or open issues or pull requests.
old/assets/js/ui/icon-picker.js
2018-10-16 18:28:42 +02:00

24 lines
625 B
JavaScript

import Picker from './picker';
class IconPicker extends Picker {
constructor(select, icons) {
super(select);
this.container.classList.add('ql-icon-picker');
[].forEach.call(this.container.querySelectorAll('.ql-picker-item'), (item) => {
item.innerHTML = icons[item.getAttribute('data-value') || ''];
});
this.defaultItem = this.container.querySelector('.ql-selected');
this.selectItem(this.defaultItem);
}
selectItem(item, trigger) {
super.selectItem(item, trigger);
item = item || this.defaultItem;
this.label.innerHTML = item.innerHTML;
}
}
export default IconPicker;