fixup! Implement text selection mixin in mobile and web editor
Add try/catch to JSON parse
This commit is contained in:
@@ -113,6 +113,7 @@ class _WebEditorState extends State<WebEditorWidget> with TextSelectionMixin {
|
||||
}
|
||||
|
||||
_selectionChangeListener = (event) {
|
||||
try {
|
||||
if (event is MessageEvent) {
|
||||
final data = jsonDecode(event.data);
|
||||
|
||||
@@ -120,6 +121,11 @@ class _WebEditorState extends State<WebEditorWidget> with TextSelectionMixin {
|
||||
handleSelectionChange(data);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
logError(
|
||||
'_WebEditorState::_selectionChangeListener: Unable to parse selection data = $e',
|
||||
);
|
||||
}
|
||||
};
|
||||
if (_selectionChangeListener != null) {
|
||||
window.addEventListener("message", _selectionChangeListener!);
|
||||
|
||||
Reference in New Issue
Block a user