fixup! Implement text selection mixin in mobile and web editor

Add try/catch to JSON parse
This commit is contained in:
Théo Poizat
2025-12-11 10:49:55 +01:00
committed by Dat H. Pham
parent 0b8a814ad6
commit 75f5817e1c
@@ -113,12 +113,18 @@ class _WebEditorState extends State<WebEditorWidget> with TextSelectionMixin {
}
_selectionChangeListener = (event) {
if (event is MessageEvent) {
final data = jsonDecode(event.data);
try {
if (event is MessageEvent) {
final data = jsonDecode(event.data);
if (data['name'] == HtmlUtils.registerSelectionChangeListener.name) {
handleSelectionChange(data);
if (data['name'] == HtmlUtils.registerSelectionChangeListener.name) {
handleSelectionChange(data);
}
}
} catch (e) {
logError(
'_WebEditorState::_selectionChangeListener: Unable to parse selection data = $e',
);
}
};
if (_selectionChangeListener != null) {