Skip to content

Commit

Permalink
fix: focus will lost when typing slash
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasXu0 committed Sep 24, 2023
1 parent 56b0e36 commit 5c29132
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,11 @@ class KeyboardServiceWidgetState extends State<KeyboardServiceWidget>
'keyboard service - focus changed: ${focusNode.hasFocus}}',
);

/// On web, we don't need to close the keyboard when the focus is lost.
if (kIsWeb) {
return;
}

// clear the selection when the focus is lost.
if (!focusNode.hasFocus) {
if (PlatformExtension.isDesktopOrWeb) {
Expand Down
7 changes: 7 additions & 0 deletions lib/src/editor/util/platform_extension.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ import 'package:flutter/foundation.dart';

// TODO(Xazin): Refactor to honor `Theme.platform`
extension PlatformExtension on Platform {
static bool get isMacOS {
if (kIsWeb) {
return false;
}
return Platform.isMacOS;
}

static bool get isWindows {
if (kIsWeb) {
return false;
Expand Down

0 comments on commit 5c29132

Please sign in to comment.