Skip to content

Commit

Permalink
feat(List/Matrix View): ✨ Option to treat the current note as an impl…
Browse files Browse the repository at this point in the history
…ied sibling
  • Loading branch information
SkepticMystic committed Dec 4, 2021
1 parent 5113e3a commit 4690e9b
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 11 deletions.
36 changes: 32 additions & 4 deletions src/BreadcrumbsSettingTab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,14 +316,27 @@ export class BCSettingTab extends PluginSettingTab {
);

// TODO I don't think this setting works anymore. I removed it's functionality when adding multiple hierarchies
// new Setting(MLViewDetails)
// .setName("Show all field names or just relation types")
// .setDesc(
// "This changes the headers in matrix/list view. You can have the headers be the list of metadata fields for each relation type (e.g. `parent, broader, upper`). Or you can have them just be the name of the relation type, i.e. 'Parent', 'Sibling', 'Child'. On = show the full list of names."
// )
// .addToggle((toggle) =>
// toggle.setValue(settings.showNameOrType).onChange(async (value) => {
// settings.showNameOrType = value;
// await plugin.saveSettings();
// await plugin.getActiveTYPEView(MATRIX_VIEW).draw();
// })
// );

new Setting(MLViewDetails)
.setName("Show all field names or just relation types")
.setName("Show Relationship Type")
.setDesc(
"This changes the headers in matrix/list view. You can have the headers be the list of metadata fields for each relation type (e.g. `parent, broader, upper`). Or you can have them just be the name of the relation type, i.e. 'Parent', 'Sibling', 'Child'. On = show the full list of names."
"Show whether a link is real or implied. A real link is one you explicitly put in a note. E.g. parent:: [[Note]]. An implied link is the reverse of a real link. For example, if A is the real parent of B, then B must be the implied child of A."
)
.addToggle((toggle) =>
toggle.setValue(settings.showNameOrType).onChange(async (value) => {
settings.showNameOrType = value;
toggle.setValue(settings.showRelationType).onChange(async (value) => {
settings.showRelationType = value;
await plugin.saveSettings();
await plugin.getActiveTYPEView(MATRIX_VIEW).draw();
})
Expand Down Expand Up @@ -355,6 +368,21 @@ export class BCSettingTab extends PluginSettingTab {
})
);

new Setting(MLViewDetails)
.setName("Make Current Note an Implied Sibling")
.setDesc(
"Techincally, the current note is always it's own implied sibling. By default, it is not show as such. Toggle this on to make it show."
)
.addToggle((toggle) =>
toggle
.setValue(settings.treatCurrNodeAsImpliedSibling)
.onChange(async (value) => {
settings.treatCurrNodeAsImpliedSibling = value;
await plugin.saveSettings();
await plugin.getActiveTYPEView(MATRIX_VIEW).draw();
})
);

new Setting(MLViewDetails)
.setName("Filter Implied Siblings")
.setDesc(
Expand Down
2 changes: 1 addition & 1 deletion src/MatrixView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export default class MatrixView extends ItemView {

currParents.forEach((parent) => {
closedUp.forEachInEdge(parent, (k, a, s, t) => {
if (s === basename) return;
if (s === basename && !settings.treatCurrNodeAsImpliedSibling) return;
iSamesII.push(this.toInternalLinkObj(s, false, parent));
});
});
Expand Down
13 changes: 7 additions & 6 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,14 @@ export const DEFAULT_SETTINGS: BCSettings = {
fieldSuggestor: true,
filterImpliedSiblingsOfDifferentTypes: false,
limitWriteBCCheckboxStates: {},
indexNotes: [""],
gridDots: false,
gridHeatmap: false,
heatmapColour: getComputedStyle(document.body).getPropertyValue(
"--text-accent"
),
hierarchyNotes: [""],
HNUpField: "",
indexNotes: [""],
refreshOnNoteChange: false,
useAllMetadata: true,
openMatrixOnLoad: true,
Expand All @@ -168,14 +173,10 @@ export const DEFAULT_SETTINGS: BCSettings = {
showGrid: true,
showPrevNext: true,
limitTrailCheckboxStates: {},
gridDots: false,
gridHeatmap: false,
heatmapColour: getComputedStyle(document.body).getPropertyValue(
"--text-accent"
),
showAll: false,
noPathMessage: `This note has no real or implied parents`,
trailSeperator: "→",
treatCurrNodeAsImpliedSibling: false,
respectReadableLineLength: true,
userHiers: [
{
Expand Down
1 change: 1 addition & 0 deletions src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export interface BCSettings {
showRefreshNotice: boolean;
showTrail: boolean;
trailSeperator: string;
treatCurrNodeAsImpliedSibling: boolean;
useAllMetadata: boolean;
userHiers: UserHier[];
visGraph: visTypes;
Expand Down

0 comments on commit 4690e9b

Please sign in to comment.