import { NAME, pattern, UI, type VNode, Writable } from "commonfabric"; import { Controls, SelectControl, SwitchControl, TextControl, } from "../ui/controls/index.ts"; // deno-lint-ignore no-empty-interface interface CodeEditorStoryInput {} export interface CodeEditorStoryOutput { [NAME]: string; [UI]: VNode; controls: VNode; } export default pattern(() => { const value = new Writable("## Hello, world!"); const language = new Writable< | "text/javascript" | "text/markdown" | "application/json" | "text/css" | "text/html" | "text/x.jsx" | "text/x.typescript" >("text/markdown"); const disabled = new Writable(false); const readonly = new Writable(false); const placeholder = new Writable("Start writing..."); const timingStrategy = new Writable< "immediate" | "debounce" | "throttle" | "blur" >("debounce"); const timingDelay = new Writable(500); const wordWrap = new Writable(true); const lineNumbers = new Writable(false); const maxLineWidth = new Writable(undefined); const tabSize = new Writable(2); const tabIndent = new Writable(true); const theme = new Writable<"light" | "dark">("light"); const mode = new Writable<"code" | "prose">("prose"); const autofocus = new Writable(false); const cursorPosition = new Writable<"start" | "end">("start"); const pattern = new Writable("catalog"); const mentionableData = [ { [NAME]: "Design System" }, { [NAME]: "Runtime Docs" }, { [NAME]: "Patterns Catalog" }, ]; const mentionedData = [{ [NAME]: "Design System" }]; const mentionable = new Writable( mentionableData, ); const mentioned = new Writable(undefined); return { [NAME]: "cf-code-editor Story", [UI]: (
Switching mode from code to{" "} prose{" "} changes this component from a syntax-focused code editor to a markdown prose editor experience. For inline markdown rendering in prose mode, set language to text/markdown.
), controls: ( <> ), }; });