Skip to content

feat: highlight + comment annotations with right-click context menu#11

Open
abdullah4tech wants to merge 2 commits into
mainfrom
feat/highlight-annotations
Open

feat: highlight + comment annotations with right-click context menu#11
abdullah4tech wants to merge 2 commits into
mainfrom
feat/highlight-annotations

Conversation

@abdullah4tech

Copy link
Copy Markdown
Owner

Summary

  • Right-click context menu on selected text now includes a Highlight… option alongside Copy / Cut / Paste
  • Selected text gets a coloured background overlay rendered directly in the editor (yellow, green, blue, pink, or orange)
  • Each highlight can carry an optional comment/annotation — shown as a tooltip on hover and in the highlights panel
  • All highlights are persisted per note in a new SQLite highlights table and survive app restarts

What changed

db.go

  • New Highlight struct
  • New highlights table in initDB
  • dbGetHighlights, dbAddHighlight, dbDeleteHighlight query helpers

app.go

  • GetHighlights, AddHighlight, DeleteHighlight Wails-bound methods

frontend/dist/index.html

  • Transparent-background textarea + #hl-overlay mirror div renders <mark> spans with coloured backgrounds; scroll-synced and word-wrap-aware
  • Right-click context menu (Copy / Cut / Paste / Highlight…) — "Highlight…" and its divider only appear when text is selected
  • Floating colour-picker dialog with 5 swatches + comment textarea; Save on Enter, dismiss on Esc or outside click
  • Highlights panel — right-side drawer toggled from the toolbar; lists all highlights for the open note with jump-to and delete per entry
  • Ctrl+H keyboard shortcut retained for power users
  • Highlights reload when switching notes and clear when a note is deleted

Test plan

  • Open a note, select some text, right-click → Highlight… appears in the context menu
  • Pick a colour, type a comment, hit Save — text shows a coloured background in the editor
  • Close and reopen the app — highlights persist
  • Click the Highlights toolbar button — panel opens listing the highlight; click it to jump to the text
  • Delete a highlight from the panel — overlay clears
  • Edit text before/after a highlight — background follows the text correctly
  • Ctrl+H with selected text opens the same picker
  • Right-click with no selection — Highlight… option is hidden, Copy/Cut are disabled

🤖 Generated with Claude Code

user-select:none on body lacked the -webkit- prefix WebKitGTK needs,
so UI chrome (buttons, menus, window controls) was selectable and
Ctrl+A would select-all the whole page instead of just the note.
Adds a per-note highlight system where the user selects text,
right-clicks (or presses Ctrl+H) to assign a colour and an optional
comment, and the text receives a coloured background overlay directly
in the editor.

- SQLite: new `highlights` table (sel_text, color, comment, off_start)
- Backend: GetHighlights / AddHighlight / DeleteHighlight Wails methods
- Editor: transparent-background textarea + mirror overlay div renders
  <mark> spans with 5 preset colours (yellow/green/blue/pink/orange);
  scroll-synced, word-wrap-aware, re-renders on every keystroke
- Context menu: right-click on selected text shows Copy / Cut / Paste +
  "Highlight…" — opening the colour-picker dialog
- Highlight picker: floating dialog with colour swatches + comment field;
  Save on Enter, dismiss on Esc or outside click
- Highlights panel: right-side drawer (toolbar button) listing all
  highlights for the open note; click to jump & select, trash to remove
- Highlights load on note open and clear on note delete
- Ctrl+H shortcut retained for keyboard users
@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

An error occurred during the review process. Please try again later.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/highlight-annotations

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Caution

Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted.

Error details
{"name":"HttpError","status":500,"request":{"method":"PATCH","url":"https://api.github.com/repos/abdullah4tech/gopad/issues/comments/4802314653","headers":{"accept":"application/vnd.github.v3+json","user-agent":"octokit.js/0.0.0-development octokit-core.js/7.0.6 Node.js/24","authorization":"token [REDACTED]","content-type":"application/json; charset=utf-8"},"body":{"body":"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- review_stack_entry_start -->\n\n[![Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/abdullah4tech/gopad/pull/11?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)\n\n<!-- review_stack_entry_end -->\n<!-- This is an auto-generated comment: review in progress by coderabbit.ai -->\n\n> [!NOTE]\n> Currently processing new changes in this PR. This may take a few minutes, please wait...\n> \n> <details>\n> <summary>⚙️ Run configuration</summary>\n> \n> **Configuration used**: defaults\n> \n> **Review profile**: CHILL\n> \n> **Plan**: Pro Plus\n> \n> **Run ID**: `292bf0eb-7078-4041-95be-88e35d07c8a1`\n> \n> </details>\n> \n> <details>\n> <summary>📥 Commits</summary>\n> \n> Reviewing files that changed from the base of the PR and between 4b86d5111936cc31b68ac539b3d5113bedf6c65a and f844e02558461d672281b7b2c76dd8c1ab5dcc3e.\n> \n> </details>\n> \n> <details>\n> <summary>⛔ Files ignored due to path filters (1)</summary>\n> \n> * `frontend/dist/index.html` is excluded by `!**/dist/**`\n> \n> </details>\n> \n> <details>\n> <summary>📒 Files selected for processing (2)</summary>\n> \n> * `app.go`\n> * `db.go`\n> \n> </details>\n> \n> ```ascii\n>  _____________________________\n> < Here comes the bug bouncer. >\n>  -----------------------------\n>   \\\n>    \\   (\\__/)\n>        (•ㅅ•)\n>        /   づ\n> ```\n\n<!-- end of auto-generated comment: review in progress by coderabbit.ai -->\n\n<!-- finishing_touch_checkbox_start -->\n\n<details>\n<summary>✨ Finishing Touches</summary>\n\n<details>\n<summary>📝 Generate docstrings</summary>\n\n- [ ] <!-- {\"checkboxId\": \"7962f53c-55bc-4827-bfbf-6a18da830691\"} --> Create stacked PR\n- [ ] <!-- {\"checkboxId\": \"3e1879ae-f29b-4d0d-8e06-d12b7ba33d98\"} --> Commit on current branch\n\n</details>\n<details>\n<summary>🧪 Generate unit tests (beta)</summary>\n\n- [ ] <!-- {\"checkboxId\": \"f47ac10b-58cc-4372-a567-0e02b2c3d479\", \"radioGroupId\": \"utg-output-choice-group-unknown_comment_id\"} -->   Create PR with unit tests\n- [ ] <!-- {\"checkboxId\": \"6ba7b810-9dad-11d1-80b4-00c04fd430c8\", \"radioGroupId\": \"utg-output-choice-group-unknown_comment_id\"} -->   Commit unit tests in branch `feat/highlight-annotations`\n\n</details>\n\n</details>\n\n<!-- finishing_touch_checkbox_end -->\n<!-- tips_start -->\n\n---\n\nThanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=abdullah4tech/gopad&utm_content=11)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.\n\n<details>\n<summary>❤️ Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n\n<sub>Comment `@coderabbitai help` to get the list of available commands.</sub>\n\n<!-- tips_end -->"},"request":{"retryCount":3,"signal":{},"retries":3,"retryAfter":16}}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant