diff --git a/Proton/Sources/Swift/Attachment/Attachment.swift b/Proton/Sources/Swift/Attachment/Attachment.swift index 949f0618..f5f53e7d 100644 --- a/Proton/Sources/Swift/Attachment/Attachment.swift +++ b/Proton/Sources/Swift/Attachment/Attachment.swift @@ -474,9 +474,10 @@ extension Attachment { let range = editor.attributedText.rangeFor(attachment: self) else { return } cachedBounds = nil + let needsInvalidation = bounds.integral.size != contentView?.bounds.integral.size editor.invalidateLayout(for: range) - if containerTextView?.isScrollEnabled == false { + if containerTextView?.isScrollEnabled == false, needsInvalidation { containerTextView?.invalidateIntrinsicContentSize() } } diff --git a/Proton/Sources/Swift/Core/RichTextView.swift b/Proton/Sources/Swift/Core/RichTextView.swift index 246bf297..99c8ed5e 100644 --- a/Proton/Sources/Swift/Core/RichTextView.swift +++ b/Proton/Sources/Swift/Core/RichTextView.swift @@ -87,13 +87,6 @@ class RichTextView: AutogrowingTextView { } } - override func layoutSubviews() { - super.layoutSubviews() - if editorView?.isRootEditor == true, editorView?.isScrollEnabled == false { - invalidateIntrinsicContentSize() - } - } - override var selectedTextRange: UITextRange? { didSet{ let old = oldValue?.toNSRange(in: self) diff --git a/Proton/Sources/Swift/Grid/View/GridCell.swift b/Proton/Sources/Swift/Grid/View/GridCell.swift index 15a369f1..9a229c7f 100644 --- a/Proton/Sources/Swift/Grid/View/GridCell.swift +++ b/Proton/Sources/Swift/Grid/View/GridCell.swift @@ -183,7 +183,7 @@ public class GridCell { } public convenience init(rowSpan: [Int], columnSpan: [Int], initialHeight: CGFloat = 40, style: GridCellStyle = .init(), gridStyle: GridStyle = .default) { - self.init(editor: EditorView(), rowSpan: rowSpan, columnSpan: columnSpan, initialHeight: initialHeight, style: style, gridStyle: gridStyle) + self.init(editor: EditorView(allowAutogrowing: false), rowSpan: rowSpan, columnSpan: columnSpan, initialHeight: initialHeight, style: style, gridStyle: gridStyle) } /// Sets the focus in the `Editor` within the cell.