Skip to content

Commit

Permalink
Merge pull request #121 from vict0rsch/tags-list
Browse files Browse the repository at this point in the history
  • Loading branch information
vict0rsch authored Sep 27, 2022
2 parents b8cbe34 + 7d456fb commit 2f554b5
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 3 deletions.
24 changes: 24 additions & 0 deletions src/popup/css/popup.css
Original file line number Diff line number Diff line change
Expand Up @@ -831,3 +831,27 @@ button.changed {
transform: rotate(359deg);
}
}

#tags-list-container {
margin: 16px;
display: flex;
align-items: center;
justify-content: space-between;
width: calc(100% - 32px);
}
#all-tags-list li {
display: inline-block;
margin-bottom: 8px;
}
#all-tags-list {
display: block;
list-style-type: none;
padding: 0;
margin-bottom: -8px;
}
summary {
cursor: pointer;
padding: 4px 6px 2px;
border-radius: var(--round);
margin-left: 3px;
}
1 change: 1 addition & 0 deletions src/popup/js/handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ const handleMemorySearchKeyPress = (allowEmptySearch) => (e) => {
searchMemory(query);
}
// display filtered papers
toggleTagsCollapse(query.startsWith("t:"));
displayMemoryTable();
};

Expand Down
22 changes: 22 additions & 0 deletions src/popup/js/memory.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,28 @@ const getTagsOptions = (paper) => {
})
.join("");
};

const toggleTagsCollapse = (on) => {
if (on) {
if (!!findEl("tags-list-container")) return;
const contents = /*html*/ `
<ul id="all-tags-list">
${[...global.state.paperTags]
.map((t) => /*html*/ `<li class="memory-tag" >${t}</li>`)
.join("")}
</ul>`;
const details = /*html*/ `
<div id="tags-list-container">
<details id="tags-list-details" style="outline: none !important;">
<summary style="font-size: 0.85rem; color: #5f5f5f;">Tags list</summary>
${contents}
</details>
</div>`;
findEl("memory-filters").insertAdjacentHTML("afterend", details);
} else {
findEl("tags-list-container")?.remove();
}
};
/**
* Updates all the papers' options HTML list
*/
Expand Down
2 changes: 1 addition & 1 deletion src/popup/min/popup.min.css

Large diffs are not rendered by default.

Loading

0 comments on commit 2f554b5

Please sign in to comment.