mirror of
https://github.com/filecoin-project/slate.git
synced 2024-11-27 01:03:08 +03:00
added download feature to SlateLayout
This commit is contained in:
parent
6c25da3280
commit
228d3a9934
@ -834,6 +834,15 @@ export class SlateLayout extends React.Component {
|
||||
this.setState({ layout });
|
||||
};
|
||||
|
||||
_handleDownloadFiles = async () => {
|
||||
const selectedFiles = this.props.items.filter((_, i) => this.state.checked[i]);
|
||||
UserBehaviors.compressAndDownloadFiles({
|
||||
files: selectedFiles,
|
||||
resourceURI: this.props.resources.download,
|
||||
});
|
||||
this.setState({ checked: {} });
|
||||
};
|
||||
|
||||
_handleMouseUp = (e) => {
|
||||
window.removeEventListener("mousemove", this._handleDrag);
|
||||
window.removeEventListener("mouseup", this._handleMouseUp);
|
||||
@ -1783,6 +1792,13 @@ export class SlateLayout extends React.Component {
|
||||
{/* <ButtonPrimary transparent onClick={this._handleDownload}>
|
||||
Download
|
||||
</ButtonPrimary> */}
|
||||
<ButtonWarning
|
||||
transparent
|
||||
style={{ marginLeft: 8, color: Constants.system.white }}
|
||||
onClick={this._handleDownloadFiles}
|
||||
>
|
||||
download
|
||||
</ButtonWarning>
|
||||
<ButtonWarning
|
||||
transparent
|
||||
style={{ marginLeft: 8, color: Constants.system.white }}
|
||||
|
@ -549,6 +549,7 @@ class SlatePage extends React.Component {
|
||||
preview={preview}
|
||||
onSavePreview={(preview) => this._handleSave(null, null, null, false, preview)}
|
||||
items={objects}
|
||||
resources={this.props.resources}
|
||||
onSelect={this._handleSelect}
|
||||
defaultLayout={layouts && layouts.ver === "2.0" ? layouts.defaultLayout : true}
|
||||
onAction={this.props.onAction}
|
||||
|
Loading…
Reference in New Issue
Block a user