Missing functionality in copy/paste of NSAttributedStrings? or of NSData?
Missing functionality in copy/paste of NSAttributedStrings? or of NSData?
- Subject: Missing functionality in copy/paste of NSAttributedStrings? or of NSData?
- From: James Stein <email@hidden>
- Date: Sun, 21 Jun 2009 16:27:27 -0700
I use a few non-standard attributes in NSAttributedStrings.
("Standard" attributes are listed in the "Attributed Strings
Programming Guide.")
My first stumbling block is that such a string (or substring) in an
NSTextView, when copied and pasted, will "lose" its non-standard
attributes. (As an aside, the non-standard attributes will survive
encoding and decoding, and are preserved by the 'copy:withZone'
method.) It appears to me that the Cocoa methods for converting
attributed strings to-and-from NSData objects assume the used of
"standard" attributes; and it further appears to me that these
conversions neglect to copy non-standard attributes.
I use a subclass of NSTextView, and am willing to override the
copy/paste/cut methods that it inherits from NSText; and am willing
to employ an additional pasteboard type. Here is my quandary:
It appears that the only objects that can be written to an NSPasteboard are
these:
NSData (setData: forType)
NSString (setString:forType:)
NSFileWrapper (writeFileWrapper:)
file content (writeFileContents:)
OK, so it seems the first method is the only appropriate method, so
I need to create an NSData object from my NSAttributedString.
But how?
I must be missing something, but what?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden