When adding commands via the Commander Ribbon Tab, or when changing icon, color, name, or mode, the elements are getting reordered on the ribbon. This requires the user to re-reorder the ribbon elements every time a new command is added or an already existing one is changed.
This fix allows adding, renaming, and removing commands via the Commander Ribbon tab, or changing icon, color, name, or mode, without them being reordered on the ribbon.
Changes:
Implemented a new update() method in leftRibbonManager.ts that only adds commands without removing them
Modified the handleRename method in commandViewerComponent.tsx to handle rename with only the renamed command being reordered:
a. First, the command is being removed using the manager.removeCommand() method
b. Then the name of the command is being changed
c. Finally, the command is being added again using the manager.addCommand() method
Replaced manager.reorder() calls with new method manager.update() for the following functions in src/ui/components/commandViewerComponent.tsx to handle icon/mode/color change without reordering:
handleNewIcon
handleModeChange
handleColorChange
Modified addCommand() and removeCommand() method to use the id (instead of the name) for finding the native action.
Used nativeAction.hidden property to handle mode changes without reordering
Removed the reorder() call in "Add command" button click handler to handle adding commands without reordering.
Description:
When adding commands via the Commander Ribbon Tab, or when changing icon, color, name, or mode, the elements are getting reordered on the ribbon. This requires the user to re-reorder the ribbon elements every time a new command is added or an already existing one is changed.
This fix allows adding, renaming, and removing commands via the Commander Ribbon tab, or changing icon, color, name, or mode, without them being reordered on the ribbon.
Changes:
Implemented a new update() method in leftRibbonManager.ts that only adds commands without removing them
Modified the handleRename method in commandViewerComponent.tsx to handle rename with only the renamed command being reordered: a. First, the command is being removed using the manager.removeCommand() method b. Then the name of the command is being changed c. Finally, the command is being added again using the manager.addCommand() method
Replaced manager.reorder() calls with new method manager.update() for the following functions in src/ui/components/commandViewerComponent.tsx to handle icon/mode/color change without reordering:
Modified addCommand() and removeCommand() method to use the id (instead of the name) for finding the native action.
Used nativeAction.hidden property to handle mode changes without reordering
Removed the reorder() call in "Add command" button click handler to handle adding commands without reordering.
Additional References: