mirror of
https://github.com/amitwh/markdown-converter.git
synced 2026-08-03 10:21:06 +05:30
feat: add writing analytics dashboard and daily word goal tracking
This commit is contained in:
@@ -21,6 +21,7 @@ interface EditorState {
|
||||
setCursor: (id: string, line: number, column: number) => void;
|
||||
closeBuffer: (id: string) => void;
|
||||
setActive: (id: string) => void;
|
||||
renameBuffer: (oldId: string, newId: string, newPath: string) => void;
|
||||
}
|
||||
|
||||
export const useEditorStore = create<EditorState>()(
|
||||
@@ -59,5 +60,14 @@ export const useEditorStore = create<EditorState>()(
|
||||
set((s) => {
|
||||
s.activeId = id;
|
||||
}),
|
||||
renameBuffer: (oldId, newId, newPath) =>
|
||||
set((s) => {
|
||||
const buf = s.buffers.get(oldId);
|
||||
if (buf) {
|
||||
s.buffers.delete(oldId);
|
||||
s.buffers.set(newId, { ...buf, id: newId, path: newPath });
|
||||
if (s.activeId === oldId) s.activeId = newId;
|
||||
}
|
||||
}),
|
||||
}))
|
||||
);
|
||||
Reference in New Issue
Block a user