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

Mobile: Fixes #3344: Fixed regression that would cause links in notes to open within app itself

This commit is contained in:
Laurent Cozic 2020-06-08 07:41:04 +01:00
parent e5866e8aa6
commit 0bc10acf02
2 changed files with 12 additions and 8 deletions

View File

@ -61,9 +61,9 @@ class NoteBodyViewer extends Component {
}, 100); }, 100);
}, },
highlightedKeywords: this.props.highlightedKeywords, highlightedKeywords: this.props.highlightedKeywords,
resources: this.props.noteResources, // await shared.attachedResources(bodyToRender), resources: this.props.noteResources,
codeTheme: theme.codeThemeCss, codeTheme: theme.codeThemeCss,
postMessageSyntax: 'window.ReactNativeWebView.postMessage', postMessageSyntax: 'window.joplinPostMessage_',
}; };
const result = await this.markupToHtml_.render( const result = await this.markupToHtml_.render(
@ -82,6 +82,9 @@ class NoteBodyViewer extends Component {
const injectedJs = []; const injectedJs = [];
injectedJs.push(shim.injectedJs('webviewLib')); injectedJs.push(shim.injectedJs('webviewLib'));
// Note that this postMessage function accepts two arguments, for compatibility with the desktop version, but
// the ReactNativeWebView actually supports only one, so the second arg is ignored (and currently not needed for the mobile app).
injectedJs.push('window.joplinPostMessage_ = (msg, args) => { console.info("AAAAAAAAAAAAAAAAA"); return window.ReactNativeWebView.postMessage(msg); };');
injectedJs.push('webviewLib.initialize({ postMessage: msg => { return window.ReactNativeWebView.postMessage(msg); } });'); injectedJs.push('webviewLib.initialize({ postMessage: msg => { return window.ReactNativeWebView.postMessage(msg); } });');
injectedJs.push(` injectedJs.push(`
const readyStateCheckInterval = setInterval(function() { const readyStateCheckInterval = setInterval(function() {

View File

@ -8,7 +8,7 @@
// console.disableYellowBox = true // console.disableYellowBox = true
import { YellowBox, AppRegistry, NativeModules } from 'react-native'; import { YellowBox, AppRegistry } from 'react-native';
YellowBox.ignoreWarnings([ YellowBox.ignoreWarnings([
'Require cycle: node_modules/react-native-', 'Require cycle: node_modules/react-native-',
'Require cycle: node_modules/rn-fetch-blob', 'Require cycle: node_modules/rn-fetch-blob',
@ -19,11 +19,12 @@ YellowBox.ignoreWarnings([
const { Root } = require('./root.js'); const { Root } = require('./root.js');
// Disable buggy Fast Refresh // Disable buggy Fast Refresh
if (__DEV__) { // NOTE: not working - can make the app go into an infinite crash/restart loop
const { DevSettings } = NativeModules; // if (__DEV__) {
DevSettings.setHotLoadingEnabled(false); // const { DevSettings } = NativeModules;
DevSettings.setLiveReloadEnabled(false); // DevSettings.setHotLoadingEnabled(false);
} // DevSettings.setLiveReloadEnabled(false);
// }
function main() { function main() {
AppRegistry.registerComponent('Joplin', () => Root); AppRegistry.registerComponent('Joplin', () => Root);