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

[SuperEditor] Add toggleable headers (Resolves #2276) #2404

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
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