Skip to content

Commit

Permalink
autosize tag entry
Browse files Browse the repository at this point in the history
  • Loading branch information
shish committed Jan 6, 2024
1 parent 948f3f1 commit 4df1e93
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions ext/view/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);

Expand Down

0 comments on commit 4df1e93

Please sign in to comment.