0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2024-12-22 15:23:29 -05:00

Fix KB bold/italic etc. shortcuts in Webkit.

Webkit needs a special placeholder text node as it can't focus empty text nodes.
This was being cleaned up too early, before the user had a chance to enter any
text.
This commit is contained in:
Neil Jenkins 2013-04-18 13:59:08 +02:00
parent 20f92c9785
commit 4c5b157d09
3 changed files with 5 additions and 3 deletions

View file

@ -1277,6 +1277,7 @@ var willEnablePlaceholderRemoval = false;
var enablePlaceholderRemoval = function () { var enablePlaceholderRemoval = function () {
mayRemovePlaceholder = true; mayRemovePlaceholder = true;
willEnablePlaceholderRemoval = false; willEnablePlaceholderRemoval = false;
removeEventListener( 'keydown', enablePlaceholderRemoval );
}; };
var removePlaceholderTextNode = function () { var removePlaceholderTextNode = function () {
@ -1304,7 +1305,7 @@ var setPlaceholderTextNode = function ( node ) {
removePlaceholderTextNode(); removePlaceholderTextNode();
} }
if ( !willEnablePlaceholderRemoval ) { if ( !willEnablePlaceholderRemoval ) {
setTimeout( enablePlaceholderRemoval, 0 ); addEventListener( 'keydown', enablePlaceholderRemoval );
willEnablePlaceholderRemoval = true; willEnablePlaceholderRemoval = true;
} }
mayRemovePlaceholder = false; mayRemovePlaceholder = false;

File diff suppressed because one or more lines are too long

View file

@ -198,6 +198,7 @@ var willEnablePlaceholderRemoval = false;
var enablePlaceholderRemoval = function () { var enablePlaceholderRemoval = function () {
mayRemovePlaceholder = true; mayRemovePlaceholder = true;
willEnablePlaceholderRemoval = false; willEnablePlaceholderRemoval = false;
removeEventListener( 'keydown', enablePlaceholderRemoval );
}; };
var removePlaceholderTextNode = function () { var removePlaceholderTextNode = function () {
@ -225,7 +226,7 @@ var setPlaceholderTextNode = function ( node ) {
removePlaceholderTextNode(); removePlaceholderTextNode();
} }
if ( !willEnablePlaceholderRemoval ) { if ( !willEnablePlaceholderRemoval ) {
setTimeout( enablePlaceholderRemoval, 0 ); addEventListener( 'keydown', enablePlaceholderRemoval );
willEnablePlaceholderRemoval = true; willEnablePlaceholderRemoval = true;
} }
mayRemovePlaceholder = false; mayRemovePlaceholder = false;