[kupu-dev] Pasting HTML into Kupu
Johnny deBris
johnny at debris.demon.nl
Sun Dec 3 23:14:23 CET 2006
George Lee wrote:
>
> Technically how do browsers paste -- by typing in character by character
> what's in the pasted selection? If so it seems like it'd be hard to
> trigger an HTML cleanup since it couldn't be called after each character
> ("<" "d" "i" "v") was inserted.
In browsers, paste is a single action. In IE, certain events
(onbeforepaste and something like onpaste or onafterpaste, or even both)
are emitted, but not in Mozilla. I think in Mozilla it's not possible to
automatically trigger cleanups on paste (actually spent some time
looking at this something like two years ago, perhaps things changed,
but as far as I know, Mozilla still only supports the 'standard', and
not IE's extended, events).
> Alternatively, is there a way to
> override "paste" within browsers with a custom paste function?
There's no hook or anything.
> Or to
> disable it and create another way like right-click, paste defined
> through Kupu?
>
I'm not sure if you can disable it. I do know you can trigger paste from
JavaScript (some execCommand call iirc), but in Mozilla it's not allowed
by default and has to be allowed on a per-domain basis by tweaking some
config file somewhere (the details are a little fuzzy, it's been a
while, I just remembered it was cumbersome).
>
> Where is this code?
>
It's in common/kupucontentfilters.js, and if not, it was there at some
moment so check SVN history...
>
> How does the filtering and HTML tidying of kupu, work in conjunction
> with non-kupu users? If someone is entering HTML manually, through epoz,
> etc., if that uses different tidying standards, then isn't this going to
> wreak havoc as different users edit the same content with different
> methods? Or is there a way to enforce tidying across the board -- for
> instance using a KupuRichWidget which doesn't have to use kupu but will
> still tidy the HTML according to the same standards whenever it is edited?
>
I'll leave this one for Duncan to answer, also because it's Plone
related (partially, I guess the answer in general would be something
like 'let's just hope they're all flexible enough, and at the same time
produce clean enough results, so that they can cooperate nicely)...
Cheers,
Guido
More information about the kupu-dev
mailing list