feat: Enhance editor functionality with autocorrect handling and text replacement
feat: Implement confirmation dialog for room sharing in ShareRoomPicker fix: Improve server input synchronization and blur handling in ServerPicker feat: Integrate UnifiedPush for background sync in Android, including pusher management refactor: Streamline Android share handling and file upload processes fix: Update notification handling to use Capacitor's local notifications API
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import React, {
|
||||
ChangeEventHandler,
|
||||
FocusEventHandler,
|
||||
KeyboardEventHandler,
|
||||
MouseEventHandler,
|
||||
useEffect,
|
||||
@@ -39,8 +40,13 @@ export function ServerPicker({
|
||||
const serverInputRef = useRef<HTMLInputElement>(null);
|
||||
|
||||
useEffect(() => {
|
||||
// sync input with it outside server changes
|
||||
if (serverInputRef.current && serverInputRef.current.value !== server) {
|
||||
// Only sync input when server changes externally (e.g., from menu selection)
|
||||
// and input is not focused to avoid cursor jumping during typing
|
||||
if (
|
||||
serverInputRef.current &&
|
||||
serverInputRef.current.value !== server &&
|
||||
document.activeElement !== serverInputRef.current
|
||||
) {
|
||||
serverInputRef.current.value = server;
|
||||
}
|
||||
}, [server]);
|
||||
@@ -52,6 +58,13 @@ export function ServerPicker({
|
||||
if (inputServer) debounceServerSelect(inputServer);
|
||||
};
|
||||
|
||||
const handleBlur: FocusEventHandler<HTMLInputElement> = (evt) => {
|
||||
const inputServer = evt.target.value.trim();
|
||||
if (inputServer && inputServer !== server) {
|
||||
onServerChange(inputServer);
|
||||
}
|
||||
};
|
||||
|
||||
const handleKeyDown: KeyboardEventHandler<HTMLInputElement> = (evt) => {
|
||||
if (evt.key === 'ArrowDown') {
|
||||
evt.preventDefault();
|
||||
@@ -85,6 +98,7 @@ export function ServerPicker({
|
||||
outlined
|
||||
defaultValue={server}
|
||||
onChange={handleServerChange}
|
||||
onBlur={handleBlur}
|
||||
onKeyDown={handleKeyDown}
|
||||
size="500"
|
||||
readOnly={!allowCustomServer}
|
||||
|
||||
Reference in New Issue
Block a user