Skip to content

Rich Text Paste Duplicates Content via HTML & Plain Text on Web #2220

Open
@EchoEllet

Description

@EchoEllet

Is there an existing issue for this?

Flutter Quill version

Commit e51add5

Steps to reproduce

  1. Run the example, open an empty document

  2. Copy the Table of Contnets section

    Screenshot

    image

  3. Paste it into the editor using the keyboard paste hotkey

Expected results

Should only paste once

Actual results

Duplicated paste, one pasted via HTML and the other as plain text.

Code sample

Run the application in the example

Additional Context

For more details #2009

Screenshots / Video demonstration

image

Logs
╡ EXCEPTION CAUGHT BY FOUNDATION LIBRARY ╞════════════════════════════════════════════════════════
The following assertion was thrown while dispatching notifications for QuillController:
Looking up a deactivated widget's ancestor is unsafe.
At this point the state of the widget's element tree is no longer stable.
To safely refer to a widget's ancestor in its dispose() method, save a reference to the ancestor by
calling dependOnInheritedWidgetOfExactType() in the widget's didChangeDependencies() method.

When the exception was thrown, this was the stack:
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 296:3  throw_
errors.dart:296
packages/flutter/src/widgets/framework.dart 4873:9                           <fn>
framework.dart:4873
packages/flutter/src/widgets/framework.dart 4886:14                          [_debugCheckStateIsActiveForAncestorLookup]
framework.dart:4886
packages/flutter/src/widgets/framework.dart 4906:12                          dependOnInheritedWidgetOfExactType
framework.dart:4906
packages/flutter/src/widgets/localizations.dart 529:47                       of
localizations.dart:529
packages/flutter_quill/src/l10n/generated/quill_localizations.dart 107:26    of
quill_localizations.dart:107
packages/flutter_quill/src/l10n/extensions/localizations_ext.dart 23:38      LocalizationsExt.get$35loc
localizations_ext.dart:23
packages/flutter_quill/src/toolbar/buttons/font_family_button.dart 49:21     get [_defaultDisplayText]
font_family_button.dart:49
packages/flutter_quill/src/toolbar/buttons/font_family_button.dart 41:11     get currentStateValue
font_family_button.dart:41
packages/flutter_quill/src/toolbar/base_button/base_value_button.dart 88:35  <fn>
base_value_button.dart:88
packages/flutter/src/widgets/framework.dart 1203:30                          setState
framework.dart:1203
packages/flutter_quill/src/toolbar/base_button/base_value_button.dart 88:5   didChangeEditingValue
base_value_button.dart:88
packages/flutter/src/foundation/change_notifier.dart 437:24                  notifyListeners
change_notifier.dart:437
packages/flutter_quill/src/controller/quill_controller.dart 353:7            replaceText
quill_controller.dart:353
packages/flutter_quill/src/controller/quill_controller_rich_paste.dart 86:5  QuillControllerRichPaste._pasteUsingDelta
quill_controller_rich_paste.dart:86
packages/flutter_quill/src/controller/quill_controller_rich_paste.dart 42:7  QuillControllerRichPaste$124pasteHTML
quill_controller_rich_paste.dart:42
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 45:50           <fn>
async_patch.dart:45
dart-sdk/lib/async/zone.dart 1661:54                                         runUnary
zone.dart:1661
dart-sdk/lib/async/future_impl.dart 163:18                                   handleValue
future_impl.dart:163
dart-sdk/lib/async/future_impl.dart 861:44                                   handleValueCallback
future_impl.dart:861
dart-sdk/lib/async/future_impl.dart 890:13                                   _propagateToListeners
future_impl.dart:890
dart-sdk/lib/async/future_impl.dart 666:5                                    [_completeWithValue]
future_impl.dart:666
dart-sdk/lib/async/future_impl.dart 736:7                                    callback
future_impl.dart:736
dart-sdk/lib/async/schedule_microtask.dart 40:11                             _microtaskLoop
schedule_microtask.dart:40
dart-sdk/lib/async/schedule_microtask.dart 49:5                              _startMicrotaskLoop
schedule_microtask.dart:49
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 181:7           <fn>
async_patch.dart:181

The QuillController sending notification was:
  Instance of 'QuillController'

nother exception was thrown: Looking up a deactivated widget's ancestor is unsafe.
3
Another exception was thrown: TypeError: null: type 'Null' is not a subtype of type 'bool'
3
Another exception was thrown: Unexpected null value.
2
Another exception was thrown: Looking up a deactivated widget's ancestor is unsafe.
3
Another exception was thrown: TypeError: null: type 'Null' is not a subtype of type 'bool'
3
Another exception was thrown: Unexpected null value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    blockedThis issue cannot be resolved due to an obstacle or dependency.bugSomething isn't workingminorMinimal impact or cosmetic issue. Can be resolved at a later time without affecting overall functionwebIssues or feature requests specific to the Web platform.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions