-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into 411-delete-file
- Loading branch information
Showing
39 changed files
with
359 additions
and
286 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import { doFileActions, doNodeActions } from "./"; | ||
import { doNodeActions } from "./node"; | ||
import { doFileActions } from "./file"; | ||
|
||
export const callNodeApi = doNodeActions; | ||
export const callFileApi = doFileActions; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { Buffer } from "buffer"; | ||
|
||
export const _fs = window.Filer.fs; | ||
export const _path = window.Filer.path; | ||
export const _sh = new _fs.Shell(); | ||
|
||
export const _createIDBDirectory = async (path: string): Promise<void> => { | ||
return new Promise<void>((resolve, reject) => { | ||
_fs.mkdir(path, (err: any) => { | ||
err ? reject(err) : resolve(); | ||
}); | ||
}); | ||
}; | ||
export const _readIDBFile = async (path: string): Promise<Uint8Array> => { | ||
return new Promise<Uint8Array>((resolve, reject) => { | ||
_fs.readFile(path, (err: any, data: Buffer) => { | ||
err ? reject(err) : resolve(data); | ||
}); | ||
}); | ||
}; | ||
export const _writeIDBFile = async ( | ||
path: string, | ||
content: Uint8Array | string, | ||
): Promise<void> => { | ||
return new Promise<void>((resolve, reject) => { | ||
_fs.writeFile(path, content, (err: any) => { | ||
err ? reject(err) : resolve(); | ||
}); | ||
}); | ||
}; | ||
export const _removeIDBDirectoryOrFile = async ( | ||
path: string, | ||
): Promise<void> => { | ||
return new Promise<void>((resolve, reject) => { | ||
_sh.rm(path, { recursive: true }, (err: any) => { | ||
err ? reject(err) : resolve(); | ||
}); | ||
}); | ||
}; | ||
export const _readIDBDirectory = async (path: string): Promise<string[]> => { | ||
return new Promise<string[]>((resolve, reject) => { | ||
_fs.readdir(path, (err: any, files: string[]) => { | ||
err ? reject(err) : resolve(files); | ||
}); | ||
}); | ||
}; | ||
export const _getIDBDirectoryOrFileStat = async ( | ||
path: string, | ||
): Promise<any> => { | ||
return new Promise<any>((resolve, reject) => { | ||
_fs.stat(path, (err: any, stats: any) => { | ||
err ? reject(err) : resolve(stats); | ||
}); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
export * from "./apis"; | ||
export * from "./types"; | ||
export * from "./helpers"; | ||
export * from "./apis"; | ||
export * from "./file"; | ||
export * from "./node"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,26 @@ | ||
import { createSlice, PayloadAction } from "@reduxjs/toolkit"; | ||
|
||
import { TCodeViewReducerState } from "./types"; | ||
import { TNodeUid } from "@_node/types"; | ||
|
||
const codeViewReducerInitialState: TCodeViewReducerState = { | ||
editingNodeUid: null, | ||
codeViewTabSize: 4, | ||
}; | ||
const codeViewSlice = createSlice({ | ||
name: "codeView", | ||
initialState: codeViewReducerInitialState, | ||
reducers: { | ||
setEditingNodeUidInCodeView(state, action: PayloadAction<TNodeUid | null>) { | ||
const editingNodeUid = action.payload; | ||
state.editingNodeUid = editingNodeUid; | ||
}, | ||
setCodeViewTabSize(state, action: PayloadAction<number>) { | ||
const codeViewTabSize = action.payload; | ||
state.codeViewTabSize = codeViewTabSize; | ||
}, | ||
}, | ||
}); | ||
export const { setCodeViewTabSize } = codeViewSlice.actions; | ||
export const { setEditingNodeUidInCodeView, setCodeViewTabSize } = | ||
codeViewSlice.actions; | ||
export const CodeViewReduer = codeViewSlice.reducer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
import { TNodeUid } from "@_node/types"; | ||
|
||
export type TCodeViewReducerState = { | ||
editingNodeUid: TNodeUid | null; | ||
codeViewTabSize: number; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.