Re: NSAttributedString gains default font and paragraph style after round tripping through pasteboard?
Re: NSAttributedString gains default font and paragraph style after round tripping through pasteboard?
- Subject: Re: NSAttributedString gains default font and paragraph style after round tripping through pasteboard?
- From: Douglas Davidson <email@hidden>
- Date: Mon, 12 Jun 2006 15:49:14 -0700
On Jun 11, 2006, at 4:00 PM, Jim Correia wrote:
I am creating an NSAttributedString which only has a link attribute
with the hopes that when pasted it would pick up the typing
attributes. However, after round tripping through RTFD it appears
to have picked up the default font and paragraph style.
Is this the expected behavior? Is there any way I can put a string
with a link on the pasteboard in such a way that it will pick up
the typing attributes when pasted?
Not easily. Try this: create an NSTextView, populate it with your
attributed string, and set the selection to cover the range of the
link. Call -writablePasteboardTypes, and create a mutable copy of
the resulting array. From it, remove NSRTFPboardType and
NSRTFDPboardType (if present). Then call -
writeSelectionToPasteboard:types: with the modified array as the
types array.
Douglas Davidson
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden