mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2026-10-19 09:22:12 +00:00
open links in browser
This commit is contained in:
1 parent
8d6885d58b
commit
358253b7a9
9 files changed
+90
No files matched your search
@@ -221,6 +221,7 @@ export async function createTauriBackend(): Promise<Backend> {
|
||||
exportFiles: (fileIds, options) =>
|
||||
invoke<boolean>('export_files', { fileIds, options }),
|
||||
listFolder: (path) => invoke<FolderEntry[]>('list_folder', { path }),
|
||||
openUrl: (url) => invoke('open_url', { url }),
|
||||
listen: async (onEngineChanged, onWorkspaceChanged, onFilesOpened, onFolderChanged) => {
|
||||
await listen<Outcome>('files-opened', (event) => onFilesOpened(event.payload));
|
||||
await listen<Outcome>('engine-changed', (event) => onEngineChanged(event.payload));
|
||||
|
||||
@@ -89,6 +89,8 @@ export interface DesktopFiles {
|
||||
exportFiles(fileIds: string[], options: ExportOptions): Promise<boolean>;
|
||||
/** The folders and GPX files in a folder of the open folder (the open folder by default). */
|
||||
listFolder(path?: string): Promise<FolderEntry[]>;
|
||||
/** Opens a web page (or an email to write) in the app of the system for it. */
|
||||
openUrl(url: string): Promise<void>;
|
||||
/**
|
||||
* Tells when the engine changed without being asked, because the files on the disk did (the
|
||||
* outcome to apply), when the status of the files changed, when files were opened with the
|
||||
|
||||
@@ -617,6 +617,16 @@ class Engine {
|
||||
await this.enqueue(async () => this.refreshWorkspace(this.backend!));
|
||||
}
|
||||
|
||||
/** Opens a web page in the browser of the system (the desktop app). */
|
||||
async openUrl(url: string) {
|
||||
await this.ready;
|
||||
try {
|
||||
await this.backend!.desktop?.openUrl(url);
|
||||
} catch (error) {
|
||||
console.error('The page could not be opened', error);
|
||||
}
|
||||
}
|
||||
|
||||
/** The folders and GPX files in a folder of the open folder (the open folder by default). */
|
||||
async listFolder(path?: string): Promise<FolderEntry[]> {
|
||||
await this.ready;
|
||||
|
||||
Reference in new issue
Block a user