API リファレンス
このページでは、メインエントリ @powerduck/md-editor とサブパス ./react のすべてのエクスポートを説明します。シグネチャはソースコードに基づいています。
MarkdownEditor
エディターの最上位クラスです。コンテナーとオプションを渡して作成します。
class MarkdownEditor {
constructor(container: HTMLElement | string, options?: MarkdownEditorOptions);
getValue(): string;
setValue(value: string): void;
getHtml(): string;
renderNow(): void;
setAutoPreview(auto: boolean): void;
setMode(mode: EditorMode): void;
setTheme(theme: EditorTheme): void;
focus(): void;
destroy(): void;
}
constructor(container, options?)
container: HTMLElement | string— DOM 要素または CSS セレクター。一致する要素がなければMarkdownEditor: mount container not foundをスローします。options?: MarkdownEditorOptions— 設定を参照してください。
レイアウトを構築し、CodeEditor を作成してキーボードショートカットを登録します。complex モードではツールバーとステータスバーも作成します。作成時に初回レンダリングとステータスバーの更新を実行します。
getValue(): string
現在の Markdown ソースを返します。
setValue(value: string): void
文書全体を置き換え、保留中のデバウンス処理を取り消し、プレビューを同期的に再描画してステータスバーを更新します。