mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Better handling of closing notebooks and refreshing data in the highlight layer
This commit is contained in:
parent
2ed372a74c
commit
3f8926eb18
4 changed files with 4 additions and 36 deletions
|
|
@ -320,13 +320,6 @@ export function ArticleContainer(props: ArticleContainerProps): JSX.Element {
|
|||
readerTableHeaderColor: theme.colors.readerTableHeader.toString(),
|
||||
readerHeadersColor: theme.colors.readerFont.toString(),
|
||||
}
|
||||
console.log(
|
||||
'currentTheme from iOS: ',
|
||||
highContrastText,
|
||||
currentTheme(),
|
||||
'readerFontColor',
|
||||
styles.readerFontColor
|
||||
)
|
||||
|
||||
const recommendationsWithNotes = useMemo(() => {
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ type HighlightViewItemProps = {
|
|||
|
||||
viewInReader: (highlightId: string) => void
|
||||
|
||||
deleteHighlightAction: () => void
|
||||
updateHighlight: (highlight: Highlight) => void
|
||||
|
||||
setSetLabelsTarget: (highlight: Highlight) => void
|
||||
|
|
|
|||
|
|
@ -289,7 +289,6 @@ export function HighlightsLayer(props: HighlightsLayerProps): JSX.Element {
|
|||
|
||||
if (!target || (target as Node)?.nodeType !== Node.ELEMENT_NODE) {
|
||||
console.log(' -- returning early from page tap')
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -399,18 +398,15 @@ export function HighlightsLayer(props: HighlightsLayerProps): JSX.Element {
|
|||
(updatedHighlights: Highlight[], deletedHighlights: Highlight[]) => {
|
||||
props.setShowHighlightsModal(false)
|
||||
|
||||
setHighlights(updatedHighlights)
|
||||
|
||||
// Remove all the existing highlights, then set the new ones
|
||||
removeHighlights(
|
||||
deletedHighlights.map((h) => h.id),
|
||||
highlights.map((h) => h.id),
|
||||
highlightLocations
|
||||
)
|
||||
|
||||
updatedHighlights.forEach((h) => {
|
||||
updateHighlightsCallback(h)
|
||||
})
|
||||
setHighlights([...updatedHighlights])
|
||||
},
|
||||
[highlightLocations, props, updateHighlightsCallback]
|
||||
[highlights, highlightLocations, props, setHighlights]
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
|
|
@ -675,12 +671,6 @@ export function HighlightsLayer(props: HighlightsLayerProps): JSX.Element {
|
|||
}
|
||||
}
|
||||
|
||||
console.log(
|
||||
'going to show the higlight bar: ',
|
||||
focusedHighlightMousePos.current?.pageY,
|
||||
selectionData?.focusPosition
|
||||
)
|
||||
|
||||
return (
|
||||
<>
|
||||
<HighlightBar
|
||||
|
|
@ -692,12 +682,6 @@ export function HighlightsLayer(props: HighlightsLayerProps): JSX.Element {
|
|||
/>
|
||||
</>
|
||||
)
|
||||
} else {
|
||||
console.log(
|
||||
'not showing the higlight bar: ',
|
||||
focusedHighlight,
|
||||
selectionData
|
||||
)
|
||||
}
|
||||
|
||||
if (props.showHighlightsModal) {
|
||||
|
|
|
|||
|
|
@ -121,8 +121,6 @@ export function Notebook(props: NotebookProps): JSX.Element {
|
|||
}
|
||||
case 'DELETE_HIGHLIGHT': {
|
||||
const highlightId = action.deleteHighlightId
|
||||
console.log(' DELETE_HIGHLIGHT: ', highlightId)
|
||||
|
||||
if (!highlightId) {
|
||||
throw new Error('No highlightId for delete action.')
|
||||
}
|
||||
|
|
@ -318,12 +316,6 @@ export function Notebook(props: NotebookProps): JSX.Element {
|
|||
viewInReader={props.viewInReader}
|
||||
setSetLabelsTarget={setLabelsTarget}
|
||||
setShowConfirmDeleteHighlightId={setShowConfirmDeleteHighlightId}
|
||||
deleteHighlightAction={() => {
|
||||
dispatchAnnotations({
|
||||
type: 'DELETE_HIGHLIGHT',
|
||||
deleteHighlightId: highlight.id,
|
||||
})
|
||||
}}
|
||||
updateHighlight={() => {
|
||||
dispatchAnnotations({
|
||||
type: 'UPDATE_HIGHLIGHT',
|
||||
|
|
|
|||
Loading…
Reference in a new issue