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 Toggle from 'react-toggle';
|
||||||
import { openEditorMenu, stopContextMenu } from 'util/context-menu';
|
import { openEditorMenu, stopContextMenu } from 'util/context-menu';
|
||||||
import SimpleMDE from 'react-simplemde-editor';
|
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';
|
import MarkdownPreview from 'component/common/markdown-preview-internal';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
|
|
|
@ -42,10 +42,7 @@ function Paginate(props: Props) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
// Hide the paginate controls if we are loading or there is only one page
|
// 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
|
// It should still be rendered to trigger the onPageChange callback
|
||||||
// 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)} />
|
|
||||||
<Form style={totalPages <= 1 || loading ? { display: 'none' } : null}>
|
<Form style={totalPages <= 1 || loading ? { display: 'none' } : null}>
|
||||||
<fieldset-group class="fieldset-group--smushed fieldgroup--paginate">
|
<fieldset-group class="fieldset-group--smushed fieldgroup--paginate">
|
||||||
<fieldset-section>
|
<fieldset-section>
|
||||||
|
|
|
@ -34,6 +34,8 @@ type State = {
|
||||||
contentType?: string,
|
contentType?: string,
|
||||||
downloadPath?: string,
|
downloadPath?: string,
|
||||||
fileType?: 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,
|
contentType,
|
||||||
downloadPath,
|
downloadPath,
|
||||||
fileType: path.extname(fileName).substring(1),
|
fileType: path.extname(fileName).substring(1),
|
||||||
|
// Readable stream from file
|
||||||
|
// @if TARGET='app'
|
||||||
|
stream: opts => fs.createReadStream(downloadPath, opts),
|
||||||
|
// @endif
|
||||||
};
|
};
|
||||||
|
|
||||||
// Update state
|
// Update state
|
||||||
|
|
Loading…
Reference in a new issue