recent docs

LianaHus-patch-7
bunsenstraat 11 months ago
parent b2bf1dceee
commit a2dacd5dc7
  1. 1
      .gitignore
  2. 4
      apps/remixdesktop/src/engine.ts
  3. 13
      apps/remixdesktop/src/menus/edit.ts
  4. 33
      apps/remixdesktop/src/menus/file.ts
  5. 4
      apps/remixdesktop/src/plugins/fsPlugin.ts
  6. 1
      libs/remix-ui/workspace/src/lib/actions/workspace.ts

1
.gitignore vendored

@ -63,3 +63,4 @@ apps/remixdesktop/out
apps/remixdesktop/release/ apps/remixdesktop/release/
apps/remix-ide/src/assets/list.json apps/remix-ide/src/assets/list.json
apps/remix-ide/src/assets/esbuild.wasm apps/remix-ide/src/assets/esbuild.wasm
apps/remixdesktop/build*

@ -36,8 +36,8 @@ ipcMain.handle('manager:activatePlugin', async (event, plugin) => {
return await appManager.call(plugin, 'createClient', event.sender.id) return await appManager.call(plugin, 'createClient', event.sender.id)
}) })
ipcMain.on('fs:openFolder', async (event) => { ipcMain.on('fs:openFolder', async (event, path?) => {
fsPlugin.openFolder(event) fsPlugin.openFolder(event, path)
}) })

@ -33,19 +33,6 @@ export default (
}, },
]; ];
if (process.platform !== 'darwin') {
submenu.push(
{ type: 'separator' },
{
label: 'Preferences...',
accelerator: commandKeys['window:preferences'],
click() {
execCommand('window:preferences');
}
}
);
}
return { return {
label: 'Edit', label: 'Edit',
submenu submenu

@ -1,4 +1,22 @@
import { BrowserWindow, MenuItemConstructorOptions } from 'electron'; import { BrowserWindow, MenuItemConstructorOptions, app, ipcMain } from 'electron';
import fs from 'fs'
import os from 'os'
import path from 'path'
import { cacheDir } from '../utils/config';
let recentFolders: string[] = []
if (fs.existsSync(cacheDir + '/remixdesktop.json')) {
try {
// read the cache file
const cache = fs.readFileSync(cacheDir + '/remixdesktop.json')
const data = JSON.parse(cache.toString())
recentFolders = data && data.recentFolders || []
console.log('recentFolders', recentFolders)
} catch (e) {
}
}
export default ( export default (
commandKeys: Record<string, string>, commandKeys: Record<string, string>,
@ -31,11 +49,16 @@ export default (
}, },
{ {
role: 'recentDocuments', role: 'recentDocuments',
submenu: [ submenu: recentFolders.map((folder) => {
{ return {
role: 'clearRecentDocuments' label: folder,
click(item, focusedWindow) {
if(focusedWindow) {
ipcMain.emit('fs:openFolder', focusedWindow.webContents.id, folder);
}
}
} }
] })
}, },
{ {
role: 'close', role: 'close',

@ -76,10 +76,10 @@ export class FSPlugin extends ElectronBasePlugin {
} }
} }
openFolder(webContentsId: any): void { openFolder(webContentsId: any, path?: string): void {
const client = this.clients.find((c) => c.webContentsId === webContentsId) const client = this.clients.find((c) => c.webContentsId === webContentsId)
if (client) { if (client) {
client.openFolder() client.openFolder(path)
} }
} }
} }

@ -88,7 +88,6 @@ export const setPlugin = (filePanelPlugin, reducerDispatch) => {
} }
}) })
plugin.on('fs', 'workingDirChanged', async (dir: string) => { plugin.on('fs', 'workingDirChanged', async (dir: string) => {
console.log('workingDirChanged', dir)
dispatch(setCurrentLocalFilePath(dir)) dispatch(setCurrentLocalFilePath(dir))
await checkGit() await checkGit()
}) })

Loading…
Cancel
Save