meta_workflows 0.9.8 → 0.9.9
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9932a3a977ad87e5dc4df73df1153bdd55ec50634ca2a7b7e2dfff718682140b
|
4
|
+
data.tar.gz: 3cc0fc37cf578f4f4401d6077cdfd5dea1d2673f980581d9b8fcc4642ef1b1bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 868f9f58a148e118ff77bb23a175de2fcebc400afbf680e72c04f2888dea99ea816d736ff0124f539f807483dbab4e9b84b601a32c37d578232707b60810187c
|
7
|
+
data.tar.gz: 81a1e87cf5b6099521de598132cd8c68d010607b9f8bad437ef3a1e2f609a257e4f9721394216e542f84838a0caaa9d78adee69b0952c9f03012c45852aa79da
|
@@ -1,18 +1,30 @@
|
|
1
1
|
import { Controller } from '@hotwired/stimulus';
|
2
2
|
|
3
3
|
export default class extends Controller {
|
4
|
-
|
5
|
-
this.element.addEventListener('keydown', this.handleKeyDown);
|
6
|
-
}
|
4
|
+
static targets = ['textarea', 'form'];
|
7
5
|
|
8
|
-
|
9
|
-
this.
|
6
|
+
connect() {
|
7
|
+
this.submitted = false;
|
10
8
|
}
|
11
9
|
|
12
|
-
handleKeyDown
|
10
|
+
handleKeyDown(event) {
|
13
11
|
if (event.key === 'Enter' && !event.shiftKey) {
|
14
12
|
event.preventDefault();
|
15
|
-
|
13
|
+
event.stopPropagation();
|
14
|
+
this.handleSubmit();
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
18
|
+
handleSubmit() {
|
19
|
+
if (this.submitted) {
|
20
|
+
return;
|
21
|
+
}
|
22
|
+
|
23
|
+
if (!this.hasTextareaTarget || this.textareaTarget.value.trim() === '') {
|
24
|
+
return;
|
16
25
|
}
|
17
|
-
|
26
|
+
|
27
|
+
this.submitted = true;
|
28
|
+
this.formTarget.requestSubmit();
|
29
|
+
}
|
18
30
|
}
|
@@ -2,8 +2,8 @@
|
|
2
2
|
<div>
|
3
3
|
<%= form_with url: (workflow_execution_id.present? ? meta_workflows.human_path(workflow_execution_id) : "#"),
|
4
4
|
method: :patch,
|
5
|
-
|
6
|
-
|
5
|
+
id: "#{target_frame_id(record, form: true)}_lexi",
|
6
|
+
data: { controller: "meta-workflows--lexi-form-submit", "meta-workflows--lexi-form-submit-target": "form" } do |form| %>
|
7
7
|
<%= form.hidden_field :chat_id, value: chat_id %>
|
8
8
|
<fieldset>
|
9
9
|
<div class="lexi-form-container">
|
@@ -11,7 +11,7 @@
|
|
11
11
|
<div class="lexi-input-container lexi-input-max-height">
|
12
12
|
<!-- Input area with icons -->
|
13
13
|
<div class="lexi-textarea-wrapper">
|
14
|
-
<%= form.text_area :message, rows: 1, placeholder: random_chat_placeholder, disabled: local_assigns[:responding] || !local_assigns[:response_enabled], class: "lexi-textarea lexi-textarea-min-height" %>
|
14
|
+
<%= form.text_area :message, rows: 1, placeholder: random_chat_placeholder, disabled: local_assigns[:responding] || !local_assigns[:response_enabled], class: "lexi-textarea lexi-textarea-min-height", data: { action: "keypress.enter->meta-workflows--lexi-form-submit#handleKeyDown submit->meta-workflows--lexi-form-submit#handleSubmit", "meta-workflows--lexi-form-submit-target": "textarea" } %>
|
15
15
|
</div>
|
16
16
|
|
17
17
|
<div class="lexi-input-controls">
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module MetaWorkflows
|
4
4
|
MAJOR = 0
|
5
5
|
MINOR = 9
|
6
|
-
PATCH =
|
6
|
+
PATCH = 9 # this is automatically incremented by the build process
|
7
7
|
|
8
8
|
VERSION = "#{MetaWorkflows::MAJOR}.#{MetaWorkflows::MINOR}.#{MetaWorkflows::PATCH}".freeze
|
9
9
|
end
|