scripting / drummerRFC

A place to post RFCs for people who use and develop in Drummer.
MIT License
11 stars 0 forks source link

OPML and clipboard interop #26

Open jessegrosjean opened 2 years ago

jessegrosjean commented 2 years ago

It would be useful if there was a standard way to read/write OPML data to clipboard.

On macOS data types (both file and clipboard) are identified with a UTI type as described here. According to Wikipedia the standard opml UTI is org.opm.opml. That's what I use in my app, and if other apps also support that type then it means we can copy/paste OPML between our apps.

On the other hand right now when I copy/paste between Drummer (or any web app) and my app I get a plain text representation of the outline without any OPML attributes. This is a sensible default since it's probably most common to paste Drummer into plain text editor. It also works well enough because my app can also read tab indented plain text into an outline. But OPML would be nicer since it's a standard and also can transfer attributes.

I'm not sure if it's possible though.

When I suggested this on twitter I thought there must be a way for web apps to also put typed data on clipboard, but now I'm not sure sure. I'm not very familiar with web APIs. I "think" the way you would do this on web is through this API. The problem is that it looks like the available types that you can write is not open ended and OPML is not included.

In web terms I think my request is to able to read opml-x mime type from clipboard. I think someone more experienced with web API will need to review this and tell if it's possible or not.

scripting commented 2 years ago

Jesse thanks for the very clear explanation of the question. I would love to straighten this out because we put a lot of attributes in our outlines to make it work with our CMS, and for other applications, and to have those same attributes work in other editing and rendering environments. That's where we should be headed. So this is a good topic to discuss and act on, with due deliberation, because we will have to live with whatever mistakes are made. :smile:

With that in mind.

  1. I've never done work on web clipboards.

  2. I did not write the code in Concord, which is the base outliner for all my work for clipboards. It's open source, GPL licensed, so anyone can investigate and advise.

I will write about this on my blog, and ask other people to look at this.

Thanks for getting the discussion going! ;-)

scripting commented 2 years ago

Also I suggest changing the title of this thread.

We're just looking for interop. So I would suggest changing the title to something like "OPML and clipboard interop."

I've been involved in standards work before, and I didn't like it. I like to make software for users. ;-)

Keep it in the code-writing realm. ;-)

jessegrosjean commented 2 years ago

I've just been looking more and I think web clipboard only supports text/html, text/plain and text/uri-list types for security reasons. I've read that in a few places including here. So maybe OPML on clipboard just isn't possible.

If that's the case I see three options:

  1. Leave as is, plain text copy and paste does work quite well. Maybe this could be discussed on "opml" compatible applications page... because while some apps don't support OPML many do support outline data in the form of tab indented text. I think is best option.

  2. You could add a separate Copy command to copy OPML text instead of plain text to clipboard. Then check text to see if OPML or plain on paste. Kinda mess, but could work. I'd be happy to support in my app anyway, though not sure it would get much use.

  3. My app Bike uses html subset as native file format and I think that can be written to web clipboard since it's HTML. Using an HTML subset would be another route, but new format and thus lots of work. I'm not sure it worth at this point. Apps receiving the past would also need to detect the HTML subset, so not clean, but better then (2) maybe.