Skip to content

Commit

Permalink
fix: ToC item title
Browse files Browse the repository at this point in the history
  • Loading branch information
pnd280 committed Nov 27, 2024
1 parent f06030b commit 9bc2ef2
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
6 changes: 6 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ Consider giving a star ⭐ on [Github](https://github.com/pnd280/complexity).

---

## v0.0.5.18

_Release date: 27th Nov, 2024_

- **FIX**: Fixed Thread ToC title retrieval.

## v0.0.5.16

_Release date: 23rd Nov, 2024_
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "complexity",
"displayName": "Complexity - Perplexity AI Supercharged",
"version": "0.0.5.17",
"version": "0.0.5.18",
"author": "pnd280",
"description": "⚡ Supercharge your Perplexity AI",
"type": "module",
Expand Down
13 changes: 4 additions & 9 deletions src/content-script/hooks/useThreadTocObserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import throttle from "lodash/throttle";
import { AnchorProps } from "@/content-script/components/ThreadToc";
import useRouter from "@/content-script/hooks/useRouter";
import { useCanvasStore } from "@/content-script/session-store/canvas";
import { DomHelperSelectors } from "@/utils/DomSelectors";
import { DomSelectors } from "@/utils/DomSelectors";
import UiUtils from "@/utils/UiUtils";
import { scrollToElement } from "@/utils/utils";

Expand Down Expand Up @@ -60,14 +60,9 @@ export default function useThreadTocObserver() {

$messageBlocks.forEach(({ $query, $answer, $messageBlock }) => {
queueMicrotask(() => {
const title =
$query.find("textarea").val() ||
$query
.find(
`>*:not(${DomHelperSelectors.THREAD.MESSAGE.TEXT_COL_CHILD.MARKDOWN_QUERY}):not(.tw-sticky)`,
)
.first()
.text();
const title = $query
.find(DomSelectors.THREAD.MESSAGE.TEXT_COL_CHILD.QUERY_TITLE)
.text();

if (!title.length) return;

Expand Down
1 change: 1 addition & 0 deletions src/utils/DomSelectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const DomSelectors = {
TEXT_COL_CHILD: {
/** The query box */
QUERY: ".my-md.md\\:my-lg",
QUERY_TITLE: ".group\\/title>:last-child",
/** The answer box */
ANSWER: ".mb-md",
/** The answer heading */
Expand Down

0 comments on commit 9bc2ef2

Please sign in to comment.