From 480480f288bfffd145f95db79c9f53adfe30dd0a Mon Sep 17 00:00:00 2001 From: dragonish Date: Tue, 22 Apr 2025 20:39:12 +0800 Subject: [PATCH] refactor(child): modify component name --- components/{outline.ts => child.ts} | 2 +- main.ts | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) rename components/{outline.ts => child.ts} (96%) diff --git a/components/outline.ts b/components/child.ts similarity index 96% rename from components/outline.ts rename to components/child.ts index 71328a8..4b60a7b 100644 --- a/components/outline.ts +++ b/components/child.ts @@ -1,6 +1,6 @@ import { Component, View } from "obsidian"; -export class OutlineChildComponent extends Component { +export class ViewChildComponent extends Component { private leafId: string; private view: View | null; private containerEl: HTMLElement | null; diff --git a/main.ts b/main.ts index c6f0210..d0f8a9c 100644 --- a/main.ts +++ b/main.ts @@ -47,7 +47,7 @@ import { editorModeField, updateEditorMode, } from "./components/view"; -import { OutlineChildComponent } from "./components/outline"; +import { ViewChildComponent } from "./components/child"; import { FolderSuggest } from "./components/suggest"; interface ObsidianEditor extends Editor { @@ -83,10 +83,10 @@ export default class HeadingPlugin extends Plugin { settings: HeadingPluginSettings; private outlineIdSet: Set = new Set(); - private outlineComponents: OutlineChildComponent[] = []; + private outlineComponents: ViewChildComponent[] = []; private fileExplorerIdSet: Set = new Set(); - private fileExplorerComponents: OutlineChildComponent[] = []; + private fileExplorerComponents: ViewChildComponent[] = []; async onload() { await this.loadSettings(); @@ -407,7 +407,7 @@ export default class HeadingPlugin extends Plugin { this.outlineIdSet.add(leafId); - const oc = new OutlineChildComponent( + const vc = new ViewChildComponent( leafId, view, viewContent, @@ -544,8 +544,8 @@ export default class HeadingPlugin extends Plugin { } ); - this.outlineComponents.push(oc); - view.addChild(oc); + this.outlineComponents.push(vc); + view.addChild(vc); view.register(() => { this.outlineComponents = this.outlineComponents.filter( (item) => !item.equal(leafId) @@ -572,7 +572,7 @@ export default class HeadingPlugin extends Plugin { this.fileExplorerIdSet.add(leafId); - const oc = new OutlineChildComponent( + const vc = new ViewChildComponent( leafId, view, navFilesContainer, @@ -720,8 +720,8 @@ export default class HeadingPlugin extends Plugin { } ); - this.fileExplorerComponents.push(oc); - view.addChild(oc); + this.fileExplorerComponents.push(vc); + view.addChild(vc); view.register(() => { this.fileExplorerComponents = this.fileExplorerComponents.filter( (item) => !item.equal(leafId)