opening md files, update flow

pull/4301/head
yann300 12 months ago
parent e622f8d2b8
commit 41b7807430
  1. 5
      apps/doc-viewer/src/app/App.tsx
  2. 1
      apps/remix-ide/src/app/files/fileManager.ts
  3. 9
      libs/remix-ui/workspace/src/lib/actions/index.ts

@ -12,9 +12,14 @@ export default function App() {
setContents(fileContents)
})
}, [])
const edit = () => {
if (!client.mdFile) return
client.call('fileManager', 'open' as any, client.mdFile)
}
return (
<>
<div className="m-5 p-2">
<button className="btn btn-secondary mb-2" onClick={edit}>EDIT</button>
<ReactMarkdown children={contents} remarkPlugins={[remarkGfm]} />
</div>
</>

@ -741,7 +741,6 @@ class FileManager extends Plugin {
// TODO: Only keep `this.emit` (issue#2210)
this.emit('currentFileChanged', file)
this.events.emit('currentFileChanged', file)
if (file.endsWith('.md')) await this.call('doc-viewer' as any, 'viewDocs', [file])
return true
}
}

@ -344,8 +344,13 @@ export const emitContextMenuEvent = async (cmd: customAction) => {
}
export const handleClickFile = async (path: string, type: 'file' | 'folder' | 'gist') => {
await plugin.fileManager.open(path)
dispatch(focusElement([{ key: path, type }]))
if (type === 'file' && path.endsWith('.md')) {
// just opening the preview
await plugin.call('doc-viewer' as any, 'viewDocs', [path])
} else {
await plugin.fileManager.open(path)
dispatch(focusElement([{ key: path, type }]))
}
}
export const handleExpandPath = (paths: string[]) => {

Loading…
Cancel
Save