prompt_navigator 2.2.0 → 2.4.0
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: 04d9f220508c190b8c3b728e41ec2accc79d5b6812db89c6cbf9f55dca42763c
|
|
4
|
+
data.tar.gz: d1fca1e05f83c779d656e7d4e1e9671220f65ad12462553164bb72e3ebe656fc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 38f374671929eec32bd9d30758803fa557ac9be9f50b6ec3cc54a1e258548f27c362dfafaa9e7a7473b2f27bdf8b93990422a7b32126ef9dacd9c1fda6159a58
|
|
7
|
+
data.tar.gz: 434dc4c667d5737e083b1ea4773660abf576bbe6ea1695ea6bd98f5168fc2a457010907f4669aa07c0cb9688dbd950aed73908143911e9825034e10ea64bc576
|
|
@@ -18,10 +18,22 @@ export default class extends Controller {
|
|
|
18
18
|
|
|
19
19
|
connect() {
|
|
20
20
|
this.#drawArrows()
|
|
21
|
+
this.#scrollActiveCardIntoView()
|
|
21
22
|
this.#drawArrowsBound = this.#drawArrows.bind(this)
|
|
22
23
|
window.addEventListener("resize", this.#drawArrowsBound)
|
|
23
24
|
}
|
|
24
25
|
|
|
26
|
+
// If the currently-selected history card would be scrolled off-screen
|
|
27
|
+
// (short viewport, long history), bring it into view. `block: "nearest"`
|
|
28
|
+
// is a no-op when the card is already visible, so this only jumps when
|
|
29
|
+
// needed. Runs on `connect()`, which fires on initial mount AND after
|
|
30
|
+
// Turbo replaces the sidebar (post-stream / branch / rename).
|
|
31
|
+
#scrollActiveCardIntoView() {
|
|
32
|
+
const activeCard = this.element.querySelector(".history-card.is-active")
|
|
33
|
+
if (!activeCard) return
|
|
34
|
+
activeCard.scrollIntoView({ block: "nearest", inline: "nearest" })
|
|
35
|
+
}
|
|
36
|
+
|
|
25
37
|
disconnect() {
|
|
26
38
|
window.removeEventListener("resize", this.#drawArrowsBound)
|
|
27
39
|
}
|
|
@@ -7,10 +7,14 @@
|
|
|
7
7
|
delete_path = locals[:delete_path]
|
|
8
8
|
is_leaf = locals[:is_leaf]
|
|
9
9
|
|
|
10
|
-
# Hide
|
|
11
|
-
#
|
|
12
|
-
#
|
|
13
|
-
|
|
10
|
+
# Hide attached-file data URIs so the base64 blob doesn't dominate the
|
|
11
|
+
# 30-char preview. Images use `` and get replaced with `[image]`;
|
|
12
|
+
# documents use `[filename](data:…)` and get replaced with `[filename]`
|
|
13
|
+
# (or `[document]` if the filename slot is empty).
|
|
14
|
+
display_prompt = ann.prompt.to_s
|
|
15
|
+
.gsub(/!\[[^\]]*\]\(data:[^)]+\)/m, "[image]")
|
|
16
|
+
.gsub(/(?<!!)\[([^\]]*)\]\(data:[^)]+\)/m) { "[#{Regexp.last_match(1).presence || 'document'}]" }
|
|
17
|
+
.strip
|
|
14
18
|
%>
|
|
15
19
|
|
|
16
20
|
<div class="history-card<%= ' is-active' if is_active %>" data-history-target="cards" data-uuid="<%= ann.execution_id %>" data-parent-uuid="<%= parent_uuid %>">
|