mirror of
https://github.com/thomiceli/opengist.git
synced 2024-12-22 20:42:40 +00: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
1 changed files with 10 additions and 1 deletions
|
@ -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 a new issue