From a39c6e121fe0065f900a7ff449220be35f0d9864 Mon Sep 17 00:00:00 2001 From: nhannht Date: Sun, 28 Jul 2024 23:46:50 +0700 Subject: [PATCH] feat: update July/28/2024 --- main.tsx | 8 +++----- src/BlockComponent/TaskListMdBlock.tsx | 26 +++++++------------------- src/GanttBlockManager.tsx | 2 +- 3 files changed, 11 insertions(+), 25 deletions(-) diff --git a/main.tsx b/main.tsx index 8fa7226..0a50c0e 100644 --- a/main.tsx +++ b/main.tsx @@ -12,8 +12,8 @@ const DEFAULT_SETTINGS: SmartGanttSettings = { pathListFilter: ["AllFiles"], todoShowQ: true, doneShowQ: true, - leftBarChartDisplayQ:true, - viewMode:ViewMode.Day + leftBarChartDisplayQ: true, + viewMode: ViewMode.Day } @@ -23,6 +23,7 @@ export default class SmartGanttPlugin extends Plugin { ganttBlockManager = new GanttBlockManager(this) modesToKeep = ["hypermd", "markdown", "null", "xml"]; + refreshLeaves = () => { // re-set the editor mode to refresh the syntax highlighting //@ts-ignore @@ -30,7 +31,6 @@ export default class SmartGanttPlugin extends Plugin { } - override async onload() { await this.settingManager.loadSettings() @@ -84,8 +84,6 @@ export default class SmartGanttPlugin extends Plugin { await this.ganttBlockManager.registerTaskListBlock() - - // This adds a settings tab so the user can configure various aspects of the plugin // this.addSettingTab(new SampleSettingTab(this.app, this)); diff --git a/src/BlockComponent/TaskListMdBlock.tsx b/src/BlockComponent/TaskListMdBlock.tsx index e1f5217..9674220 100644 --- a/src/BlockComponent/TaskListMdBlock.tsx +++ b/src/BlockComponent/TaskListMdBlock.tsx @@ -1,5 +1,5 @@ -import {useCallback, useEffect, useMemo, useState} from "react"; -import {App, MarkdownPostProcessorContext, TAbstractFile} from "obsidian"; +import {useCallback, useEffect, useState} from "react"; +import {MarkdownPostProcessorContext} from "obsidian"; import SmartGanttPlugin from "../../main"; import {SmartGanttSettings} from "@/SettingManager"; import MarkdownProcesser from "../MarkdownProcesser"; @@ -10,7 +10,7 @@ import SettingViewComponent from "../component/SettingViewComponent"; import TaskList from "../component/TaskList"; import {NavBar} from "@/BlockComponent/NavBar"; -import {useApp} from "@/lib/AppContext"; + export const TaskListMdBlock = (props: { ctx: MarkdownPostProcessorContext, @@ -24,25 +24,14 @@ export const TaskListMdBlock = (props: { // const [resultWithChronoCount, setResultWithChronoCount] = useState(0) const [timelineResults, setTimelineResults] = useState([]) const [tasks, setTasks] = useState([]) - const app = useApp() as App - const consoleMyName = useCallback( (file:TAbstractFile)=>{ - console.log(file) - },[]) - useEffect(() => { - return ()=>{ - app.vault.off('modify',consoleMyName) - app.vault.off('modify',consoleMyName) - } - }); - - useMemo(()=>{ - props.thisPlugin.registerEvent(app.vault.on('modify',consoleMyName)) - // console.log("Memo memo") - },[]) + // useMemo(() => { + // props.thisPlugin.registerEvent(app.vault.on('modify', consoleMyName)) + // // console.log("Memo memo") + // }, []) const reupdateData = useCallback(async () => { const allMarkdownFiles = props.thisPlugin.app.vault.getMarkdownFiles(); @@ -113,7 +102,6 @@ export const TaskListMdBlock = (props: { }, [timelineResults]) - if (isSettingQ) { mainComponent =
- + ) })