We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit 2836c4e5 authored by Brion Vibber's avatar Brion Vibber

Fix for ticket #2942: character counter now updates on cut and paste...

Fix for ticket #2942: character counter now updates on cut and paste operations made with mouse or menu

This uses the 'copy' and 'paste' DOM events to trigger a counter update. I haven't had a chance to 100% confirm that middle-button click on X11 triggers the event, but it ought to.
Cut and paste events from context menu and main edit menu known good in:
* Firefox 4.08b-pre
* IE 9 preview 7
* IE 8 current
* Chrome 8 beta current
* Safari 5.0.3

Opera is listed as not supporting these events, oh well.

Note that using a *delete* command from a menu doesn't trigger an event. Sigh, you can't win everything.
parent 0330bad6
......@@ -85,6 +85,19 @@ var SN = { // StatusNet
SN.U.Counter(form);
});
var delayedUpdate= function(e) {
// Cut and paste events fire *before* the operation,
// so we need to trigger an update in a little bit.
// This would be so much easier if the 'change' event
// actually fired every time the value changed. :P
window.setTimeout(function() {
SN.U.Counter(form);
}, 50);
};
// Note there's still no event for mouse-triggered 'delete'.
NDT.bind('cut', delayedUpdate)
.bind('paste', delayedUpdate);
NDT.bind('keydown', function(e) {
SN.U.SubmitOnReturn(e, form);
});
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment