W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2014

Re: [clipboard] Add RTF to the "mandatory data types" list?

From: Daniel Cheng <dcheng@chromium.org>
Date: Wed, 20 Aug 2014 02:18:39 -0700
Message-ID: <CAF3XrKrbdhoLWMp-_JnXOd4FLiCbKh7avf23KWW8m0MugEgbaA@mail.gmail.com>
To: Karl Dubost <karl@la-grange.net>
Cc: "Hallvord R. M. Steen" <hsteen@mozilla.com>, "James M. Greene" <james.m.greene@gmail.com>, public-webapps <public-webapps@w3.org>
Right now, the default action for copy/cut also populates text/plain on the
clipboard if you're copying HTML (I don't think the spec explicitly
mentions this, but I'm pretty sure this is how most browsers behave).

Given the current discussion, it seems expected that the browser will
automatically convert between RTF and HTML. If a user copies markup, the
browser should add RTF. If the user pastes RTF, the browser should convert
it back into HTML.

Implementing this conversion has one major problem: RTF parsing is
complicated. The spec is several hundred pages long. Every browser is going
to have to add rich text parser that's almost completely unrelated to the
web when it already has a perfectly good parser for HTML.

In the past, RTF support would have helped text that wanted to include
inline images, but there has been progress on solving this without
depending on RTF:
http://lists.w3.org/Archives/Public/public-webapps/2014JanMar/0103.html

On Tue, Aug 19, 2014 at 3:36 AM, Hallvord R. M. Steen <hsteen@mozilla.com>
 wrote:

> I don't have "input" as such, but I have a few questions:
> Is there any widely used software that writes RTF data to the system
> clipboard but *not* HTML?


I'm curious about the answer to this as well. I haven't seen any examples
raised outside of TextEdit. While TextEdit is widely deployed, is it
actually widely used as a rich text editor? I know I just use it as the
occasional scratch pad. If there aren't any good examples, I don't think it
makes sense to make RTF a mandatory data type. If there are, I still think
it'd make more sense to push those editors towards supporting HTML rather
than trying to make browsers support RTF.

Daniel


On Tue, Aug 19, 2014 at 8:17 PM, Karl Dubost <karl@la-grange.net> wrote:

>
> Le 19 août 2014 à 19:36, Hallvord R. M. Steen <hsteen@mozilla.com> a
> écrit :
> > If there's RTF on the clipboard and you try pasting into a rich text
> editing element, does any browser convert RTF to HTML to preserve the
> formatting?
>
> On MacOSX
>
> Test 1:
> Copy styled text with a link in a Web page (grey and pink text, black
> background, Big size) into an RTF editor (TextEdit).
> * Safari  -> TextEdit: color, size, position and links preserved
> * Firefox -> TextEdit: only size and links are preserved
>
> Test 2:
> Copy styled text from an RTF editor to content editable form
> http://codepen.io/matt-west/full/gtruC
> * TextEdit -> Safari: Everything is preserved
> * TextEdit -> Firefox: Nothing is preserved, just the text.
>
>
> Checking by inspecting the DOM content in the form in Safari:
>
> <p style="margin: 0px 0px 10px; font-size: 34px; line-height: normal;
> font-family: Times; color: rgb(225, 44, 155);">foobar</p>
>
>
> --
> Karl Dubost 🐄
> http://www.la-grange.net/karl/
>
>
>
Received on Wednesday, 20 August 2014 09:19:48 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:14:26 UTC