move 'env' from state to context
This commit is contained in:
parent
9ef160aeb7
commit
f09261df93
13 changed files with 178 additions and 148 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import type { Ref } from "react";
|
||||
|
||||
// If there is a caret anywhere in the document (user entering text), returns the position of the caret in the focused element
|
||||
export function getCaretPosition(): number | undefined {
|
||||
|
|
@ -46,4 +47,10 @@ export function focusPrevElement() {
|
|||
prevElem.focus();
|
||||
setRightMostCaretPosition(prevElem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const autoInputWidth = (inputRef: React.RefObject<HTMLInputElement| null>, text) => {
|
||||
if (inputRef.current) {
|
||||
inputRef.current.style.width = `${text.length === 0 ? 140 : (text.length*8.7)}px`;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue