mirror of
https://github.com/dergigi/boris.git
synced 2025-12-18 15:14:20 +01:00
fix: highlight button positioning with scroll
Change button from absolute to fixed positioning so it appears at the correct location relative to selected text regardless of scroll position
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
---
|
||||
alwaysApply: true
|
||||
description: when dealing with user and app settings
|
||||
alwaysApply: false
|
||||
---
|
||||
|
||||
We use nostr to load/save/sync our settings.
|
||||
|
||||
- https://nostrbook.dev/kinds/30078
|
||||
- https://github.com/nostr-protocol/nips/blob/master/78.md
|
||||
2
dist/index.html
vendored
2
dist/index.html
vendored
@@ -5,7 +5,7 @@
|
||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Boris - Nostr Bookmarks</title>
|
||||
<script type="module" crossorigin src="/assets/index-CDSPBMvO.js"></script>
|
||||
<script type="module" crossorigin src="/assets/index-DnVl8eXy.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-Bj-Uhit8.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -39,7 +39,8 @@ export const HighlightButton = React.forwardRef<HighlightButtonRef, HighlightBut
|
||||
if (buttonRef.current) {
|
||||
const rect = range.getBoundingClientRect()
|
||||
buttonRef.current.style.display = 'flex'
|
||||
buttonRef.current.style.top = `${rect.bottom + window.scrollY + 8}px`
|
||||
// Use fixed positioning relative to viewport, so it follows the scroll
|
||||
buttonRef.current.style.top = `${rect.bottom + 8}px`
|
||||
buttonRef.current.style.left = `${rect.left + rect.width / 2 - 20}px`
|
||||
}
|
||||
},
|
||||
@@ -57,7 +58,7 @@ export const HighlightButton = React.forwardRef<HighlightButtonRef, HighlightBut
|
||||
className="highlight-create-button"
|
||||
style={{
|
||||
display: 'none',
|
||||
position: 'absolute',
|
||||
position: 'fixed',
|
||||
zIndex: 1000,
|
||||
width: '40px',
|
||||
height: '40px',
|
||||
|
||||
Reference in New Issue
Block a user