implemented image support

This commit is contained in:
Iaphetes 2024-12-22 20:35:01 +01:00
parent 2eb111ebeb
commit c2cc84f9dc
5 changed files with 39 additions and 23 deletions

View file

@ -14,17 +14,21 @@ let text = "";
// tag_id.innerHTML = "<p>HI</p>"
// window.addEventListener("DOMContentLoaded", () => {
let textarea = document.getElementById('markdown_input');
let placeholder_path = "FILEPATH";
let path_template = convertFileSrc(placeholder_path);
textarea.addEventListener('input', ()=> {
text = textarea.innerText;
var tag_id = document.getElementById('rendered_markdown');
tag_id.innerHTML = "<p>HI</p>"
invoke("parse_markdown", { document: text }).then(
(ret)=>{
var tag_id = document.getElementById('rendered_markdown');
tag_id.innerHTML = "<pre>".concat("", ret).concat("", "</pre>");
invoke("parse_markdown", { document: text, pathtemplate: path_template}).then(
(ret)=>{
var tag_id = document.getElementById('rendered_markdown');
tag_id.innerHTML = "<pre>".concat("", ret).concat("", "</pre>");
// tag_id.innerHTML = assetUrl.concat(" ", ' \n <img src="'.concat("", assetUrl).concat("", '" alt="Girl in a jacket" width="500" height="600">'))
}
);
}
);
// });
});

View file

@ -62,6 +62,9 @@
text-align: left;
color: #f6f6f6;
background-color: var(--main-bg-color);
img {
width: 100%;
}
}
.main_editor{
width: 100%;
@ -83,18 +86,13 @@ h1 {
color: red;
}
ol li {
li {
line-height: 0.1em;
margin 0px 0;
margin-left: 1em;
padding 0;
}
ul li {
margin-top: 0;
margin-bottom: 0;
padding: 0;
margin: 0;
padding: 0;
margin-left: 1em;
}
.sidebar_button {
width: 100%;
background-color: var(--main-bg-color);
@ -137,3 +135,4 @@ ul li {
transition: all 0.1s ease-out;
}