Skip to content

Commit 8863b82

Browse files
committed
another fix for old installers
1 parent 563ae72 commit 8863b82

File tree

6 files changed

+28
-10
lines changed

6 files changed

+28
-10
lines changed

exampleVault/Buttons/Replace Buttons.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,19 @@ action:
101101
replacement: "i am no longer a button\n\nnice"
102102
```
103103
```
104+
105+
### Relative Line Numbers
106+
107+
```meta-bind-button
108+
label: Insert with relative line numbers
109+
hidden: false
110+
class: ""
111+
tooltip: ""
112+
id: ""
113+
style: default
114+
action:
115+
type: insertIntoNote
116+
line: selfEnd + 1
117+
value: Hello
118+
```
119+
Hello

packages/core/src/metadata/MetadataSource.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ export abstract class FilePathMetadataSource<T extends FilePathMetadataCacheItem
233233
}
234234

235235
getCacheItems(): T[] {
236-
return this.cache.values().toArray();
236+
return Array.from(this.cache.values());
237237
}
238238

239239
shouldDelete(_cacheItem: T): boolean {

packages/core/src/utils/LineNumberExpression.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ export class LineNumberExpression {
9696

9797
if (this.literal in context) {
9898
return (context as unknown as Record<string, number>)[this.literal];
99+
} else {
100+
throw new Error(`Error while evaluating line number expression: Literal "${this.literal}" not available.`);
99101
}
100-
101-
return undefined;
102102
}
103103
}

packages/obsidian/src/ObsInternalAPI.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,8 @@ export class ObsInternalAPI extends InternalAPI<ObsMetaBind> {
211211

212212
const newFile = await templaterAPI.create_new_note_from_template(templateFile, folder, fileName, false);
213213

214+
// The problem here is that Templater can't open the note in a new tab.
215+
// TODO: maybe a better way to handle this would be to first create and switch to a new tab, and then let templater open it.
214216
if (openNote && newFile) {
215217
await this.mb.file.openInSourceMode(newFile, newTab);
216218
}

packages/obsidian/src/ObsUtils.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ export function getJsEnginePluginAPI(mb: ObsMetaBind): JsEngineAPI {
1616
}
1717

1818
export enum Templater_RunMode {
19-
CreateNewFromTemplate,
20-
AppendActiveFile,
21-
OverwriteFile,
22-
OverwriteActiveFile,
23-
DynamicProcessor,
24-
StartupTemplate,
19+
CreateNewFromTemplate,
20+
AppendActiveFile,
21+
OverwriteFile,
22+
OverwriteActiveFile,
23+
DynamicProcessor,
24+
StartupTemplate,
2525
}
2626

2727
export function getTemplaterPluginAPI(mb: ObsMetaBind): Templater {

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"compilerOptions": {
33
"baseUrl": ".",
44
"module": "ESNext",
5-
"target": "ES2020",
5+
"target": "ES2022",
66
"allowJs": true,
77
"noImplicitAny": true,
88
"strict": true,

0 commit comments

Comments
 (0)