diff --git a/package-lock.json b/package-lock.json index 55003d64..2565ff21 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,8 +20,9 @@ "@tauri-apps/plugin-dialog": "^2.6.0", "@tauri-apps/plugin-opener": "^2", "@tauri-apps/plugin-updater": "^2.10.0", - "@tiptap/core": "^3.19.0", + "@tiptap/core": "3.20.0", "@tiptap/extension-code-block-lowlight": "^3.20.0", + "@tiptap/extension-highlight": "3.20.0", "@tiptap/extension-image": "^3.18.0", "@tiptap/extension-link": "^3.18.0", "@tiptap/extension-mathematics": "^3.18.0", @@ -33,7 +34,7 @@ "@tiptap/extension-task-item": "^3.18.0", "@tiptap/extension-task-list": "^3.18.0", "@tiptap/markdown": "^3.18.0", - "@tiptap/pm": "^3.18.0", + "@tiptap/pm": "3.20.0", "@tiptap/react": "^3.18.0", "@tiptap/starter-kit": "^3.18.0", "@tiptap/suggestion": "^3.18.0", @@ -2787,6 +2788,19 @@ "@tiptap/core": "^3.20.0" } }, + "node_modules/@tiptap/extension-highlight": { + "version": "3.20.0", + "resolved": "https://registry.npmjs.org/@tiptap/extension-highlight/-/extension-highlight-3.20.0.tgz", + "integrity": "sha512-ANL1wFz0s1ScNR4uBfO0s6Sz+qqGp2u6ynrCVk6TCT3d10CQ+gD1gSDTrVRC3CtlMKtHHH4fYrFAq284+J0gKA==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/core": "^3.20.0" + } + }, "node_modules/@tiptap/extension-horizontal-rule": { "version": "3.20.0", "resolved": "https://registry.npmjs.org/@tiptap/extension-horizontal-rule/-/extension-horizontal-rule-3.20.0.tgz", diff --git a/package.json b/package.json index fb889190..430b54d7 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "@tauri-apps/plugin-updater": "^2.10.0", "@tiptap/core": "^3.19.0", "@tiptap/extension-code-block-lowlight": "^3.20.0", + "@tiptap/extension-highlight": "^3.20.0", "@tiptap/extension-image": "^3.18.0", "@tiptap/extension-link": "^3.18.0", "@tiptap/extension-mathematics": "^3.18.0", diff --git a/src/App.css b/src/App.css index d094bedf..17f9bc3d 100644 --- a/src/App.css +++ b/src/App.css @@ -16,6 +16,7 @@ --color-border: rgba(28, 25, 23, 0.08); --color-accent: #1c1917; --color-selection: rgba(250, 204, 21, 0.4); /* Tailwind yellow-400 */ + --color-text-selection: rgba(96, 165, 250, 0.35); /* Tailwind blue-400 */ /* Editor font settings - simplified (overridden by ThemeContext) */ --editor-font-family: @@ -61,6 +62,7 @@ --color-border: rgba(250, 249, 249, 0.07); --color-accent: #fafaf9; --color-selection: rgba(253, 224, 71, 0.35); /* Tailwind yellow-300 */ + --color-text-selection: rgba(147, 197, 253, 0.3); /* Tailwind blue-300 */ /* Syntax highlighting colors - Dark (GitHub) */ --color-syntax-keyword: #ea4a5a; @@ -145,13 +147,13 @@ body { -moz-osx-font-smoothing: grayscale; } -/* Text and image selection highlight */ +/* Text and image selection highlight - always blue, distinct from yellow highlight marks */ ::selection { - background-color: var(--color-selection); + background-color: var(--color-text-selection); } ::-moz-selection { - background-color: var(--color-selection); + background-color: var(--color-text-selection); } /* Hide scrollbar while allowing scroll */ @@ -394,6 +396,13 @@ html.dark { color: var(--color-text); } +/* Highlighted text - yellow background, theme-aware text color */ +.prose mark { + background-color: rgba(250, 204, 21, 0.4); + color: inherit; + border-radius: 0.15em; +} + /* Code blocks and inline code */ .prose :where(code):not(:where([class~="not-prose"], [class~="not-prose"] *)) { color: var(--color-code); diff --git a/src/components/editor/Editor.tsx b/src/components/editor/Editor.tsx index 32a8159c..677ee531 100644 --- a/src/components/editor/Editor.tsx +++ b/src/components/editor/Editor.tsx @@ -19,6 +19,7 @@ import Image from "@tiptap/extension-image"; import TaskList from "@tiptap/extension-task-list"; import TaskItem from "@tiptap/extension-task-item"; import { TableKit } from "@tiptap/extension-table"; +import Highlight from "@tiptap/extension-highlight"; import { Markdown } from "@tiptap/markdown"; import CodeBlockLowlight from "@tiptap/extension-code-block-lowlight"; import { lowlight } from "./lowlight"; @@ -79,6 +80,7 @@ import { BoldIcon, ItalicIcon, StrikethroughIcon, + HighlighterIcon, Heading1Icon, Heading2Icon, Heading3Icon, @@ -283,6 +285,13 @@ function FormatBar({ > + editor.chain().focus().toggleHighlight().run()} + isActive={editor.isActive("highlight")} + title={`Highlight (${mod}${isMac ? "" : "+"}${shift}${isMac ? "" : "+"}H)`} + > + +
@@ -1098,6 +1107,7 @@ export function Editor({ inline: false, allowBase64: false, }), + Highlight, TaskList, TaskItem.configure({ nested: true, diff --git a/src/components/icons/index.tsx b/src/components/icons/index.tsx index 3e25c02b..7456c553 100644 --- a/src/components/icons/index.tsx +++ b/src/components/icons/index.tsx @@ -378,6 +378,26 @@ export function LinkOffIcon({ className = "w-4.5 h-4.5" }: IconProps) { ); } +export function HighlighterIcon({ className = "w-4.5 h-4.5" }: IconProps) { + return ( + + + + + + + + ); +} + export function ImageIcon({ className = "w-4.5 h-4.5" }: IconProps) { return (