Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

Add description label and resize after textarea after quiting editing session

天舟e255ff1080d5
diff --git a/frontend/src/views/TaskDescriptionPanel.vue b/frontend/src/views/TaskDescriptionPanel.vue
index 22a692a9c2..1740d9b438 100644
--- a/frontend/src/views/TaskDescriptionPanel.vue
+++ b/frontend/src/views/TaskDescriptionPanel.vue
@@ -1,43 +1,46 @@
<template>
<!-- Description Bar -->
- <div v-if="!$props.new" class="flex justify-end space-x-2">
- <button
- v-if="allowEdit && !state.edit"
- type="button"
- class="btn-icon"
- @click.prevent="beginEdit"
- >
- <!-- Heroicon name: solid/pencil -->
- <svg
- class="h-6 w-6"
- xmlns="http://www.w3.org/2000/svg"
- viewBox="0 0 20 20"
- fill="currentColor"
- aria-hidden="true"
+ <div class="flex justify-between">
+ <div class="textlabel">Description</div>
+ <div v-if="!$props.new" class="space-x-2">
+ <button
+ v-if="allowEdit && !state.editing"
+ type="button"
+ class="btn-icon"
+ @click.prevent="beginEdit"
>
- <path
- d="M13.586 3.586a2 2 0 112.828 2.828l-.793.793-2.828-2.828.793-.793zM11.379 5.793L3 14.172V17h2.828l8.38-8.379-2.83-2.828z"
- />
- </svg>
- </button>
- <!-- mt-0.5 is to prevent jiggling betweening switching edit/none-edit -->
- <button
- v-if="state.edit"
- type="button"
- class="mt-0.5 px-3 rounded-sm text-control hover:bg-control-bg-hover disabled:bg-control-bg disabled:opacity-50 disabled:cursor-not-allowed text-sm leading-5 font-normal focus:ring-control focus:outline-none focus-visible:ring-2 focus:ring-offset-2"
- @click.prevent="cancelEdit"
- >
- Cancel
- </button>
- <button
- v-if="state.edit"
- type="button"
- class="mt-0.5 px-3 border border-control-border rounded-sm text-control bg-control-bg hover:bg-control-bg-hover disabled:bg-control-bg disabled:opacity-50 disabled:cursor-not-allowed text-sm leading-5 font-normal focus:ring-control focus:outline-none focus-visible:ring-2 focus:ring-offset-2"
- :disabled="state.editDescription == task.description"
- @click.prevent="saveEdit"
- >
- Save
- </button>
+ <!-- Heroicon name: solid/pencil -->
+ <svg
+ class="h-6 w-6"
+ xmlns="http://www.w3.org/2000/svg"
+ viewBox="0 0 20 20"
+ fill="currentColor"
+ aria-hidden="true"
+ >
+ <path
+ d="M13.586 3.586a2 2 0 112.828 2.828l-.793.793-2.828-2.828.793-.793zM11.379 5.793L3 14.172V17h2.828l8.38-8.379-2.83-2.828z"
+ />
+ </svg>
+ </button>
+ <!-- mt-0.5 is to prevent jiggling betweening switching edit/none-edit -->
+ <button
+ v-if="state.editing"
+ type="button"
+ class="mt-0.5 px-3 rounded-sm text-control hover:bg-control-bg-hover disabled:bg-control-bg disabled:opacity-50 disabled:cursor-not-allowed text-sm leading-5 font-normal focus:ring-control focus:outline-none focus-visible:ring-2 focus:ring-offset-2"
+ @click.prevent="cancelEdit"
+ >
+ Cancel
+ </button>
+ <button
+ v-if="state.editing"
+ type="button"
+ class="mt-0.5 px-3 border border-control-border rounded-sm text-control bg-control-bg hover:bg-control-bg-hover disabled:bg-control-bg disabled:opacity-50 disabled:cursor-not-allowed text-sm leading-5 font-normal focus:ring-control focus:outline-none focus-visible:ring-2 focus:ring-offset-2"
+ :disabled="state.editDescription == task.description"
+ @click.prevent="saveEdit"
+ >
+ Save
+ </button>
+ </div>
</div>
<!-- Description -->
<label for="description" class="sr-only">Edit Description</label>
@@ -47,14 +50,14 @@
ref="editDescriptionTextArea"
:rows="$props.new ? 10 : 5"
class="mt-2 w-full resize-none whitespace-pre-wrap border-white focus:border-white outline-none"
- :class="state.edit ? 'focus:ring-control focus-visible:ring-2' : ''"
+ :class="state.editing ? 'focus:ring-control focus-visible:ring-2' : ''"
:style="
- state.edit
+ state.editing
? ''
: '-webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none'
"
placeholder="Add some description..."
- :readonly="!state.edit"
+ :readonly="!state.editing"
v-model="state.editDescription"
@input="
(e) => {
@@ -83,7 +86,7 @@ import { Task } from "../types";
import { sizeToFit } from "../utils";
interface LocalState {
- edit: boolean;
+ editing: boolean;
editDescription: string;
}
@@ -109,13 +112,13 @@ export default {
const editDescriptionTextArea = ref();
const state = reactive<LocalState>({
- edit: false,
+ editing: false,
editDescription: props.task.description,
});
const keyboardHandler = (e: KeyboardEvent) => {
if (
- state.edit &&
+ state.editing &&
editDescriptionTextArea.value === document.activeElement
) {
if (e.code == "Escape") {
@@ -136,7 +139,7 @@ export default {
document.addEventListener("keydown", keyboardHandler);
window.addEventListener("resize", resizeTextAreaHandler);
if (props.new) {
- state.edit = true;
+ state.editing = true;
}
nextTick(() => {
sizeToFit(editDescriptionTextArea.value);
@@ -156,7 +159,7 @@ export default {
() => props.new,
(curNew, prevNew) => {
if (!curNew && prevNew) {
- state.edit = false;
+ state.editing = false;
}
}
);
@@ -173,7 +176,7 @@ export default {
const beginEdit = () => {
state.editDescription = props.task.description;
- state.edit = true;
+ state.editing = true;
nextTick(() => {
editDescriptionTextArea.value.focus();
});
@@ -182,13 +185,19 @@ export default {
const saveEdit = () => {
emit("update-description", state.editDescription, (updatedTask: Task) => {
state.editDescription = updatedTask.description;
- state.edit = false;
+ state.editing = false;
+ nextTick(() => {
+ sizeToFit(editDescriptionTextArea.value);
+ });
});
};
const cancelEdit = () => {
state.editDescription = props.task.description;
- state.edit = false;
+ state.editing = false;
+ nextTick(() => {
+ sizeToFit(editDescriptionTextArea.value);
+ });
};
return {