@adminforth/agent 2.4.0 → 2.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,6 +25,7 @@
25
25
  ]"
26
26
  :placeholder="placeholderText"
27
27
  @keydown.enter.exact.prevent="sendMessage"
28
+ @keydown.esc="onEscape"
28
29
  />
29
30
  <div class="flex items-center justify-between px-2 py-1">
30
31
  <div
@@ -74,10 +75,9 @@
74
75
  </div>
75
76
  </Transition>
76
77
  </div>
77
- <MicrophoneButton
78
- v-if="props.meta.hasAudioAdapter"
79
- v-show="!agentStore.isEditingMessage"
80
- />
78
+ <div v-if="props.meta.hasAudioAdapter" v-show="!agentStore.isEditingMessage" class="contents">
79
+ <MicrophoneButton />
80
+ </div>
81
81
  <template v-if="!agentStore.isAudioChatMode">
82
82
  <template v-if="agentStore.isEditingMessage">
83
83
  <EditActionButtons
@@ -222,6 +222,16 @@ function cancelEdit() {
222
222
  autoResize();
223
223
  }
224
224
 
225
+ // Esc discards an in-progress message edit; when not editing it does nothing so the
226
+ // keystroke keeps its default textarea behaviour.
227
+ function onEscape(event: KeyboardEvent) {
228
+ if (!agentStore.isEditingMessage) {
229
+ return;
230
+ }
231
+ event.preventDefault();
232
+ cancelEdit();
233
+ }
234
+
225
235
  function stopCurrentRequest() {
226
236
  agentStore.abortCurrentChatRequestAndAddSystemMessage();
227
237
  }
@@ -25,6 +25,7 @@
25
25
  <textarea
26
26
  v-model="agentStore.userMessageInput"
27
27
  class="w-full min-h-24 resize-y bg-transparent text-sm text-gray-900 dark:text-gray-100 border-none focus:outline-none focus:ring-0 p-0"
28
+ @keydown.esc.prevent="agentStore.cancelEditMessage"
28
29
  />
29
30
  <EditActionButtons
30
31
  class="mt-2 self-end"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/agent",
3
- "version": "2.4.0",
3
+ "version": "2.4.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",