@@ -98,26 +98,24 @@ class ActionsClass {
9898 const inputLoader = nameBlock.find('.input-loader');
9999
100100 inputField.focus();
101- inputField.on('blur keypress ', e => {
101+ inputField.on('blur keydown ', e => {
102102 // Save Field
103103 if (
104- (e.type === 'keypress ' && e.which === 27)
104+ (e.type === 'keydown ' && e.which === 27)
105105 || e.type === 'blur'
106- || (e.type === 'keypress ' && e.which === 13 && currentName === inputField.val())
106+ || (e.type === 'keydown ' && e.which === 13 && currentName === inputField.val())
107107 ) {
108108 if (!_.isEmpty(currentLink)) {
109109 nameBlock.html(currentLink);
110110 } else {
111111 nameBlock.html(currentName);
112112 }
113113 inputField.remove();
114- ContextMenu.run();
114+ ContextMenu.unbind(). run();
115115 return;
116116 }
117117
118- if (e.type === 'keypress' && e.which !== 13) return;
119-
120- console.log('did not');
118+ if (e.type === 'keydown' && e.which !== 13) return;
121119
122120 inputLoader.show();
123121 const currentPath = decodeURIComponent(nameBlock.data('path'));
@@ -138,7 +136,10 @@ class ActionsClass {
138136 }).done(data => {
139137 nameBlock.attr('data-name', inputField.val());
140138 if (!_.isEmpty(currentLink)) {
141- const newLink = currentLink.attr('href').substr(0, currentLink.attr('href').lastIndexOf('/')) + '/' + inputField.val();
139+ let newLink = currentLink.attr('href');
140+ if (nameBlock.parent().data('type') !== 'folder') {
141+ newLink = newLink.substr(0, newLink.lastIndexOf('/')) + '/' + inputField.val();
142+ }
142143 currentLink.attr('href', newLink);
143144 nameBlock.html(
144145 currentLink.html(inputField.val())
@@ -164,6 +165,7 @@ class ActionsClass {
164165 }).popover('show');
165166 }).always(() => {
166167 inputLoader.remove();
168+ ContextMenu.unbind().run();
167169 });
168170 });
169171 }
0 commit comments