fix some issues; migrate to bun'

This commit is contained in:
Moritz Jung 2024-04-11 22:30:55 +02:00
parent cf3d5c6d6f
commit 54293ac3a1
56 changed files with 1360 additions and 764 deletions

View file

@ -145,7 +145,9 @@ export function markdownTable(content: string[][]): string {
return table;
}
export const fragWithHTML = (html: string) => createFragment(frag => (frag.createDiv().innerHTML = html));
export function fragWithHTML(html: string): DocumentFragment {
return createFragment(frag => (frag.createDiv().innerHTML = html));
}
export function dateToString(date: Date): string {
return `${date.getMonth() + 1}-${date.getDate()}-${date.getFullYear()}`;
@ -207,13 +209,13 @@ export function unCamelCase(str: string): string {
// space before last upper in a sequence followed by lower
.replace(/\b([A-Z]+)([A-Z])([a-z])/, '$1 $2$3')
// uppercase the first character
.replace(/^./, function(str) {
.replace(/^./, function (str) {
return str.toUpperCase();
})
);
}
export function hasTemplaterPlugin(app: App) {
export function hasTemplaterPlugin(app: App): boolean {
const templater = (app as any).plugins.plugins['templater-obsidian'];
return !!templater;
@ -221,7 +223,7 @@ export function hasTemplaterPlugin(app: App) {
// Copied from https://github.com/anpigon/obsidian-book-search-plugin
// Licensed under the MIT license. Copyright (c) 2020 Jake Runzer
export async function useTemplaterPluginInFile(app: App, file: TFile) {
export async function useTemplaterPluginInFile(app: App, file: TFile): Promise<void> {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const templater = (app as any).plugins.plugins['templater-obsidian'];
if (templater && !templater?.settings['trigger_on_file_creation']) {