mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
feat(core): add open link in app to doc menu (#8597)
add "open in desktop app" menu item for editor fix AF-1547
This commit is contained in:
@@ -6,6 +6,7 @@ import { buildType, isDev } from './config';
|
||||
import { logger } from './logger';
|
||||
import { uiSubjects } from './ui';
|
||||
import {
|
||||
addTab,
|
||||
getMainWindow,
|
||||
openUrlInHiddenWindow,
|
||||
openUrlInMainWindow,
|
||||
@@ -81,6 +82,24 @@ async function handleAffineUrl(url: string) {
|
||||
method,
|
||||
payload,
|
||||
});
|
||||
} else if (
|
||||
urlObj.searchParams.get('new-tab') &&
|
||||
urlObj.pathname.startsWith('/workspace')
|
||||
) {
|
||||
// @todo(@forehalo): refactor router utilities
|
||||
// basename of /workspace/xxx/yyy is /workspace/xxx
|
||||
const basename = urlObj.pathname.split('/').slice(0, 3).join('/');
|
||||
const pathname = '/' + urlObj.pathname.split('/').slice(3).join('/');
|
||||
|
||||
await addTab({
|
||||
basename,
|
||||
show: true,
|
||||
view: {
|
||||
path: {
|
||||
pathname: pathname,
|
||||
},
|
||||
},
|
||||
});
|
||||
} else {
|
||||
const hiddenWindow = urlObj.searchParams.get('hidden')
|
||||
? await openUrlInHiddenWindow(urlObj)
|
||||
|
||||
@@ -41,9 +41,9 @@ const ReleaseTypeSchema = z.enum(['stable', 'beta', 'canary', 'internal']);
|
||||
const envBuildType = (process.env.BUILD_TYPE || 'canary').trim().toLowerCase();
|
||||
const buildType = ReleaseTypeSchema.parse(envBuildType);
|
||||
const isDev = process.env.NODE_ENV === 'development';
|
||||
let schema =
|
||||
let scheme =
|
||||
buildType === 'stable' ? 'affine' : (`affine-${envBuildType}` as Schema);
|
||||
schema = isDev ? 'affine-dev' : schema;
|
||||
scheme = isDev ? 'affine-dev' : scheme;
|
||||
|
||||
export const appInfo = {
|
||||
electron: true,
|
||||
@@ -53,7 +53,7 @@ export const appInfo = {
|
||||
viewId:
|
||||
process.argv.find(arg => arg.startsWith('--view-id='))?.split('=')[1] ??
|
||||
'unknown',
|
||||
schema,
|
||||
scheme,
|
||||
};
|
||||
|
||||
function getMainAPIs() {
|
||||
|
||||
Reference in New Issue
Block a user