Skip to content

Commit

Permalink
feat(List/Matrix View): ✨ Button to toggle alphabetical sorting direc…
Browse files Browse the repository at this point in the history
…tion (Updates the corresponding setting) (Fix #208)
  • Loading branch information
SkepticMystic committed Dec 16, 2021
1 parent b3bba6d commit 2d164c1
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 4 deletions.
15 changes: 14 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -24683,16 +24683,29 @@ class MatrixView extends require$$0.ItemView {
const currFile = this.app.workspace.getActiveFile();
contentEl.createEl("button", {
text: this.matrixQ ? "List" : "Matrix",
attr: { "aria-label": "Mode" },
}, (el) => {
el.onclick = async () => {
this.matrixQ = !this.matrixQ;
el.innerText = this.matrixQ ? "List" : "Matrix";
await this.draw();
};
});
contentEl.createEl("button", { text: "↻" }, (el) => {
contentEl.createEl("button", { text: "↻", attr: { "aria-label": "Refresh Index" } }, (el) => {
el.onclick = async () => await this.plugin.refreshIndex();
});
contentEl.createEl("button", {
text: settings.alphaSortAsc ? "↗" : "↘",
attr: { "aria-label": "Alphabetical sorting order" },
}, (el) => {
el.onclick = async () => {
this.plugin.settings.alphaSortAsc =
!this.plugin.settings.alphaSortAsc;
await this.plugin.saveSettings();
el.innerText = settings.alphaSortAsc ? "↗" : "↘";
await this.draw();
};
});
const hierSquares = this.getHierSquares(userHiers, currFile, settings).filter((squareArr) => squareArr.some((square) => square.realItems.length + square.impliedItems.length > 0));
const compInput = {
target: contentEl,
Expand Down
28 changes: 25 additions & 3 deletions src/MatrixView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ export default class MatrixView extends ItemView {
"button",
{
text: this.matrixQ ? "List" : "Matrix",
attr: { "aria-label": "Mode" },
},
(el) => {
el.onclick = async () => {
Expand All @@ -284,9 +285,30 @@ export default class MatrixView extends ItemView {
}
);

contentEl.createEl("button", { text: "↻" }, (el) => {
el.onclick = async () => await this.plugin.refreshIndex();
});
contentEl.createEl(
"button",
{ text: "↻", attr: { "aria-label": "Refresh Index" } },
(el) => {
el.onclick = async () => await this.plugin.refreshIndex();
}
);

contentEl.createEl(
"button",
{
text: settings.alphaSortAsc ? "↗" : "↘",
attr: { "aria-label": "Alphabetical sorting order" },
},
(el) => {
el.onclick = async () => {
this.plugin.settings.alphaSortAsc =
!this.plugin.settings.alphaSortAsc;
await this.plugin.saveSettings();
el.innerText = settings.alphaSortAsc ? "↗" : "↘";
await this.draw();
};
}
);

const hierSquares = this.getHierSquares(
userHiers,
Expand Down

0 comments on commit 2d164c1

Please sign in to comment.