views:

24

answers:

2

I need to be notified when the user pastes data into an NSTextView in order to strip it of any disallowed data types (url links, etc). I don't want to use NSTextStorageDelegate's textStorageDidProcessEditing: because it is called when the user is just typing. How can I be notified of pastes only?

A: 

Subclass NSTextView and override the paste: method to notify you of the paste after passing on to super.

Dave DeLong
I don't see how to use the paste: method. the signature of the method is `- (void)paste:(id)sender` . No docs on how to implement. Probably my issue, but my answer below worked.
John Gordon
A: 

implementing the NSTextStorageDelegate method: - (void)textStorageDidProcessEditing:(NSNotification *)notification captures any kind of text input. I didn't see a slow down in processing, so i'll go with this.

John Gordon