mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-24 23:49:33 +01:00
update
This commit is contained in:
@@ -1,2 +1 @@
|
||||
<!-- You can style this into a Splash Loading screen -->
|
||||
<a id="progress-bar" href="#"></a>
|
||||
@@ -83,19 +83,22 @@ const getDpi = pd => {
|
||||
let multiplier = pd / 1.5;
|
||||
return 240 * multiplier;
|
||||
} else if (pd > 1.5 && pd <= 2) {
|
||||
let multiplier = pd / 1.5;
|
||||
let multiplier = pd / 2;
|
||||
return 320 * multiplier;
|
||||
} else if (pd > 2 && pd <= 3) {
|
||||
let multiplier = pd / 3;
|
||||
return 480 * multiplier;
|
||||
} else if (pd > 3) {
|
||||
return 510;
|
||||
} else if (pd > 3 && pd <= 3.5) {
|
||||
let multiplier = pd / 3.5;
|
||||
return 520 * multiplier;
|
||||
} else if (pd > 3.5) {
|
||||
return 550;
|
||||
}
|
||||
};
|
||||
|
||||
const correction = (size, multiplier) => {
|
||||
let dSize = getDeviceSize();
|
||||
|
||||
console.log(getDeviceSize());
|
||||
if (dSize > 4 && dSize <= 5.3 && pixelDensity <= 3) {
|
||||
return size * 0.87;
|
||||
} else if (dSize > 5.5 && dSize < 6.5 && pixelDensity <= 3) {
|
||||
@@ -115,6 +118,7 @@ const correction = (size, multiplier) => {
|
||||
|
||||
export const normalize = size => {
|
||||
let pd = pixelDensity;
|
||||
console.log(pd);
|
||||
|
||||
if (pd === 1 || pd < 1) {
|
||||
return correction(size, 0.75);
|
||||
|
||||
@@ -214,7 +214,7 @@ const Editor = ({navigation, noMenu}) => {
|
||||
|
||||
const onWebViewLoad = () => {
|
||||
console.log('requesting focus');
|
||||
EditorWebView.requestFocus();
|
||||
//EditorWebView.requestFocus();
|
||||
if (noMenu) {
|
||||
post(
|
||||
JSON.stringify({
|
||||
@@ -279,14 +279,13 @@ const Editor = ({navigation, noMenu}) => {
|
||||
};
|
||||
|
||||
const params = 'platform=' + Platform.OS;
|
||||
|
||||
const sourceUri =
|
||||
(Platform.OS === 'android' ? 'file:///android_asset/' : '') +
|
||||
'Web.bundle/loader.html';
|
||||
const injectedJS = `if (!window.location.search) {
|
||||
var link = document.getElementById('progress-bar');
|
||||
link.href = './site/index.html?${params}';
|
||||
link.click();
|
||||
var link = document.getElementById('progress-bar');
|
||||
link.href = './site/index.html?${params}';
|
||||
link.click();
|
||||
}`;
|
||||
|
||||
const _renderEditor = () => {
|
||||
@@ -405,7 +404,7 @@ const Editor = ({navigation, noMenu}) => {
|
||||
ref={ref => (EditorWebView = ref)}
|
||||
onError={error => console.log(error)}
|
||||
onLoad={onWebViewLoad}
|
||||
javaScriptEnabled
|
||||
javaScriptEnabled={true}
|
||||
injectedJavaScript={Platform.OS === 'ios' ? injectedJS : null}
|
||||
onShouldStartLoadWithRequest={_onShouldStartLoadWithRequest}
|
||||
renderLoading={() => (
|
||||
@@ -417,19 +416,20 @@ const Editor = ({navigation, noMenu}) => {
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
cacheMode="LOAD_CACHE_ELSE_NETWORK"
|
||||
cacheMode="LOAD_DEFAULT"
|
||||
cacheEnabled={true}
|
||||
domStorageEnabled
|
||||
domStorageEnabled={true}
|
||||
scrollEnabled={false}
|
||||
bounces={false}
|
||||
allowFileAccess={true}
|
||||
scalesPageToFit={true}
|
||||
allowingReadAccessToURL={Platform.OS === 'android' ? true : null}
|
||||
allowFileAccessFromFileURLs={true}
|
||||
allowUniversalAccessFromFileURLs={true}
|
||||
originWhitelist={'*'}
|
||||
originWhitelist={['*']}
|
||||
source={
|
||||
Platform.OS === 'ios'
|
||||
? sourceUri
|
||||
? {uri: sourceUri}
|
||||
: {
|
||||
uri: 'file:///android_asset/texteditor.html',
|
||||
baseUrl: 'file:///android_asset/',
|
||||
|
||||
Reference in New Issue
Block a user