Skip to content

Commit 37236b6

Browse files
matthew-carrollweb-flow
authored andcommitted
[SuperEditor] - Added logs to SuperIme (#2872)
1 parent 9bb6f07 commit 37236b6

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

super_editor/example/lib/main.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ Future<void> main() async {
5555
// editorLayoutLog,
5656
// editorDocLog,
5757
// editorStyleLog,
58+
// superImeLog,
5859
// textFieldLog,
5960
// editorUserTagsLog,
6061
// contentLayersLog,

super_editor/lib/src/default_editor/document_ime/shared_ime.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'package:flutter/cupertino.dart';
22
import 'package:flutter/services.dart';
3+
import 'package:super_editor/src/infrastructure/_logging.dart';
34

45
/// A globally shared holder of an IME connection, so that the IME connection
56
/// can be seamlessly transferred between the same `SuperEditor` or `SuperTextField`
@@ -68,6 +69,7 @@ class SuperIme with ChangeNotifier {
6869
_imeConnection = null;
6970
}
7071

72+
superImeLog.info("Opening IME connection (owner: '$ownerInputId')");
7173
_imeConnection ??= TextInput.attach(client, configuration);
7274
if (showKeyboard) {
7375
_imeConnection!.show();
@@ -83,6 +85,7 @@ class SuperIme with ChangeNotifier {
8385
return;
8486
}
8587

88+
superImeLog.info("Closing IME connection (owner: '$ownerInputId')");
8689
_imeConnection?.close();
8790
_imeConnection = null;
8891

@@ -112,6 +115,7 @@ class SuperIme with ChangeNotifier {
112115
return;
113116
}
114117

118+
superImeLog.info("Giving IME ownership to new owner (owner: '$newOwnerInputId')");
115119
_owner = newOwnerInputId;
116120

117121
notifyListeners();
@@ -133,7 +137,9 @@ class SuperIme with ChangeNotifier {
133137
return;
134138
}
135139

140+
superImeLog.info("Releasing IME ownership (owner: '$ownerInputId')");
136141
if (clearConnectionOnRelease) {
142+
superImeLog.info("Closing connection when releasing IME ownership (owner: '$ownerInputId')");
137143
clearConnection(ownerInputId);
138144
}
139145
_owner = null;

super_editor/lib/src/infrastructure/_logging.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class LogNames {
4444
static const androidTextField = 'textfield.android';
4545
static const iosTextField = 'textfield.ios';
4646

47+
static const superIme = 'superime';
4748
static const infrastructure = 'infrastructure';
4849
static const keyboardPanel = 'infrastructure.keyboardPanel';
4950
static const longPressSelection = 'infrastructure.gestures.longPress';
@@ -91,13 +92,16 @@ final readerStyleLog = logging.Logger(LogNames.readerStyle);
9192
final readerDocLog = logging.Logger(LogNames.readerDocument);
9293
final readerOpsLog = logging.Logger(LogNames.readerCommonOps);
9394

95+
// Text Fields.
9496
final textFieldLog = logging.Logger(LogNames.textField);
9597
final scrollingTextFieldLog = logging.Logger(LogNames.scrollingTextField);
9698
final imeTextFieldLog = logging.Logger(LogNames.imeTextField);
9799
final androidTextFieldLog = logging.Logger(LogNames.androidTextField);
98100
final iosTextFieldLog = logging.Logger(LogNames.iosTextField);
99101

102+
// Infrastructure.
100103
final docGesturesLog = logging.Logger(LogNames.documentGestures);
104+
final superImeLog = logging.Logger(LogNames.superIme);
101105
final infrastructureLog = logging.Logger(LogNames.infrastructure);
102106
final keyboardPanelLog = logging.Logger(LogNames.keyboardPanel);
103107
final longPressSelectionLog = logging.Logger(LogNames.longPressSelection);

0 commit comments

Comments
 (0)