mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-25 06:33:48 +00:00
Fix code bug (#6299)
* fix search ref bug * fix no global var * fix search mask open and keyEvent can use
This commit is contained in:
@@ -132,7 +132,9 @@ export default class AISearch extends Component {
|
|||||||
if (this.inputRef && this.inputRef.current) {
|
if (this.inputRef && this.inputRef.current) {
|
||||||
this.inputRef.current.focus();
|
this.inputRef.current.focus();
|
||||||
}
|
}
|
||||||
} else if (isHotkey('esc', e)) {
|
}
|
||||||
|
if (this.state.isMaskShow) {
|
||||||
|
if (isHotkey('esc', e)) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
this.inputRef && this.inputRef.current && this.inputRef.current.blur();
|
this.inputRef && this.inputRef.current && this.inputRef.current.blur();
|
||||||
this.resetToDefault();
|
this.resetToDefault();
|
||||||
@@ -143,6 +145,7 @@ export default class AISearch extends Component {
|
|||||||
} else if (isHotkey('down', e)) {
|
} else if (isHotkey('down', e)) {
|
||||||
this.onDown(e);
|
this.onDown(e);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
onFocusHandler = () => {
|
onFocusHandler = () => {
|
||||||
@@ -660,7 +663,7 @@ export default class AISearch extends Component {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<MediaQuery query="(min-width: 768px)">
|
<MediaQuery query="(min-width: 768px)">
|
||||||
<div className="search-result-list-container">{results}</div>
|
<div className="search-result-list-container" ref={this.searchResultListContainerRef}>{results}</div>
|
||||||
</MediaQuery>
|
</MediaQuery>
|
||||||
<MediaQuery query="(max-width: 767.8px)">
|
<MediaQuery query="(max-width: 767.8px)">
|
||||||
{results}
|
{results}
|
||||||
|
@@ -94,7 +94,9 @@ class Search extends Component {
|
|||||||
if (this.inputRef && this.inputRef.current) {
|
if (this.inputRef && this.inputRef.current) {
|
||||||
this.inputRef.current.focus();
|
this.inputRef.current.focus();
|
||||||
}
|
}
|
||||||
} else if (isHotkey('esc', e)) {
|
}
|
||||||
|
if (this.state.isMaskShow) {
|
||||||
|
if (isHotkey('esc', e)) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
this.inputRef && this.inputRef.current && this.inputRef.current.blur();
|
this.inputRef && this.inputRef.current && this.inputRef.current.blur();
|
||||||
this.resetToDefault();
|
this.resetToDefault();
|
||||||
@@ -105,6 +107,7 @@ class Search extends Component {
|
|||||||
} else if (isDown(e)) {
|
} else if (isDown(e)) {
|
||||||
this.onDown(e);
|
this.onDown(e);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
onFocusHandler = () => {
|
onFocusHandler = () => {
|
||||||
|
@@ -823,7 +823,6 @@ class RecordsGroupBody extends Component {
|
|||||||
groupOffsetLeft={groupOffsetLeft}
|
groupOffsetLeft={groupOffsetLeft}
|
||||||
scrollLeft={scrollLeft}
|
scrollLeft={scrollLeft}
|
||||||
leftBarWidth={0}
|
leftBarWidth={0}
|
||||||
appNavWidth={0}
|
|
||||||
columns={columns}
|
columns={columns}
|
||||||
summaryConfigs={summaryConfigs}
|
summaryConfigs={summaryConfigs}
|
||||||
isExpanded={isExpanded}
|
isExpanded={isExpanded}
|
||||||
|
@@ -489,11 +489,6 @@ class InteractionMasks extends React.Component {
|
|||||||
this.closeEditor();
|
this.closeEditor();
|
||||||
};
|
};
|
||||||
|
|
||||||
getEditorContainer = () => {
|
|
||||||
// todo
|
|
||||||
return null;
|
|
||||||
};
|
|
||||||
|
|
||||||
onKeyDown = (e) => {
|
onKeyDown = (e) => {
|
||||||
const keyCode = e.keyCode;
|
const keyCode = e.keyCode;
|
||||||
if (isCtrlKeyHeldDown(e)) {
|
if (isCtrlKeyHeldDown(e)) {
|
||||||
@@ -874,14 +869,12 @@ class InteractionMasks extends React.Component {
|
|||||||
const rect = cellContainer.getBoundingClientRect();
|
const rect = cellContainer.getBoundingClientRect();
|
||||||
const leftInterval = this.getLeftInterval();
|
const leftInterval = this.getLeftInterval();
|
||||||
const nextColumnWidth = columns[current.idx - 1] ? columns[current.idx - 1].width : 0;
|
const nextColumnWidth = columns[current.idx - 1] ? columns[current.idx - 1].width : 0;
|
||||||
const appNavWidth = window.app.state.appNavWidth || 0;
|
|
||||||
const appLeftBarWidth = parseInt(appNavWidth) + 130;
|
|
||||||
// selectMask is outside the viewport, scroll to next column
|
// selectMask is outside the viewport, scroll to next column
|
||||||
if (rect.x < 0 || rect.x > window.innerWidth) {
|
if (rect.x < 0 || rect.x > window.innerWidth) {
|
||||||
this.props.scrollToColumn(current.idx - 1);
|
this.props.scrollToColumn(current.idx - 1);
|
||||||
} else if (nextColumnWidth > rect.x - leftInterval - appLeftBarWidth) {
|
} else if (nextColumnWidth > rect.x - leftInterval) {
|
||||||
// selectMask is part of the viewport, newScrollLeft = columnWidth - visibleWidth
|
// selectMask is part of the viewport, newScrollLeft = columnWidth - visibleWidth
|
||||||
const newScrollLeft = nextColumnWidth - (rect.x - leftInterval - appLeftBarWidth);
|
const newScrollLeft = nextColumnWidth - (rect.x - leftInterval);
|
||||||
this.props.setRecordsScrollLeft(this.props.getScrollLeft() - newScrollLeft);
|
this.props.setRecordsScrollLeft(this.props.getScrollLeft() - newScrollLeft);
|
||||||
}
|
}
|
||||||
return ({ ...current, idx: current.idx === 0 ? 0 : current.idx - 1 });
|
return ({ ...current, idx: current.idx === 0 ? 0 : current.idx - 1 });
|
||||||
|
Reference in New Issue
Block a user