Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Commit 8670907

Browse files
committed
Merge pull request #7209 from Robo210/initial_selection
Exclude file ext from initial selection when renaming a file.
2 parents 9f2c33a + 17e3703 commit 8670907

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/project/ProjectManager.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1807,8 +1807,13 @@ define(function (require, exports, module) {
18071807

18081808
// Since html_titles are enabled, we have to reset the text without markup.
18091809
// And we also need to explicitly escape all html-sensitive characters.
1810-
_projectTree.jstree("set_text", $selected, _.escape(entry.name));
1810+
var escapedName = _.escape(entry.name);
1811+
_projectTree.jstree("set_text", $selected, escapedName);
18111812
_projectTree.jstree("rename");
1813+
var indexOfExtension = escapedName.lastIndexOf('.');
1814+
if (indexOfExtension > 0) {
1815+
$selected.children(".jstree-rename-input")[0].setSelectionRange(0, indexOfExtension);
1816+
}
18121817
});
18131818
// No fail handler: silently no-op if file doesn't exist in tree
18141819
}

0 commit comments

Comments
 (0)