Commit 2abb8d6d authored by fukino@chromium.org's avatar fukino@chromium.org

Focus whole entry name when renaming directories.

Under current implementation, extension part of entry name (after the last '.') is not focused even when users rename directories.
For directories, whole entry name should always be focused.

BUG=371676
TEST=manually tested

Review URL: https://codereview.chromium.org/279753002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269559 0039d316-1c4b-4281-b951-d872f2087c98
parent 95bc10a4
...@@ -2435,22 +2435,24 @@ var BOTTOM_MARGIN_FOR_PREVIEW_PANEL_PX = 52; ...@@ -2435,22 +2435,24 @@ var BOTTOM_MARGIN_FOR_PREVIEW_PANEL_PX = 52;
return; return;
var label = item.querySelector('.filename-label'); var label = item.querySelector('.filename-label');
var input = this.renameInput_; var input = this.renameInput_;
var currentEntry = this.currentList_.dataModel.item(item.listIndex);
input.value = label.textContent; input.value = label.textContent;
item.setAttribute('renaming', ''); item.setAttribute('renaming', '');
label.parentNode.appendChild(input); label.parentNode.appendChild(input);
input.focus(); input.focus();
var selectionEnd = input.value.lastIndexOf('.'); var selectionEnd = input.value.lastIndexOf('.');
if (selectionEnd == -1) { if (currentEntry.isFile && selectionEnd !== -1) {
input.select();
} else {
input.selectionStart = 0; input.selectionStart = 0;
input.selectionEnd = selectionEnd; input.selectionEnd = selectionEnd;
} else {
input.select();
} }
// This has to be set late in the process so we don't handle spurious // This has to be set late in the process so we don't handle spurious
// blur events. // blur events.
input.currentEntry = this.currentList_.dataModel.item(item.listIndex); input.currentEntry = currentEntry;
this.table_.startBatchUpdates(); this.table_.startBatchUpdates();
this.grid_.startBatchUpdates(); this.grid_.startBatchUpdates();
}; };
......
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