mirror of
https://github.com/excalidraw/excalidraw
synced 2025-07-25 13:58:22 +08:00
fix: do not refocus element link input on unrelated updates (#9037)
This commit is contained in:
@ -171,15 +171,17 @@ export const Hyperlink = ({
|
|||||||
}, [handleSubmit]);
|
}, [handleSubmit]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let timeoutId: number | null = null;
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
inputRef &&
|
isEditing &&
|
||||||
inputRef.current &&
|
inputRef?.current &&
|
||||||
!(device.viewport.isMobile || device.isTouchScreen)
|
!(device.viewport.isMobile || device.isTouchScreen)
|
||||||
) {
|
) {
|
||||||
inputRef.current.select();
|
inputRef.current.select();
|
||||||
}
|
}
|
||||||
|
}, [isEditing, device.viewport.isMobile, device.isTouchScreen]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
let timeoutId: number | null = null;
|
||||||
|
|
||||||
const handlePointerMove = (event: PointerEvent) => {
|
const handlePointerMove = (event: PointerEvent) => {
|
||||||
if (isEditing) {
|
if (isEditing) {
|
||||||
@ -207,15 +209,7 @@ export const Hyperlink = ({
|
|||||||
clearTimeout(timeoutId);
|
clearTimeout(timeoutId);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}, [
|
}, [appState, element, isEditing, setAppState, elementsMap]);
|
||||||
appState,
|
|
||||||
element,
|
|
||||||
isEditing,
|
|
||||||
setAppState,
|
|
||||||
elementsMap,
|
|
||||||
device.viewport.isMobile,
|
|
||||||
device.isTouchScreen,
|
|
||||||
]);
|
|
||||||
|
|
||||||
const handleRemove = useCallback(() => {
|
const handleRemove = useCallback(() => {
|
||||||
trackEvent("hyperlink", "delete");
|
trackEvent("hyperlink", "delete");
|
||||||
|
Reference in New Issue
Block a user