Skip to content

Commit

Permalink
modified: Change to using LiteLoader openExternal method.
Browse files Browse the repository at this point in the history
Using open external link function provided by LiteLoader plugin framework instead of the self-written one.
  • Loading branch information
nfnfgo committed Jul 6, 2024
1 parent 5e2b420 commit aac4045
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/renderer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ function render() {
const href = event
.composedPath()[0]
.href.replace("app://./renderer/", "");
await markdown_it.open_link(href);
await LiteLoader.api.openExternal(href);
return false;
};
})
Expand Down
2 changes: 1 addition & 1 deletion src/states/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { create } from 'zustand';
import { immer } from 'zustand/middleware/immer';

import { persist, createJSONStorage, subscribeWithSelector } from 'zustand/middleware';
import { LiteLoaderStorage } from '@/utils/liteloaderConfig';
import { LiteLoaderStorage } from '@/utils/liteloader_config';

export interface SettingStateProperties {
// Boolean properties
Expand Down
15 changes: 1 addition & 14 deletions src/utils/liteloaderConfig.ts → src/utils/liteloader_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,7 @@ import {
StateStorage
} from 'zustand/middleware';


/**
* The interface for QQNT Liteloader dev api.
*
* Notice the `new_config` and `default_config` should all be a Object. Passing string will cause unexpected behaviour.
*/
interface LiteLoaderInterFace<T> {
api: {
config: {
set(slug: string, new_config: T): Promise<T>;
get(slug: string, default_config: T): Promise<T>;
}
}
};
import { LiteLoaderInterFace } from '@/utils/liteloader_type';

declare const LiteLoader: LiteLoaderInterFace<Object>;

Expand Down
15 changes: 15 additions & 0 deletions src/utils/liteloader_type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* The interface for QQNT Liteloader dev api.
*
* Notice the `new_config` and `default_config` should all be a Object. Passing string will cause unexpected behaviour.
*/
export interface LiteLoaderInterFace<T> {
api: {
openPath(path: string): any;
openExternal(uri: string): any;
config: {
set(slug: string, new_config: T): Promise<T>;
get(slug: string, default_config: T): Promise<T>;
}
},
};

0 comments on commit aac4045

Please sign in to comment.