From 408f29d6a65e797572adf45873780c3adfc0bf4d Mon Sep 17 00:00:00 2001 From: Marcin Warpechowski Date: Wed, 20 Feb 2013 11:19:37 +0100 Subject: [PATCH] bugfix: scrolls to top of table on any key press if the top is not on the screen (issue #348) --- CHANGELOG.md | 5 +++++ dist/jquery.handsontable.full.css | 2 +- dist/jquery.handsontable.full.js | 13 +++++++------ jquery.handsontable.css | 2 +- jquery.handsontable.js | 13 +++++++------ src/editors/textEditor.js | 11 ++++++----- 6 files changed, 27 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 060ab7c08ef..7ed4df50296 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## HEAD + +Bugfix: +- scrolls to top of table on any key press if the top is not on the screen ([#348](https://github.com/warpech/jquery-handsontable/issues/348)) + ## [0.8.5](https://github.com/warpech/jquery-handsontable/tree/v0.8.5) (Feb 18, 2013) Bugfix: diff --git a/dist/jquery.handsontable.full.css b/dist/jquery.handsontable.full.css index f4461ecd8c3..7fc96421c3b 100644 --- a/dist/jquery.handsontable.full.css +++ b/dist/jquery.handsontable.full.css @@ -6,7 +6,7 @@ * Licensed under the MIT license. * http://handsontable.com/ * - * Date: Mon Feb 18 2013 19:46:29 GMT+0100 (Central European Standard Time) + * Date: Wed Feb 20 2013 11:18:51 GMT+0100 (Central European Standard Time) */ .handsontable { diff --git a/dist/jquery.handsontable.full.js b/dist/jquery.handsontable.full.js index dff09eeb7b2..14a62df3596 100644 --- a/dist/jquery.handsontable.full.js +++ b/dist/jquery.handsontable.full.js @@ -6,7 +6,7 @@ * Licensed under the MIT license. * http://handsontable.com/ * - * Date: Mon Feb 18 2013 19:46:29 GMT+0100 (Central European Standard Time) + * Date: Wed Feb 20 2013 11:18:51 GMT+0100 (Central European Standard Time) */ /*jslint white: true, browser: true, plusplus: true, indent: 4, maxerr: 50 */ @@ -2674,8 +2674,9 @@ var texteditor = { } if (instance.getSettings().asyncRendering) { + texteditor.refreshDimensions(instance, row, col, keyboardProxy); //need it instantly, to prevent https://github.com/warpech/jquery-handsontable/issues/348 setTimeout(function () { - texteditor.refreshDimensions(instance, row, col, keyboardProxy); + texteditor.refreshDimensions(instance, row, col, keyboardProxy); //need it after rerender to reposition in case scroll was moved }, 0); } else { @@ -2827,10 +2828,10 @@ Handsontable.TextEditor = function (instance, td, row, col, prop, keyboardProxy, }); /*keyboardProxy.on('blur.editor', function () { - if (texteditor.isCellEdited) { - texteditor.finishEditing(instance, null, row, col, prop, keyboardProxy, false); - } - });*/ + if (texteditor.isCellEdited) { + texteditor.finishEditing(instance, null, row, col, prop, keyboardProxy, false); + } + });*/ keyboardProxy.on('refreshBorder.editor', function () { setTimeout(function () { diff --git a/jquery.handsontable.css b/jquery.handsontable.css index b6dc599b608..b0da7025d0a 100644 --- a/jquery.handsontable.css +++ b/jquery.handsontable.css @@ -6,7 +6,7 @@ * Licensed under the MIT license. * http://handsontable.com/ * - * Date: Mon Feb 18 2013 19:46:29 GMT+0100 (Central European Standard Time) + * Date: Wed Feb 20 2013 11:18:51 GMT+0100 (Central European Standard Time) */ .handsontable { diff --git a/jquery.handsontable.js b/jquery.handsontable.js index 97746592f54..da6903f58cb 100644 --- a/jquery.handsontable.js +++ b/jquery.handsontable.js @@ -6,7 +6,7 @@ * Licensed under the MIT license. * http://handsontable.com/ * - * Date: Mon Feb 18 2013 19:46:29 GMT+0100 (Central European Standard Time) + * Date: Wed Feb 20 2013 11:18:51 GMT+0100 (Central European Standard Time) */ /*jslint white: true, browser: true, plusplus: true, indent: 4, maxerr: 50 */ @@ -2674,8 +2674,9 @@ var texteditor = { } if (instance.getSettings().asyncRendering) { + texteditor.refreshDimensions(instance, row, col, keyboardProxy); //need it instantly, to prevent https://github.com/warpech/jquery-handsontable/issues/348 setTimeout(function () { - texteditor.refreshDimensions(instance, row, col, keyboardProxy); + texteditor.refreshDimensions(instance, row, col, keyboardProxy); //need it after rerender to reposition in case scroll was moved }, 0); } else { @@ -2827,10 +2828,10 @@ Handsontable.TextEditor = function (instance, td, row, col, prop, keyboardProxy, }); /*keyboardProxy.on('blur.editor', function () { - if (texteditor.isCellEdited) { - texteditor.finishEditing(instance, null, row, col, prop, keyboardProxy, false); - } - });*/ + if (texteditor.isCellEdited) { + texteditor.finishEditing(instance, null, row, col, prop, keyboardProxy, false); + } + });*/ keyboardProxy.on('refreshBorder.editor', function () { setTimeout(function () { diff --git a/src/editors/textEditor.js b/src/editors/textEditor.js index 811e4169999..5c13e99747c 100644 --- a/src/editors/textEditor.js +++ b/src/editors/textEditor.js @@ -82,8 +82,9 @@ var texteditor = { } if (instance.getSettings().asyncRendering) { + texteditor.refreshDimensions(instance, row, col, keyboardProxy); //need it instantly, to prevent https://github.com/warpech/jquery-handsontable/issues/348 setTimeout(function () { - texteditor.refreshDimensions(instance, row, col, keyboardProxy); + texteditor.refreshDimensions(instance, row, col, keyboardProxy); //need it after rerender to reposition in case scroll was moved }, 0); } else { @@ -235,10 +236,10 @@ Handsontable.TextEditor = function (instance, td, row, col, prop, keyboardProxy, }); /*keyboardProxy.on('blur.editor', function () { - if (texteditor.isCellEdited) { - texteditor.finishEditing(instance, null, row, col, prop, keyboardProxy, false); - } - });*/ + if (texteditor.isCellEdited) { + texteditor.finishEditing(instance, null, row, col, prop, keyboardProxy, false); + } + });*/ keyboardProxy.on('refreshBorder.editor', function () { setTimeout(function () {