1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Chore: iOS: Remove now-unnecessary scrolling non-root element (#9554)

This commit is contained in:
Henry Heino 2023-12-20 11:08:28 -08:00 committed by GitHub
parent 4ec2fb216e
commit f7e64e9681
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -151,12 +151,6 @@ export default function useSource(
const resourceDownloadMode = Setting.value('sync.resourceDownloadMode');
// On iOS, the root container has slow inertial scroll, which feels very different from
// the native scroll in other apps. This is not the case, however, when a child (e.g. a div)
// scrolls the content instead.
// Use a div to scroll on iOS instead of the main container:
const scrollRenderedMdContainer = shim.mobilePlatform() === 'ios';
const js = [];
js.push('try {');
js.push(shim.injectedJs('webviewLib'));
@ -165,8 +159,7 @@ export default function useSource(
js.push('window.joplinPostMessage_ = (msg, args) => { return window.ReactNativeWebView.postMessage(msg); };');
js.push('webviewLib.initialize({ postMessage: msg => { return window.ReactNativeWebView.postMessage(msg); } });');
js.push(`
const scrollingElement =
${scrollRenderedMdContainer ? 'document.querySelector("#rendered-md")' : 'document.scrollingElement'};
const scrollingElement = document.scrollingElement;
let lastScrollTop;
const onMainContentScroll = () => {
const newScrollTop = scrollingElement.scrollTop;
@ -232,19 +225,6 @@ export default function useSource(
font: -apple-system-body;
}
}
:root > body {
padding: 0;
}
`;
const scrollRenderedMdContainerCss = `
body > #rendered-md {
width: 100vw;
overflow: auto;
height: calc(100vh - ${paddingBottom}px - ${paddingTop});
padding-bottom: ${paddingBottom}px;
padding-top: ${paddingTop};
}
`;
const defaultCss = `
code {
@ -263,7 +243,6 @@ export default function useSource(
<style>
${defaultCss}
${shim.mobilePlatform() === 'ios' ? iOSSpecificCss : ''}
${scrollRenderedMdContainer ? scrollRenderedMdContainerCss : ''}
${editPopupCss}
</style>
${assetsToHeaders(result.pluginAssets, { asHtml: true })}