Skip to content
Draft
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions super_editor/lib/src/core/document_layout.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ abstract class DocumentLayout {

/// Returns the [DocumentPosition] at the end of the last selectable component.
DocumentPosition? findLastSelectablePosition();

/// Returns whether the component with the given [nodeId] is visible.
///
/// For example, this method returns `false` if the node is collapsed.
bool isComponentVisible(String nodeId);
}

/// Contract for all widgets that operate as document components
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -825,9 +825,11 @@ class CommonEditorOperations {
selectableNode = document.getNodeBefore(prevNode);

if (selectableNode != null) {
final nextComponent = documentLayoutResolver().getComponentByNodeId(selectableNode.id);
final documentLayout = documentLayoutResolver();
final nextComponent = documentLayout.getComponentByNodeId(selectableNode.id);
if (nextComponent != null) {
foundSelectableNode = nextComponent.isVisualSelectionSupported();
foundSelectableNode =
documentLayout.isComponentVisible(selectableNode.id) && nextComponent.isVisualSelectionSupported();
}
prevNode = selectableNode;
}
Expand All @@ -846,9 +848,11 @@ class CommonEditorOperations {
selectableNode = document.getNodeAfter(prevNode);

if (selectableNode != null) {
final nextComponent = documentLayoutResolver().getComponentByNodeId(selectableNode.id);
final documentLayout = documentLayoutResolver();
final nextComponent = documentLayout.getComponentByNodeId(selectableNode.id);
if (nextComponent != null) {
foundSelectableNode = nextComponent.isVisualSelectionSupported();
foundSelectableNode =
documentLayout.isComponentVisible(selectableNode.id) && nextComponent.isVisualSelectionSupported();
}
prevNode = selectableNode;
}
Expand Down
Loading
Loading