|
|
|
@ -6,6 +6,8 @@ import { ICommand, CommandList } from './CommandList';
|
|
|
|
|
import { CommandItem } from './CommandItem';
|
|
|
|
|
import { Singleton } from '../../../Common/Singleton';
|
|
|
|
|
import { CommandServer } from '../../../DatabaseServices/CommandServer';
|
|
|
|
|
import { app } from '../../../ApplicationServices/Application';
|
|
|
|
|
import { end } from 'xaop';
|
|
|
|
|
|
|
|
|
|
interface CommandPanelState
|
|
|
|
|
{
|
|
|
|
@ -35,10 +37,28 @@ export class CommandPanel extends React.Component<{}, CommandPanelState>
|
|
|
|
|
]
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
//获取最后一次滚动条位置
|
|
|
|
|
GetLastScrollTop()
|
|
|
|
|
{
|
|
|
|
|
let cserver = Singleton.GetInstance(CommandServer);
|
|
|
|
|
if (cserver.m_LastScrollTop)
|
|
|
|
|
this.scrollCard.scrollTop = cserver.m_LastScrollTop;
|
|
|
|
|
}
|
|
|
|
|
componentDidUpdate()
|
|
|
|
|
{
|
|
|
|
|
this.GetLastScrollTop();
|
|
|
|
|
}
|
|
|
|
|
componentDidMount()
|
|
|
|
|
{
|
|
|
|
|
this.initCommandData();
|
|
|
|
|
this.inputEl.focus();
|
|
|
|
|
this.GetLastScrollTop();
|
|
|
|
|
app.m_Editor.m_MaskManage.events.push(
|
|
|
|
|
end(app.m_Editor.m_MaskManage, app.m_Editor.m_MaskManage.OnFocusEvent, () =>
|
|
|
|
|
{
|
|
|
|
|
app.m_Editor.m_ModalManage.Clear();
|
|
|
|
|
})
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
async initCommandData()
|
|
|
|
|
{
|
|
|
|
@ -54,11 +74,13 @@ export class CommandPanel extends React.Component<{}, CommandPanelState>
|
|
|
|
|
this.searchList.push(c);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
handleTabsClick = () =>
|
|
|
|
|
handleTabsClick = async () =>
|
|
|
|
|
{
|
|
|
|
|
let cserver = Singleton.GetInstance(CommandServer);
|
|
|
|
|
let elc = this.ulRef.querySelector(`#${this.id}`) as HTMLElement;
|
|
|
|
|
if (elc)
|
|
|
|
|
this.scrollCard.scrollTop = elc.offsetTop - elc.offsetHeight * 2 - 55;
|
|
|
|
|
await cserver.SetLastScrollTop(this.scrollCard.scrollTop);
|
|
|
|
|
}
|
|
|
|
|
render()
|
|
|
|
|
{
|
|
|
|
@ -138,10 +160,12 @@ export class CommandPanel extends React.Component<{}, CommandPanelState>
|
|
|
|
|
<div
|
|
|
|
|
ref={el => this.scrollCard = el}
|
|
|
|
|
className="bp3-card bp3-elevation-0"
|
|
|
|
|
onScroll={() =>
|
|
|
|
|
onScroll={async () =>
|
|
|
|
|
{
|
|
|
|
|
let cserver = Singleton.GetInstance(CommandServer);
|
|
|
|
|
let index = Math.floor(this.scrollCard.scrollTop / 60);
|
|
|
|
|
this.id = this.searchRes[index].typeId;
|
|
|
|
|
await cserver.SetLastScrollTop(this.scrollCard.scrollTop);
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<ul className={Classes.LIST_UNSTYLED}
|
|
|
|
|