mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-11-20 03:49:45 +00:00
Added an editor tool to export and preview documents, with all configurable options. Not supported: output path customization (requires changes in server) <img width="1381" height="1458" alt="image" src="https://github.com/user-attachments/assets/d27e6e19-bcf4-4d1a-a20e-9bea0258be24" /> <img width="1392" height="877" alt="image" src="https://github.com/user-attachments/assets/53d93601-3e05-4e36-b4fd-26384fda1347" /> --------- Co-authored-by: Myriad-Dreamin <camiyoru@gmail.com>
50 lines
1.4 KiB
TypeScript
50 lines
1.4 KiB
TypeScript
import van, { type ChildDom, type State } from "vanjs-core";
|
|
import { lastFocusedTypstDoc } from "@/vscode";
|
|
|
|
const { div, h3, input } = van.tags;
|
|
|
|
interface InputSectionProps {
|
|
inputPath: State<string>;
|
|
outputPath: State<string>;
|
|
actionButton?: ChildDom;
|
|
}
|
|
|
|
export const InputSection = ({ inputPath, actionButton }: InputSectionProps) => {
|
|
return div(
|
|
{ class: "flex flex-col gap-sm" },
|
|
h3(
|
|
{ class: "mb-xs", title: "Configure and export your Typst documents to various formats" },
|
|
"Export Document",
|
|
),
|
|
// Input Path Section
|
|
div(
|
|
{ class: "flex flex-row items-center gap-sm" },
|
|
input({
|
|
class: "input flex-1",
|
|
type: "text",
|
|
placeholder: () => lastFocusedTypstDoc.val || "Document Path",
|
|
value: inputPath,
|
|
oninput: (e: Event) => {
|
|
const target = e.target as HTMLInputElement;
|
|
inputPath.val = target.value;
|
|
},
|
|
}),
|
|
actionButton,
|
|
),
|
|
// Output Path Section (not supported yet)
|
|
/* div(
|
|
{ class: "flex flex-col gap-xs" },
|
|
h3({ class: "mb-xs" }, "Output Path"),
|
|
input({
|
|
class: "input",
|
|
type: "text",
|
|
placeholder: "Automatically decided based on input path",
|
|
value: outputPath,
|
|
oninput: (e: Event) => {
|
|
const target = e.target as HTMLInputElement;
|
|
outputPath.val = target.value;
|
|
},
|
|
}),
|
|
), */
|
|
);
|
|
};
|