mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-03 16:10:26 +00:00
['library view' page] added 'copy path' for the current folder (#8013)
This commit is contained in:
@@ -1,10 +1,11 @@
|
|||||||
import React, { Fragment } from 'react';
|
import React, { Fragment } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
import copy from 'copy-to-clipboard';
|
||||||
import { Dropdown, DropdownToggle, DropdownMenu, DropdownItem } from 'reactstrap';
|
import { Dropdown, DropdownToggle, DropdownMenu, DropdownItem } from 'reactstrap';
|
||||||
import { Utils } from '../../utils/utils';
|
import { Utils } from '../../utils/utils';
|
||||||
|
import { seafileAPI } from '../../utils/seafile-api';
|
||||||
import { enableExcalidraw, enableSeadoc, enableWhiteboard, gettext } from '../../utils/constants';
|
import { enableExcalidraw, enableSeadoc, enableWhiteboard, gettext } from '../../utils/constants';
|
||||||
import toaster from '../toast';
|
import toaster from '../toast';
|
||||||
import { seafileAPI } from '../../utils/seafile-api';
|
|
||||||
import TipDialog from '../dialog/tip-dailog';
|
import TipDialog from '../dialog/tip-dailog';
|
||||||
import { EVENT_BUS_TYPE } from '../common/event-bus-type';
|
import { EVENT_BUS_TYPE } from '../common/event-bus-type';
|
||||||
|
|
||||||
@@ -64,6 +65,15 @@ class DirOperationToolbar extends React.Component {
|
|||||||
eventBus.dispatch(EVENT_BUS_TYPE.SHARE_FILE, path, { type, name, permission: userPerm });
|
eventBus.dispatch(EVENT_BUS_TYPE.SHARE_FILE, path, { type, name, permission: userPerm });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
copyPath = () => {
|
||||||
|
const { path } = this.props;
|
||||||
|
copy(path);
|
||||||
|
const message = gettext('The path has been copied to the clipboard');
|
||||||
|
toaster.success((message), {
|
||||||
|
duration: 2
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
onCreateFolder = () => {
|
onCreateFolder = () => {
|
||||||
const { eventBus, path, direntList } = this.props;
|
const { eventBus, path, direntList } = this.props;
|
||||||
eventBus.dispatch(EVENT_BUS_TYPE.CREATE_FOLDER, path, direntList);
|
eventBus.dispatch(EVENT_BUS_TYPE.CREATE_FOLDER, path, direntList);
|
||||||
@@ -220,6 +230,12 @@ class DirOperationToolbar extends React.Component {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
opList.push({
|
||||||
|
'icon': 'copy1',
|
||||||
|
'text': gettext('Copy path'),
|
||||||
|
'onClick': this.copyPath
|
||||||
|
});
|
||||||
|
|
||||||
if (enableSeadoc && !repoEncrypted) {
|
if (enableSeadoc && !repoEncrypted) {
|
||||||
opList.push('Divider', {
|
opList.push('Divider', {
|
||||||
'icon': 'import-sdoc',
|
'icon': 'import-sdoc',
|
||||||
|
Reference in New Issue
Block a user