From 0592bfba961c9f899e2f5960b47a9ec51f5124fe Mon Sep 17 00:00:00 2001 From: Andrew Simachev Date: Thu, 5 Jun 2025 12:49:33 +0200 Subject: [PATCH 1/3] feat(shortcut): add Cmd+Shift+C shortcut to copy current page link --- src/ts/lib/keyboard.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/ts/lib/keyboard.ts b/src/ts/lib/keyboard.ts index 66669f3d81..8852bec50f 100644 --- a/src/ts/lib/keyboard.ts +++ b/src/ts/lib/keyboard.ts @@ -315,6 +315,15 @@ class Keyboard { Action.createWidgetFromObject(rootId, rootId, first?.id, I.BlockPosition.Top, analytics.route.shortcut); }); + // Copy page link + this.shortcut(`${cmd}+shift+c`, e, () => { + e.preventDefault(); + const rootId = this.getRootId(); + 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()); }; From 1a99c94caef85e35dbc48a6bd3b0619006fbbe01 Mon Sep 17 00:00:00 2001 From: Andrew Simachev Date: Thu, 5 Jun 2025 12:52:05 +0200 Subject: [PATCH 2/3] feat(shortcut): add copyPageLink shortcut to shortcut.ts and use id in keyboard handler --- src/json/shortcut.ts | 1 + src/ts/lib/keyboard.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/json/shortcut.ts b/src/json/shortcut.ts index a9f9fe0946..80797d08c5 100644 --- a/src/json/shortcut.ts +++ b/src/json/shortcut.ts @@ -34,6 +34,7 @@ const getSections = () => { { id: 'undo', name: translate('popupShortcutMainBasics6'), keys: [ cmdKey, 'z' ] }, { id: 'redo', name: translate('popupShortcutMainBasics7'), keys: [ cmdKey, 'shift', 'z' ] }, { id: 'createWidget', name: translate('popupShortcutMainBasics25'), keys: [ cmdKey, 'shift', 'w' ] }, + { id: 'copyPageLink', name: translate('popupShortcutCopyPageLink'), keys: [ cmdKey, 'shift', 'c' ] }, ] }, diff --git a/src/ts/lib/keyboard.ts b/src/ts/lib/keyboard.ts index 8852bec50f..e97f793488 100644 --- a/src/ts/lib/keyboard.ts +++ b/src/ts/lib/keyboard.ts @@ -316,7 +316,7 @@ class Keyboard { }); // Copy page link - this.shortcut(`${cmd}+shift+c`, e, () => { + this.shortcut('copyPageLink', e, () => { e.preventDefault(); const rootId = this.getRootId(); const object = S.Detail.get(rootId, rootId); From 600a3b19b4eafb5bd7b22d2edd39772b43ccbbc7 Mon Sep 17 00:00:00 2001 From: Andrew Simachev Date: Thu, 5 Jun 2025 12:54:57 +0200 Subject: [PATCH 3/3] JS-6300: Copy link --- src/json/shortcut.ts | 4 ++-- src/json/text.json | 1 - src/ts/lib/keyboard.ts | 6 ++++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/json/shortcut.ts b/src/json/shortcut.ts index 80797d08c5..70aece5385 100644 --- a/src/json/shortcut.ts +++ b/src/json/shortcut.ts @@ -33,8 +33,8 @@ const getSections = () => { { id: 'lock', name: translate('popupShortcutMainBasics22'), keys: [ cmdKey, 'alt', 'l' ] }, { id: 'undo', name: translate('popupShortcutMainBasics6'), keys: [ cmdKey, 'z' ] }, { id: 'redo', name: translate('popupShortcutMainBasics7'), keys: [ cmdKey, 'shift', 'z' ] }, - { id: 'createWidget', name: translate('popupShortcutMainBasics25'), keys: [ cmdKey, 'shift', 'w' ] }, - { id: 'copyPageLink', name: translate('popupShortcutCopyPageLink'), keys: [ cmdKey, 'shift', 'c' ] }, + { id: 'createWidget', name: translate('menuObjectCreateWidget'), keys: [] }, + { id: 'copyPageLink', name: translate('commonCopyLink'), keys: [] }, ] }, diff --git a/src/json/text.json b/src/json/text.json index 707e2251f2..e410dbbbbb 100644 --- a/src/json/text.json +++ b/src/json/text.json @@ -1303,7 +1303,6 @@ "popupShortcutMainBasics22": "Lock Anytype", "popupShortcutMainBasics23": "Previous Space", "popupShortcutMainBasics24": "Lock / Unlock Object", - "popupShortcutMainBasics25": "Create widget", "popupShortcutMainTextStyle": "Text style", "popupShortcutMainTextStyle1": "Bold", diff --git a/src/ts/lib/keyboard.ts b/src/ts/lib/keyboard.ts index e97f793488..4df823d1a2 100644 --- a/src/ts/lib/keyboard.ts +++ b/src/ts/lib/keyboard.ts @@ -152,9 +152,11 @@ class Keyboard { const isMain = this.isMain(); const canWrite = U.Space.canMyParticipantWrite(); const selection = S.Common.getRef('selectionProvider'); + const rootId = this.getRootId(); this.shortcut('toggleSidebar', e, () => { e.preventDefault(); + sidebar.toggleOpenClose(); }); @@ -309,7 +311,6 @@ class Keyboard { this.shortcut('createWidget', e, () => { e.preventDefault(); - const rootId = this.getRootId(); const first = S.Block.getFirstBlock(S.Block.widgets, 1, it => it.isWidget()); Action.createWidgetFromObject(rootId, rootId, first?.id, I.BlockPosition.Top, analytics.route.shortcut); @@ -318,9 +319,10 @@ class Keyboard { // Copy page link this.shortcut('copyPageLink', e, () => { e.preventDefault(); - const rootId = this.getRootId(); + const object = S.Detail.get(rootId, rootId); const space = U.Space.getSpaceview(); + U.Object.copyLink(object, space, 'web', analytics.route.shortcut); });