Skip to content

Commit

Permalink
chore: rename closeWebPasteEvent() to cancelWebPasteEvent(), improve …
Browse files Browse the repository at this point in the history
…doc of _webPasteEventSubscription
  • Loading branch information
EchoEllet committed Sep 20, 2024
1 parent 3e118b2 commit 206f929
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/src/controller/quill_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ class QuillController extends ChangeNotifier {

_isDisposed = true;
if (kIsWeb) {
closeWebPasteEvent();
cancelWebPasteEvent();
}
super.dispose();
}
Expand Down
5 changes: 3 additions & 2 deletions lib/src/controller/web/quill_controller_web_real.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import '../quill_controller_rich_paste.dart';

/// Paste event for the web.
///
/// Will be `null` for non-web platforms.
/// Will be `null` when [QuillControllerWeb.initializeWebPasteEvent] was not called
/// or the subscription was canceled due to calling [QuillControllerWeb.cancelWebPasteEvent]
///
/// See: https://developer.mozilla.org/en-US/docs/Web/API/Element/paste_event
StreamSubscription? _webPasteEventSubscription;
Expand All @@ -30,7 +31,7 @@ extension QuillControllerWeb on QuillController {
});
}

void closeWebPasteEvent() {
void cancelWebPasteEvent() {
_webPasteEventSubscription?.cancel();
_webPasteEventSubscription = null;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/src/controller/web/quill_controller_web_stub.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ extension QuillControllerWeb on QuillController {
);
}

void closeWebPasteEvent() {
void cancelWebPasteEvent() {
throw UnsupportedError(
'The closeWebPasteEvent() method should be called only on web.',
);
Expand Down

0 comments on commit 206f929

Please sign in to comment.