Skip to content

Commit

Permalink
chore: formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
kometenstaub committed Apr 23, 2023
1 parent e3cc705 commit a1fdaf8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 16 deletions.
18 changes: 13 additions & 5 deletions src/methods/methods-write.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { App, Notice, TFile, MarkdownView } from "obsidian";
import type { headings, keyValuePairs } from "../interfaces";
import type SKOSPlugin from "../main";
import {settingsKeys} from "../constants";
import { settingsKeys } from "../constants";

export class WriteMethods {
app: App;
Expand Down Expand Up @@ -40,15 +40,23 @@ export class WriteMethods {
// the shift key is not activated
if (!evt.shiftKey) {
await this.app.fileManager.processFrontMatter(tfile, (frontmatter) => {
const s = this.plugin.settings
const els = [s.headingKey, s.altLabel, s.uriKey, s.lccKey, s.broaderKey, s.narrowerKey, s.relatedKey]
const s = this.plugin.settings;
const els = [
s.headingKey,
s.altLabel,
s.uriKey,
s.lccKey,
s.broaderKey,
s.narrowerKey,
s.relatedKey,
];
for (const el of els) {
// only remove keys that are activated by the user
if (el.length > 0) {
frontmatter[el] = undefined;
}
}
})
});
await this.app.fileManager.processFrontMatter(tfile, (frontMatter) => {
for (const [key, value] of Object.entries(keys)) {
frontMatter[key] = value;
Expand Down Expand Up @@ -85,7 +93,7 @@ export class WriteMethods {
): string[] {
for (const [key, value] of Object.entries(keys)) {
if (key === this.plugin.settings.altLabel) {
const newValue = this.surroundWithQuotes(value as string[])
const newValue = this.surroundWithQuotes(value as string[]);
newFrontMatter.push(key + ":: " + `[${newValue}]`);
} else {
newFrontMatter.push(key + ":: " + `"${value}"`);
Expand Down
24 changes: 13 additions & 11 deletions src/ui/LOC/suggester.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,25 +65,27 @@ export class SKOSModal extends SuggestModal<SuggesterItem> {
}
const extraInstructions: Instruction[] = [];
if (Platform.isMacOS) {
extraInstructions.push({
command: "opt ↵",
extraInstructions.push(
{
command: "opt ↵",
purpose: SUBDIV_PURPOSE,
},
{
command: "cmd ↵",
purpose: BROWSER_PURPOSE,
},
)
},
{
command: "cmd ↵",
purpose: BROWSER_PURPOSE,
}
);
} else {
extraInstructions.push(
{
command: "alt ↵",
purpose: SUBDIV_PURPOSE,
},
{
command: "ctrl ↵",
purpose: BROWSER_PURPOSE,
});
command: "ctrl ↵",
purpose: BROWSER_PURPOSE,
}
);
}
this.setInstructions(BASIC_INSTRUCTIONS.concat(extraInstructions));
}
Expand Down

0 comments on commit a1fdaf8

Please sign in to comment.