I'm trying to implement auto copy content from NSTextView to clipboard for pasting it in editor in the future. NSTextView has plain and attributed text and images.
If I select all and copy by pressing CMD+C and paste to some rich editor (for example Mail.app) everything is fine.
I found this solution to copy RTF on CocoaDev.com
But when I'm trying to copy my content through this solution is nothing happening if I pasting then in editor.
How to copy attributed text with images from NSTextView textStorage 开发者_运维百科to NSPasteboard?
All that was needed is to use NSRTFDPboardType.
Your text view's text storage is an instance of NSTextStorage, which is a subclass of NSMutableAttributedString. With that in mind, look at Copy NSAttributedString to pasteboard and you'll have everything you need to move forward.
精彩评论