mirror of
https://github.com/thomiceli/opengist
synced 2024-11-08 12:55:50 +01:00
fix missing preview button when editing .md gist (#259)
Co-authored-by: Dennis Sumser <dennis.sumser@schmolck.de>
This commit is contained in:
parent
a3a3d367ea
commit
6a8759e21e
@ -36,8 +36,17 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||
|
||||
let mdpreview = dom.querySelector(".md-preview") as HTMLElement;
|
||||
|
||||
let formfilename = dom.querySelector<HTMLInputElement>(".form-filename");
|
||||
|
||||
// check if file ends with .md on pageload
|
||||
if (formfilename!.value.endsWith(".md")) {
|
||||
mdpreview!.classList.remove("hidden");
|
||||
} else {
|
||||
mdpreview!.classList.add("hidden");
|
||||
}
|
||||
|
||||
// event if the filename ends with .md; trigger event
|
||||
dom.querySelector<HTMLInputElement>(".form-filename")!.onkeyup = (e) => {
|
||||
formfilename!.onkeyup = (e) => {
|
||||
let filename = (e.target as HTMLInputElement).value;
|
||||
if (filename.endsWith(".md")) {
|
||||
mdpreview!.classList.remove("hidden");
|
||||
|
Loading…
Reference in New Issue
Block a user