mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-05-07 22:04:36 +02:00
24 lines
652 B
TypeScript
24 lines
652 B
TypeScript
import * as React from 'react';
|
|
import { CommandToCode } from '../CommandToCode';
|
|
import { ActionButton } from './ActionButton';
|
|
import { Messenger } from '@estruyf/vscode/dist/client';
|
|
|
|
export interface ICustomScriptProps {
|
|
title: string;
|
|
script: string;
|
|
}
|
|
|
|
const CustomScript: React.FunctionComponent<ICustomScriptProps> = ({
|
|
title,
|
|
script
|
|
}: React.PropsWithChildren<ICustomScriptProps>) => {
|
|
const runCustomScript = () => {
|
|
Messenger.send(CommandToCode.runCustomScript, { title, script });
|
|
};
|
|
|
|
return <ActionButton onClick={runCustomScript} title={title} />;
|
|
};
|
|
|
|
CustomScript.displayName = 'CustomScript';
|
|
export { CustomScript };
|