Skip to content

[BUG] - Editor crashes when pasting email address enclosed in brackets #2893

@nilayjain

Description

@nilayjain

Package Version
Which package and version are you using? E.g., "super_editor, GitHub, stable branch"
super_editor 0.3.0-dev.38

User Info
To help us understand who is using Super Editor and for what purpose, please include your company name, or say "individual" if you're using it for yourself.

flodo.ai

To Reproduce
Steps to reproduce the behavior:

  1. Paste string: "ben p <ben@example.com>" . Editor will crash.

Actual behavior
What's the result of repeating the steps above?

Following exception occurs:

[error] Uncaught zone error
TypeError: Instance of 'TextElement': type 'TextElement' is not a subtype of type 'EmailElement'

══╡ EXCEPTION CAUGHT BY FLUTTER FRAMEWORK ╞═════════════════════════════════════════════════════════
The following _TypeError was thrown:
TypeError: Instance of 'TextElement': type 'TextElement' is not a subtype of type 'EmailElement'

When the exception was thrown, this was the stack:
dart-sdk/lib/internal/js_dev_runtime/private/ddc_runtime/errors.dart 274:3 throw
dart-sdk/lib/_internal/js_shared/lib/rti.dart 1503:3 _generalAsCheckImplementation
dart-sdk/lib/_internal/js_shared/lib/rti.dart 89:34 _installSpecializedAsCheck
package:super_editor/src/default_editor/default_document_editor_reactions.dart 928:48 tryToParseUrl
package:super_editor/src/default_editor/common_editor_operations.dart 2576:19 [_findUrlSpansInText]
package:super_editor/src/default_editor/common_editor_operations.dart 2558:11 [_inferAttributionsForLinesOfPastedText]
package:super_editor/src/default_editor/common_editor_operations.dart 2536:29 [_parseContent]
package:super_editor/src/default_editor/common_editor_operations.dart 2447:24 execute
package:super_editor/src/core/editor.dart 705:14 executeCommand
package:super_editor/src/core/editor.dart 316:5 [_executeCommand]
package:super_editor/src/core/editor.dart 278:30 execute
package:super_editor/src/default_editor/common_editor_operations.dart 2407:11
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 623:19
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 648:23
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 594:19
dart-sdk/lib/async/zone.dart 1538:47 _rootRunUnary
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 118:77 tear
dart-sdk/lib/async/zone.dart 1429:19 runUnary
dart-sdk/lib/async/future_impl.dart 222:18 handleValue
dart-sdk/lib/async/future_impl.dart 948:44 handleValueCallback
dart-sdk/lib/async/future_impl.dart 977:13 _propagateToListeners
dart-sdk/lib/async/future_impl.dart 720:5 [_completeWithValue]
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 504:7 complete
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 571:12 _asyncReturn
package:flutter/src/services/clipboard.dart 57:3
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 623:19
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 648:23
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 594:19
dart-sdk/lib/async/zone.dart 1538:47 _rootRunUnary
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 118:77 tear
dart-sdk/lib/async/zone.dart 1429:19 runUnary
dart-sdk/lib/async/future_impl.dart 222:18 handleValue
dart-sdk/lib/async/future_impl.dart 948:44 handleValueCallback
dart-sdk/lib/async/future_impl.dart 977:13 _propagateToListeners
dart-sdk/lib/async/future_impl.dart 720:5 [_completeWithValue]
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 504:7 complete
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 571:12 _asyncReturn
package:flutter/src/services/platform_channel.dart 368:3
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 623:19
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 648:23
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 594:19
dart-sdk/lib/async/zone.dart 1538:47 _rootRunUnary
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 118:77 tear
dart-sdk/lib/async/zone.dart 1429:19 runUnary
dart-sdk/lib/async/future_impl.dart 222:18 handleValue
dart-sdk/lib/async/future_impl.dart 948:44 handleValueCallback
dart-sdk/lib/async/future_impl.dart 977:13 _propagateToListeners
dart-sdk/lib/async/future_impl.dart 720:5 [_completeWithValue]
dart-sdk/lib/async/future_impl.dart 804:7
dart-sdk/lib/async/zone.dart 1525:13 _rootRun
════════════════════════════════════════════════════════════════════════════════════════════════════

Expected behavior
What should be the result of repeating the steps above (the desired behavior)?

Content should be pasted.

Platform
Which device(s) and operating system(s) have experienced the problem?

Flutter web on chrome macos.

Flutter version
Please list your Flutter and Dart version info. You can find this by running flutter --version at the command line.

Flutter 3.38.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    type_bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions