Adding HTML data to the general pasteboard
Adding HTML data to the general pasteboard
- Subject: Adding HTML data to the general pasteboard
- From: Patrick Robertson <email@hidden>
- Date: Fri, 27 May 2011 16:43:50 +1000
Dear all,
I currently have an application which pastes objects from a given list of
saved objects (basically strings) to wherever the mouse if focused.
What I'm looking to do is paste these objects in RT format into various text
editors. Most notably - URL strings (e.g. http://example.com) such that they
are formatted as clickable links.
In order to paste the objects (I'll concentrate on URLs), I add them to the
generalPasteboard with a type 'Apple URL pasteboard type'. Then I use some
carbon to simulate ⌘V.
Now the 'Apple URL pasteboard type' works well for pasting in apps such as
TextEdit - TextEdit format's the URL as RTF and makes it a clickable link. I
have problems with other text editors, such as Gmail's email editor (that
most likely do not understand the Apple URL pasteboard type).
My question is - how should I go about adding the correct types to the URL
(e.g. NSHTMLPboardType) before I add it to the generalPasteboard? - such
that text editors that do not undersand the 'Apple URL pasteboard type'
(Gmail's editor) can still paste the object.
I have tried giving the URL object the NSHTMLPboardType, but I get messages
in the console saying 'bad data for ...' where ... is, for example
public.rtf or public.html
I'm assuming I need to first convert the string into a HTML type string?
Thanks
_______________________________________________
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