Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🐛 fix(page-editor): use remoteServerUrl for copy link on desktop (#14057)

Innei5e9546c5375d
diff --git a/src/features/PageEditor/store/action.ts b/src/features/PageEditor/store/action.ts
index 88ed49194a9..c1963c4e310 100644
--- a/src/features/PageEditor/store/action.ts
+++ b/src/features/PageEditor/store/action.ts
@@ -1,9 +1,11 @@
-import { EDITOR_DEBOUNCE_TIME, EDITOR_MAX_WAIT } from '@lobechat/const';
+import { EDITOR_DEBOUNCE_TIME, EDITOR_MAX_WAIT, isDesktop } from '@lobechat/const';
import debug from 'debug';
import { debounce } from 'es-toolkit/compat';
import { type StateCreator } from 'zustand';
import { useDocumentStore } from '@/store/document';
+import { getElectronStoreState } from '@/store/electron';
+import { electronSyncSelectors } from '@/store/electron/selectors';
import { useFileStore } from '@/store/file';
import { type RightPanelMode, type State } from './initialState';
@@ -64,7 +66,10 @@ export const store: (initState?: Partial<State>) => StateCreator<Store> =
handleCopyLink: (t, message) => {
const { documentId } = get();
if (documentId) {
- const url = `${window.location.origin}${window.location.pathname}`;
+ const appOrigin = isDesktop
+ ? electronSyncSelectors.remoteServerUrl(getElectronStoreState())
+ : window.location.origin;
+ const url = `${appOrigin}${window.location.pathname}`;
navigator.clipboard.writeText(url);
message.success(t('pageEditor.linkCopied'));
}