Fix classic compose caption counter

This commit is contained in:
Daniel Supernault 2019-04-24 22:49:51 -06:00
parent 752c98a086
commit 4a986bfa5b
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -19,6 +19,25 @@ $(document).ready(function() {
new Vue({
el: '#content'
});
$('.metro-classic-compose textarea[name="caption"]').on('click', function(e) {
let el = $(this);
el.attr('rows', 4);
});
$('.metro-classic-compose textarea[name="caption"]').on('change keyup paste', function(e) {
let el = $(this);
let len = el.val().length;
let limit = el.attr('data-limit');
let res = len;
if(len > limit) {
res = '<span class="text-danger">' + (limit - len) + '</span>';
} else {
res = '<span>' + len + '</span>';
}
$('.metro-classic-compose .caption-counter').html(res);
})
});
</script>
@endpush