rdesktop2
filip mertens 1 year ago
parent 8edd1925b7
commit 0483d13e56
  1. 6
      apps/1test/src/remix/ui/remix-ui-xterminals.tsx
  2. 3
      apps/remix-ide/src/app.js
  3. 19
      apps/remix-ide/src/app/files/dgitProvider.js
  4. 2
      apps/remix-ide/src/app/files/electronProvider.ts
  5. 4
      apps/remix-ide/src/app/plugins/electron/xtermPlugin.ts
  6. 1
      apps/remix-ide/src/app/plugins/parser/code-parser.tsx
  7. 9
      apps/remixdesktop/src/engine.ts
  8. 120
      apps/remixdesktop/src/main.ts
  9. 3
      apps/remixdesktop/src/plugins/configPlugin.ts
  10. 25
      apps/remixdesktop/src/plugins/fsPlugin.ts
  11. 63
      apps/remixdesktop/src/plugins/isoGitPlugin.ts
  12. 7
      apps/remixdesktop/src/plugins/templates.ts
  13. 24
      apps/remixdesktop/src/plugins/xtermPlugin.ts
  14. 12
      apps/remixdesktop/src/preload.ts
  15. 1
      apps/remixdesktop/src/tools/git.ts
  16. 3
      libs/remix-ui/panel/src/lib/dragbar/dragbar.tsx
  17. 1
      libs/remix-ui/panel/src/lib/plugins/panel-plugin.tsx
  18. 2
      libs/remix-ui/workspace/src/lib/actions/index.ts
  19. 2
      libs/remix-ui/workspace/src/lib/actions/workspace.ts
  20. 7
      libs/remix-ui/workspace/src/lib/components/electron-menu.tsx
  21. 3
      libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx
  22. 20
      libs/remix-ui/xterm/src/lib/components/remix-ui-xterm.tsx
  23. 16
      libs/remix-ui/xterm/src/lib/components/remix-ui-xterminals.tsx
  24. 3
      libs/remix-ui/xterm/src/lib/components/xterm-fit-addOn.ts
  25. 3
      libs/remix-ui/xterm/src/lib/components/xterm-wrap.tsx

