ui(server): fix console searchbar z-index (#4587)

This commit is contained in:
Charles Morgan 2022-11-27 21:38:28 -05:00 committed by GitHub
parent 1bb1b13f6d
commit a4e547dc67
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -66,6 +66,11 @@ export default () => {
const isTransferring = ServerContext.useStoreState((state) => state.server.data!.isTransferring); const isTransferring = ServerContext.useStoreState((state) => state.server.data!.isTransferring);
const [history, setHistory] = usePersistedState<string[]>(`${serverId}:command_history`, []); const [history, setHistory] = usePersistedState<string[]>(`${serverId}:command_history`, []);
const [historyIndex, setHistoryIndex] = useState(-1); const [historyIndex, setHistoryIndex] = useState(-1);
// SearchBarAddon has hardcoded z-index: 999 :(
const zIndex = `
.xterm-search-bar__addon {
z-index: 10;
}`;
const handleConsoleOutput = (line: string, prelude = false) => const handleConsoleOutput = (line: string, prelude = false) =>
terminal.writeln((prelude ? TERMINAL_PRELUDE : '') + line.replace(/(?:\r\n|\r|\n)$/im, '') + '\u001b[0m'); terminal.writeln((prelude ? TERMINAL_PRELUDE : '') + line.replace(/(?:\r\n|\r|\n)$/im, '') + '\u001b[0m');
@ -126,6 +131,7 @@ export default () => {
terminal.open(ref.current); terminal.open(ref.current);
fitAddon.fit(); fitAddon.fit();
searchBar.addNewStyle(zIndex);
// Add support for capturing keys // Add support for capturing keys
terminal.attachCustomKeyEventHandler((e: KeyboardEvent) => { terminal.attachCustomKeyEventHandler((e: KeyboardEvent) => {