prompt_navigator 2.3.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 +4 -4
- data/app/javascript/controllers/history_controller.js +12 -0
- data/lib/prompt_navigator/version.rb +1 -1
- metadata +1 -1
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
|
}
|