Markdown editor improvements (#87)

This commit is contained in:
Bao Le 2023-10-06 02:08:24 +08:00 committed by GitHub
parent 458b9e425e
commit 49d1bc2e1b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,20 +2,19 @@
{% block media %} {% block media %}
<style> <style>
main { main{
overflow: hidden; overflow: hidden;
} }
#content { #content{
width: 100%; width: 100%;
} }
#content.wrapper { #content.wrapper{
padding: 0; padding: 0;
} }
.form-area { .form-area{
float: left; float: left;
width: 47%; width: 47%;
height: 100% height: 100%
} }
.wmd-preview{ .wmd-preview{
float: right; float: right;
@ -24,13 +23,16 @@
.width-controller{ .width-controller{
width: 51%; width: 51%;
} }
.wmd-input { .wmd-input{
height: calc(100vh - 114px); height: calc(100vh - 72px);
} }
.right-markdown{ .right-markdown{
height: calc(100vh - 69px); height: calc(100vh - 72px);
overflow-y: scroll; overflow-y: scroll;
} }
.wrap{
display: flex;
}
</style> </style>
{% endblock %} {% endblock %}
@ -49,13 +51,15 @@
preview: $(this).val() preview: $(this).val()
}, },
success: function(data) { success: function(data) {
$('#display').html(data) $('#display').html(data);
MathJax.typeset();
}, },
error: function(error) { error: function(error) {
alert(error); alert(error);
console.log(error.message) console.log(error.message)
} }
}) })
}); });
}); });
</script> </script>
@ -90,45 +94,50 @@
{% block title_row %} {% block title_row %}
{% endblock %} {% endblock %}
{% block body %} {% block title_ruler %}
<div id="new-comment" class="form-area" style=""> {% endblock %}
<input type="hidden" name="parent" id="id_parent">
<div class="comment-post-wrapper">
<div id="comment-form-body"><div class="wmd-wrapper image-upload-enabled">
<div class="wmd-panel">
<div id="wmd-button-bar-id_body"></div>
<textarea id="wmd-input-id_body" class="wmd-input" name="body" required=""></textarea>
</div>
<div id="id_body-preview" data-preview-url="{{url('comment_preview')}}" data-textarea-id="wmd-input-id_body" data-timeout="1000" class="wmd-panel wmd-preview dmmd-preview dmmd-no-button">
<div class="dmmd-preview-update"><i class="fa fa-refresh"></i> {{_('Update Preview')}}</div>
<div class="dmmd-preview-content content-description"></div>
</div>
<div class="pagedown-image-upload">
<h2>{{_('Insert Image')}}</h2>
<div class="form-row">
<div>
<label class="label">{{_('From the web')}}</label>
<input class="url-input" type="text" placeholder="http://">
</div>
</div>
<div class="form-row">
<div>
<label class="label">{{_('From your computer')}}</label>
<input class="file-input" type="file" name="image" id="file" data-action="/pagedown/image-upload/" accept="image/*">
</div>
</div>
<div class="submit-row">
<div class="submit-loading"></div>
<input class="submit-input show" type="submit" value="{{_('Save')}}" name="_addanother">
<p class="deletelink-box"><a href="#" class="close-image-upload deletelink">{{_('Cancel')}}</a></p>
</div>
</div>
</div></div>
</div>
</div>
<div id="id_body-preview" data-preview-url="{{url('comment_preview')}}" data-textarea-id="wmd-input-id_body" data-timeout="1000" class="width-controller wmd-panel wmd-preview dmmd-preview dmmd-no-button dmmd-preview-has-content"> {% block body %}
<div class="right-markdown dmmd-preview-content content-description" id="display"></div> <div class="wrap">
<div id="new-comment" class="form-area">
<input type="hidden" name="parent" id="id_parent">
<div class="comment-post-wrapper">
<div id="comment-form-body"><div class="wmd-wrapper image-upload-enabled">
<div class="wmd-panel">
<div id="wmd-button-bar-id_body"></div>
<textarea id="wmd-input-id_body" class="wmd-input" name="body" required=""></textarea>
</div>
<div id="id_body-preview" data-preview-url="{{url('comment_preview')}}" data-textarea-id="wmd-input-id_body" data-timeout="1000" class="wmd-panel wmd-preview dmmd-preview dmmd-no-button">
<div class="dmmd-preview-update"><i class="fa fa-refresh"></i> {{_('Update Preview')}}</div>
<div class="dmmd-preview-content content-description"></div>
</div>
<div class="pagedown-image-upload">
<h2>{{_('Insert Image')}}</h2>
<div class="form-row">
<div>
<label class="label">{{_('From the web')}}</label>
<input class="url-input" type="text" placeholder="http://">
</div>
</div>
<div class="form-row">
<div>
<label class="label">{{_('From your computer')}}</label>
<input class="file-input" type="file" name="image" id="file" data-action="/pagedown/image-upload/" accept="image/*">
</div>
</div>
<div class="submit-row">
<div class="submit-loading"></div>
<input class="submit-input show" type="submit" value="{{_('Save')}}" name="_addanother">
<p class="deletelink-box"><a href="#" class="close-image-upload deletelink">{{_('Cancel')}}</a></p>
</div>
</div>
</div></div>
</div>
</div>
<div id="id_body-preview" data-preview-url="{{url('comment_preview')}}" data-textarea-id="wmd-input-id_body" data-timeout="1000" class="width-controller wmd-panel wmd-preview dmmd-preview dmmd-no-button dmmd-preview-has-content">
<div class="right-markdown dmmd-preview-content content-description" id="display"></div>
</div>
</div> </div>
{% endblock %} {% endblock %}