fix editor mounted

pull/4791/head
filip mertens 6 months ago
parent e8b6a2fe92
commit c1435c41cd
  1. 4
      libs/remix-ui/editor/src/lib/remix-ui-editor.tsx
  2. 1
      libs/remix-ui/git/src/components/branchHeader.tsx
  3. 6
      libs/remix-ui/git/src/components/gitui.tsx
  4. 38
      libs/remix-ui/git/src/lib/gitactions.ts
  5. 10
      libs/remix-ui/git/src/lib/listeners.ts
  6. 2
      libs/remix-ui/git/src/state/gitpayload.ts
  7. 1
      libs/remix-ui/workspace/src/lib/actions/index.ts

@ -561,6 +561,7 @@ export const EditorUI = (props: EditorUIProps) => {
props.editorAPI.getValue = (uri: string) => {
if (!editorRef.current) return
const model = editorModelsState[uri]?.model
if (model) {
return model.getValue()
@ -645,12 +646,11 @@ export const EditorUI = (props: EditorUIProps) => {
function handleDiffEditorDidMount(editor: any) {
console.log('diff editor mounted')
diffEditorRef.current = editor
defineAndSetTheme(monacoRef.current)
setReducerListener()
props.events.onEditorMounted()
}
function handleEditorDidMount(editor) {
console.log('editor mounted')
editorRef.current = editor
defineAndSetTheme(monacoRef.current)
setReducerListener()

@ -9,7 +9,6 @@ export const BranchHeader = () => {
useEffect(() => {
if (context.currentBranch) {
console.log('GET BRANCH COMMITS', context.currentBranch)
actions.getBranchDifferences(context.currentBranch, null, context)
}
}, [context.currentBranch, context.commits, context.branches, context.remotes])

@ -66,7 +66,7 @@ export const GitUI = (props: IGitUi) => {
setCallBacks(plugin, gitDispatch, loaderDispatch)
setPlugin(plugin, gitDispatch, loaderDispatch)
loaderDispatch({ type: 'plugin', payload: true })
console.log(props)
//console.log(props)
}, [appLoaded])
useEffect(() => {
@ -76,7 +76,7 @@ export const GitUI = (props: IGitUi) => {
const username = await plugin.call('settings', 'get', 'settings/github-user-name')
const email = await plugin.call('settings', 'get', 'settings/github-email')
const token = await plugin.call('settings', 'get', 'settings/gist-access-token')
console.log('gitState', gitState, username, email, token)
//console.log('gitState', gitState, username, email, token)
setSetup(!(username && email))
}
checkconfig()
@ -99,7 +99,7 @@ export const GitUI = (props: IGitUi) => {
useEffect(() => {
if (!appLoaded) return
async function updatestate() {
console.log('updatestate', gitState)
if (gitState.currentBranch && gitState.currentBranch.remote && gitState.currentBranch.remote.url) {
remoteCommits(gitState.currentBranch.remote.url, gitState.currentBranch.name, 1)
}

@ -42,26 +42,25 @@ let plugin: Plugin<any, CustomRemixApi>, dispatch: React.Dispatch<gitActionDispa
export const setPlugin = (p: Plugin, dispatcher: React.Dispatch<gitActionDispatch>) => {
plugin = p
dispatch = dispatcher
console.log('setPlugin')
}
export const init = async () => {
console.log('gitInit')
await plugin.call('dgitApi', "init");
await gitlog();
await getBranches();
}
export const getBranches = async () => {
console.log('getBranches')
const branches = await plugin.call('dgitApi', "branches")
console.log('branches :>>', branches)
dispatch(setBranches(branches));
}
export const getRemotes = async () => {
console.log('getRemotes')
const remotes: remote[] = await plugin.call('dgitApi', "remotes");
console.log('remotes :>>', remotes)
dispatch(setRemotes(remotes));
}
@ -89,8 +88,7 @@ export const getFileStatusMatrix = async (filepaths: string[]) => {
}
export const getCommits = async () => {
//Utils.log("get commits");
console.log('getCommits')
try {
const commits: ReadCommitResult[] = await plugin.call(
'dgitApi',
@ -117,7 +115,7 @@ export const gitlog = async () => {
export const showCurrentBranch = async () => {
try {
const branch = await currentBranch();
console.log('branch :>>', branch)
dispatch(setCanCommit((branch && branch.name !== "")));
dispatch(setCurrentBranch(branch));
@ -279,7 +277,7 @@ export const checkoutfile = async (filename: string) => {
}
export const checkout = async (cmd: checkoutInput) => {
console.log(cmd)
await disableCallBacks();
await plugin.call('fileManager', 'closeAllFiles')
try {
@ -492,7 +490,7 @@ export const remoteBranches = async (owner: string, repo: string) => {
export const remoteCommits = async (url: string, branch: string, length: number) => {
const urlParts = url.split("/");
console.log(urlParts, 'urlParts')
// check if it's github
if (!urlParts[urlParts.length - 3].includes('github')) {
return
@ -504,9 +502,9 @@ export const remoteCommits = async (url: string, branch: string, length: number)
try {
const token = await tokenWarning();
if (token) {
console.log(token, owner, repo, branch, length)
const commits = await plugin.call('dgitApi' as any, 'remotecommits', { token, owner, repo, branch, length });
console.log(commits, 'remote commits')
} else {
sendToGitLog({
type: 'error',
@ -523,7 +521,7 @@ export const remoteCommits = async (url: string, branch: string, length: number)
}
export const saveGitHubCredentials = async (credentials: { username: string, email: string, token: string }) => {
console.log('saveGitHubCredentials', credentials)
try {
const storedEmail = await plugin.call('config', 'getAppParameter', 'settings/github-email')
const storedUsername = await plugin.call('config', 'getAppParameter', 'settings/github-user-name')
@ -566,9 +564,9 @@ export const loadGitHubUserFromToken = async () => {
emails: userEmails
} = await plugin.call('dgitApi' as any, 'getGitHubUser', { token });
console.log('GET USER"', data)
if (data && data.emails && data.user && data.user.login) {
console.log('SET USER"', data)
const primaryEmail = data.emails.find(email => email.primary)
const storedEmail = await plugin.call('config', 'getAppParameter', 'settings/github-email')
@ -635,7 +633,7 @@ export const diff = async (commitChange: commitChange) => {
});
const modifiedContent = Buffer.from(modifiedContentReadBlobResult.blob).toString("utf8");
console.log(modifiedContent)
commitChange.modified = modifiedContent;
commitChange.readonly = true;
} catch (e) {
@ -650,7 +648,7 @@ export const diff = async (commitChange: commitChange) => {
});
const originalContent = Buffer.from(originalContentReadBlobResult.blob).toString("utf8");
console.log(originalContent)
commitChange.original = originalContent;
} catch (e) {
commitChange.original = "";
@ -668,14 +666,14 @@ export const getCommitChanges = async (oid1: string, oid2: string, branch?: bran
log = await plugin.call('dgitApi', 'log', {
ref: branch ? branch.name : 'HEAD',
})
console.log(log, 'log')
} catch (e) {
console.log(e, 'log error')
}
if (log) {
const foundCommit = log.find((commit: ReadCommitResult) => commit.oid === oid2)
if (!foundCommit && remote) {
console.log('getCommitChanges fetching remote')
//await fetch(remote ? remote.name : null, branch ? branch.name : null, null, 5, true, true)
await fetch({
remote: remote,

@ -43,7 +43,7 @@ export const setCallBacks = (viewPlugin: Plugin, gitDispatcher: React.Dispatch<g
setPlugin(viewPlugin, gitDispatcher)
plugin.on("fileManager", "fileSaved", async (file: string) => {
console.log(file)
//console.log(file)
loadFileQueue.enqueue(async () => {
loadFiles()
})
@ -67,7 +67,7 @@ export const setCallBacks = (viewPlugin: Plugin, gitDispatcher: React.Dispatch<g
});
plugin.on("fileManager", "currentFileChanged", async (e) => {
console.log('current file change', e)
//console.log('current file change', e)
//await synTimerStart();
});
@ -148,11 +148,11 @@ export const setCallBacks = (viewPlugin: Plugin, gitDispatcher: React.Dispatch<g
})
plugin.on('config', 'configChanged', async () => {
console.log('config changed')
//console.log('config changed')
await getGitConfig()
})
plugin.on('settings', 'configChanged', async () => {
console.log('settings changed')
//console.log('settings changed')
await getGitConfig()
})
@ -173,7 +173,7 @@ export const getGitConfig = async () => {
export const loadFiles = async (filepaths: string[] = null) => {
try {
const branch = await plugin.call('dgitApi', "currentbranch")
console.log('load files', branch)
//console.log('load files', branch)
if (branch) {
await getFileStatusMatrix(filepaths);
} else {

@ -45,7 +45,7 @@ export const setRemoteBranches = (branches: any[]) => {
}
export const setGitHubUser = (user: GitHubUser) => {
console.log('set user', user)
return {
type: 'SET_GITHUB_USER',
payload: user

@ -60,6 +60,7 @@ export const initWorkspace = (filePanelPlugin) => async (reducerDispatch: React.
let filePathToOpen = null
let workspaces = []
plugin.on('editor', 'editorMounted', async () => {
console.log('editor mounted')
editorMounted = true
if (filePathToOpen){
setTimeout(async () => {

Loading…
Cancel
Save