Немного доработана страница написания статьи
This commit is contained in:
parent
430ea5df5a
commit
1f437e193d
|
|
@ -22,6 +22,7 @@
|
|||
articleText = document.getElementById('articleText');
|
||||
imgText = '\n[img|#' + $(this).attr('photoid') + ']\n';
|
||||
insertAtCursor(articleText, imgText);
|
||||
markdown();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
@ -68,10 +69,11 @@
|
|||
<tr>
|
||||
<td style="width: 50%;">
|
||||
<label for="articleText">Текст статьи</label>
|
||||
<textarea name="text" id="articleText" class="form-control" onscroll="monitor.scrollTop=scrollTop" style="height: 500px; resize: none;" ><?= $article->text ?></textarea>
|
||||
<textarea name="text" id="articleText" class="form-control" onscroll="monitor.scrollTop=scrollTop" style="height: 250px; resize: none;" ><?= $article->text ?></textarea>
|
||||
</td>
|
||||
<td style="width: 50%;">
|
||||
<div id="monitor" style="height: 500px; width: 100%; background-color: white; margin-top: 25px; overflow-y: scroll; padding: 5px 10px;"></div>
|
||||
<td style="width: 50%; padding-left: 3px;">
|
||||
<label for="monitor">Предпросмотр</label>
|
||||
<div id="monitor" style="height: 250px; width: 100%; background-color: white; overflow-y: scroll; padding: 5px 10px; border: solid 1px #ccc; border-radius: 4px;"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
|
@ -111,12 +113,17 @@
|
|||
<script>
|
||||
var monitorTimeout;
|
||||
|
||||
$('#articleText').keyup(function () {
|
||||
clearTimeout(monitorTimeout);
|
||||
monitorTimeout = setTimeout(function () {
|
||||
function markdown()
|
||||
{
|
||||
$.post('/articles/markdown', {text: $('#articleText').val()}, function (data) {
|
||||
$('#monitor').html(data);
|
||||
});
|
||||
}
|
||||
|
||||
$('#articleText').keyup(function () {
|
||||
clearTimeout(monitorTimeout);
|
||||
monitorTimeout = setTimeout(function () {
|
||||
markdown();
|
||||
}, 300);
|
||||
}).keydown(function () {
|
||||
clearTimeout(monitorTimeout)
|
||||
|
|
@ -129,9 +136,7 @@
|
|||
});
|
||||
|
||||
$(document).ready(function(){
|
||||
$.post('/articles/markdown', {text: $('#articleText').val()}, function (data) {
|
||||
$('#monitor').html(data);
|
||||
});
|
||||
markdown();
|
||||
});
|
||||
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Reference in New Issue