previw text teste
This commit is contained in:
@@ -40,10 +40,14 @@
|
||||
<span class="material-symbols-outlined" id="gap">chat_paste_go</span>
|
||||
<span class="material-symbols-outlined">visibility</span>
|
||||
</ul>
|
||||
<li>
|
||||
<li class="txtarea">
|
||||
<textarea id="edit" placeholder="escreva sua historia aqui"></textarea>
|
||||
</li>
|
||||
<li class="txtmark" style="display: none;">
|
||||
<div id="markdown"></div>
|
||||
</li>
|
||||
<a id="btn">enviar</a>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript" src="javascript/libs/markdown.js"></script>
|
||||
<script type="text/javascript" src="javascript/escrever.js"></script>
|
||||
|
||||
@@ -37,7 +37,7 @@ $(function () {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
let txt = true;
|
||||
$("#text-write ul span").on("click", function () {
|
||||
let list = [
|
||||
{ start: "# ", end: "" },
|
||||
@@ -54,10 +54,25 @@ $(function () {
|
||||
{ start: "> ", end: "" },
|
||||
];
|
||||
let md = list[$(this).index()];
|
||||
|
||||
try {
|
||||
md.addImg ? md.addImg() : editText($("#edit")[0], md.start, md.end);
|
||||
} catch {
|
||||
alert("vou usar essa parte para executar a previw");
|
||||
switch (txt) {
|
||||
case true:
|
||||
$(".txtarea").hide();
|
||||
$(".txtmark").show();
|
||||
document.getElementById("markdown").innerHTML = marked.parse(
|
||||
$("#edit")[0].value,
|
||||
);
|
||||
txt = false;
|
||||
break;
|
||||
default:
|
||||
$(".txtarea").show();
|
||||
$(".txtmark").hide();
|
||||
txt = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
74
javascript/libs/markdown.js
Normal file
74
javascript/libs/markdown.js
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user