mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-08-07 17:32:58 +02:00
#778 - Open file or webpage
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
|
||||
- [#773](https://github.com/estruyf/vscode-front-matter/issues/773): Added the ability to rename content files
|
||||
- [#777](https://github.com/estruyf/vscode-front-matter/issues/777): Show an error in the metadata panel if something went wrong while parsing the front matter
|
||||
- [#778](https://github.com/estruyf/vscode-front-matter/issues/778): Added the ability to open a file or webpage when custom scripts is completed
|
||||
|
||||
### ⚡️ Optimizations
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Settings } from './SettingsHelper';
|
||||
import { CommandType, EnvironmentType } from './../models/PanelSettings';
|
||||
import { CustomScript as ICustomScript, ScriptType } from '../models/PanelSettings';
|
||||
import { window, env as vscodeEnv, ProgressLocation } from 'vscode';
|
||||
import { window, env as vscodeEnv, ProgressLocation, Uri, commands } from 'vscode';
|
||||
import { ArticleHelper, Logger, Telemetry } from '.';
|
||||
import { Folders, WORKSPACE_PLACEHOLDER } from '../commands/Folders';
|
||||
import { exec, execSync } from 'child_process';
|
||||
@@ -301,6 +301,11 @@ export class CustomScript {
|
||||
l10n.t(LocalizationKey.helpersCustomScriptShowOutputFrontMatterSuccess, script.title)
|
||||
);
|
||||
}
|
||||
} else if (data.fmAction) {
|
||||
if (data.fmAction === 'open' && data.fmPath) {
|
||||
const uri = data.fmPath.startsWith(`http`) ? data.fmPath : Uri.file(data.fmPath);
|
||||
commands.executeCommand('vscode.open', uri);
|
||||
}
|
||||
} else {
|
||||
Logger.error(`No frontmatter found.`);
|
||||
throw new Error(`No frontmatter found.`);
|
||||
|
||||
Reference in New Issue
Block a user