mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-13 13:50:07 +00:00
[shared file view] added modification for 'preview only' (#3867)
This commit is contained in:
@@ -15,7 +15,7 @@ const propTypes = {
|
||||
};
|
||||
|
||||
let loginUser = window.app.pageOptions.name;
|
||||
const { repoID, sharedToken, trafficOverLimit, fileName, fileSize, sharedBy, siteName, enableWatermark, download, zipped, filePath } = window.shared.pageOptions;
|
||||
const { repoID, sharedToken, trafficOverLimit, fileName, fileSize, sharedBy, siteName, enableWatermark, canDownload, zipped, filePath } = window.shared.pageOptions;
|
||||
|
||||
class SharedFileView extends React.Component {
|
||||
|
||||
@@ -50,6 +50,21 @@ class SharedFileView extends React.Component {
|
||||
duration: 3
|
||||
});
|
||||
}
|
||||
if (!canDownload) {
|
||||
document.addEventListener('contextmenu', function(e) {
|
||||
e.preventDefault();
|
||||
return false;
|
||||
});
|
||||
document.addEventListener('keydown', function(e) {
|
||||
// prevent ctrl + s/p/a/c, i.e, 'save', 'print', 'select all', 'copy'
|
||||
// metaKey: for mac
|
||||
if ((e.ctrlKey || e.metaKey) && (e.which == 83 || e.which == 80 || e.which == 65 || e.which == 67)) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
renderPath = () => {
|
||||
@@ -91,7 +106,7 @@ class SharedFileView extends React.Component {
|
||||
<p className="share-by ellipsis">{gettext('Shared by:')}{' '}{sharedBy}</p>
|
||||
}
|
||||
</div>
|
||||
{download &&
|
||||
{canDownload &&
|
||||
<div className="float-right">
|
||||
{(loginUser && loginUser !== sharedBy) &&
|
||||
<Button color="secondary" id="save"
|
||||
|
Reference in New Issue
Block a user