diff --git a/Proton/Sources/Swift/Grid/View/GridView.swift b/Proton/Sources/Swift/Grid/View/GridView.swift index 49df024c..93592031 100644 --- a/Proton/Sources/Swift/Grid/View/GridView.swift +++ b/Proton/Sources/Swift/Grid/View/GridView.swift @@ -135,6 +135,11 @@ public class GridView: UIView { /// Delegate for `GridView` which can be used to handle cell specific `EditorView` events public weak var delegate: GridViewDelegate? + /// Gets the attachment containing the `GridView` + public var containerAttachment: Attachment? { + attachmentContentView?.attachment + } + /// Determines if column resizing handles are visible or not. public private(set) var isColumnResizingHandlesVisible = false { didSet { diff --git a/Proton/Tests/Grid/GridViewAttachmentSnapshotTests.swift b/Proton/Tests/Grid/GridViewAttachmentSnapshotTests.swift index 9873bbca..13d91c45 100644 --- a/Proton/Tests/Grid/GridViewAttachmentSnapshotTests.swift +++ b/Proton/Tests/Grid/GridViewAttachmentSnapshotTests.swift @@ -44,6 +44,8 @@ class GridViewAttachmentSnapshotTests: SnapshotTestCase { editor.insertAttachment(in: editor.textEndRange, attachment: attachment) editor.replaceCharacters(in: editor.textEndRange, with: "Text after grid") + XCTAssertEqual(attachment.view.containerAttachment, attachment) + viewController.render(size: CGSize(width: 400, height: 300)) assertSnapshot(matching: viewController.view, as: .image, record: recordMode) }