[Webkit-unassigned] [Bug 25607] Need a way to catch (and cancel?) any execCommand. Maybe document.onexeccommand = ?

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jul 28 19:20:58 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=25607


Alex Russell <alex at dojotoolkit.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |alex at dojotoolkit.org




--- Comment #5 from Alex Russell <alex at dojotoolkit.org>  2010-07-28 19:20:58 PST ---
(In reply to comment #4)
> Alex proposed an alternative approach of exposing each command of execCommand as a method of document, window, etc... and make it replaceable by JavaScript, and have all editing commands such as bolding initiated by user go through that API.
> 
> So for example, you can override the bolding operation as follows:
> 
> var b = document.execCommand.bold;
> document.execCommand.bold = function (range, showDefaultUI, value) {
>   if (...) {...}// take care of my stuff here
>   return b(range, showDefaultUI, value); // call the original for other cases
> }

I'd actually suggested a new map, something like "document.commands" that would be where the existing and new commands could be listed and replaced. E.g.:

var c = document.commands;
var b = c.bold;
c.bold = function(range, defaultUI, value) {
   // call original or do your own processing here
   return b.apply(this, arguments); // no-op
};

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list