File tree 2 files changed +16
-6
lines changed
2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change 1
1
### Breaking Changes
2
2
- Changed the behavior for dropping an item at the bottom of an open folder has changed, and will now drop
3
3
into the open folder at its top, instead of the parent folder below the open folder. See discussion at #148 for details.
4
- You can opt out of this behavior by setting the ` canDropBelowOpenFolders ` prop on the tree environment (#148 ).
4
+ You can opt out of this behavior by setting the ` canDropBelowOpenFolders ` prop on the tree environment (#148 ).
5
+
6
+ ### Bug Fixes
7
+ - Fixed a bug where the ` canRename ` property in a tree item payload was not respected.
Original file line number Diff line number Diff line change @@ -170,12 +170,19 @@ export const useTreeKeyboardBindings = () => {
170
170
useHotkey (
171
171
'renameItem' ,
172
172
e => {
173
- if ( viewState . focusedItem !== undefined ) {
174
- e . preventDefault ( ) ;
175
- const item = environment . items [ viewState . focusedItem ] ;
176
- environment . onStartRenamingItem ?.( item , treeId ) ;
177
- setRenamingItem ( item . index ) ;
173
+ if ( viewState . focusedItem === undefined ) {
174
+ return ;
175
+ }
176
+
177
+ e . preventDefault ( ) ;
178
+ const item = environment . items [ viewState . focusedItem ] ;
179
+
180
+ if ( item . canRename === false ) {
181
+ return ;
178
182
}
183
+
184
+ environment . onStartRenamingItem ?.( item , treeId ) ;
185
+ setRenamingItem ( item . index ) ;
179
186
} ,
180
187
isActiveTree && ( environment . canRename ?? true ) && ! isRenaming
181
188
) ;
You can’t perform that action at this time.
0 commit comments