[whatwg] Proposal: content-style attribute for contenteditable elements

On Tue, May 17, 2011 at 1:09 AM, Markus Ernst <derernst at gmx.ch> wrote:
> Special cases:
> - If the linked CSS document contains declarations for the body element,
> they are applied to the contenteditable element itself. (This could be
> necessary in case of light text on dark backgrounds, where you want to apply
> the background to the contenteditable area.)

It would be cleaner to simply say that the contenteditable element
matches the :root pseudoclass in the linked sheet.


> Rationale:
> - In today's iframe-based online rich text editors, it is common to apply
> the styles of the target page of the edited text to the source document of
> the iframe. This is not possible in a <div contenteditable>.
> - For many use cases, such as forum and blog entries, or non-fullpage
> oriented web content management systems, <div contenteditable> is easier to
> implement than iframe-based editors. The only downside is the WYSIWYG issue.

Why not just use an <iframe> with a contenteditable inside the linked
page?  This also gives you the ability to link in arbitrary CSS and be
shielded from the outside page's CSS, and as long as the linked page
is same-origin, you can still fiddle with it from script in the outer
page.

~TJ

Received on Tuesday, 17 May 2011 08:23:45 UTC