mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
This commit is contained in:
parent
774d924abd
commit
ff62bd8ff7
@ -9,8 +9,6 @@ import { WebView, WebViewMessageEvent } from 'react-native-webview';
|
||||
import { WebViewErrorEvent, WebViewEvent, WebViewSource } from 'react-native-webview/lib/WebViewTypes';
|
||||
|
||||
import Setting from '@joplin/lib/models/Setting';
|
||||
import { themeStyle } from '@joplin/lib/theme';
|
||||
import { Theme } from '@joplin/lib/themes/type';
|
||||
import shim from '@joplin/lib/shim';
|
||||
import { StyleProp, ViewStyle } from 'react-native';
|
||||
|
||||
@ -34,8 +32,6 @@ type OnLoadEndCallback = (event: WebViewEvent)=> void;
|
||||
type OnFileUpdateCallback = (event: SourceFileUpdateEvent)=> void;
|
||||
|
||||
interface Props {
|
||||
themeId: number;
|
||||
|
||||
// A name to be associated with the WebView (e.g. NoteEditor)
|
||||
// This name should be unique.
|
||||
webviewInstanceId: string;
|
||||
@ -67,7 +63,6 @@ interface Props {
|
||||
}
|
||||
|
||||
const ExtendedWebView = (props: Props, ref: Ref<WebViewControl>) => {
|
||||
const theme: Theme = themeStyle(props.themeId);
|
||||
const webviewRef = useRef(null);
|
||||
const [source, setSource] = useState<WebViewSource|undefined>(undefined);
|
||||
|
||||
@ -135,7 +130,10 @@ const ExtendedWebView = (props: Props, ref: Ref<WebViewControl>) => {
|
||||
return (
|
||||
<WebView
|
||||
style={{
|
||||
backgroundColor: theme.backgroundColor,
|
||||
// `backgroundColor: transparent` prevents a white fhash on iOS.
|
||||
// It seems that `backgroundColor: theme.backgroundColor` does not
|
||||
// prevent the flash.
|
||||
backgroundColor: 'transparent',
|
||||
...(props.style as any),
|
||||
}}
|
||||
ref={webviewRef}
|
||||
|
@ -28,10 +28,6 @@ interface Props {
|
||||
onLoadEnd?: ()=> void;
|
||||
}
|
||||
|
||||
const webViewStyle = {
|
||||
backgroundColor: 'transparent',
|
||||
};
|
||||
|
||||
export default function NoteBodyViewer(props: Props) {
|
||||
const dialogBoxRef = useRef(null);
|
||||
const webviewRef = useRef<WebViewControl>(null);
|
||||
@ -103,8 +99,6 @@ export default function NoteBodyViewer(props: Props) {
|
||||
<ExtendedWebView
|
||||
ref={webviewRef}
|
||||
webviewInstanceId='NoteBodyViewer'
|
||||
themeId={props.themeId}
|
||||
style={webViewStyle}
|
||||
html={html}
|
||||
injectedJavaScript={injectedJs.join('\n')}
|
||||
mixedContentMode="always"
|
||||
|
@ -314,7 +314,6 @@ const ImageEditor = (props: Props) => {
|
||||
|
||||
return (
|
||||
<ExtendedWebView
|
||||
themeId={props.themeId}
|
||||
html={html}
|
||||
injectedJavaScript={injectedJavaScript}
|
||||
allowFileAccessFromJs={true}
|
||||
|
@ -488,7 +488,6 @@ function NoteEditor(props: Props, ref: any) {
|
||||
}}>
|
||||
<ExtendedWebView
|
||||
webviewInstanceId='NoteEditor'
|
||||
themeId={props.themeId}
|
||||
scrollEnabled={true}
|
||||
ref={webviewRef}
|
||||
html={html}
|
||||
|
Loading…
Reference in New Issue
Block a user