Skip to content

Commit 9bc2ef2

Browse files
committed
fix: ToC item title
1 parent f06030b commit 9bc2ef2

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

docs/changelog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ Consider giving a star ⭐ on [Github](https://github.com/pnd280/complexity).
1212

1313
---
1414

15+
## v0.0.5.18
16+
17+
_Release date: 27th Nov, 2024_
18+
19+
- **FIX**: Fixed Thread ToC title retrieval.
20+
1521
## v0.0.5.16
1622

1723
_Release date: 23rd Nov, 2024_

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "complexity",
33
"displayName": "Complexity - Perplexity AI Supercharged",
4-
"version": "0.0.5.17",
4+
"version": "0.0.5.18",
55
"author": "pnd280",
66
"description": "⚡ Supercharge your Perplexity AI",
77
"type": "module",

src/content-script/hooks/useThreadTocObserver.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import throttle from "lodash/throttle";
88
import { AnchorProps } from "@/content-script/components/ThreadToc";
99
import useRouter from "@/content-script/hooks/useRouter";
1010
import { useCanvasStore } from "@/content-script/session-store/canvas";
11-
import { DomHelperSelectors } from "@/utils/DomSelectors";
11+
import { DomSelectors } from "@/utils/DomSelectors";
1212
import UiUtils from "@/utils/UiUtils";
1313
import { scrollToElement } from "@/utils/utils";
1414

@@ -60,14 +60,9 @@ export default function useThreadTocObserver() {
6060

6161
$messageBlocks.forEach(({ $query, $answer, $messageBlock }) => {
6262
queueMicrotask(() => {
63-
const title =
64-
$query.find("textarea").val() ||
65-
$query
66-
.find(
67-
`>*:not(${DomHelperSelectors.THREAD.MESSAGE.TEXT_COL_CHILD.MARKDOWN_QUERY}):not(.tw-sticky)`,
68-
)
69-
.first()
70-
.text();
63+
const title = $query
64+
.find(DomSelectors.THREAD.MESSAGE.TEXT_COL_CHILD.QUERY_TITLE)
65+
.text();
7166

7267
if (!title.length) return;
7368

src/utils/DomSelectors.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const DomSelectors = {
1919
TEXT_COL_CHILD: {
2020
/** The query box */
2121
QUERY: ".my-md.md\\:my-lg",
22+
QUERY_TITLE: ".group\\/title>:last-child",
2223
/** The answer box */
2324
ANSWER: ".mb-md",
2425
/** The answer heading */

0 commit comments

Comments
 (0)