rewrite in vanilla js

This commit is contained in:
Adrian Osterwind 2024-11-13 14:59:13 +01:00
parent 5f35da27f2
commit 590aec5260
26 changed files with 223 additions and 3227 deletions

26
src/main.js Normal file
View file

@ -0,0 +1,26 @@
const { invoke } = window.__TAURI__.core;
let greetInputEl;
let greetMsgEl;
async function greet() {
// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/
greetMsgEl.textContent = await invoke("greet", { name: "harald" });
}
let text = "";
window.addEventListener("DOMContentLoaded", () => {
let textarea = document.getElementById('markdown_input');
textarea.addEventListener('input', ()=> {
text = textarea.value;
invoke("parse_markdown", { document: text }).then(
(ret)=>{
var tag_id = document.getElementById('rendered_markdown');
tag_id.innerHTML = ret;
}
);
});
});
var x = document.createElement("INPUT");
x.setAttribute("type", "text");