mirror of
https://github.com/laurent22/joplin.git
synced 2025-03-26 21:12:59 +02:00
Use enum
This commit is contained in:
parent
2386abea3e
commit
20d1f74ee4
@ -36,7 +36,7 @@ import ShareService from '@joplin/lib/services/share/ShareService';
|
||||
import { reg } from '@joplin/lib/registry';
|
||||
import removeKeylessItems from '../ResizableLayout/utils/removeKeylessItems';
|
||||
import { localSyncInfoFromState } from '@joplin/lib/services/synchronizer/syncInfoUtils';
|
||||
import { parseCallbackUrl } from '@joplin/lib/ProtocolUtils';
|
||||
import { Command, parseCallbackUrl } from '@joplin/lib/ProtocolUtils';
|
||||
import ElectronAppWrapper from '../../ElectronAppWrapper';
|
||||
|
||||
const { connect } = require('react-redux');
|
||||
@ -203,7 +203,7 @@ class MainScreenComponent extends React.Component<Props, State> {
|
||||
private openUrl(url: string) {
|
||||
console.log(`openUrl ${url}`);
|
||||
const { command, params } = parseCallbackUrl(url);
|
||||
void CommandService.instance().execute(command, params.id);
|
||||
void CommandService.instance().execute(Command[command], params.id);
|
||||
}
|
||||
|
||||
private updateLayoutPluginViews(layout: LayoutItem, plugins: PluginStates) {
|
||||
|
@ -14,7 +14,11 @@ export function getTagUrl(tagId: string) {
|
||||
return `joplin://x-callback-url/openTag?id=${encodeURIComponent(tagId)}`;
|
||||
}
|
||||
|
||||
export type Command = 'openNote' | 'openFolder' | 'openTag';
|
||||
export enum Command {
|
||||
openNote = 'openNote',
|
||||
openFolder = 'openFolder',
|
||||
openTag = 'openTag',
|
||||
}
|
||||
|
||||
export interface CallbackUrlInfo {
|
||||
command: Command;
|
||||
|
Loading…
x
Reference in New Issue
Block a user