Skip to content

Commit

Permalink
Added ability to get container attachment for gridView
Browse files Browse the repository at this point in the history
  • Loading branch information
rajdeep committed Dec 11, 2023
1 parent 333e68b commit 1d32723
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Proton/Sources/Swift/Grid/View/GridView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions Proton/Tests/Grid/GridViewAttachmentSnapshotTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 1d32723

Please sign in to comment.