Fix pasting into the subject field in Firefox.

This commit is contained in:
Vikhyat Korrapati 2014-03-24 22:33:20 +05:30
parent 36cbd0d348
commit 881340213e
1 changed files with 2 additions and 2 deletions

View File

@ -328,8 +328,8 @@ Discourse.ComposerView = Discourse.View.extend(Ember.Evented, {
var uaMatch = navigator.userAgent.match(/Firefox\/(\d+)\.\d/);
if (uaMatch && parseInt(uaMatch[1]) >= 24) {
self.$().append( Ember.$("<div id='contenteditable' contenteditable='true' style='height: 0; width: 0; overflow: hidden'></div>") );
self.$().off('keydown.contenteditable');
self.$().on('keydown.contenteditable', function(event) {
self.$("textarea").off('keydown.contenteditable');
self.$("textarea").on('keydown.contenteditable', function(event) {
// Catch Ctrl+v / Cmd+v and hijack focus to a contenteditable div. We can't
// use the onpaste event because for some reason the paste isn't resumed
// after we switch focus, probably because it is being executed too late.