@ -48,11 +48,6 @@ export const RemixUiXterminals = (props: RemixUiXterminalsProps) => {
})
}
useEffect(() => {
console.log('terminals', terminals)
}, [terminals])
const send = (data: string, pid: number) => {
plugin.call('xterm', 'keystroke', data, pid)
}
@ -71,7 +66,6 @@ export const RemixUiXterminals = (props: RemixUiXterminalsProps) => {
}
const setTerminalRef = (pid: number, ref: any) => {
console.log('setTerminalRef', pid, ref)
setTerminals(prevState => {
const terminal = prevState.find(xtermState => xtermState.pid === pid)
terminal.ref = ref

@ -88,9 +88,6 @@ const { TabProxy } = require('./app/panels/tab-proxy.js')
class AppComponent {
constructor() {
console.log(window.electronAPI)
console.log(window.api)
this.appManager = new RemixAppManager({})
this.queryParams = new QueryParams()
this._components = {}

@ -104,16 +104,16 @@ class DGitProvider extends Plugin {
if (isElectron()) {
const status = await this.call('isogit', 'status', cmd)
console.log('STATUS', status)
return status
}
console.log('status')
const status = await git.statusMatrix({
...await this.getGitConfig(),
...cmd
})
console.log('STATUS', status)
return status
}
@ -132,7 +132,7 @@ class DGitProvider extends Plugin {
}
async rm(cmd) {
console.log('rm', cmd)
if (isElectron()) {
await this.call('isogit', 'rm', cmd)
} else {
@ -146,7 +146,7 @@ class DGitProvider extends Plugin {
}
async reset(cmd) {
console.log('rm', cmd)
if (isElectron()) {
await this.call('isogit', 'reset', cmd)
} else {
@ -184,7 +184,7 @@ class DGitProvider extends Plugin {
...cmd,
depth: 10
})
console.log('STATUS', status)
return status
}
@ -233,12 +233,10 @@ class DGitProvider extends Plugin {
async currentbranch(config) {
console.log('currentbranch')
if (isElectron()) {
console.log('currentbranch electron')
return await this.call('isogit', 'currentbranch')
}
try {
@ -329,10 +327,8 @@ class DGitProvider extends Plugin {
}
async readblob(cmd) {
console.log('readblob', cmd)
if (isElectron()) {
const readBlobResult = await this.call('isogit', 'readblob', cmd)
console.log('readblob', readBlobResult)
return readBlobResult
}
const readBlobResult = await git.readBlob({
@ -385,7 +381,6 @@ class DGitProvider extends Plugin {
if (isElectron()) {
const folder = await this.call('fs', 'selectFolder')
if (!folder) return false
console.log('folder', folder)
const cmd = {
url: input.url,
singleBranch: input.singleBranch,

@ -15,7 +15,6 @@ export class ElectronProvider extends FileProvider {
async init() {
this._appManager.on('fs', 'change', (event, path) => {
console.log('change', event, path)
switch (event) {
case 'add':
this.event.emit('fileAdded', path)
@ -47,7 +46,6 @@ export class ElectronProvider extends FileProvider {
if (path.indexOf('/') !== 0) path = '/' + path
try {
const files = await window.remixFileSystem.readdir(path)
console.log(files.length, 'files resolveDirectory ELECTRON')
const ret = {}
if (files) {
for (let element of files) {

@ -8,8 +8,4 @@ export class xtermPlugin extends ElectronPlugin {
description: 'xterm',
})
}
onActivation(){
console.log('xtermPlugin Activated')
}
}

@ -125,7 +125,6 @@ export class CodeParser extends Plugin {
})
this.on('filePanel', 'setWorkspace', async () => {
console.log('setWorkspace')
await this.call('fileDecorator', 'clearFileDecorators')
await this.importService.setFileTree()
})

@ -27,28 +27,23 @@ appManager.activatePlugin('fs')
ipcMain.handle('manager:activatePlugin', async (event, plugin) => {
console.log('manager:activatePlugin', plugin, event.sender.id)
return await appManager.call(plugin, 'createClient', event.sender.id)
})
ipcMain.on('fs:openFolder', async (event) => {
console.log('fs:openFolder', event)
fsPlugin.openFolder(event)
})
ipcMain.on('terminal:new', async (event) => {
console.log('terminal:new', event)
xtermPlugin.new(event)
})
ipcMain.on('template:open', async (event) => {
console.log('template:open', event)
templatesPlugin.openTemplate(event)
})
ipcMain.on('git:startclone', async (event) => {
console.log('git:startclone', event)
isoGitPlugin.startClone(event)
})
@ -60,9 +55,7 @@ ipcMain.handle('getWebContentsID', (event, message) => {
app.on('before-quit', async (event) => {
//event.preventDefault()
console.log('before-quit')
await appManager.call('fs', 'removeCloseListener')
await appManager.call('fs', 'closeWatch')
//app.quit()
await appManager.call('xterm', 'closeTerminals')
})

@ -90,13 +90,11 @@ const showAbout = () => {
const isMac = process.platform === 'darwin'
import FileMenu from './menus/file';
import MainMenu from './menus/main';
import darwinMenu from './menus/darwin';
import WindowMenu from './menus/window';
import EditMenu from './menus/edit';
import GitMenu from './menus/git';
import ViewMenu from './menus/view';
import TerminalMenu from './menus/terminal';
import { execCommand } from './menus/commands';
@ -115,121 +113,3 @@ WindowMenu(commandKeys, execCommand, []),
Menu.setApplicationMenu(Menu.buildFromTemplate(menu))
/*
searchProxy.checkIfGrepIsInstalled().then((result) => {
console.log('grep --version', result)
})
searchProxy.checkIffindstrIsInstalled().then((result) => {
console.log('findstr /?', result)
})
searchProxy.checkIfSelectStringIsInstalled().then((result) => {
console.log('get-help Select-String', result)
})
*/
interface position {
start: {
line: number
column: number
},
end: {
line: number
column: number
}
}
export interface SearchResultLineLine {
left: any,
center: any,
right: any,
position: position
}
export interface SearchResultLine {
lines: SearchResultLineLine[]
}
//import * as cp from 'child_process';
//import { rgPath } from '@vscode/ripgrep';
//const rgDiskPath = rgPath.replace(/\bnode_modules\.asar\b/, 'node_modules.asar.unpacked');
//console.log('rgDiskPath', rgDiskPath)
// ripgrep
// -s means case sensitive
// -i means ignore case
// -F means fixed strings so not regex
/*
-g, --glob GLOB ...
Include or exclude files and directories for searching that match the given glob. This always overrides any other ignore logic. Multiple glob flags may be used. Globbing rules match .gitignore globs. Precede a glob with a ! to exclude it. If multiple globs match a file or directory, the glob given later in the command line takes precedence.
*/
/*
console.log('process.cwd()', process.cwd())
const child = cp.spawn(rgDiskPath, ['bunsens[a-z]*', '--json', './'], { cwd: process.cwd() });
child.on('error', (err) => {
console.log('error', err)
}
)
child.stdout.on('data', (data) => {
const lines: string[] = data.toString().split('\n')
lines.forEach(line => {
if (line) {
try {
const result = JSON.parse(line)
if (result && result.type && result.type === 'match') {
//console.log('line:', result)
//console.log('path:', result.data.path.text)
//console.log('line:', result.data.lines.text)
//console.log('submatch: ', result.data.submatches)
let searchResultLine: SearchResultLine = {
lines: []
}
result.data.submatches.forEach((submatch: any) => {
searchResultLine.lines.push({
left: result.data.lines.text.substring(0, submatch.start),
center: result.data.lines.text.substring(submatch.start, submatch.end),
right: result.data.lines.text.substring(submatch.end),
position: {
start: {
line: result.data.line_number,
column: submatch.start,
},
end: {
line: result.data.line_number,
column: submatch.end,
},
},
})
})
console.log('searchResultLine', searchResultLine)
}
} catch (e) {
console.log('error ripgrep', e)
}
}
})
//console.log('stdout', lines)
}
)
child.stderr.on('data', (data) => {
console.log('stderr', data.toString())
}
)
child.on('close', (code) => {
console.log('close', code)
}
)
child.on('exit', (code) => {
console.log('exit', code)
}
)
*/

@ -37,9 +37,6 @@ class ConfigPluginClient extends ElectronBasePluginClient {
constructor(webContentsId: number, profile: Profile) {
super(webContentsId, profile)
this.onload(() => {
//console.log('config client onload')
})
}
async writeConfig(data: any): Promise<void> {

@ -38,7 +38,6 @@ export class FSPlugin extends ElectronBasePlugin {
const foldersToDelete: string[] = []
if (openedFolders && openedFolders.length) {
for (const folder of openedFolders) {
console.log('opening folder', folder)
try {
const stat = await fs.stat(folder)
if (stat.isDirectory()) {
@ -54,14 +53,12 @@ export class FSPlugin extends ElectronBasePlugin {
this.call('electronconfig', 'writeConfig', { 'recentFolders': newFolders })
}
}else{
console.log('no opened folders')
createWindow()
}
}
async removeCloseListener(): Promise<void> {
for (const client of this.clients) {
console.log('removeCloseListener', client.webContentsId)
client.window.removeAllListeners()
}
}
@ -96,13 +93,12 @@ class FSPluginClient extends ElectronBasePluginClient {
constructor(webContentsId: number, profile: Profile) {
super(webContentsId, profile)
this.onload(() => {
//console.log('fsPluginClient onload')
if(!isPackaged) {
this.window.webContents.openDevTools()
}
this.window.on('close', async () => {
console.log('close', this.webContentsId)
await this.removeFromOpenedFolders(this.workingDir)
await this.closeWatch()
})
})
@ -111,7 +107,6 @@ class FSPluginClient extends ElectronBasePluginClient {
// best for non recursive
async readdir(path: string): Promise<string[]> {
// call node fs.readdir
console.log('readdir', path)
if (!path) return []
const startTime = Date.now()
const files = await fs.readdir(this.fixPath(path), {
@ -126,14 +121,12 @@ class FSPluginClient extends ElectronBasePluginClient {
isDirectory
})
}
console.log('readdir', result, Date.now() - startTime)
return result
}
async glob(path: string, pattern: string, options?: GlobOptions): Promise<string[] | Path[]> {
path = this.fixPath(path)
console.log('glob', path, pattern, options)
const files = await glob(path + pattern, {
withFileTypes: true,
...options
@ -153,24 +146,20 @@ class FSPluginClient extends ElectronBasePluginClient {
isDirectory: (file as Path).isDirectory(),
})
}
//console.log('glob', result)
return result
}
async readFile(path: string, options: any): Promise<string | undefined> {
//console.log('readFile', path, options)
// hacky fix for TS error
if (!path) return undefined
try {
return (fs as any).readFile(this.fixPath(path), options)
} catch (e) {
//console.log('readFile error', e)
return undefined
}
}
async writeFile(path: string, content: string, options: any): Promise<void> {
//console.log('writeFile', path, content, options)
this.trackDownStreamUpdate[path] = content
return (fs as any).writeFile(this.fixPath(path), content, options)
}
@ -180,7 +169,6 @@ class FSPluginClient extends ElectronBasePluginClient {
}
async rmdir(path: string): Promise<void> {
console.log('rmdir', this.fixPath(path))
return fs.rm(this.fixPath(path), {
recursive: true
})
@ -197,14 +185,12 @@ class FSPluginClient extends ElectronBasePluginClient {
async stat(path: string): Promise<any> {
try {
const stat = await fs.stat(this.fixPath(path))
////console.log('stat', path, stat)
const isDirectory = stat.isDirectory()
return {
...stat,
isDirectoryValue: isDirectory
}
} catch (e) {
//console.log('stat error', e)
return undefined
}
}
@ -218,7 +204,6 @@ class FSPluginClient extends ElectronBasePluginClient {
isDirectoryValue: isDirectory
}
} catch (e) {
//console.log('lstat error', e)
return undefined
}
}
@ -235,7 +220,6 @@ class FSPluginClient extends ElectronBasePluginClient {
async watch(): Promise<void> {
if (this.watcher) this.watcher.close()
console.log('watch', this.workingDir)
this.watcher =
chokidar.watch(this.workingDir, {
ignorePermissionErrors: true, ignoreInitial: true,
@ -245,7 +229,6 @@ class FSPluginClient extends ElectronBasePluginClient {
}).on('all', async (eventName, path, stats) => {
console.log('change', eventName, path, stats)
let pathWithoutPrefix = path.replace(this.workingDir, '')
pathWithoutPrefix = convertPathToPosix(pathWithoutPrefix)
@ -255,7 +238,6 @@ class FSPluginClient extends ElectronBasePluginClient {
// remove workingDir from path
const newContent = await fs.readFile(path, 'utf-8')
console.log('change', pathWithoutPrefix, this.trackDownStreamUpdate)
const currentContent = this.trackDownStreamUpdate[pathWithoutPrefix]
if (currentContent !== newContent) {
@ -278,7 +260,6 @@ class FSPluginClient extends ElectronBasePluginClient {
}
async closeWatch(): Promise<void> {
console.log('closing Watcher', this.webContentsId)
if (this.watcher) this.watcher.close()
}
@ -299,11 +280,9 @@ class FSPluginClient extends ElectronBasePluginClient {
}
async removeFromOpenedFolders(path: string): Promise<void> {
console.log('removeFromOpenedFolders', path)
const config = await this.call('electronconfig' as any, 'readConfig')
config.openedFolders = config.openedFolders || []
config.openedFolders = config.openedFolders.filter((p: string) => p !== path)
console.log('removeFromOpenedFolders', config)
writeConfig(config)
}
@ -362,13 +341,11 @@ class FSPluginClient extends ElectronBasePluginClient {
await this.updateRecentFolders(path)
await this.updateOpenedFolders(path)
this.window.setTitle(this.workingDir)
console.log('setWorkingDir', path)
this.watch()
this.emit('workingDirChanged', path)
}
async setWorkingDir(path: string): Promise<void> {
console.log('setWorkingDir', path)
this.workingDir = path
await this.updateRecentFolders(path)
await this.updateOpenedFolders(path)

@ -55,14 +55,9 @@ class IsoGitPluginClient extends ElectronBasePluginClient {
constructor(webContentsId: number, profile: Profile) {
super(webContentsId, profile)
this.onload(() => {
console.log('IsoGit client onload')
this.on('fs' as any, 'workingDirChanged', async (path: string) => {
console.log('workingDirChanged', path)
this.workingDir = path
this.gitIsInstalled = await gitProxy.version() ? true : false
if (this.gitIsInstalled) {
console.log('git is installed')
}
})
})
}
@ -79,7 +74,7 @@ class IsoGitPluginClient extends ElectronBasePluginClient {
}
async status(cmd: any) {
console.log('status', cmd)
if(this.workingDir === ''){
return []
@ -112,7 +107,6 @@ class IsoGitPluginClient extends ElectronBasePluginClient {
return []
}
console.log('log')
const log = await git.log({
...await this.getGitConfig(),
...cmd
@ -122,43 +116,42 @@ class IsoGitPluginClient extends ElectronBasePluginClient {
}
async add(cmd: any) {
console.log('add')
const add = await git.add({
...await this.getGitConfig(),
...cmd
})
console.log('ADD', add)
return add
}
async rm(cmd: any) {
console.log('rm', cmd)
const rm = await git.remove({
...await this.getGitConfig(),
...cmd
})
console.log('RM', rm)
return rm
}
async reset(cmd: any){
console.log('reset', cmd)
const reset = await git.resetIndex({
...await this.getGitConfig(),
...cmd
})
console.log('RESET', reset)
return reset
}
async commit(cmd: any) {
console.log('commit')
const commit = await git.commit({
...await this.getGitConfig(),
...cmd
})
console.log('COMMIT', commit)
return commit
}
@ -170,7 +163,7 @@ class IsoGitPluginClient extends ElectronBasePluginClient {
}
async branch(cmd: any) {
console.log('branch')
const branch = await git.branch({
...await this.getGitConfig(),
...cmd
@ -180,7 +173,7 @@ class IsoGitPluginClient extends ElectronBasePluginClient {
}
async lsfiles(cmd: any) {
console.log('lsfiles')
const lsfiles = await git.listFiles({
...await this.getGitConfig(),
...cmd
@ -189,7 +182,7 @@ class IsoGitPluginClient extends ElectronBasePluginClient {
}
async resolveref(cmd: any) {
console.log('resolveref')
const resolveref = await git.resolveRef({
...await this.getGitConfig(),
...cmd
@ -200,7 +193,7 @@ class IsoGitPluginClient extends ElectronBasePluginClient {
async readblob(cmd: any) {
console.log('readblob')
const readblob = await git.readBlob({
...await this.getGitConfig(),
...cmd
@ -210,54 +203,54 @@ class IsoGitPluginClient extends ElectronBasePluginClient {
}
async checkout(cmd: any) {
console.log('checkout')
const checkout = await git.checkout({
...await this.getGitConfig(),
...cmd
})
console.log('CHECKOUT', checkout)
return checkout
}
async push(cmd: any) {
console.log('push')
const push = await git.push({
...await this.getGitConfig(),
...cmd,
...parseInput(cmd.input)
})
console.log('PUSH', push)
return push
}
async pull(cmd: any) {
console.log('pull', cmd)
const pull = await git.pull({
...await this.getGitConfig(),
...cmd,
...parseInput(cmd.input)
})
console.log('PULL', pull)
return pull
}
async fetch(cmd: any) {
console.log('fetch', cmd)
const fetch = await git.fetch({
...await this.getGitConfig(),
...cmd,
...parseInput(cmd.input)
})
console.log('FETCH', fetch)
return fetch
}
async clone(cmd: any) {
console.log('clone')
if (this.gitIsInstalled) {
await gitProxy.clone(cmd.url, cmd.dir)
console.log('CLONING WITH NATIVE GIT', cmd)
} else {
try {
const clone = await git.clone({
@ -266,7 +259,7 @@ class IsoGitPluginClient extends ElectronBasePluginClient {
...parseInput(cmd.input),
dir: cmd.dir || this.workingDir
})
console.log('CLONE', clone)
return clone
} catch (e) {
console.log('CLONE ERROR', e)
@ -276,22 +269,22 @@ class IsoGitPluginClient extends ElectronBasePluginClient {
}
async addremote(cmd: any) {
console.log('addremote')
const addremote = await git.addRemote({
...await this.getGitConfig(),
...cmd
})
console.log('ADDREMOTE', addremote)
return addremote
}
async delremote(cmd: any) {
console.log('delremote')
const delremote = await git.deleteRemote({
...await this.getGitConfig(),
...cmd
})
console.log('DELREMOTE', delremote)
return delremote
}
@ -307,7 +300,7 @@ class IsoGitPluginClient extends ElectronBasePluginClient {
try {
const defaultConfig = await this.getGitConfig()
const name = await git.currentBranch(defaultConfig)
console.log('currentbranch', name)
return name
} catch (e) {
return ''

@ -40,9 +40,6 @@ class TemplatesPluginClient extends ElectronBasePluginClient {
constructor(webContentsId: number, profile: Profile) {
super(webContentsId, profile)
this.onload(() => {
console.log('TemplatesPluginClient onload')
})
}
async loadTemplateInNewWindow (files: any) {
@ -50,11 +47,11 @@ class TemplatesPluginClient extends ElectronBasePluginClient {
let folder = await this.call('fs' as any, 'selectFolder')
if (!folder || folder === '') return
// @ts-ignore
console.log('files for template ', files)
for (const file in files) {
try {
if(!folder.endsWith('/')) folder += '/'
console.log('writing file', folder + file)
await fs.mkdir(path.dirname(folder + file), { recursive: true})
await fs.writeFile(folder + file, files[file], {
encoding: 'utf8'

@ -32,7 +32,6 @@ export const detectDefaultShell = () => {
// Stores default shell when imported.
const defaultShell = detectDefaultShell();
console.log('defaultShell', defaultShell)
export default defaultShell;
@ -47,6 +46,7 @@ export class XtermPlugin extends ElectronBasePlugin {
clients: XtermPluginClient[] = []
constructor() {
super(profile, clientProfile, XtermPluginClient)
this.methods = [...super.methods, 'closeTerminals']
}
new(webContentsId: any): void {
@ -56,6 +56,12 @@ export class XtermPlugin extends ElectronBasePlugin {
}
}
async closeTerminals(): Promise<void> {
for (const client of this.clients) {
await client.closeAll()
}
}
}
const clientProfile: Profile = {
@ -71,15 +77,10 @@ class XtermPluginClient extends ElectronBasePluginClient {
constructor(webContentsId: number, profile: Profile) {
super(webContentsId, profile)
this.onload(() => {
console.log('XtermPluginClient onload')
this.emit('loaded')
})
}
async onActivation(): Promise<void> {
console.log('XtermPluginClient onActivation')
}
async keystroke(key: string, pid: number): Promise<void> {
this.terminals[pid].write(key)
}
@ -92,7 +93,6 @@ class XtermPluginClient extends ElectronBasePluginClient {
async createTerminal(path?: string): Promise<number> {
const shell = defaultShell;
console.log('defaultShell', defaultShell)
// filter undefined out of the env
const env = Object.keys(process.env)
@ -112,7 +112,6 @@ class XtermPluginClient extends ElectronBasePluginClient {
});
ptyProcess.onData((data: string) => {
console.log('onData', data)
this.sendData(data, ptyProcess.pid);
})
this.terminals[ptyProcess.pid] = ptyProcess
@ -126,6 +125,15 @@ class XtermPluginClient extends ElectronBasePluginClient {
this.emit('close', pid)
}
async closeAll(): Promise<void> {
for (const pid in this.terminals) {
this.terminals[pid].kill()
delete this.terminals[pid]
this.emit('close', pid)
}
}
async sendData(data: string, pid: number) {
this.emit('data', data, pid)
}

@ -8,19 +8,10 @@ console.log('preload.ts')
const exposedPLugins = ['fs', 'git', 'xterm', 'isogit', 'electronconfig', 'electronTemplates']
console.log('preload.ts', process)
let webContentsId: number | undefined
/*
// get the window id from the process arguments
const windowIdFromArgs = process.argv.find(arg => arg.startsWith('--window-id='))
if (windowIdFromArgs) {
[, windowId] = windowIdFromArgs.split('=')
console.log('windowId', windowId, )
}
*/
ipcRenderer.invoke('getWebContentsID').then((id: number) => {
webContentsId = id
console.log('getWebContentsID', webContentsId)
})
contextBridge.exposeInMainWorld('electronAPI', {
@ -35,7 +26,6 @@ contextBridge.exposeInMainWorld('electronAPI', {
name,
on: (cb:any) => ipcRenderer.on(`${name}:send`, cb),
send: (message: Partial<Message>) => {
console.log('send', message, `${name}:on:${webContentsId}`)
ipcRenderer.send(`${name}:on:${webContentsId}`, message)
}
}

@ -31,7 +31,6 @@ export const gitProxy = {
version: async () => {
try {
const result = await execAsync('git --version');
console.log('git --version', result.stdout)
return result.stdout
} catch (error) {
return false;

@ -16,16 +16,13 @@ const DragBar = (props: IRemixDragBarUi) => {
const nodeRef = React.useRef(null) // fix for strictmode
function stopDrag (e: MouseEvent, data: any) {
console.log('stopDrag', data)
const h = window.innerHeight - data.y
props.refObject.current.setAttribute('style', `height: ${h}px;`)
console.log('stopDrag', `height: ${h}px;`)
setDragBarPosY(props.refObject.current.offsetTop)
setDragState(false)
props.setHideStatus(false)
}
const handleResize = () => {
console.log('handleResize', props.refObject.current)
if (!props.refObject.current) return
setDragBarPosY(props.refObject.current.offsetTop)
}

@ -13,7 +13,6 @@ const RemixUIPanelPlugin = (props: panelPLuginProps, panelRef: any) => {
const ref:any = panelRef || localRef
if (ref.current) {
console.log('ref.current', props.pluginRecord)
if (props.pluginRecord.view) {
if (React.isValidElement(props.pluginRecord.view)) {
setView(props.pluginRecord.view)

@ -45,7 +45,6 @@ const basicWorkspaceInit = async (workspaces: { name: string; isGitRepo: boolean
}
export const initWorkspace = (filePanelPlugin) => async (reducerDispatch: React.Dispatch<any>) => {
console.log('initWorkspace', filePanelPlugin)
if (filePanelPlugin) {
plugin = filePanelPlugin
dispatch = reducerDispatch
@ -119,7 +118,6 @@ export const initWorkspace = (filePanelPlugin) => async (reducerDispatch: React.
}
} else await basicWorkspaceInit(workspaces, workspaceProvider)
} else if (isElectron()) {
console.log('isElectron initWorkspace')
if (params.opendir) {
params.opendir = decodeURIComponent(params.opendir)
plugin.call('notification', 'toast', `opening ${params.opendir}...`)

@ -283,14 +283,12 @@ export const fetchWorkspaceDirectory = async (path: string) => {
if (!path) return
const provider = plugin.fileManager.currentFileProvider()
console.log('fetchWorkspaceDirectory', path, provider)
const promise = new Promise((resolve, reject) => {
provider.resolveDirectory(path, (error, fileTree) => {
if (error) {
console.error(error)
return reject(error)
}
console.log('fetchWorkspaceDirectory', fileTree)
resolve(fileTree)
})
})

@ -14,14 +14,7 @@ export const ElectronMenu = () => {
}
}, [])
useEffect(() => {
if (isElectron()) {
console.log('global.fs.browser.recentFolders', global.fs.browser.recentFolders)
}
}, [global.fs.browser.recentFolders])
const openFolderElectron = async (path: string) => {
console.log('open folder electron', path)
global.dispatchOpenElectronFolder(path)
}

@ -188,17 +188,14 @@ export const FileSystemProvider = (props: WorkspaceProps) => {
}
const dispatchOpenElectronFolder = async (path: string) => {
console.log('open electron folder')
await openElectronFolder(path)
}
const dispatchGetElectronRecentFolders = async () => {
console.log('get electron recent folders')
await getElectronRecentFolders()
}
const dispatchRemoveRecentFolder = async (path: string) => {
console.log('remove recent folder')
await removeRecentElectronFolder(path)
}

@ -22,12 +22,8 @@ const RemixUiXterm = (props: RemixUiXtermProps) => {
const { plugin, pid, send, timeStamp } = props
const xtermRef = React.useRef(null)
useEffect(() => {
console.log('render remix-ui-xterm')
}, [])
useEffect(() => {
console.log('remix-ui-xterm ref', xtermRef.current)
props.setTerminalRef(pid, xtermRef.current)
}, [xtermRef.current])
@ -35,20 +31,16 @@ const RemixUiXterm = (props: RemixUiXtermProps) => {
send(event.key, pid)
}
const onData = (data: string) => {
console.log('onData', data)
}
return (
<Xterm
addons={[fitAddon]}
options={{theme: {background: props.theme.backgroundColor , foreground: props.theme.textColor}}}
<Xterm
addons={[fitAddon]}
options={{ theme: { background: props.theme.backgroundColor, foreground: props.theme.textColor } }}
onRender={() => fitAddon.fit()}
ref={xtermRef} onData={onData}
ref={xtermRef}
onKey={onKey}></Xterm>
)
}

@ -54,17 +54,14 @@ export const RemixUiXterminals = (props: RemixUiXterminalsProps) => {
})
plugin.on('theme', 'themeChanged', async (theme) => {
console.log('themeChanged', theme)
handleThemeChange(theme)
})
const theme = await plugin.call('theme', 'currentTheme')
console.log('theme', theme)
handleThemeChange(theme)
const shells = await plugin.call('xterm', 'getShells')
console.log('shells', shells)
setShells(shells)
}, 2000)
}, [])
@ -74,7 +71,6 @@ export const RemixUiXterminals = (props: RemixUiXterminalsProps) => {
themeCollection.forEach((themeItem) => {
if (themeItem.themeName === theme.name) {
setTheme(themeItem)
console.log('setTheme', themeItem)
}
})
}
@ -84,21 +80,14 @@ export const RemixUiXterminals = (props: RemixUiXterminalsProps) => {
setTerminals(prevState => {
const terminal = prevState.find(xtermState => xtermState.pid === pid)
if (terminal.ref && terminal.ref.terminal) {
console.log('writing to terminal', terminal, data)
terminal.ref.terminal.write(data)
} else {
console.log('no terminal ref', terminal)
terminal.queue += data
}
return [...prevState]
})
}
useEffect(() => {
console.log('terminals', terminals)
}, [terminals])
const send = (data: string, pid: number) => {
plugin.call('xterm', 'keystroke', data, pid)
}
@ -122,7 +111,6 @@ export const RemixUiXterminals = (props: RemixUiXterminalsProps) => {
}
const setTerminalRef = (pid: number, ref: any) => {
console.log('setTerminalRef', pid, ref)
setTerminals(prevState => {
const terminal = prevState.find(xtermState => xtermState.pid === pid)
terminal.ref = ref
@ -180,7 +168,7 @@ export const RemixUiXterminals = (props: RemixUiXterminalsProps) => {
<Dropdown.Menu className='custom-dropdown-items remixui_menuwidth'>
{shells.map((shell, index) => {
return (<Dropdown.Item index={index} onClick={createTerminal}>{shell}</Dropdown.Item>)
return (<Dropdown.Item key={index} onClick={createTerminal}>{shell}</Dropdown.Item>)
})}
</Dropdown.Menu>
</Dropdown>
@ -206,7 +194,7 @@ export const RemixUiXterminals = (props: RemixUiXterminalsProps) => {
})}
<div className='remix-ui-xterminals-buttons border-left'>
{terminals.map((xtermState, index) => {
return (<button onClick={async () => selectTerminal(xtermState)} className={`btn btn-sm mt-2 btn-secondary ${xtermState.hidden ? 'xterm-btn-none' : 'xterm-btn-active'}`}><span className="fa fa-terminal border-0 p-0 m-0"></span></button>)
return (<button key={index} onClick={async () => selectTerminal(xtermState)} className={`btn btn-sm mt-2 btn-secondary ${xtermState.hidden ? 'xterm-btn-none' : 'xterm-btn-active'}`}><span className="fa fa-terminal border-0 p-0 m-0"></span></button>)
})}
</div>
</div>

@ -27,7 +27,6 @@ export class FitAddon implements ITerminalAddon {
constructor() {}
public activate(terminal: Terminal): void {
console.log('FitAddon activate')
this._terminal = terminal;
}
@ -35,7 +34,6 @@ export class FitAddon implements ITerminalAddon {
public fit(): void {
const dims = this.proposeDimensions();
console.log('FitAddon fit', dims)
if (!dims || !this._terminal || isNaN(dims.cols) || isNaN(dims.rows)) {
return;
}
@ -70,7 +68,6 @@ export class FitAddon implements ITerminalAddon {
const scrollbarWidth = this._terminal.options.scrollback === 0 ?
0 : core.viewport.scrollBarWidth;
console.log('parentElementStyle', this._terminal.element.parentElement)
const parentElementStyle = window.getComputedStyle(this._terminal.element.parentElement);
const parentElementHeight = parseInt(parentElementStyle.getPropertyValue('height'));

@ -133,8 +133,6 @@ export class Xterm extends React.Component<IProps> {
constructor(props: IProps) {
super(props)
console.log('Xterm constructor')
this.terminalRef = React.createRef()
// Bind Methods
@ -159,7 +157,6 @@ export class Xterm extends React.Component<IProps> {
// Load addons if the prop exists.
if (this.props.addons) {
this.props.addons.forEach((addon) => {
console.log('addon', addon)
this.terminal.loadAddon(addon)
})
}

Loading…
Cancel
Save