Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
1 task done
EchoEllet opened this issue Sep 13, 2024 · 2 comments
Open
1 task done

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

EchoEllet opened this issue Sep 13, 2024 · 2 comments
Labels
blocked bug Something isn't working

Comments

@EchoEllet
Copy link
Collaborator

EchoEllet commented Sep 13, 2024

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.
@EchoEllet
Copy link
Collaborator Author

EchoEllet commented Sep 13, 2024

Will fix this issue ASAP. For now, it has been disabled in #2221

EchoEllet added a commit that referenced this issue Sep 13, 2024
* revert: disable rich text paste feature on web as a workaround to issue #2220
@EchoEllet
Copy link
Collaborator Author

EchoEllet commented Sep 14, 2024

It seems that even after disabling/reverting #2009, returns false in clipboardPaste and disable pasteText.

And also pass false to pasteEnabled.

The text still gets pasted as plain text after using the paste hotkey (ctrl/cmd + v) on the web, this is not the case for desktop or mobile.

If anyone has any ideas or thoughts on where this paste is triggered, feel free to share them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant