const { convertFileSrc, invoke } = window.__TAURI__.core; // const { invoke } = window.__TAURI__.core; const { homeDir, join } = window.__TAURI__.path; const { readFile } = window.__TAURI__.fs; const appDataDirPath = await homeDir(); const filePath = await join(appDataDirPath, 'Pictures/wallpaper.png'); const assetUrl = convertFileSrc(filePath); let text = ""; // window.addEventListener("DOMCharacterDataModified", () => { // var tag_id = document.getElementById('rendered_markdown'); // tag_id.innerHTML = "

HI

" // window.addEventListener("DOMContentLoaded", () => { let textarea = document.getElementById('markdown_input'); textarea.addEventListener('input', ()=> { text = textarea.innerText; var tag_id = document.getElementById('rendered_markdown'); tag_id.innerHTML = "

HI

" invoke("parse_markdown", { document: text }).then( (ret)=>{ var tag_id = document.getElementById('rendered_markdown'); tag_id.innerHTML = "
".concat("", ret).concat("", "
"); // tag_id.innerHTML = assetUrl.concat(" ", ' \n Girl in a jacket')) } ); // }); }); document.getElementById("hide-sidebar").onclick = function() {toggle_visibility("sidebar");}; function toggle_visibility(id) { if (document.getElementById(id).style.visibility == "hidden"){ document.getElementById(id).style.visibility = "visible"; var style = window.getComputedStyle(document.body); document.getElementById(id).style.width = style.getPropertyValue("--sidebar-width"); }else{ document.getElementById(id).style.visibility = "hidden"; document.getElementById(id).style.width = 0; } } function handleShortcut(event) { var markdown_editor = document.getElementById('markdown_input'); if (document.activeElement === markdown_editor){ if (event.ctrlKey) { if (event.key === "l"){ event.preventDefault(); } } } } document.addEventListener("keydown", handleShortcut);