import NoteContextAwareWidget from "./note_context_aware_widget.js"; import attributeService from "../services/attributes.js"; import server from "../services/server.js"; const TPL = ` `; export default class NoteIconWidget extends NoteContextAwareWidget { doRender() { this.$widget = $(TPL); this.$icon = this.$widget.find('button.note-icon'); this.$iconList = this.$widget.find('.icon-list'); this.$iconList.on('click', 'span', async e => { const clazz = $(e.target).attr('class'); await attributeService.setLabel(this.noteId, this.note.hasOwnedLabel('workspace') ? 'workspaceIconClass' : 'iconClass', clazz ); }); this.$iconCategory = this.$widget.find("select[name='icon-category']"); this.$iconCategory.on('change', () => this.renderDropdown()); this.$iconCategory.on('click', e => e.stopPropagation()); this.$iconSearch = this.$widget.find("input[name='icon-search']"); this.$iconSearch.on('input', () => this.renderDropdown()); this.$notePathList = this.$widget.find(".note-path-list"); this.$widget.on('show.bs.dropdown', async () => { const {categories} = (await import('./icon_list.js')).default; this.$iconCategory.empty(); for (const category of categories) { this.$iconCategory.append( $("