mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-06-13 18:04:55 +02:00
28 lines
694 B
TypeScript
28 lines
694 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}>
|
|
{title}
|
|
</ActionButton>
|
|
);
|
|
};
|
|
|
|
CustomScript.displayName = 'CustomScript';
|
|
export { CustomScript };
|