mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-28 10:12:11 +00:00
[CodeHealth] Convert useAutoSize to kwargs (#2259)
This commit is contained in:
@@ -20,11 +20,16 @@ const terminalCreated = (
|
|||||||
let offData: IDisposable
|
let offData: IDisposable
|
||||||
let offOutput: () => void
|
let offOutput: () => void
|
||||||
|
|
||||||
useAutoSize(root, true, true, () => {
|
useAutoSize({
|
||||||
// If we aren't visible, don't resize
|
root,
|
||||||
if (!terminal.element?.offsetParent) return
|
autoRows: true,
|
||||||
|
autoCols: true,
|
||||||
|
onResize: () => {
|
||||||
|
// If we aren't visible, don't resize
|
||||||
|
if (!terminal.element?.offsetParent) return
|
||||||
|
|
||||||
terminalApi.resize(terminal.cols, terminal.rows)
|
terminalApi.resize(terminal.cols, terminal.rows)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ const terminalCreated = (
|
|||||||
{ terminal, useAutoSize }: ReturnType<typeof useTerminal>,
|
{ terminal, useAutoSize }: ReturnType<typeof useTerminal>,
|
||||||
root: Ref<HTMLElement>
|
root: Ref<HTMLElement>
|
||||||
) => {
|
) => {
|
||||||
useAutoSize(root, true, false)
|
useAutoSize({ root, autoRows: true, autoCols: false })
|
||||||
|
|
||||||
const update = (entries: Array<LogEntry>, size?: TerminalSize) => {
|
const update = (entries: Array<LogEntry>, size?: TerminalSize) => {
|
||||||
if (size) {
|
if (size) {
|
||||||
|
|||||||
@@ -36,12 +36,17 @@ export function useTerminal(element: Ref<HTMLElement>) {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
terminal,
|
terminal,
|
||||||
useAutoSize(
|
useAutoSize({
|
||||||
root: Ref<HTMLElement>,
|
root,
|
||||||
autoRows: boolean = true,
|
autoRows = true,
|
||||||
autoCols: boolean = true,
|
autoCols = true,
|
||||||
|
onResize
|
||||||
|
}: {
|
||||||
|
root: Ref<HTMLElement>
|
||||||
|
autoRows?: boolean
|
||||||
|
autoCols?: boolean
|
||||||
onResize?: () => void
|
onResize?: () => void
|
||||||
) {
|
}) {
|
||||||
const ensureValidRows = (rows: number | undefined) => {
|
const ensureValidRows = (rows: number | undefined) => {
|
||||||
if (rows == null || isNaN(rows)) {
|
if (rows == null || isNaN(rows)) {
|
||||||
return root.value?.clientHeight / 20
|
return root.value?.clientHeight / 20
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ const terminalCreated = (
|
|||||||
) => {
|
) => {
|
||||||
xterm = terminal
|
xterm = terminal
|
||||||
|
|
||||||
useAutoSize(root, true, true)
|
useAutoSize({ root, autoRows: true, autoCols: true })
|
||||||
electron.onLogMessage((message: string) => {
|
electron.onLogMessage((message: string) => {
|
||||||
terminal.write(message)
|
terminal.write(message)
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user