From 597e595c3202bb3c100229c84bc2fa4ad84c265f Mon Sep 17 00:00:00 2001 From: zadam Date: Mon, 15 Feb 2021 22:11:38 +0100 Subject: [PATCH] filtering for the icon picker --- src/public/app/widgets/note_icon.js | 145 ++++++++++++++++++++++++++-- 1 file changed, 138 insertions(+), 7 deletions(-) diff --git a/src/public/app/widgets/note_icon.js b/src/public/app/widgets/note_icon.js index 877c5bbda..6b2140320 100644 --- a/src/public/app/widgets/note_icon.js +++ b/src/public/app/widgets/note_icon.js @@ -22,6 +22,28 @@ const TPL = ` border: 1px solid var(--main-border-color); } + .note-icon-container .dropdown-menu { + border-radius: 10px; + border-width: 2px; + box-shadow: 10px 10px 93px -25px black; + padding: 10px 15px 10px 15px !important; + } + + .note-icon-container .filter-row { + padding-top: 10px; + padding-bottom: 10px; + padding-right: 20px; + display: flex; + align-items: baseline; + } + + .note-icon-container .filter-row span { + display: block; + padding-left: 15px; + padding-right: 15px; + font-weight: bold; + } + .note-icon-container .icon-list { height: 500px; overflow: auto; @@ -41,14 +63,19 @@ const TPL = ` - `; let icons = []; +let categories = []; export default class NoteIconWidget extends TabAwareWidget { doRender() { @@ -59,15 +86,39 @@ export default class NoteIconWidget extends TabAwareWidget { this.$iconList.on('click', 'span', async e => { const clazz = $(e.target).attr('class'); - await attributeService.setLabel(this.noteId, 'iconClass', clazz); + 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.renderFilteredDropdown()); + this.$iconCategory.on('click', e => e.stopPropagation()); + + this.$iconSearch = this.$widget.find("input[name='icon-search']"); + this.$iconSearch.on('input', () => this.renderFilteredDropdown()); + this.$notePathList = this.$widget.find(".note-path-list"); - this.$widget.on('show.bs.dropdown', () => this.renderDropdown()); + this.$widget.on('show.bs.dropdown', () => { + this.$iconCategory.empty(); + + for (const category of categories) { + this.$iconCategory.append( + $("