Merge branch 'master' of github.com:laurent22/joplin

pull/922/head
Laurent Cozic 2018-10-24 19:51:16 +01:00
commit 3ff139d445
12 changed files with 146 additions and 71 deletions

View File

@ -1,20 +1,20 @@
function randomClipperPort(state, env) {
const startPorts = {
prod: 41184,
dev: 27583,
};
const startPorts = {
prod: 41184,
dev: 27583,
};
const startPort = env === 'prod' ? startPorts.prod : startPorts.dev;
const startPort = env === 'prod' ? startPorts.prod : startPorts.dev;
if (!state) {
state = { offset: 0 };
} else {
state.offset++;
}
if (!state) {
state = { offset: 0 };
} else {
state.offset++;
}
state.port = startPort + state.offset;
state.port = startPort + state.offset;
return state;
return state;
}
module.exports = randomClipperPort;

View File

@ -595,6 +595,8 @@ class NoteTextComponent extends React.Component {
} else {
require('electron').shell.openExternal(msg);
}
} else if (msg.indexOf('#') === 0) {
// This is an internal anchor, which is handled by the WebView so skip this case
} else {
bridge().showErrorMessageBox(_('Unsupported link or message: %s', msg));
}

View File

@ -276,12 +276,24 @@
}
});
// Prevent URLs added via <a> tags from being opened within the application itself
document.addEventListener('click', function(event) {
const t = event.target;
// Prevent URLs added via <a> tags from being opened within the application itself
if (t && t.nodeName === 'A' && !t.hasAttribute('data-from-md')) {
event.preventDefault();
ipcProxySendToHost(t.getAttribute('href'));
return;
}
// IF this is an internal link, jump to the anchor directly
if (t && t.nodeName === 'A' && t.hasAttribute('data-from-md')) {
const href = t.getAttribute('href');
if (href.indexOf('#') === 0) {
event.preventDefault();
location.hash = href;
return;
}
}
});

View File

@ -1,52 +1,70 @@
#!/bin/bash
set -e
# Title
echo " _ _ _ _ _ _ _ "
echo " | | | |(_) (_) | | | | | "
echo " | | ___ _ __ | | _ _ __ _ _ __ ___| |_ __ _| | | ___ _ __ "
echo " _ | |/ _ \| _ \| || | _ \ | | _ \ / __| __ | | |/ _ \ __| "
echo " | |__| | (_) | |_) | || | | | | | | | | \__ \ || (_| | | | __/ | "
echo " \____/ \___/| .__/|_||_|_| |_| |_|_| |_|___/\__\__,_|_|_|\___|_| "
echo " | | "
echo " |_| "
echo " _ _ _ _ _ _ "
echo " | | (_) (_) | | | | | "
echo " | | ___ _ __ _ _ __ _ _ __ ___| |_ __ _| | | ___ _ __ "
echo " _ | |/ _ \\\| '_ \| | '_ \\ | | '_ \\\/ __| __/ _\` | | |/ _ \ '__|"
echo " | |__| | (_) | |_) | | | | | | | | | \__ \ || (_| | | | __/ | "
echo " \____/ \___/| .__/|_|_| |_| |_|_| |_|___/\__\__,_|_|_|\___|_| "
echo " | | "
echo " |_| "
echo ""
#-----------------------------------------------------
# Download Joplin
#-----------------------------------------------------
# Get the latest version to download
version=$(curl --silent "https://api.github.com/repos/laurent22/joplin/releases/latest" | grep -Po '"tag_name": "v\K.*?(?=")')
# Delete previous version
rm -f ~/.joplin/*.AppImage ~/.local/share/applications/*joplin.desktop
# Check if it's in the latest version
touch VERSION
if [[ $(< ~/.joplin/VERSION) != "$version" ]]; then
# Creates the folder where the binary will be stored
mkdir -p ~/.joplin/
# Delete previous version
rm -f ~/.joplin/*.AppImage ~/.local/share/applications/joplin.desktop ~/.joplin/VERSION
# Creates the folder where the binary will be stored
mkdir -p ~/.joplin/
# Download the latest version
wget -O ~/.joplin/Joplin.AppImage https://github.com/laurent22/joplin/releases/download/v$version/Joplin-$version-x86_64.AppImage
# Gives execution privileges
chmod +x ~/.joplin/Joplin.AppImage
#-----------------------------------------------------
# Icon
#-----------------------------------------------------
# Download icon
wget -O ~/.joplin/Icon512.png https://joplin.cozic.net/images/Icon512.png
# Detect desktop environment
if [ "$XDG_CURRENT_DESKTOP" = "" ]
then
desktop=$(echo "$XDG_DATA_DIRS" | sed 's/.*\(xfce\|kde\|gnome\).*/\1/')
else
desktop=$XDG_CURRENT_DESKTOP
fi
desktop=${desktop,,} # convert to lower case
# Download the latest version
wget -O ~/.joplin/Joplin-$version-x86_64.AppImage https://github.com/laurent22/joplin/releases/download/v$version/Joplin-$version-x86_64.AppImage
# Gives execution privileges
chmod +x ~/.joplin/Joplin-$version-x86_64.AppImage
# Download icon
wget -O ~/.joplin/Icon512.png https://joplin.cozic.net/images/Icon512.png
# Detect desktop environment
if [ "$XDG_CURRENT_DESKTOP" = "" ]
then
desktop=$(echo "$XDG_DATA_DIRS" | sed 's/.*\(xfce\|kde\|gnome\).*/\1/')
# Create icon for Gnome
if [[ $desktop =~ .*gnome.* ]]
then
echo -e "[Desktop Entry]\nEncoding=UTF-8\nName=Joplin\nExec=/home/$USER/.joplin/Joplin-$version-x86_64.AppImage\nIcon=/home/$USER/.joplin/Icon512.png\nType=Application\nCategories=Application;" >> ~/.local/share/applications/joplin.desktop
fi
#-----------------------------------------------------
# Finish
#-----------------------------------------------------
# Informs the user that it has been installed and cleans variables
echo 'Joplin installed in the version' $version
# Add version
echo $version > ~/.joplin/VERSION
else
desktop=$XDG_CURRENT_DESKTOP
echo 'You are now in the latest version.'
fi
desktop=${desktop,,} # convert to lower case
# Create icon for Gnome
if [[ $desktop =~ .*gnome.* ]]
then
echo -e "[Desktop Entry]\nEncoding=UTF-8\nName=Joplin\nExec=/home/$USER/.joplin/Joplin-$version-x86_64.AppImage\nIcon=/home/$USER/.joplin/Icon512.png\nType=Application\nCategories=Application;" >> ~/.local/share/applications/joplin.desktop
fi
# Informs the user that it has been installed and cleans variables
echo 'Joplin installed in the version' $version
# start Joplin:
~/.joplin/Joplin-$version-x86_64.AppImage
unset version

