From 4690e9bee46b3bb55dbb5e38aba6d8a326c7181b Mon Sep 17 00:00:00 2001 From: Ross Keenan Date: Sat, 4 Dec 2021 09:12:57 +0200 Subject: [PATCH] feat(List/Matrix View): :sparkles: Option to treat the current note as an implied sibling --- src/BreadcrumbsSettingTab.ts | 36 ++++++++++++++++++++++++++++++++---- src/MatrixView.ts | 2 +- src/constants.ts | 13 +++++++------ src/interfaces.ts | 1 + 4 files changed, 41 insertions(+), 11 deletions(-) diff --git a/src/BreadcrumbsSettingTab.ts b/src/BreadcrumbsSettingTab.ts index 173ef2bd..5524009d 100644 --- a/src/BreadcrumbsSettingTab.ts +++ b/src/BreadcrumbsSettingTab.ts @@ -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(); }) @@ -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( diff --git a/src/MatrixView.ts b/src/MatrixView.ts index bc8b103b..6115a9fa 100644 --- a/src/MatrixView.ts +++ b/src/MatrixView.ts @@ -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)); }); }); diff --git a/src/constants.ts b/src/constants.ts index a6901b3c..494b348f 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -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, @@ -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: [ { diff --git a/src/interfaces.ts b/src/interfaces.ts index 322133b3..031e95e8 100644 --- a/src/interfaces.ts +++ b/src/interfaces.ts @@ -49,6 +49,7 @@ export interface BCSettings { showRefreshNotice: boolean; showTrail: boolean; trailSeperator: string; + treatCurrNodeAsImpliedSibling: boolean; useAllMetadata: boolean; userHiers: UserHier[]; visGraph: visTypes;