diff --git a/main.js b/main.js
index 1273b577..4fabb4dd 100644
--- a/main.js
+++ b/main.js
@@ -21104,6 +21104,7 @@ const DEFAULT_SETTINGS = {
showTrail: true,
showGrid: true,
showPrevNext: true,
+ squareDirectionsOrder: [0, 1, 2, 3, 4],
limitTrailCheckboxes: [],
limitJumpToFirstFields: [],
showAll: false,
@@ -24857,9 +24858,10 @@ class MatrixView extends require$$0.ItemView {
const realTos = reals.map((real) => real.to);
return implieds.filter((implied) => !realTos.includes(implied.to));
}
- getHierSquares(userHiers, currFile, settings) {
+ getHierSquares(userHiers, currFile) {
const { plugin } = this;
- const { mainG } = plugin;
+ const { mainG, settings } = plugin;
+ const { alphaSortAsc, enableAlphaSort, treatCurrNodeAsImpliedSibling, squareDirectionsOrder, } = settings;
if (!mainG)
return [];
const { basename } = currFile;
@@ -24892,7 +24894,7 @@ class MatrixView extends require$$0.ItemView {
closedUp.forEachOutEdge(basename, (k, a, s, par) => {
if (hier.up.includes(a.field)) {
closedUp.forEachInEdge(par, (k, a, s, t) => {
- if (s === basename && !settings.treatCurrNodeAsImpliedSibling)
+ if (s === basename && !treatCurrNodeAsImpliedSibling)
return;
iSamesII.push(this.toInternalLinkObj(s, false, t));
});
@@ -24918,9 +24920,8 @@ class MatrixView extends require$$0.ItemView {
const getFieldInHier = (dir) => hier[dir][0]
? hier[dir].join(", ")
: `${hier[getOppDir(dir)].join(",")}${ARROW_DIRECTIONS[dir]}`;
- const { alphaSortAsc } = settings;
const squares = [ru, rs, rd, rn, rp, iu, is, id, iN, ip];
- if (settings.enableAlphaSort) {
+ if (enableAlphaSort) {
squares.forEach((sq) => sq.sort((a, b) => {
var _a, _b;
return ((_a = a.alt) !== null && _a !== void 0 ? _a : a.to) < ((_b = b.alt) !== null && _b !== void 0 ? _b : b.to)
@@ -24945,7 +24946,7 @@ class MatrixView extends require$$0.ItemView {
{ iN },
{ ip },
]);
- return [
+ const square = [
{
realItems: ru,
impliedItems: iu,
@@ -24972,6 +24973,7 @@ class MatrixView extends require$$0.ItemView {
field: getFieldInHier("prev"),
},
];
+ return squareDirectionsOrder.map((order) => square[order]);
});
}
async draw() {
@@ -25007,7 +25009,7 @@ class MatrixView extends require$$0.ItemView {
await this.draw();
};
});
- const hierSquares = this.getHierSquares(userHiers, currFile, settings).filter((squareArr) => squareArr.some((square) => square.realItems.length + square.impliedItems.length > 0));
+ const hierSquares = this.getHierSquares(userHiers, currFile).filter((squareArr) => squareArr.some((sq) => sq.realItems.length + sq.impliedItems.length > 0));
const compInput = {
target: contentEl,
props: {
@@ -25195,6 +25197,38 @@ class BCSettingTab extends require$$0.PluginSettingTab {
await plugin.saveSettings();
await plugin.getActiveTYPEView(MATRIX_VIEW).draw();
}));
+ new require$$0.Setting(MLViewDetails)
+ .setName("Directions Order")
+ .setDesc(fragWithHTML(`Change the order in which the directions appear in the M/L view. Use numbers to change the order, the default is "up, same, down, next, prev" (01234
).
+
+ - 0 = up
+ - 1 = same
+ - 2 = down
+ - 3 = next
+ - 4 = prev
+
+ Note: You can only change the order of the directions. You can't add or remove directions.`))
+ .addText((text) => {
+ text.setValue(settings.squareDirectionsOrder.join(""));
+ text.inputEl.onblur = async () => {
+ const value = text.getValue();
+ if (value.length === 5 &&
+ value.includes("0") &&
+ value.includes("1") &&
+ value.includes("2") &&
+ value.includes("3") &&
+ value.includes("4")) {
+ settings.squareDirectionsOrder = value
+ .split("")
+ .map((order) => Number.parseInt(order));
+ await plugin.saveSettings();
+ await plugin.getActiveTYPEView(MATRIX_VIEW).draw();
+ }
+ else {
+ new require$$0.Notice('The value must be a 5 digit number using only the digits "0", "1", "2", "3", "4"');
+ }
+ };
+ });
new require$$0.Setting(MLViewDetails)
.setName("Enable Alpahebtical Sorting")
.setDesc("By default, items in the Matrix view are sorted by the order they appear in your notes. Toggle this on to enable Alphabetical sorting. You can choose ascending/descending order in the setting below.")
diff --git a/src/BreadcrumbsSettingTab.ts b/src/BreadcrumbsSettingTab.ts
index 55173a87..0024a5e7 100644
--- a/src/BreadcrumbsSettingTab.ts
+++ b/src/BreadcrumbsSettingTab.ts
@@ -250,6 +250,46 @@ export class BCSettingTab extends PluginSettingTab {
})
);
+ new Setting(MLViewDetails)
+ .setName("Directions Order")
+ .setDesc(
+ fragWithHTML(
+ `Change the order in which the directions appear in the M/L view. Use numbers to change the order, the default is "up, same, down, next, prev" (01234
).
+
+ - 0 = up
+ - 1 = same
+ - 2 = down
+ - 3 = next
+ - 4 = prev
+
+ Note: You can only change the order of the directions. You can't add or remove directions.`
+ )
+ )
+ .addText((text) => {
+ text.setValue(settings.squareDirectionsOrder.join(""));
+ text.inputEl.onblur = async () => {
+ const value = text.getValue();
+ if (
+ value.length === 5 &&
+ value.includes("0") &&
+ value.includes("1") &&
+ value.includes("2") &&
+ value.includes("3") &&
+ value.includes("4")
+ ) {
+ settings.squareDirectionsOrder = value
+ .split("")
+ .map((order) => Number.parseInt(order));
+ await plugin.saveSettings();
+ await plugin.getActiveTYPEView(MATRIX_VIEW).draw();
+ } else {
+ new Notice(
+ 'The value must be a 5 digit number using only the digits "0", "1", "2", "3", "4"'
+ );
+ }
+ };
+ });
+
new Setting(MLViewDetails)
.setName("Enable Alpahebtical Sorting")
.setDesc(
diff --git a/src/MatrixView.ts b/src/MatrixView.ts
index 8aa7a1d8..03338d37 100644
--- a/src/MatrixView.ts
+++ b/src/MatrixView.ts
@@ -11,7 +11,6 @@ import {
} from "./constants";
import { getOppDir, getReflexiveClosure, getSubInDirs } from "./graphUtils";
import type {
- BCSettings,
Directions,
internalLinkObj,
SquareProps,
@@ -105,13 +104,15 @@ export default class MatrixView extends ItemView {
getOrder = (node: string) =>
Number.parseInt(this.plugin.mainG.getNodeAttribute(node, "order"));
- getHierSquares(
- userHiers: UserHier[],
- currFile: TFile,
- settings: BCSettings
- ): SquareProps[][] {
+ getHierSquares(userHiers: UserHier[], currFile: TFile): SquareProps[][] {
const { plugin } = this;
- const { mainG } = plugin;
+ const { mainG, settings } = plugin;
+ const {
+ alphaSortAsc,
+ enableAlphaSort,
+ treatCurrNodeAsImpliedSibling,
+ squareDirectionsOrder,
+ } = settings;
if (!mainG) return [];
const { basename } = currFile;
@@ -168,8 +169,7 @@ export default class MatrixView extends ItemView {
closedUp.forEachOutEdge(basename, (k, a, s, par) => {
if (hier.up.includes(a.field)) {
closedUp.forEachInEdge(par, (k, a, s, t) => {
- if (s === basename && !settings.treatCurrNodeAsImpliedSibling)
- return;
+ if (s === basename && !treatCurrNodeAsImpliedSibling) return;
iSamesII.push(this.toInternalLinkObj(s, false, t));
});
}
@@ -200,10 +200,9 @@ export default class MatrixView extends ItemView {
? hier[dir].join(", ")
: `${hier[getOppDir(dir)].join(",")}${ARROW_DIRECTIONS[dir]}`;
- const { alphaSortAsc } = settings;
const squares = [ru, rs, rd, rn, rp, iu, is, id, iN, ip];
- if (settings.enableAlphaSort) {
+ if (enableAlphaSort) {
squares.forEach((sq) =>
sq.sort((a, b) =>
(a.alt ?? a.to) < (b.alt ?? b.to)
@@ -231,7 +230,7 @@ export default class MatrixView extends ItemView {
{ ip },
]);
- return [
+ const square = [
{
realItems: ru,
impliedItems: iu,
@@ -260,6 +259,8 @@ export default class MatrixView extends ItemView {
field: getFieldInHier("prev"),
},
];
+
+ return squareDirectionsOrder.map((order) => square[order]);
});
}
@@ -312,14 +313,11 @@ export default class MatrixView extends ItemView {
}
);
- const hierSquares = this.getHierSquares(
- userHiers,
- currFile,
- settings
- ).filter((squareArr) =>
- squareArr.some(
- (square) => square.realItems.length + square.impliedItems.length > 0
- )
+ const hierSquares = this.getHierSquares(userHiers, currFile).filter(
+ (squareArr) =>
+ squareArr.some(
+ (sq) => sq.realItems.length + sq.impliedItems.length > 0
+ )
);
const compInput = {
diff --git a/src/constants.ts b/src/constants.ts
index cf544a47..af321a50 100644
--- a/src/constants.ts
+++ b/src/constants.ts
@@ -177,6 +177,7 @@ export const DEFAULT_SETTINGS: BCSettings = {
showTrail: true,
showGrid: true,
showPrevNext: true,
+ squareDirectionsOrder: [0, 1, 2, 3, 4],
limitTrailCheckboxes: [],
limitJumpToFirstFields: [],
showAll: false,
diff --git a/src/interfaces.ts b/src/interfaces.ts
index 2370ba6f..efd6b59e 100644
--- a/src/interfaces.ts
+++ b/src/interfaces.ts
@@ -56,6 +56,7 @@ export interface BCSettings {
showPrevNext: boolean;
showRefreshNotice: boolean;
showTrail: boolean;
+ squareDirectionsOrder: (0 | 1 | 2 | 3 | 4)[];
trailSeperator: string;
treatCurrNodeAsImpliedSibling: boolean;
trimDendronNotes: boolean;