Skip to content

Commit b73670c

Browse files
authored
Merge pull request #69 from nodes-app/fix/empty-file-placeholder-clip
Fix empty-file placeholder clipping to one line after view rebuild
2 parents 6e6eab2 + 597678d commit b73670c

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎Sources/MarkdownEngine/TextView/NativeTextView/NativeTextView+Placeholder.swift‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ extension NativeTextView {
6060
self.placeholderView = nil
6161
}
6262
refreshPlaceholderVisibility()
63+
// An empty doc's text view sits at its one-line content height, which
64+
// clips the placeholder subview. Stretch it to the viewport (its intended
65+
// height): the first layout can run before the scroll view is sized and
66+
// `restack` never re-measures height, so otherwise the quote stays clipped
67+
// after the editor is rebuilt (e.g. graph view and back).
68+
if let placeholderView, !placeholderView.isHidden {
69+
applyManagedFrameSize(width: frame.width)
70+
}
6371
}
6472

6573
/// Visible only while the document is truly empty: the first typed character

0 commit comments

Comments
 (0)