forked from MarseyWorld/MarseyWorld
dfssf
parent
89834c3deb
commit
810924f314
|
@ -5,7 +5,6 @@
|
|||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous" type="37cef32129ec2b1bc32e9226-text/javascript"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
||||
<script src='/assets/js/bundle.js'></script>
|
||||
|
||||
<script>
|
||||
|
||||
|
@ -111,6 +110,7 @@
|
|||
text.innerText = maxLength - length;
|
||||
|
||||
}
|
||||
|
||||
|
||||
//part of submit page js
|
||||
|
||||
|
@ -232,6 +232,24 @@
|
|||
button.disabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// markdown
|
||||
|
||||
function markdown() {
|
||||
|
||||
var input = document.getElementById('post-text').value;
|
||||
|
||||
let emojis = Array.from(input.matchAll(/:(.{1,30}?):/gi))
|
||||
if(emojis != null){
|
||||
for(i = 0; i < emojis.length; i++){
|
||||
input = input.replace(emojis[i][0], "<img height=30 src='/assets/images/emojis/" + emojis[i][1] + ".webp'>")
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById('preview').value = marked(input)
|
||||
}
|
||||
|
||||
</script>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
|
@ -326,7 +344,16 @@
|
|||
|
||||
<label for="body" class="mt-3">Text<i class="fas fa-info-circle text-gray-400 ml-1" data-toggle="tooltip" data-placement="top" title="Uses markdown. Limited to 10000 characters."></i></label>
|
||||
|
||||
<div id="svelte-app">
|
||||
<div>
|
||||
<textarea form="submitform" id="post-text" class="form-control rounded" aria-label="With textarea" placeholder="Optional if you have a link or an image." rows="3" name="body" oninput="markdown();charLimit('post-text','character-count-submit-text-form');checkForRequired()" maxlength="10000" required></textarea>
|
||||
|
||||
<div class="btn btn-secondary" onclick="document.getElementById('preview').classList.toggle('d-none');" style="float: right;">
|
||||
Toggle preview
|
||||
</div>
|
||||
|
||||
<div id="preview"></div>
|
||||
|
||||
<span class="position-absolute text-small font-weight-bold" id="character-count-submit-text-form" style="right: 1rem; bottom: 0.5rem; z-index: 3;"></span>
|
||||
</div>
|
||||
|
||||
<p></p>
|
||||
|
|
Loading…
Reference in New Issue