autosize tag entry

This commit is contained in:
Shish 2024-01-06 14:09:55 +00:00
parent 948f3f1bd8
commit 4df1e935b4

View file

@ -6,10 +6,19 @@ function joinUrlSegments(base, query) {
return base + separatorChar + query;
}
function autosize(el) {
setTimeout(function() {
el.style.cssText = 'height:' + el.scrollHeight + 'px';
}, 0);
}
function clearViewMode() {
document.querySelectorAll('.image_info').forEach((element) => {
element.classList.remove('infomode-view');
});
document.querySelectorAll('.image_info textarea').forEach((el) => {
autosize(el);
});
}
function updateAttr(selector, attr, value) {
@ -28,6 +37,11 @@ document.addEventListener('DOMContentLoaded', () => {
element.classList.add('infomode-view');
});
document.querySelectorAll('.image_info textarea').forEach((el) => {
el.addEventListener('keydown', () => autosize(el));
autosize(el);
});
if(document.location.hash.length > 3) {
var query = document.location.hash.substring(1);