mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-03 03:33:16 +03:00
Fix: Improve textarea height updating in CommitMessageInput.
This commit is contained in:
parent
b663c40423
commit
7a7299545b
@ -48,8 +48,8 @@
|
||||
let aiLoading = false;
|
||||
let aiConfigurationValid = false;
|
||||
|
||||
let titleTextArea: HTMLTextAreaElement | undefined;
|
||||
let descriptionTextArea: HTMLTextAreaElement | undefined;
|
||||
let titleTextArea: HTMLTextAreaElement;
|
||||
let descriptionTextArea: HTMLTextAreaElement;
|
||||
|
||||
$: ({ title, description } = splitMessage(commitMessage));
|
||||
$: valid = !!title;
|
||||
@ -62,6 +62,11 @@
|
||||
el.focus();
|
||||
}
|
||||
|
||||
function updateFieldsHeight() {
|
||||
if (titleTextArea) autoHeight(titleTextArea);
|
||||
if (descriptionTextArea) autoHeight(descriptionTextArea);
|
||||
}
|
||||
|
||||
async function generateCommitMessage(files: LocalFile[]) {
|
||||
const hunks = files.flatMap((f) =>
|
||||
f.hunks.filter((h) => $selectedOwnership.contains(f.id, h.id))
|
||||
@ -104,6 +109,11 @@
|
||||
}
|
||||
|
||||
aiLoading = false;
|
||||
|
||||
// set timeout to update the height of the textareas
|
||||
setTimeout(() => {
|
||||
updateFieldsHeight();
|
||||
}, 0);
|
||||
}
|
||||
|
||||
onMount(async () => {
|
||||
@ -112,13 +122,7 @@
|
||||
</script>
|
||||
|
||||
{#if isExpanded}
|
||||
<div
|
||||
class="commit-box__textarea-wrapper text-input"
|
||||
use:resizeObserver={() => {
|
||||
if (titleTextArea) autoHeight(titleTextArea);
|
||||
if (descriptionTextArea) autoHeight(descriptionTextArea);
|
||||
}}
|
||||
>
|
||||
<div class="commit-box__textarea-wrapper text-input" use:resizeObserver={updateFieldsHeight}>
|
||||
<textarea
|
||||
value={title}
|
||||
placeholder="Commit summary"
|
||||
|
Loading…
Reference in New Issue
Block a user