Skip to content

Commit

Permalink
- Fix inability to unset note
Browse files Browse the repository at this point in the history
- Better highlights style
- Add special style for highlights with note
  • Loading branch information
Rustem Mussabekov committed Jun 28, 2024
1 parent 1bb341b commit 263cec4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 5 additions & 3 deletions src/marker/modern.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function apply(highlights: RaindropHighlight[]) {
for(const i in highlights) {
if (!textsRanges[i].length) continue

const { _id, color } = highlights[i]
const { _id, color, note } = highlights[i]
const cssId = `${cssprefix}${_id}`

//@ts-ignore
Expand All @@ -39,8 +39,10 @@ export function apply(highlights: RaindropHighlight[]) {
cssRules.push(`
::highlight(${cssId}) {
all: unset;
background-color: color-mix(in srgb, ${colors.get(color!) || color}, white 50%) !important;
color: black;
background-color: color-mix(in srgb, ${colors.get(color!) || color || 'yellow'}, white 60%) !important;
color: color-mix(in srgb, ${colors.get(color!) || color}, black 80%) !important;
${note ? `text-decoration: underline wavy;` : ''}
text-decoration-thickness: from-font;
}
:root {
Expand Down
6 changes: 3 additions & 3 deletions src/store.svelte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ export function createStore(

function upsert(highlight: RaindropHighlight) {
const item: RaindropHighlight = {
...(highlight._id ? { _id: highlight._id } : {}),
...(highlight.text ? { text: highlight.text } : {}),
...(highlight.note ? { note: highlight.note } : {}),
...(typeof highlight._id == 'string' ? { _id: highlight._id } : {}),
...(typeof highlight.text == 'string' ? { text: highlight.text } : {}),
...(typeof highlight.note == 'string' ? { note: highlight.note } : {}),
color: highlight.color || 'yellow',
//ignore all unknown fields (otherwise breaks ios)
}
Expand Down

0 comments on commit 263cec4

Please sign in to comment.