Skip to content

Commit 79b5523

Browse files
committed
somewhat working set highlight
1 parent 2c71e4f commit 79b5523

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// ... existing imports ...
2+
import { Extension } from '@tiptap/core'
3+
4+
// Add this custom extension configuration before the EditorManager component
5+
const CustomHighlight = Extension.create({
6+
name: 'customHighlight',
7+
addGlobalAttributes() {
8+
return [
9+
{
10+
types: ['highlight'],
11+
attributes: {
12+
class: {
13+
default: 'selection-highlight',
14+
parseHTML: () => 'selection-highlight',
15+
renderHTML: () => ({
16+
class: 'selection-highlight',
17+
}),
18+
},
19+
},
20+
},
21+
]
22+
},
23+
})
24+
25+
export default CustomHighlight

src/contexts/FileContext.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import getMarkdown from '@/components/Editor/utils'
3737
import useOrderedSet from '../lib/hooks/use-ordered-set'
3838
import welcomeNote from '@/lib/welcome-note'
3939
import ClearFormattingExtension from '@/components/Editor/Extensions/FormattingExtension'
40+
import CustomHighlight from '@/components/Editor/Extensions/CustomHighlight'
4041

4142
type FileContextType = {
4243
vaultFilesTree: FileInfoTree
@@ -169,6 +170,7 @@ export const FileProvider: React.FC<{ children: ReactNode }> = ({ children }) =>
169170
TableHeader,
170171
TableCell,
171172
TextStyle,
173+
CustomHighlight,
172174
SearchAndReplace.configure({
173175
searchResultClass: 'bg-yellow-400',
174176
disableRegex: false,

src/styles/global.css

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,18 @@ button {
190190
/* Adjust day cell size */
191191
}
192192

193-
/* AI Edit highlight styles */
193+
/* Add this before the @layer base section */
194+
.tiptap mark.selection-highlight {
195+
background: rgba(66, 135, 245, 0.4) !important;
196+
color: inherit !important;
197+
border-radius: 0 !important;
198+
padding: 0 !important;
199+
margin: 0 !important;
200+
-webkit-user-select: none !important;
201+
user-select: none !important;
202+
}
203+
204+
/* You can remove or comment out the existing AI edit highlight styles */
194205
/* .tiptap .ai-edit-highlight {
195206
background-color: pink;
196207
border-radius: 2px;

0 commit comments

Comments
 (0)