mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 09:35:49 +02:00
21 lines
No EOL
505 B
JavaScript
21 lines
No EOL
505 B
JavaScript
import {Controller} from "@hotwired/stimulus";
|
|
import katex from "katex";
|
|
import "katex/dist/katex.css";
|
|
|
|
/* stimulusFetch: 'lazy' */
|
|
export default class extends Controller {
|
|
static targets = ["input", "preview"];
|
|
|
|
updatePreview()
|
|
{
|
|
katex.render(this.inputTarget.value, this.previewTarget, {
|
|
throwOnError: false,
|
|
});
|
|
}
|
|
|
|
connect()
|
|
{
|
|
this.updatePreview();
|
|
this.inputTarget.addEventListener('input', this.updatePreview.bind(this));
|
|
}
|
|
} |