Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 16 additions & 15 deletions lib/src/editor/toolbar/desktop/floating_toolbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -136,22 +136,23 @@
final selection = editorState.selection;
final selectionType = editorState.selectionType;
if (lastSelection == selection) return;
lastSelection = selection;

if (selection == null ||
selection.isCollapsed ||
selectionType == SelectionType.block ||
editorState.selectionExtraInfo?[selectionExtraInfoDisableToolbar] ==
true) {
_clear();
} else {
// uses debounce to avoid the computing the rects too frequently.
_showAfterDelay(
duration: const Duration(milliseconds: 200),
isMetricsChanged: hasMetricsChanged,
);
if (hasMetricsChanged) hasMetricsChanged = false;
if (lastSelection == null || selection == null) {
if (selection == null ||
selection.isCollapsed ||
selectionType == SelectionType.block ||
editorState.selectionExtraInfo?[selectionExtraInfoDisableToolbar] ==
true) {
_clear();

Check warning on line 145 in lib/src/editor/toolbar/desktop/floating_toolbar.dart

View check run for this annotation

Codecov / codecov/patch

lib/src/editor/toolbar/desktop/floating_toolbar.dart#L145

Added line #L145 was not covered by tests
} else {
// uses debounce to avoid the computing the rects too frequently.
_showAfterDelay(
duration: const Duration(milliseconds: 200),
isMetricsChanged: hasMetricsChanged,
);
if (hasMetricsChanged) hasMetricsChanged = false;
}
}
lastSelection = selection;
}

void _onScrollPositionChanged() {
Expand Down