1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-23 18:53:36 +02:00

Open links in browser

This commit is contained in:
Laurent Cozic 2017-07-22 18:21:39 +01:00
parent 7aee903ca2
commit 7c60e32e64
10 changed files with 131 additions and 57 deletions

View File

@ -487,17 +487,30 @@ msgid "New note"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/action-button.js:81
msgid "New folder"
msgid "New notebook"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screen-header.js:145
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screen-header.js:189
msgid "Log"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screen-header.js:150
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screen-header.js:194
msgid "Status"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/side-menu-content.js:106
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/side-menu-content.js:133
msgid "Synchronize"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/side-menu-content.js:106
msgid "Cancel synchronization"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/side-menu-content.js:133
msgid "Cancel sync"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/folder.js:73
#, javascript-format
msgid "The folder could not be saved: %s"
@ -508,35 +521,39 @@ msgid ""
"There is currently no notebook. Create one by clicking on the (+) button."
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:153
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:185
msgid "Untitled"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:169
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:201
msgid "Delete note?"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:200
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:232
msgid "Attach file"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:201
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:233
msgid "Delete note"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:202
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:234
msgid "Convert to regular note"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:202
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:234
msgid "Convert to todo"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:203
msgid "Toggle metadata"
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:235
msgid "Hide metadata"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:362
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:235
msgid "Show metadata"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:395
msgid "Edit"
msgstr ""
@ -556,12 +573,12 @@ msgstr ""
msgid "There are currently no notes. Create one by clicking on the (+) button."
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/welcome.js:24
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/welcome.js:31
msgid ""
"Click on the (+) button to create a new note or notebook. Click on the side "
"menu to access your existing notebooks."
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/welcome.js:24
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/welcome.js:31
msgid "You currently have no notebook. Create one by clicking on (+) button."
msgstr ""

View File

@ -522,18 +522,33 @@ msgid "New note"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/action-button.js:81
msgid "New folder"
msgstr ""
#, fuzzy
msgid "New notebook"
msgstr "Supprime le carnet."
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screen-header.js:145
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screen-header.js:189
msgid "Log"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screen-header.js:150
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screen-header.js:194
#, fuzzy
msgid "Status"
msgstr "Etat : %s."
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/side-menu-content.js:106
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/side-menu-content.js:133
msgid "Synchronize"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/side-menu-content.js:106
#, fuzzy
msgid "Cancel synchronization"
msgstr "Commencement de la synchronisation..."
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/side-menu-content.js:133
msgid "Cancel sync"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/folder.js:73
#, javascript-format
msgid "The folder could not be saved: %s"
@ -544,37 +559,41 @@ msgid ""
"There is currently no notebook. Create one by clicking on the (+) button."
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:153
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:185
msgid "Untitled"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:169
#, fuzzy
msgid "Delete note?"
msgstr "Supprimer le carnet \"%s\" ?"
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:200
msgid "Attach file"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:201
#, fuzzy
msgid "Delete note?"
msgstr "Supprimer le carnet \"%s\" ?"
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:232
msgid "Attach file"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:233
#, fuzzy
msgid "Delete note"
msgstr "Supprime le carnet."
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:202
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:234
msgid "Convert to regular note"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:202
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:234
msgid "Convert to todo"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:203
msgid "Toggle metadata"
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:235
msgid "Hide metadata"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:362
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:235
msgid "Show metadata"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:395
msgid "Edit"
msgstr ""
@ -597,13 +616,13 @@ msgstr "Editer la note."
msgid "There are currently no notes. Create one by clicking on the (+) button."
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/welcome.js:24
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/welcome.js:31
msgid ""
"Click on the (+) button to create a new note or notebook. Click on the side "
"menu to access your existing notebooks."
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/welcome.js:24
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/welcome.js:31
msgid "You currently have no notebook. Create one by clicking on (+) button."
msgstr ""

View File

@ -487,17 +487,30 @@ msgid "New note"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/action-button.js:81
msgid "New folder"
msgid "New notebook"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screen-header.js:145
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screen-header.js:189
msgid "Log"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screen-header.js:150
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screen-header.js:194
msgid "Status"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/side-menu-content.js:106
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/side-menu-content.js:133
msgid "Synchronize"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/side-menu-content.js:106
msgid "Cancel synchronization"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/side-menu-content.js:133
msgid "Cancel sync"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/folder.js:73
#, javascript-format
msgid "The folder could not be saved: %s"
@ -508,35 +521,39 @@ msgid ""
"There is currently no notebook. Create one by clicking on the (+) button."
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:153
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:185
msgid "Untitled"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:169
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:201
msgid "Delete note?"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:200
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:232
msgid "Attach file"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:201
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:233
msgid "Delete note"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:202
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:234
msgid "Convert to regular note"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:202
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:234
msgid "Convert to todo"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:203
msgid "Toggle metadata"
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:235
msgid "Hide metadata"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:362
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:235
msgid "Show metadata"
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/note.js:395
msgid "Edit"
msgstr ""
@ -556,12 +573,12 @@ msgstr ""
msgid "There are currently no notes. Create one by clicking on the (+) button."
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/welcome.js:24
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/welcome.js:31
msgid ""
"Click on the (+) button to create a new note or notebook. Click on the side "
"menu to access your existing notebooks."
msgstr ""
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/welcome.js:24
#: /mnt/d/Web/www/joplin/ReactNativeClient/lib/components/screens/welcome.js:31
msgid "You currently have no notebook. Create one by clicking on (+) button."
msgstr ""

