Merge branch 'master' of github.com:laurent22/joplin
@ -28,13 +28,17 @@ matrix:
|
||||
before_install:
|
||||
# HOMEBREW_NO_AUTO_UPDATE needed so that Homebrew doesn't upgrade to the next
|
||||
# version, which requires Ruby 2.3, which is not available on the Travis VM.
|
||||
|
||||
# Silence apt-get update errors (for example when a module doesn't exist) since
|
||||
# otherwise it will make the whole build fails, even though all we need is yarn.
|
||||
- |
|
||||
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
|
||||
HOMEBREW_NO_AUTO_UPDATE=1 brew install yarn
|
||||
else
|
||||
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
|
||||
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
|
||||
sudo apt-get update && sudo apt-get install yarn
|
||||
sudo apt-get update || true
|
||||
sudo apt-get install -y yarn
|
||||
fi
|
||||
|
||||
script:
|
||||
|
@ -6,6 +6,7 @@ const { Note } = require('lib/models/note.js');
|
||||
const { Resource } = require('lib/models/resource.js');
|
||||
const { cliUtils } = require('./cli-utils.js');
|
||||
const { reducer, defaultState } = require('lib/reducer.js');
|
||||
const { splitCommandString } = require('lib/string-utils.js');
|
||||
const { reg } = require('lib/registry.js');
|
||||
const { _ } = require('lib/locale.js');
|
||||
|
||||
@ -520,7 +521,7 @@ class AppGui {
|
||||
|
||||
let note = this.widget('noteList').currentItem;
|
||||
let folder = this.widget('folderList').currentItem;
|
||||
let args = cliUtils.splitCommandString(cmd);
|
||||
let args = splitCommandString(cmd);
|
||||
|
||||
for (let i = 0; i < args.length; i++) {
|
||||
if (args[i] == '$n') {
|
||||
|
@ -5,75 +5,6 @@ const stringPadding = require('string-padding');
|
||||
|
||||
const cliUtils = {};
|
||||
|
||||
cliUtils.splitCommandString = function(command) {
|
||||
let args = [];
|
||||
let state = "start"
|
||||
let current = ""
|
||||
let quote = "\""
|
||||
let escapeNext = false;
|
||||
for (let i = 0; i < command.length; i++) {
|
||||
let c = command[i]
|
||||
|
||||
if (state == "quotes") {
|
||||
if (c != quote) {
|
||||
current += c
|
||||
} else {
|
||||
args.push(current)
|
||||
current = ""
|
||||
state = "start"
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
if (escapeNext) {
|
||||
current += c;
|
||||
escapeNext = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (c == "\\") {
|
||||
escapeNext = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (c == '"' || c == '\'') {
|
||||
state = "quotes"
|
||||
quote = c
|
||||
continue
|
||||
}
|
||||
|
||||
if (state == "arg") {
|
||||
if (c == ' ' || c == '\t') {
|
||||
args.push(current)
|
||||
current = ""
|
||||
state = "start"
|
||||
} else {
|
||||
current += c
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
if (c != ' ' && c != "\t") {
|
||||
state = "arg"
|
||||
current += c
|
||||
}
|
||||
}
|
||||
|
||||
if (state == "quotes") {
|
||||
throw new Error("Unclosed quote in command line: " + command)
|
||||
}
|
||||
|
||||
if (current != "") {
|
||||
args.push(current)
|
||||
}
|
||||
|
||||
if (args.length <= 0) {
|
||||
throw new Error("Empty command line")
|
||||
}
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
cliUtils.printArray = function(logFunction, rows, headers = null) {
|
||||
if (!rows.length) return '';
|
||||
|
||||
|
@ -544,6 +544,9 @@ msgstr ""
|
||||
msgid "Separate each tag by a comma."
|
||||
msgstr ""
|
||||
|
||||
msgid "Rename notebook:"
|
||||
msgstr ""
|
||||
|
||||
msgid "Layout"
|
||||
msgstr ""
|
||||
|
||||
@ -584,6 +587,9 @@ msgstr ""
|
||||
msgid "Remove this tag from all the notes?"
|
||||
msgstr ""
|
||||
|
||||
msgid "Rename"
|
||||
msgstr ""
|
||||
|
||||
msgid "Notebooks"
|
||||
msgstr ""
|
||||
|
||||
|
@ -603,6 +603,10 @@ msgstr "Modifier les étiquettes"
|
||||
msgid "Separate each tag by a comma."
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgid "Rename notebook:"
|
||||
msgstr "Nouveau carnet"
|
||||
|
||||
msgid "Layout"
|
||||
msgstr ""
|
||||
|
||||
@ -649,6 +653,9 @@ msgstr "Supprimer le carnet ?"
|
||||
msgid "Remove this tag from all the notes?"
|
||||
msgstr ""
|
||||
|
||||
msgid "Rename"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgid "Notebooks"
|
||||
msgstr "Nouveau carnet"
|
||||
|
@ -544,6 +544,9 @@ msgstr ""
|
||||
msgid "Separate each tag by a comma."
|
||||
msgstr ""
|
||||
|
||||
msgid "Rename notebook:"
|
||||
msgstr ""
|
||||
|
||||
msgid "Layout"
|
||||
msgstr ""
|
||||
|
||||
@ -584,6 +587,9 @@ msgstr ""
|
||||
msgid "Remove this tag from all the notes?"
|
||||
msgstr ""
|
||||
|
||||
msgid "Rename"
|
||||
msgstr ""
|
||||
|
||||
msgid "Notebooks"
|
||||
msgstr ""
|
||||
|
||||
|
2
CliClient/package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "joplin",
|
||||
"version": "0.10.68",
|
||||
"version": "0.10.69",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
@ -18,7 +18,7 @@
|
||||
],
|
||||
"owner": "Laurent Cozic"
|
||||
},
|
||||
"version": "0.10.68",
|
||||
"version": "0.10.69",
|
||||
"bin": {
|
||||
"joplin": "./main.js"
|
||||
},
|
||||
|
1
ElectronClient/.gitignore
vendored
@ -1,4 +1,3 @@
|
||||
build/
|
||||
app/node_modules/
|
||||
dist/
|
||||
app/lib/
|
||||
|
@ -280,16 +280,6 @@ class Application extends BaseApplication {
|
||||
|
||||
this.initRedux();
|
||||
|
||||
// const windowSize = Setting.value('windowSize');
|
||||
// const width = windowSize && windowSize.width ? windowSize.width : 800;
|
||||
// const height = windowSize && windowSize.height ? windowSize.height : 800;
|
||||
// bridge().windowSetSize(width, height);
|
||||
|
||||
// this.store().dispatch({
|
||||
// type: 'WINDOW_CONTENT_SIZE_SET',
|
||||
// size: bridge().windowContentSize(),
|
||||
// });
|
||||
|
||||
// Since the settings need to be loaded before the store is created, it will never
|
||||
// receive the SETTING_UPDATE_ALL even, which mean state.settings will not be
|
||||
// initialised. So we manually call dispatchUpdateAll() to force an update.
|
||||
|
BIN
ElectronClient/app/build/icons/1024x1024.png
Normal file
After Width: | Height: | Size: 79 KiB |
BIN
ElectronClient/app/build/icons/128x128.png
Normal file
After Width: | Height: | Size: 4.7 KiB |
BIN
ElectronClient/app/build/icons/144x144.png
Normal file
After Width: | Height: | Size: 5.5 KiB |
BIN
ElectronClient/app/build/icons/16x16.png
Normal file
After Width: | Height: | Size: 679 B |
BIN
ElectronClient/app/build/icons/24x24.png
Normal file
After Width: | Height: | Size: 968 B |
BIN
ElectronClient/app/build/icons/256x256.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
ElectronClient/app/build/icons/32x32.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
ElectronClient/app/build/icons/48x48.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
ElectronClient/app/build/icons/512x512.png
Normal file
After Width: | Height: | Size: 28 KiB |
BIN
ElectronClient/app/build/icons/72x72.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
ElectronClient/app/build/icons/96x96.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
@ -97,13 +97,14 @@ class MainScreenComponent extends React.Component {
|
||||
folder = await Folder.save({ title: answer }, { userSideValidation: true });
|
||||
} catch (error) {
|
||||
bridge().showErrorMessageBox(error.message);
|
||||
return;
|
||||
}
|
||||
|
||||
this.props.dispatch({
|
||||
type: 'FOLDER_SELECT',
|
||||
id: folder.id,
|
||||
});
|
||||
if (folder) {
|
||||
this.props.dispatch({
|
||||
type: 'FOLDER_SELECT',
|
||||
id: folder.id,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
this.setState({ promptOptions: null });
|
||||
@ -128,6 +129,26 @@ class MainScreenComponent extends React.Component {
|
||||
}
|
||||
},
|
||||
});
|
||||
} else if (command.name === 'renameNotebook') {
|
||||
const folder = await Folder.load(command.id);
|
||||
if (!folder) return;
|
||||
|
||||
this.setState({
|
||||
promptOptions: {
|
||||
label: _('Rename notebook:'),
|
||||
value: folder.title,
|
||||
onClose: async (answer) => {
|
||||
if (answer !== null) {
|
||||
try {
|
||||
await Folder.save({ id: folder.id, title: answer }, { userSideValidation: true });
|
||||
} catch (error) {
|
||||
bridge().showErrorMessageBox(error.message);
|
||||
}
|
||||
}
|
||||
this.setState({ promptOptions: null });
|
||||
}
|
||||
},
|
||||
});
|
||||
} else {
|
||||
commandProcessed = false;
|
||||
}
|
||||
|
@ -115,6 +115,14 @@ class SideBarComponent extends React.Component {
|
||||
}
|
||||
}}))
|
||||
|
||||
menu.append(new MenuItem({label: _('Rename'), click: async () => {
|
||||
this.props.dispatch({
|
||||
type: 'WINDOW_COMMAND',
|
||||
name: 'renameNotebook',
|
||||
id: itemId,
|
||||
});
|
||||
}}))
|
||||
|
||||
menu.popup(bridge().window());
|
||||
}
|
||||
|
||||
|
22
ElectronClient/app/package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "Joplin",
|
||||
"version": "0.10.16",
|
||||
"version": "0.10.19",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@ -10,14 +10,22 @@
|
||||
"integrity": "sha512-+rr4OgeTNrLuJAf09o3USdttEYiXvZshWMkhD6wR9v1ieXH0JM1Q2yT41/cJuJcqiPpSXlM/g3aR+Y5MWQdr0Q==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"7zip-bin-mac": "1.0.1"
|
||||
"7zip-bin-win": "2.1.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"7zip-bin-win": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/7zip-bin-win/-/7zip-bin-win-2.1.1.tgz",
|
||||
"integrity": "sha512-6VGEW7PXGroTsoI2QW3b0ea95HJmbVBHvfANKLLMzSzFA1zKqVX5ybNuhmeGpf6vA0x8FJTt6twpprDANsY5WQ==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"7zip-bin-mac": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/7zip-bin-mac/-/7zip-bin-mac-1.0.1.tgz",
|
||||
"integrity": "sha1-Pmh3i78JJq3GgVlCcHRQXUdVXAI=",
|
||||
"optional": true
|
||||
"7zip-bin-win": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/7zip-bin-win/-/7zip-bin-win-2.1.1.tgz",
|
||||
"integrity": "sha512-6VGEW7PXGroTsoI2QW3b0ea95HJmbVBHvfANKLLMzSzFA1zKqVX5ybNuhmeGpf6vA0x8FJTt6twpprDANsY5WQ=="
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "7.0.46",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "Joplin",
|
||||
"version": "0.10.16",
|
||||
"version": "0.10.19",
|
||||
"description": "Joplin for Desktop",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
@ -39,7 +39,7 @@
|
||||
"optionalDependencies": {
|
||||
"7zip-bin-mac": "^1.0.1",
|
||||
"7zip-bin-linux": "^1.0.1",
|
||||
"7zip-bin-win": "^1.0.1"
|
||||
"7zip-bin-win": "^2.1.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"app-module-path": "^2.2.0",
|
||||
|
0
ElectronClient/build.sh
Normal file → Executable file
@ -5,6 +5,8 @@ APP_DIR="$ROOT_DIR/app"
|
||||
cd "$APP_DIR"
|
||||
VERSION="$(npm version patch)"
|
||||
git add -A
|
||||
git commit -m "Version $VERSION"
|
||||
git commit -m "Electron release $VERSION"
|
||||
git tag $VERSION
|
||||
git push && git push --tags
|
||||
git push && git push --tags
|
||||
|
||||
echo "Create a draft release at: https://github.com/laurent22/joplin/releases/tag/$VERSION"
|
@ -90,8 +90,8 @@ android {
|
||||
applicationId "net.cozic.joplin"
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 22
|
||||
versionCode 55
|
||||
versionName "0.9.42"
|
||||
versionCode 56
|
||||
versionName "0.9.43"
|
||||
ndk {
|
||||
abiFilters "armeabi-v7a", "x86"
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ const { Note } = require('lib/models/note.js');
|
||||
const { Tag } = require('lib/models/tag.js');
|
||||
const { Setting } = require('lib/models/setting.js');
|
||||
const { Logger } = require('lib/logger.js');
|
||||
const { splitCommandString } = require('lib/string-utils.js');
|
||||
const { sprintf } = require('sprintf-js');
|
||||
const { reg } = require('lib/registry.js');
|
||||
const { fileExtension } = require('lib/path-utils.js');
|
||||
@ -63,7 +64,7 @@ class BaseApplication {
|
||||
|
||||
// Handles the initial flags passed to main script and
|
||||
// returns the remaining args.
|
||||
async handleStartFlags_(argv) {
|
||||
async handleStartFlags_(argv, setDefaults = true) {
|
||||
let matched = {};
|
||||
argv = argv.slice(0);
|
||||
argv.splice(0, 2); // First arguments are the node executable, and the node JS file
|
||||
@ -118,8 +119,10 @@ class BaseApplication {
|
||||
}
|
||||
}
|
||||
|
||||
if (!matched.logLevel) matched.logLevel = Logger.LEVEL_INFO;
|
||||
if (!matched.env) matched.env = 'prod';
|
||||
if (setDefaults) {
|
||||
if (!matched.logLevel) matched.logLevel = Logger.LEVEL_INFO;
|
||||
if (!matched.env) matched.env = 'prod';
|
||||
}
|
||||
|
||||
return {
|
||||
matched: matched,
|
||||
@ -272,6 +275,22 @@ class BaseApplication {
|
||||
reg.dispatch = this.store().dispatch;
|
||||
}
|
||||
|
||||
async readFlagsFromFile(flagPath) {
|
||||
if (!fs.existsSync(flagPath)) return {};
|
||||
let flagContent = fs.readFileSync(flagPath, 'utf8');
|
||||
if (!flagContent) return {};
|
||||
|
||||
flagContent = flagContent.trim();
|
||||
|
||||
let flags = splitCommandString(flagContent);
|
||||
flags.splice(0, 0, 'cmd');
|
||||
flags.splice(0, 0, 'node');
|
||||
|
||||
flags = await this.handleStartFlags_(flags, false);
|
||||
|
||||
return flags.matched;
|
||||
}
|
||||
|
||||
async start(argv) {
|
||||
let startFlags = await this.handleStartFlags_(argv);
|
||||
|
||||
@ -302,6 +321,9 @@ class BaseApplication {
|
||||
await fs.mkdirp(resourceDir, 0o755);
|
||||
await fs.mkdirp(tempDir, 0o755);
|
||||
|
||||
const extraFlags = await this.readFlagsFromFile(profileDir + '/flags.txt');
|
||||
initArgs = Object.assign(initArgs, extraFlags);
|
||||
|
||||
this.logger_.addTarget('file', { path: profileDir + '/log.txt' });
|
||||
//this.logger_.addTarget('console');
|
||||
this.logger_.setLevel(initArgs.logLevel);
|
||||
|
@ -122,4 +122,73 @@ function wrap(text, indent, width) {
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = { removeDiacritics, escapeFilename, wrap };
|
||||
function splitCommandString(command) {
|
||||
let args = [];
|
||||
let state = "start"
|
||||
let current = ""
|
||||
let quote = "\""
|
||||
let escapeNext = false;
|
||||
for (let i = 0; i < command.length; i++) {
|
||||
let c = command[i]
|
||||
|
||||
if (state == "quotes") {
|
||||
if (c != quote) {
|
||||
current += c
|
||||
} else {
|
||||
args.push(current)
|
||||
current = ""
|
||||
state = "start"
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
if (escapeNext) {
|
||||
current += c;
|
||||
escapeNext = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (c == "\\") {
|
||||
escapeNext = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (c == '"' || c == '\'') {
|
||||
state = "quotes"
|
||||
quote = c
|
||||
continue
|
||||
}
|
||||
|
||||
if (state == "arg") {
|
||||
if (c == ' ' || c == '\t') {
|
||||
args.push(current)
|
||||
current = ""
|
||||
state = "start"
|
||||
} else {
|
||||
current += c
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
if (c != ' ' && c != "\t") {
|
||||
state = "arg"
|
||||
current += c
|
||||
}
|
||||
}
|
||||
|
||||
if (state == "quotes") {
|
||||
throw new Error("Unclosed quote in command line: " + command)
|
||||
}
|
||||
|
||||
if (current != "") {
|
||||
args.push(current)
|
||||
}
|
||||
|
||||
if (args.length <= 0) {
|
||||
throw new Error("Empty command line")
|
||||
}
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
module.exports = { removeDiacritics, escapeFilename, wrap, splitCommandString };
|