Moved injection out of constructor; refactored nedton-editor component and saveAs logic
This commit is contained in:
@@ -89,14 +89,14 @@ const saveFile = (fpath, content) => {
|
||||
});
|
||||
}
|
||||
|
||||
const saveFileAs = (content) => {
|
||||
dialog.showSaveDialog().then((response) => {
|
||||
const saveFileAs = () => {
|
||||
return dialog.showSaveDialog().then((response) => {
|
||||
if (response.canceled) {
|
||||
console.debug("You didn't save the file");
|
||||
return;
|
||||
}
|
||||
|
||||
saveFile(response.filePath, content);
|
||||
return response.filePath;
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -18,7 +18,7 @@ contextBridge.exposeInMainWorld('fs', {
|
||||
getFileContents: (path) => ipcRenderer.invoke("getFileContents", path),
|
||||
openFiles: (startPath) => ipcRenderer.invoke("openFiles", startPath),
|
||||
saveFile: (path, content) => ipcRenderer.invoke("saveFile", path, content),
|
||||
saveFileAs: (content) => ipcRenderer.invoke("saveFileAs", content),
|
||||
saveFileAs: () => ipcRenderer.invoke("saveFileAs"),
|
||||
closeFile: (path) => ipcRenderer.invoke("closeFile", path),
|
||||
getPathForFile: (file) => webUtils.getPathForFile(file),
|
||||
onLoadFiles: (callback) => ipcRenderer.on('load-files', (_event, paths) => callback(paths)),
|
||||
|
Reference in New Issue
Block a user