diff --git a/main.js b/main.js index 87d45d09..0c32967b 100644 --- a/main.js +++ b/main.js @@ -28422,7 +28422,9 @@ class BCSettingTab extends obsidian.PluginSettingTab { // "", // null // ); - relationDetails.createEl("p", { text: 'Here you can toggle on/off different ypes of implied relationships. All of your explicit (real) relationships will still show, but you can choose which implied ones get filled in.\nAll implied relationships are given a CSS class of the type of implied relaiton, so you can style the differently. For example `.BC-Aunt`.' }); + relationDetails.createEl("p", { + text: "Here you can toggle on/off different ypes of implied relationships. All of your explicit (real) relationships will still show, but you can choose which implied ones get filled in.\nAll implied relationships are given a CSS class of the type of implied relaiton, so you can style the differently. For example `.BC-Aunt`.", + }); new obsidian.Setting(relationDetails) .setName("Same Parent is Siblings") .setDesc("If one note shares a parent with another, treat them as siblings") @@ -28633,20 +28635,15 @@ class BCSettingTab extends obsidian.PluginSettingTab {
02
will only show up and down, in that order.`))
.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));
+ const values = value.split("");
+ if (value.length <= 5 &&
+ values.every((value) => ["0", "1", "2", "3", "4"].includes(value))) {
+ settings.squareDirectionsOrder = values.map((order) => Number.parseInt(order));
await plugin.saveSettings();
await plugin.getActiveTYPEView(MATRIX_VIEW).draw();
}
diff --git a/src/BreadcrumbsSettingTab.ts b/src/BreadcrumbsSettingTab.ts
index add6f73d..5a3b31cd 100644
--- a/src/BreadcrumbsSettingTab.ts
+++ b/src/BreadcrumbsSettingTab.ts
@@ -81,7 +81,9 @@ export class BCSettingTab extends PluginSettingTab {
// null
// );
- relationDetails.createEl("p", {text: 'Here you can toggle on/off different ypes of implied relationships. All of your explicit (real) relationships will still show, but you can choose which implied ones get filled in.\nAll implied relationships are given a CSS class of the type of implied relaiton, so you can style the differently. For example `.BC-Aunt`.'})
+ relationDetails.createEl("p", {
+ text: "Here you can toggle on/off different ypes of implied relationships. All of your explicit (real) relationships will still show, but you can choose which implied ones get filled in.\nAll implied relationships are given a CSS class of the type of implied relaiton, so you can style the differently. For example `.BC-Aunt`.",
+ });
new Setting(relationDetails)
.setName("Same Parent is Siblings")
@@ -369,24 +371,21 @@ export class BCSettingTab extends PluginSettingTab {
02
will only show up and down, in that order.`
)
)
.addText((text) => {
text.setValue(settings.squareDirectionsOrder.join(""));
text.inputEl.onblur = async () => {
const value = text.getValue();
+ const values = value.split("");
if (
- value.length === 5 &&
- value.includes("0") &&
- value.includes("1") &&
- value.includes("2") &&
- value.includes("3") &&
- value.includes("4")
+ value.length <= 5 &&
+ values.every((value) => ["0", "1", "2", "3", "4"].includes(value))
) {
- settings.squareDirectionsOrder = value
- .split("")
- .map((order) => Number.parseInt(order)) as (0 | 1 | 2 | 3 | 4)[];
+ settings.squareDirectionsOrder = values.map((order) =>
+ Number.parseInt(order)
+ ) as (0 | 1 | 2 | 3 | 4)[];
await plugin.saveSettings();
await plugin.getActiveTYPEView(MATRIX_VIEW).draw();
} else {