🔨 执行日志.
This commit is contained in:
@@ -27,13 +27,14 @@ export const AppenderOptions: ITerminalOptions & ITerminalInitOnlyOptions = {
|
||||
export interface LogDomRef {
|
||||
id: number;
|
||||
el: HTMLElement;
|
||||
openSearch: () => {};
|
||||
}
|
||||
|
||||
// appender 配置
|
||||
export interface LogAppenderConf {
|
||||
id: number;
|
||||
el: HTMLElement;
|
||||
fixed: boolean;
|
||||
openSearch: () => {};
|
||||
terminal: Terminal;
|
||||
addons: LogAddons;
|
||||
}
|
||||
@@ -53,14 +54,17 @@ export interface ILogAppender {
|
||||
// 设置当前元素
|
||||
setCurrent(id: number): void;
|
||||
|
||||
// 打开搜索
|
||||
openSearch(): void;
|
||||
|
||||
// 查找关键字
|
||||
find(word: string, next: boolean, options: any): void;
|
||||
|
||||
// 聚焦
|
||||
focus(): void;
|
||||
|
||||
// 设置固定
|
||||
setFixed(fixed: boolean): void;
|
||||
// 自适应
|
||||
fitAll(): void;
|
||||
|
||||
// 去顶部
|
||||
toTop(): void;
|
||||
|
||||
@@ -59,7 +59,6 @@ export default class LogAppender implements ILogAppender {
|
||||
addons.fit.fit();
|
||||
this.appenderRel[logDomRef.id] = {
|
||||
...logDomRef,
|
||||
fixed: false,
|
||||
terminal,
|
||||
addons
|
||||
};
|
||||
@@ -94,7 +93,7 @@ export default class LogAppender implements ILogAppender {
|
||||
} else if (e.ctrlKey && e.code === 'KeyF') {
|
||||
// 搜索
|
||||
e.preventDefault();
|
||||
// TODO open search
|
||||
this.current.openSearch();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -147,13 +146,14 @@ export default class LogAppender implements ILogAppender {
|
||||
this.current = rel;
|
||||
// 自适应
|
||||
rel.addons.fit.fit();
|
||||
// 非固定跳转到最底部
|
||||
if (!rel.fixed) {
|
||||
rel.terminal.scrollToBottom();
|
||||
}
|
||||
this.focus();
|
||||
}
|
||||
|
||||
// 打开搜索
|
||||
openSearch() {
|
||||
this.current.openSearch();
|
||||
}
|
||||
|
||||
// 查找关键字
|
||||
find(word: string, next: boolean, options: any) {
|
||||
if (next) {
|
||||
@@ -163,12 +163,6 @@ export default class LogAppender implements ILogAppender {
|
||||
}
|
||||
}
|
||||
|
||||
// 设置固定
|
||||
setFixed(fixed: boolean): void {
|
||||
this.current.fixed = fixed;
|
||||
this.focus();
|
||||
}
|
||||
|
||||
// 去顶部
|
||||
toTop(): void {
|
||||
this.current.terminal.scrollToTop();
|
||||
|
||||
Reference in New Issue
Block a user