View File

@ -11,6 +11,7 @@ const globalStyle = {
// For WebView - must correspond to the properties above
htmlFontSize: '14px',
htmlColor: 'black', // Note: CSS in WebView component only seem to work if the colour is written in full letters (so no hexadecimal)
htmlDividerColor: 'Gainsboro',
};
globalStyle.marginRight = globalStyle.margin;

View File

@ -19,6 +19,12 @@ const styles = StyleSheet.create({
paddingLeft: globalStyle.marginLeft,
backgroundColor: globalStyle.backgroundColor,
},
noItemMessage: {
paddingLeft: globalStyle.marginLeft,
paddingRight: globalStyle.marginRight,
paddingTop: globalStyle.marginTop,
paddingBottom: globalStyle.marginBottom
},
});
class ItemListComponent extends Component {
@ -93,7 +99,7 @@ class ItemListComponent extends Component {
);
} else {
const noItemMessage = this.props.noItemMessage ? this.props.noItemMessage : '';
return <Text>{noItemMessage}</Text>;
return <Text style={styles.noItemMessage} >{noItemMessage}</Text>;
}
}
}

View File

@ -25,7 +25,7 @@ let styleObject = {
height: 30,
flex:1,
color: globalStyle.color,
backgroundColor: globalStyle.backgroundColor,
// Note: cannot set backgroundStyle as that would remove the arrow in the component
},
divider: {
borderBottomWidth: 1,

View File

@ -1,5 +1,5 @@
import React, { Component } from 'react';
import { BackHandler, View, Button, TextInput, WebView, Text, StyleSheet } from 'react-native';
import { BackHandler, View, Button, TextInput, WebView, Text, StyleSheet, Linking } from 'react-native';
import { connect } from 'react-redux'
import { Log } from 'lib/log.js'
import { Note } from 'lib/models/note.js'
@ -303,7 +303,6 @@ class NoteScreenComponent extends BaseScreenComponent {
const css = `
body {
font-size: ` + style.htmlFontSize + `;
/* margin: ` + style.htmlMarginLeft + `; */
color: ` + style.htmlColor + `;
}
h1 {
@ -334,6 +333,9 @@ class NoteScreenComponent extends BaseScreenComponent {
border: 1px solid silver;
padding: .5em 1em .5em 1em;
}
hr {
border: 1px solid ` + style.htmlDividerColor + `;
}
`;
let counter = -1;
@ -345,7 +347,14 @@ class NoteScreenComponent extends BaseScreenComponent {
});
}
let html = note ? '<style>' + normalizeCss + "\n" + css + '</style>' + marked(body, { gfm: true, breaks: true }) : '';
const renderer = new marked.Renderer();
renderer.link = function (href, title, text) {
const js = "postMessage(" + JSON.stringify(href) + "); return false;";
let output = "<a href='#' onclick='" + js + "'>" + text + '</a>';
return output;
}
let html = note ? '<style>' + normalizeCss + "\n" + css + '</style>' + marked(body, { gfm: true, breaks: true, renderer: renderer }) : '';
let elementId = 1;
while (html.indexOf('°°JOP°') >= 0) {
@ -364,12 +373,17 @@ class NoteScreenComponent extends BaseScreenComponent {
source={{ html: markdownToHtml(note.body, globalStyle) }}
onMessage={(event) => {
let msg = event.nativeEvent.data;
reg.logger().info('postMessage received: ' + msg);
if (msg.indexOf('checkboxclick_') === 0) {
msg = msg.split('_');
let index = Number(msg[msg.length - 1]);
let currentState = msg[msg.length - 2]; // Not really needed but keep it anyway
const newBody = toggleTickAt(note.body, index);
this.saveOneProperty('body', newBody);
} else {
Linking.openURL(msg);
}
}}
/>

View File

@ -48,7 +48,7 @@ const styleObject = {
styleObject.folderButton = Object.assign({}, styleObject.button);
styleObject.folderButtonText = Object.assign({}, styleObject.buttonText);
styleObject.folderIcon = Object.assign({}, globalStyle.icon);
styleObject.folderIcon.color = '#026CB6';
styleObject.folderIcon.color = '#0072d5';
styleObject.syncButton = Object.assign({}, styleObject.button);
styleObject.syncButtonText = Object.assign({}, styleObject.buttonText);
styleObject.folderButtonSelected = Object.assign({}, styleObject.folderButton);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long