File tree Expand file tree Collapse file tree 2 files changed +16
-6
lines changed
Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change 11### Breaking Changes
22- Changed the behavior for dropping an item at the bottom of an open folder has changed, and will now drop
33 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 = () => {
170170 useHotkey (
171171 'renameItem' ,
172172 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 ;
178182 }
183+
184+ environment . onStartRenamingItem ?.( item , treeId ) ;
185+ setRenamingItem ( item . index ) ;
179186 } ,
180187 isActiveTree && ( environment . canRename ?? true ) && ! isRenaming
181188 ) ;
You can’t perform that action at this time.
0 commit comments