Skip to content

Commit

Permalink
fix toggle tags popover (#5835)
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael18811380328 authored Dec 19, 2023
1 parent 4e33771 commit 6eec468
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 26 deletions.
4 changes: 2 additions & 2 deletions frontend/src/components/common/seahub-popover.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ class SeahubPopover extends React.Component {
isSelectOpen = false;

componentDidMount() {
document.addEventListener('mousedown', this.onMouseDown, true);
document.addEventListener('mousedown', this.onMouseDown);
document.addEventListener('keydown', this.onKeyDown);
}

componentWillUnmount() {
document.removeEventListener('mousedown', this.onMouseDown, true);
document.removeEventListener('mousedown', this.onMouseDown);
document.removeEventListener('keydown', this.onKeyDown);
}

Expand Down
31 changes: 27 additions & 4 deletions frontend/src/components/cur-dir-path/dir-tool.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,13 @@ class DirTool extends React.Component {
this.tagsIconID = `tags-icon-${uuidv4()}`;
}

onShowListRepoTag = (e) => {
this.setState({ isListRepoTagShow: true });
onMouseDown = (e) => {
e.stopPropagation();
};

toggleRepoTag = (e) => {
e.stopPropagation();
this.setState({ isListRepoTagShow: !this.state.isListRepoTagShow });
};

hidePopover = (e) => {
Expand Down Expand Up @@ -61,7 +66,16 @@ class DirTool extends React.Component {
toolbarDom = (
<ul className="path-toolbar">
<li className="toolbar-item">
<a className="op-link sf2-icon-tag" href="#" id={this.tagsIconID} role="button" onClick={this.onShowListRepoTag} title={gettext('Tags')} aria-label={gettext('Tags')}></a>
<a
className="op-link sf2-icon-tag"
href="#"
id={this.tagsIconID}
role="button"
onClick={this.toggleRepoTag}
onMouseDown={this.onMouseDown}
title={gettext('Tags')}
aria-label={gettext('Tags')}
></a>
</li>
<li className="toolbar-item">
<a className="op-link sf2-icon-recycle" href={trashUrl} title={gettext('Trash')} aria-label={gettext('Trash')}></a>
Expand All @@ -74,7 +88,16 @@ class DirTool extends React.Component {
toolbarDom = (
<ul className="path-toolbar">
<li className="toolbar-item">
<a className="op-link sf2-icon-tag" href="#" id={this.tagsIconID} role="button" onClick={this.onShowListRepoTag} title={gettext('Tags')} aria-label={gettext('Tags')}></a>
<a
className="op-link sf2-icon-tag"
href="#"
id={this.tagsIconID}
role="button"
onClick={this.toggleRepoTag}
onMouseDown={this.onMouseDown}
title={gettext('Tags')}
aria-label={gettext('Tags')}
></a>
</li>
<li className="toolbar-item">
<a className="op-link sf2-icon-recycle" href={trashUrl} title={gettext('Trash')} aria-label={gettext('Trash')}></a>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Button, Modal, Input, ModalHeader, ModalBody, ModalFooter, Label, Form, InputGroup, InputGroupAddon, FormGroup } from 'reactstrap';
import { Button, Modal, Input, ModalHeader, ModalBody, ModalFooter, Label, Form, FormGroup } from 'reactstrap';
import { gettext } from '../../utils/constants';

const propTypes = {
Expand All @@ -26,7 +26,7 @@ class OrgAdminInviteUserDialog extends React.Component {
this.setState({isAddingUser: true});
this.props.handleSubmit(email.trim());
}
}
};

handleKeyPress = (e) => {
e.preventDefault();
Expand All @@ -38,11 +38,11 @@ class OrgAdminInviteUserDialog extends React.Component {
inputEmail = (e) => {
let email = e.target.value.trim();
this.setState({email: email});
}
};

toggle = () => {
this.props.toggle();
}
};

validateInputParams() {
let errMessage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ class OrgAdminInviteUserViaWeiXinDialog extends React.Component {
copy(this.props.invitationLink);
this.props.toggle();
const message = gettext('Internal link has been copied to clipboard');
toaster.success(message), {
toaster.success(message, {
duration: 2
};
}
});
};

render() {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { Fragment } from 'react';
import React from 'react';
import PropTypes from 'prop-types';
import { Modal, ModalHeader, ModalBody } from 'reactstrap';
import SeatableAccountSettingList from '../seatable-integration-account-setting-widgets/seatable-account-setting-list.js';
Expand Down
14 changes: 7 additions & 7 deletions frontend/src/components/search/ai-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,20 +286,20 @@ export default class AISearch extends Component {
this.updateSearchPageURL(queryData);
queryData['per_page'] = PER_PAGE;
queryData['page'] = page;
this.onAiSearch(queryData, cancelToken, page);
this.onAiSearch(queryData, cancelToken, page);
};

onAiSearch = (queryData, cancelToken, page) => {
let results = [];
seafileAPI.aiSearchFiles(queryData, cancelToken).then(res => {
results = [...results, ...this.formatResultItems(res.data.results)];
this.setState({
resultItems: results,
isResultGetted: true,
isLoading: false,
page: page + 1,
hasMore: false,
});
resultItems: results,
isResultGetted: true,
isLoading: false,
page: page + 1,
hasMore: false,
});
}).catch(error => {
/* eslint-disable */
console.log(error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ class AddSeatableAccountSetting extends Component {
};

addSeatableAccountSetting = () => {
const { t } = this.props;
let { base_name, seatable_url, seatable_api_token } = this.state;
base_name = base_name.trim();
seatable_url = seatable_url.trim();
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/markdown-editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import '../../css/markdown-viewer/markdown-editor.css';
const CryptoJS = require('crypto-js');
const URL = require('url-parse');

const { repoID, filePath, fileName, draftID, isDraft, hasDraft, isLocked, lockedByMe } = window.app.pageOptions;
const { repoID, filePath, fileName, isDraft, hasDraft, isLocked, lockedByMe } = window.app.pageOptions;
const { siteRoot, serviceUrl, seafileCollabServer } = window.app.config;
const userInfo = window.app.userInfo;
const IMAGE_SUFFIXES = ['png', 'PNG', 'jpg', 'JPG', 'jpeg', 'JPEG', 'gif', 'GIF'];
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/pages/org-admin/org-users-users.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class OrgUsers extends Component {

toggleInviteUserViaWeiXinDialog = () => {
this.setState({isInviteUserViaWeiXinDialogOpen: !this.state.isInviteUserViaWeiXinDialogOpen});
}
};

initOrgUsersData = (page) => {
const { sortBy, sortOrder } = this.state;
Expand Down Expand Up @@ -218,13 +218,13 @@ class OrgUsers extends Component {
orgUsers: users.concat(this.state.orgUsers)
});

res.data.success.map(item => {
res.data.success.forEach(item => {
let msg = gettext('successfully sent email to %s.');
msg = msg.replace('%s', item.email);
toaster.success(msg);
});

res.data.failed.map(item => {
res.data.failed.forEach(item => {
const msg = `${item.email}: ${item.error_msg}`;
toaster.danger(msg);
});
Expand Down

0 comments on commit 6eec468

Please sign in to comment.