fix(web): content & navigation list scroll on mobile (#1207)
This commit is contained in:
@@ -1,9 +1,5 @@
|
|||||||
import { Uuid } from '@standardnotes/common'
|
import { Uuid } from '@standardnotes/common'
|
||||||
import {
|
import { DecryptedPayloadInterface, EncryptedPayloadInterface, PayloadInterface } from '@standardnotes/models'
|
||||||
DecryptedPayloadInterface,
|
|
||||||
EncryptedPayloadInterface,
|
|
||||||
PayloadInterface,
|
|
||||||
} from '@standardnotes/models'
|
|
||||||
import { EncryptionTypeSplit } from './EncryptionTypeSplit'
|
import { EncryptionTypeSplit } from './EncryptionTypeSplit'
|
||||||
import { KeyedDecryptionSplit } from './KeyedDecryptionSplit'
|
import { KeyedDecryptionSplit } from './KeyedDecryptionSplit'
|
||||||
import { KeyedEncryptionSplit } from './KeyedEncryptionSplit'
|
import { KeyedEncryptionSplit } from './KeyedEncryptionSplit'
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import { SelectedItemsController } from '@/Controllers/SelectedItemsController'
|
|||||||
import { NavigationController } from '@/Controllers/Navigation/NavigationController'
|
import { NavigationController } from '@/Controllers/Navigation/NavigationController'
|
||||||
import { NotesController } from '@/Controllers/NotesController'
|
import { NotesController } from '@/Controllers/NotesController'
|
||||||
import { ElementIds } from '@/Constants/ElementIDs'
|
import { ElementIds } from '@/Constants/ElementIDs'
|
||||||
|
import { classNames } from '@/Utils/ConcatenateClassNames'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
application: WebApplication
|
application: WebApplication
|
||||||
@@ -66,7 +67,11 @@ const ContentList: FunctionComponent<Props> = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className="infinite-scroll focus:shadow-none focus:outline-none"
|
className={classNames(
|
||||||
|
'infinite-scroll overflow-y-auto overflow-x-hidden focus:shadow-none focus:outline-none',
|
||||||
|
'md:overflow-y-hidden md:hover:overflow-y-auto',
|
||||||
|
'md:hover:[overflow-y:_overlay]',
|
||||||
|
)}
|
||||||
id={ElementIds.ContentList}
|
id={ElementIds.ContentList}
|
||||||
onScroll={onScroll}
|
onScroll={onScroll}
|
||||||
onKeyDown={onKeyDown}
|
onKeyDown={onKeyDown}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import { ElementIds } from '@/Constants/ElementIDs'
|
|||||||
import ContentListHeader from './Header/ContentListHeader'
|
import ContentListHeader from './Header/ContentListHeader'
|
||||||
import ResponsivePaneContent from '../ResponsivePane/ResponsivePaneContent'
|
import ResponsivePaneContent from '../ResponsivePane/ResponsivePaneContent'
|
||||||
import { AppPaneId } from '../ResponsivePane/AppPaneMetadata'
|
import { AppPaneId } from '../ResponsivePane/AppPaneMetadata'
|
||||||
|
import { useResponsiveAppPane } from '../ResponsivePane/ResponsivePaneProvider'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
accountMenuController: AccountMenuController
|
accountMenuController: AccountMenuController
|
||||||
@@ -43,6 +44,8 @@ const ContentListView: FunctionComponent<Props> = ({
|
|||||||
notesController,
|
notesController,
|
||||||
selectionController,
|
selectionController,
|
||||||
}) => {
|
}) => {
|
||||||
|
const { toggleAppPane } = useResponsiveAppPane()
|
||||||
|
|
||||||
const itemsViewPanelRef = useRef<HTMLDivElement>(null)
|
const itemsViewPanelRef = useRef<HTMLDivElement>(null)
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@@ -65,13 +68,14 @@ const ContentListView: FunctionComponent<Props> = ({
|
|||||||
[navigationController.selected?.uuid],
|
[navigationController.selected?.uuid],
|
||||||
)
|
)
|
||||||
|
|
||||||
const addNewItem = useCallback(() => {
|
const addNewItem = useCallback(async () => {
|
||||||
if (isFilesSmartView) {
|
if (isFilesSmartView) {
|
||||||
void filesController.uploadNewFile()
|
void filesController.uploadNewFile()
|
||||||
} else {
|
} else {
|
||||||
void createNewNote()
|
await createNewNote()
|
||||||
|
toggleAppPane(AppPaneId.Editor)
|
||||||
}
|
}
|
||||||
}, [filesController, createNewNote, isFilesSmartView])
|
}, [isFilesSmartView, filesController, createNewNote, toggleAppPane])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
/**
|
/**
|
||||||
@@ -84,7 +88,7 @@ const ContentListView: FunctionComponent<Props> = ({
|
|||||||
modifiers: [KeyboardModifier.Meta, KeyboardModifier.Ctrl],
|
modifiers: [KeyboardModifier.Meta, KeyboardModifier.Ctrl],
|
||||||
onKeyDown: (event) => {
|
onKeyDown: (event) => {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
addNewItem()
|
void addNewItem()
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -170,7 +174,7 @@ const ContentListView: FunctionComponent<Props> = ({
|
|||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
id="items-column"
|
id="items-column"
|
||||||
className="sn-component section app-column app-column-second border-b border-solid border-border"
|
className="sn-component section app-column app-column-second flex flex-col border-b border-solid border-border"
|
||||||
aria-label={'Notes & Files'}
|
aria-label={'Notes & Files'}
|
||||||
ref={itemsViewPanelRef}
|
ref={itemsViewPanelRef}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import PanelResizer, { PanelSide, ResizeFinishCallback, PanelResizeType } from '
|
|||||||
import SearchBar from '@/Components/SearchBar/SearchBar'
|
import SearchBar from '@/Components/SearchBar/SearchBar'
|
||||||
import ResponsivePaneContent from '@/Components/ResponsivePane/ResponsivePaneContent'
|
import ResponsivePaneContent from '@/Components/ResponsivePane/ResponsivePaneContent'
|
||||||
import { AppPaneId } from '@/Components/ResponsivePane/AppPaneMetadata'
|
import { AppPaneId } from '@/Components/ResponsivePane/AppPaneMetadata'
|
||||||
|
import { classNames } from '@/Utils/ConcatenateClassNames'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
application: WebApplication
|
application: WebApplication
|
||||||
@@ -59,7 +60,13 @@ const Navigation: FunctionComponent<Props> = ({ application }) => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="scrollable">
|
<div
|
||||||
|
className={classNames(
|
||||||
|
'h-full overflow-y-auto overflow-x-hidden',
|
||||||
|
'md:overflow-y-hidden md:hover:overflow-y-auto',
|
||||||
|
'md:hover:[overflow-y:_overlay]',
|
||||||
|
)}
|
||||||
|
>
|
||||||
<SmartViewsSection viewControllerManager={viewControllerManager} />
|
<SmartViewsSection viewControllerManager={viewControllerManager} />
|
||||||
<TagsSection viewControllerManager={viewControllerManager} />
|
<TagsSection viewControllerManager={viewControllerManager} />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -315,6 +315,7 @@ class PanelResizer extends Component<Props, State> {
|
|||||||
this.props.hoverable && 'hover:opacity-100',
|
this.props.hoverable && 'hover:opacity-100',
|
||||||
this.props.side === PanelSide.Left && 'left-0 right-auto',
|
this.props.side === PanelSide.Left && 'left-0 right-auto',
|
||||||
)}
|
)}
|
||||||
|
onMouseDown={this.onMouseDown}
|
||||||
ref={this.resizerElementRef}
|
ref={this.resizerElementRef}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ const ResponsivePaneContent = ({ children, contentClassName, contentElementId, p
|
|||||||
</button>
|
</button>
|
||||||
<div
|
<div
|
||||||
id={contentElementId}
|
id={contentElementId}
|
||||||
className={classNames('content', isSelectedPane ? 'h-full' : 'hidden flex-col md:flex', contentClassName)}
|
className={classNames('content flex flex-col', isSelectedPane ? 'h-full' : 'hidden md:flex', contentClassName)}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
import { ViewControllerManager } from '@/Services/ViewControllerManager'
|
import { ViewControllerManager } from '@/Services/ViewControllerManager'
|
||||||
import { isMobile } from '@/Utils'
|
|
||||||
import { SNTag } from '@standardnotes/snjs'
|
import { SNTag } from '@standardnotes/snjs'
|
||||||
import { observer } from 'mobx-react-lite'
|
import { observer } from 'mobx-react-lite'
|
||||||
import { FunctionComponent, useCallback } from 'react'
|
import { FunctionComponent, useCallback } from 'react'
|
||||||
import { DndProvider } from 'react-dnd'
|
import { DndProvider } from 'react-dnd'
|
||||||
import { HTML5Backend } from 'react-dnd-html5-backend'
|
import { HTML5Backend } from 'react-dnd-html5-backend'
|
||||||
import { TouchBackend } from 'react-dnd-touch-backend'
|
|
||||||
import RootTagDropZone from './RootTagDropZone'
|
import RootTagDropZone from './RootTagDropZone'
|
||||||
import { TagsListItem } from './TagsListItem'
|
import { TagsListItem } from './TagsListItem'
|
||||||
|
|
||||||
@@ -17,7 +15,7 @@ const TagsList: FunctionComponent<Props> = ({ viewControllerManager }: Props) =>
|
|||||||
const tagsState = viewControllerManager.navigationController
|
const tagsState = viewControllerManager.navigationController
|
||||||
const allTags = tagsState.allLocalRootTags
|
const allTags = tagsState.allLocalRootTags
|
||||||
|
|
||||||
const backend = isMobile({ tablet: true }) ? TouchBackend : HTML5Backend
|
const backend = HTML5Backend
|
||||||
|
|
||||||
const openTagContextMenu = useCallback(
|
const openTagContextMenu = useCallback(
|
||||||
(posX: number, posY: number) => {
|
(posX: number, posY: number) => {
|
||||||
|
|||||||
@@ -108,8 +108,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.infinite-scroll {
|
.infinite-scroll {
|
||||||
@include minimal_scrollbar();
|
|
||||||
height: inherit;
|
|
||||||
background-color: var(--items-column-items-background-color);
|
background-color: var(--items-column-items-background-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,3 @@
|
|||||||
@import './scrollbar';
|
|
||||||
|
|
||||||
#navigation .scrollable {
|
|
||||||
@include minimal_scrollbar();
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
$content-horizontal-padding: 16px;
|
$content-horizontal-padding: 16px;
|
||||||
|
|
||||||
#navigation {
|
#navigation {
|
||||||
|
|||||||
Reference in New Issue
Block a user