diff --git a/src/json/shortcut.ts b/src/json/shortcut.ts index 70aece5385..cbd52a9478 100644 --- a/src/json/shortcut.ts +++ b/src/json/shortcut.ts @@ -35,6 +35,7 @@ const getSections = () => { { id: 'redo', name: translate('popupShortcutMainBasics7'), keys: [ cmdKey, 'shift', 'z' ] }, { id: 'createWidget', name: translate('menuObjectCreateWidget'), keys: [] }, { id: 'copyPageLink', name: translate('commonCopyLink'), keys: [] }, + { id: 'moveToBin', name: translate('popupShortcutMainBasics25'), keys: [] }, ] }, diff --git a/src/json/text.json b/src/json/text.json index e410dbbbbb..49cc8d136e 100644 --- a/src/json/text.json +++ b/src/json/text.json @@ -1303,6 +1303,7 @@ "popupShortcutMainBasics22": "Lock Anytype", "popupShortcutMainBasics23": "Previous Space", "popupShortcutMainBasics24": "Lock / Unlock Object", + "popupShortcutMainBasics25": "Move to Bin / Restore from Bin", "popupShortcutMainTextStyle": "Text style", "popupShortcutMainTextStyle1": "Bold", diff --git a/src/ts/lib/keyboard.ts b/src/ts/lib/keyboard.ts index 4df823d1a2..c668524fc7 100644 --- a/src/ts/lib/keyboard.ts +++ b/src/ts/lib/keyboard.ts @@ -147,12 +147,12 @@ class Keyboard { onKeyDown (e: any) { const { theme, pin } = S.Common; const isPopup = this.isPopup(); - const key = e.key.toLowerCase(); const cmd = this.cmdKey(); const isMain = this.isMain(); const canWrite = U.Space.canMyParticipantWrite(); const selection = S.Common.getRef('selectionProvider'); const rootId = this.getRootId(); + const object = S.Detail.get(rootId, rootId); this.shortcut('toggleSidebar', e, () => { e.preventDefault(); @@ -298,6 +298,22 @@ class Keyboard { }); }); + // Copy page link + this.shortcut('copyPageLink', e, () => { + e.preventDefault(); + + const space = U.Space.getSpaceview(); + + U.Object.copyLink(object, space, 'web', analytics.route.shortcut); + }); + + // Move to bin + this.shortcut('moveToBin', e, () => { + e.preventDefault(); + + Action[object.isArchived ? 'restore' : 'archive']([ rootId ], analytics.route.shortcut); + }); + if (canWrite) { // Create new page if (!S.Popup.isOpen('search') && !this.isMainSet()) { @@ -316,16 +332,6 @@ class Keyboard { Action.createWidgetFromObject(rootId, rootId, first?.id, I.BlockPosition.Top, analytics.route.shortcut); }); - // Copy page link - this.shortcut('copyPageLink', e, () => { - e.preventDefault(); - - const object = S.Detail.get(rootId, rootId); - const space = U.Space.getSpaceview(); - - U.Object.copyLink(object, space, 'web', analytics.route.shortcut); - }); - // Lock/Unlock this.shortcut('pageLock', e, () => this.onToggleLock()); };