Editable: use execCommand to selectAll, if supported

This commit is contained in:
Rob Garrison 2016-01-22 16:52:35 -06:00
parent 121b134db9
commit 691c539ca6
2 changed files with 19 additions and 14 deletions

File diff suppressed because one or more lines are too long

View File

@ -27,6 +27,9 @@
selectAll: function( cell ) {
setTimeout( function() {
if ( document.queryCommandSupported( 'SelectAll' ) ) {
document.execCommand( 'selectAll', false, null );
} else {
// select all text in contenteditable
// see http://stackoverflow.com/a/6150060/145346
var range, selection;
@ -41,6 +44,8 @@
selection.removeAllRanges();
selection.addRange( range );
}
}
// need delay of at least 100ms or last contenteditable will get refocused
}, 100 );
},