1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-30 10:36:35 +02:00

Fix enum usage

This commit is contained in:
Roman 2021-08-20 21:43:37 +01:00
parent 62c5f433d7
commit f42fd0ecce
3 changed files with 5 additions and 4 deletions

View File

@ -1,6 +1,7 @@
import Logger from '@joplin/lib/Logger';
import { PluginMessage } from './services/plugins/PluginRunner';
import shim from '@joplin/lib/shim';
import { isCallbackUrl } from '@joplin/lib/ProtocolUtils';
const { BrowserWindow, Tray, screen } = require('electron');
const url = require('url');
@ -333,7 +334,7 @@ export default class ElectronAppWrapper {
win.show();
win.focus();
if (process.platform !== 'darwin') {
const url = argv.find((arg) => arg.startsWith('joplin://'));
const url = argv.find((arg) => isCallbackUrl(arg));
if (url) {
void this.openUrl(url);
}

View File

@ -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 { Command, parseCallbackUrl } from '@joplin/lib/ProtocolUtils';
import { parseCallbackUrl } from '@joplin/lib/ProtocolUtils';
import ElectronAppWrapper from '../../ElectronAppWrapper';
import { showMissingMasterKeyMessage } from '@joplin/lib/services/e2ee/utils';
@ -205,7 +205,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[command], params.id);
void CommandService.instance().execute(command.toString(), params.id);
}
private updateLayoutPluginViews(layout: LayoutItem, plugins: PluginStates) {

View File

@ -16,7 +16,7 @@ export function getTagUrl(tagId: string) {
return `joplin://x-callback-url/openTag?id=${encodeURIComponent(tagId)}`;
}
export enum Command {
export const enum Command {
OpenNote = 'openNote',
OpenFolder = 'openFolder',
OpenTag = 'openTag',