Re: [clipboard-apis] Should queryCommandEnabled(cut|copy|paste) trigger onbefore* events? (#4)

@zetafunction 
> For some reason, I thought the beforecopy/beforecut/beforepaste
> events were used as signals for whether or not to enable the
> corresponding context menu items. 

Well, that's how they were intended to work (but AFAIK even in IE which invented these events, support has left much to be desired..).

> queryCommandSupported('copy') only returns true with an active user gesture (!!) 

Well, that sounds wrong :) But IMO it would be useful to just move that check to the queryCommandEnabled() code - say, instead of the "is there a selection" check. So the question "is this supported" responds true and the question "is this enabled" returns false if execCommand() would indeed fail?

(Now, while I've been pushing for this as a way to feature-detect user-initiated execCommand(copy|cut) support, I admit that it's a bit inconsistent with how queryCommandEnabled() works with other commands. Maybe the perfect API would have a tri-state return value from queryCommandEnabled() - for example false,true,'user initiated'..)

> So it actually seems pretty close to what you're proposing. 

Indeed.

---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/clipboard-apis/issues/4#issuecomment-109312898

Received on Friday, 5 June 2015 14:38:16 UTC