Fix Bug 69126 - Files.Hotkeys. Added rename

This commit is contained in:
Nikita Gopienko 2024-07-12 13:31:24 +03:00
parent 888fe3700a
commit d9d237d5c9
3 changed files with 21 additions and 0 deletions

View File

@ -14,6 +14,7 @@
"HotkeysCreateSpreadsheet": "Create spreadsheet",
"HotkeysCreatingObjects": "Creating items",
"HotkeysCutSelected": "Cut selected items to the clipboard",
"HotkeysRenameSelected": "Rename selected item",
"HotkeysExtendSelectionDown": "Extend selection down",
"HotkeysExtendSelectionLeft": "Extend selection left",
"HotkeysExtendSelectionRight": "Extend selection right",

View File

@ -144,6 +144,18 @@ const withHotkeys = (Component) => {
window.dispatchEvent(event);
};
const onRename = () => {
if (selection.length === 1) {
const item = selection[0];
if (!item.contextOptions.includes("rename")) return;
const event = new Event(Events.RENAME);
event.item = item;
window.dispatchEvent(event);
}
};
const onCreateRoom = () => {
if (!isVisitor && isRoomsFolder && security?.Create) {
if (isGracePeriod) {
@ -385,6 +397,8 @@ const withHotkeys = (Component) => {
hotkeysFilter,
);
useHotkeys("f2", onRename, hotkeysFilter);
//Upload file
useHotkeys(
"Shift+u",

View File

@ -73,6 +73,12 @@ const ActionsBlock = ({ t, textStyles, keyTextStyles, CtrlKey }) => {
<Text {...keyTextStyles}> {CtrlKey} + x</Text>
</>
</Row>
<Row className="hotkeys_row">
<>
<Text {...textStyles}>{t("HotkeysRenameSelected")}</Text>
<Text {...keyTextStyles}> F2</Text>
</>
</Row>
</>
);
};