AztecEditor-iOS icon indicating copy to clipboard operation
AztecEditor-iOS copied to clipboard

Provide default implementations for optional TextViewAttachmentDelegate functions

Open benpackard opened this issue 7 years ago • 5 comments

Expected behavior

Some functions of the TextViewAttachmentDelegate protocol should be considered optional since the functionality they provide is not required for many instances of a TextView. Specifically, the selection and deselection functions are not necessary if the text view is not providing any custom behavior for these actions (for example, relying on the delete key to remove the attachment, and not providing any additional attachment features).

These should be made optional by providing an empty default implementation in an extension to TextViewAttachmentDelegate:

extension TextViewAttachmentDelegate {
	func textView(_ textView: TextView, selected attachment: NSTextAttachment, atPosition position: CGPoint) { }
	func textView(_ textView: TextView, deselected attachment: NSTextAttachment, atPosition position: CGPoint) { }
}

Actual behavior

The selection and deselection functions are unnecessarily required by any object conforming to TextViewAttachmentDelegate.

Steps to reproduce the behavior

Conform to TextViewAttachmentDelegate and attempt to compile without implementing the two mentioned functions.

benpackard avatar Jun 21 '18 17:06 benpackard

I would like to make this small change myself and provide a pull request - is there any information available on the preferred process for this? Thanks.

benpackard avatar Jun 21 '18 17:06 benpackard

Sounds like a reasonable change. Our attachment delegates are a bit unclean right now so any help in that direction is welcome.

This is the closest we have to a guideline for submitting PRs to the project: https://github.com/wordpress-mobile/WordPress-iOS/wiki/Pull-Requests-guide-line

It's in a different repo, but we use the same guidelines.

Additionally, we're reachable in the WP.org slack server (channel #mobile) for any doubts, and you can always open an issue here in GitHub for additional questions related to work in Aztec.

diegoreymendez avatar Jun 21 '18 20:06 diegoreymendez

Thanks @diegoreymendez. Very impressed with this project so far and hopefully I can make some more meaningful contributions eventually.

benpackard avatar Jun 21 '18 21:06 benpackard

P.S. Can I get an invite to the slack?

benpackard avatar Jun 21 '18 21:06 benpackard

@benpackard - It is my understanding that if you follow the link I sent earlier (this one), the invite should be sent automatically to you.

Can you double check the spam folder and let me know?

diegoreymendez avatar Jun 22 '18 03:06 diegoreymendez