Skip to content

Commit

Permalink
refactor(obsidian): update to activeWin in obsidian API
Browse files Browse the repository at this point in the history
  • Loading branch information
aidenlx committed Oct 7, 2023
1 parent dcd4179 commit 3576461
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 12 deletions.
4 changes: 1 addition & 3 deletions app/obsidian/src/note-feature/service.ts
Expand Up @@ -13,7 +13,6 @@ import { getItemKeyOf, isLiteratureNote } from "@/services/note-index";
import type { TemplateRenderer } from "@/services/template";
import { Template, fromPath } from "@/services/template/eta/preset";
import type { Context } from "@/services/template/helper/base.js";
import { getActiveWin } from "@/utils/active-win";
import ZoteroPlugin from "@/zt-main";
import { AnnotationView, annotViewType } from "./annot-view/view";
import { CitationEditorSuggest, insertCitationTo } from "./citation-suggest/";
Expand Down Expand Up @@ -187,8 +186,7 @@ class NoteFeatures extends Service {
.setIcon("reset")
.onClick(async () => {
// make sure prompt is shown in the active window
const win = getActiveWin(app);
if (!win.confirm("Reset template to default?")) return;
if (!activeWindow.confirm("Reset template to default?")) return;
await plugin.app.vault.modify(
file as TFile,
Template.Ejectable[tpl.name],
Expand Down
4 changes: 1 addition & 3 deletions app/obsidian/src/setting-tab/template/EjectableTemplate.tsx
Expand Up @@ -9,7 +9,6 @@ import {
toPath,
type TplType,
} from "@/services/template/eta/preset";
import { getActiveWin } from "@/utils/active-win";
import { useIconRef } from "@/utils/icon";
import { SettingTabCtx } from "../common";
import Setting from "../components/Setting";
Expand Down Expand Up @@ -61,8 +60,7 @@ export function EjectableTemplate({ type }: { type: TplType.Ejectable }) {
ref={resetIconRef}
onClick={async () => {
// make sure prompt is shown in the active window
const win = getActiveWin(app);
if (!win.confirm("Reset template to default?")) return;
if (!activeWindow.confirm("Reset template to default?")) return;
const file = app.vault.getAbstractFileByPath(filepath);
if (file instanceof TFile) {
await app.vault.modify(file, Template.Ejectable[type]);
Expand Down
6 changes: 0 additions & 6 deletions app/obsidian/src/utils/active-win.ts

This file was deleted.

0 comments on commit 3576461

Please sign in to comment.