View File

@ -50,7 +50,7 @@ wget -O - https://raw.githubusercontent.com/laurent22/joplin/master/Joplin_insta
Operating System | Download | Alt. Download
-----------------|----------|----------------
Android | <a href='https://play.google.com/store/apps/details?id=net.cozic.joplin&utm_source=GitHub&utm_campaign=README&pcampaignid=MKT-Other-global-all-co-prtnr-py-PartBadge-Mar2515-1'><img alt='Get it on Google Play' height="40px" src='https://joplin.cozic.net/images/BadgeAndroid.png'/></a> | or [Download APK File](https://github.com/laurent22/joplin-android/releases/download/android-v1.0.151/joplin-v1.0.151.apk)
Android | <a href='https://play.google.com/store/apps/details?id=net.cozic.joplin&utm_source=GitHub&utm_campaign=README&pcampaignid=MKT-Other-global-all-co-prtnr-py-PartBadge-Mar2515-1'><img alt='Get it on Google Play' height="40px" src='https://joplin.cozic.net/images/BadgeAndroid.png'/></a> | or [Download APK File](https://github.com/laurent22/joplin-android/releases/download/android-v1.0.174/joplin-v1.0.174.apk)
iOS | <a href='https://itunes.apple.com/us/app/joplin/id1315599797'><img alt='Get it on the App Store' height="40px" src='https://joplin.cozic.net/images/BadgeIOS.png'/></a> | -
## Terminal application

View File

@ -90,8 +90,8 @@ android {
applicationId "net.cozic.joplin"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 2097331
versionName "1.0.153"
versionCode 2097410
versionName "1.0.174"
ndk {
abiFilters "armeabi-v7a", "x86"
}
@ -154,6 +154,24 @@ dependencies {
compile project(':react-native-image-resizer')
compile project(':react-native-share-extension')
compile "com.facebook.react:react-native:+"
// To fix the error below, which happened after adding react-native-camera.
// Doesn't make any sense since rn-camera neither defines v26 nor 27 but
// v25.0.2 in build.gradle, but anyway now it works ¯\_()_/¯
// --------------------------------------------------------------------------------------
// Fatal error
// { Error: Command failed: ./gradlew assembleRelease -PbuildDir=build --console plain
//
// FAILURE: Build failed with an exception.
//
// * What went wrong:
// Execution failed for task ':app:preReleaseBuild'.
// > Android dependency 'com.android.support:support-v4' has different version for the compile (26.1.0) and runtime (27.1.1) classpath. You should manually set the same version via DependencyResolution
// --------------------------------------------------------------------------------------
// https://github.com/react-native-community/react-native-camera/issues/1532#issuecomment-386434771
compile ("com.android.support:support-v4:26.0.1") {
force = true //<-- force dependency resolution to 26.0.1 in my case
}
}
// Run this once to be able to run the application with BUCK

View File

@ -17,11 +17,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>10.0.24</string>
<string>10.0.26</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>24</string>
<string>26</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>

View File

@ -73,8 +73,12 @@ class Note extends BaseItem {
}
static defaultTitle(note) {
if (note.body && note.body.length) {
const lines = note.body.trim().split("\n");
return this.defaultTitleFromBody(note.body);
}
static defaultTitleFromBody(body) {
if (body && body.length) {
const lines = body.trim().split("\n");
let output = lines[0].trim();
// Remove the first #, *, etc.
while (output.length) {

View File

@ -90,7 +90,7 @@ class Setting extends BaseModel {
// Might be fixed in Electron 18.x but no non-beta release yet. So for now
// by default we disable it on Linux.
'showTrayIcon': { value: platform !== 'linux', type: Setting.TYPE_BOOL, public: true, appTypes: ['desktop'], label: () => _('Show tray icon'), description: () => {
return platform === 'linux' ? _('Note: Does not work in all desktop environments.') : null;
return platform === 'linux' ? _('Note: Does not work in all desktop environments.') : _('This will allow Joplin to run in the background. It is recommended to enable this setting so that your notes are constantly being synchronised, thus reducing the number of conflicts.');
}},
'startMinimized': { value: false, type: Setting.TYPE_BOOL, public: true, appTypes: ['desktop'], label: () => _('Start application minimised in the tray icon') },

View File

@ -18,6 +18,10 @@ shim.isLinux = () => {
return process && process.platform === 'linux';
}
shim.isFreeBSD = () => {
return process && process.platform === 'freebsd';
}
shim.isWindows = () => {
return process && process.platform === 'win32';
}
@ -31,6 +35,7 @@ shim.platformName = function() {
if (shim.isMac()) return 'darwin';
if (shim.isWindows()) return 'win32';
if (shim.isLinux()) return 'linux';
if (shim.isFreeBSD()) return 'freebsd';
throw new Error('Cannot determine platform');
}
@ -145,4 +150,4 @@ shim.Buffer = null;
shim.openUrl = () => { throw new Error('Not implemented'); }
shim.waitForFrame = () => { throw new Error('Not implemented'); }
module.exports = { shim };
module.exports = { shim };

View File

@ -542,16 +542,32 @@ class AppComponent extends React.Component {
try {
const { type, value } = await ShareExtension.data();
if (type != "" && this.props.selectedFolderId) {
// reg.logger().info('Got share data:', type, value);
this.props.dispatch({
type: 'NAV_GO',
routeName: 'Note',
noteId: null,
sharedData: {type: type, value: value},
folderId: this.props.selectedFolderId,
itemType: 'note',
if (type != "" && this.props.selectedFolderId) {
const newNote = await Note.save({
title: Note.defaultTitleFromBody(value),
body: value,
parent_id: this.props.selectedFolderId
});
// This is a bit hacky, but the surest way to go to
// the needed note. We go back one screen in case there's
// already a note open - if we don't do this, the dispatch
// below will do nothing (because routeName wouldn't change)
// Then we wait a bit for the state to be set correctly, and
// finally we go to the new note.
this.props.dispatch({
type: 'NAV_BACK',
});
setTimeout(() => {
this.props.dispatch({
type: 'NAV_GO',
routeName: 'Note',
noteId: newNote.id,
});
}, 5);
}
} catch(e) {

View File

@ -311,7 +311,7 @@
<tr>
<td>Android</td>
<td><a href='https://play.google.com/store/apps/details?id=net.cozic.joplin&utm_source=GitHub&utm_campaign=README&pcampaignid=MKT-Other-global-all-co-prtnr-py-PartBadge-Mar2515-1'><img alt='Get it on Google Play' height="40px" src='https://joplin.cozic.net/images/BadgeAndroid.png'/></a></td>
<td>or <a href="https://github.com/laurent22/joplin-android/releases/download/android-v1.0.151/joplin-v1.0.151.apk">Download APK File</a></td>
<td>or <a href="https://github.com/laurent22/joplin-android/releases/download/android-v1.0.174/joplin-v1.0.174.apk">Download APK File</a></td>
</tr>
<tr>
<td>iOS</td>