Skip to content

Commit db9d46f

Browse files
committed
Improve docs.
1 parent 9e97447 commit db9d46f

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

browser-extension/README.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@ This is a [WXT](https://wxt.dev/)-based browser extension that
4242

4343
### Entry points
4444

45-
- `src/entrypoints/content.ts` - injected into every webpage
46-
- `src/entrypoints/background.ts` - service worker that manages state and handles messages
47-
- `src/entrypoints/popup` - React-based popup (html/css/tsx) with shadcn/ui table components
45+
- [`src/entrypoints/content.ts`](src/entrypoints/content.ts) - injected into every webpage
46+
- [`src/entrypoints/background.ts`](src/entrypoints/background.ts) - service worker that manages state and handles messages
47+
- [`src/entrypoints/popup/popup.tsx`](src/entrypoints/popup/popup.tsx) - popup (html/css/tsx) with shadcn/ui table components
4848

4949
```mermaid
5050
graph TD
5151
Content[Content Script<br/>content.ts]
5252
Background[Background Script<br/>background.ts]
53-
Popup[Popup Script<br/>popup/main.tsx]
53+
Popup[Popup Script<br/>popup/popup.tsx]
5454
5555
Content -->|ENHANCED/DESTROYED<br/>CommentEvent| Background
5656
Popup -->|GET_OPEN_SPOTS<br/>SWITCH_TO_TAB| Background
@@ -69,8 +69,6 @@ graph TD
6969
class TextArea,UI ui
7070
```
7171

72-
### Architecture
73-
7472
Every time a `textarea` shows up on a page, on initial load or later on, it gets passed to a list of `CommentEnhancer`s. Each one gets a turn to say "I can enhance this box!". They show that they can enhance it by returning something non-null in the method `tryToEnhance(textarea: HTMLTextAreaElement): Spot | null`. Later on, that same `Spot` data will be used by the `tableRow(spot: Spot): ReactNode` method to create React components for rich formatting in the popup table.
7573

7674
Those `Spot` values get bundled up with the `HTMLTextAreaElement` itself into an `EnhancedTextarea`, which gets added to the `TextareaRegistry`. At some interval, draft edits get saved by the browser extension.
@@ -79,12 +77,12 @@ When the `textarea` gets removed from the page, the `TextareaRegistry` is notifi
7977

8078
## Testing
8179

82-
In `tests/har` there are various `.har` files. These are complete recordings of a single page load.
83-
84-
- `pnpm run har:view` and you can see the recordings, with or without our browser extension.
80+
- `npm run playground` gives you a test environment where you can tinker with the popup with various test data, supports hot reload
81+
- `npm run har:view` gives you recordings of various web pages which you can see with and without enhancement by the browser extension
8582

8683
### Recording new HAR files
8784

85+
- the har recordings live in `tests/har`, they are complete recordings of the network requests of a single page load
8886
- you can add or change URLs in `tests/har-index.ts`
8987
- `npx playwright codegen https://github.com/login --save-storage=playwright/.auth/gh.json` will store new auth tokens
9088
- login manually, then close the browser

0 commit comments

Comments
 (0)