Skip to content

Commit

Permalink
feat: update July/28/2024
Browse files Browse the repository at this point in the history
  • Loading branch information
nhannht committed Jul 28, 2024
1 parent f7c12d2 commit a39c6e1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 25 deletions.
8 changes: 3 additions & 5 deletions main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ const DEFAULT_SETTINGS: SmartGanttSettings = {
pathListFilter: ["AllFiles"],
todoShowQ: true,
doneShowQ: true,
leftBarChartDisplayQ:true,
viewMode:ViewMode.Day
leftBarChartDisplayQ: true,
viewMode: ViewMode.Day

}

Expand All @@ -23,14 +23,14 @@ 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
this.app.workspace.iterateCodeMirrors(cm => cm.setOption("mode", cm.getOption("mode")))
}



override async onload() {
await this.settingManager.loadSettings()

Expand Down Expand Up @@ -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));

Expand Down
26 changes: 7 additions & 19 deletions src/BlockComponent/TaskListMdBlock.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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,
Expand All @@ -24,25 +24,14 @@ export const TaskListMdBlock = (props: {
// const [resultWithChronoCount, setResultWithChronoCount] = useState(0)
const [timelineResults, setTimelineResults] = useState<TimelineExtractorResultNg[]>([])
const [tasks, setTasks] = useState<Task[]>([])
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();
Expand Down Expand Up @@ -113,7 +102,6 @@ export const TaskListMdBlock = (props: {
}, [timelineResults])



if (isSettingQ) {
mainComponent = <main>
<SettingViewComponent
Expand Down
2 changes: 1 addition & 1 deletion src/GanttBlockManager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export default class GanttBlockManager {
thisPlugin={this.thisPlugin}
settings={settings}/>
</AppContext.Provider>
</StrictMode>
</StrictMode>

)
})
Expand Down

0 comments on commit a39c6e1

Please sign in to comment.