1

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?

BUDDAx2
  • 399
  • 1
  • 4
  • 20

2 Answers2

1

All that was needed is to use NSRTFDPboardType.

BUDDAx2
  • 399
  • 1
  • 4
  • 20
0

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.

Community
  • 1
  • 1
Extra Savoir-Faire
  • 6,026
  • 4
  • 29
  • 47