fix: include file stream in props for document viewers
This commit is contained in:
parent
cb8afcde06
commit
4619039312
3 changed files with 7 additions and 6 deletions
|
@ -6,8 +6,6 @@ import 'easymde/dist/easymde.min.css';
|
|||
import Toggle from 'react-toggle';
|
||||
import { openEditorMenu, stopContextMenu } from 'util/context-menu';
|
||||
import SimpleMDE from 'react-simplemde-editor';
|
||||
// It would be nice to use the lazy markdown preview component but react-dom/server
|
||||
// doesn't support it yet. We use that for renderToString on our markdown text
|
||||
import MarkdownPreview from 'component/common/markdown-preview-internal';
|
||||
|
||||
type Props = {
|
||||
|
|
|
@ -42,10 +42,7 @@ function Paginate(props: Props) {
|
|||
|
||||
return (
|
||||
// Hide the paginate controls if we are loading or there is only one page
|
||||
// This is a little weird but it makes the <Paginate /> component
|
||||
// really nice to work with. It will always handle fetching your data,
|
||||
// even if the data returned doesn't have more than one page
|
||||
// <Paginate onPageChange={(page) => fetchStuff(page)} />
|
||||
// It should still be rendered to trigger the onPageChange callback
|
||||
<Form style={totalPages <= 1 || loading ? { display: 'none' } : null}>
|
||||
<fieldset-group class="fieldset-group--smushed fieldgroup--paginate">
|
||||
<fieldset-section>
|
||||
|
|
|
@ -34,6 +34,8 @@ type State = {
|
|||
contentType?: string,
|
||||
downloadPath?: string,
|
||||
fileType?: string,
|
||||
// Just using `any` because flow isn't working with `fs.createReadStream`
|
||||
stream?: ({}) => any,
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -287,6 +289,10 @@ class MediaPlayer extends React.PureComponent<Props, State> {
|
|||
contentType,
|
||||
downloadPath,
|
||||
fileType: path.extname(fileName).substring(1),
|
||||
// Readable stream from file
|
||||
// @if TARGET='app'
|
||||
stream: opts => fs.createReadStream(downloadPath, opts),
|
||||
// @endif
|
||||
};
|
||||
|
||||
// Update state
|
||||
|
|
Loading…
Reference in a new issue