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

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

This commit is contained in:
Laurent Cozic 2017-11-16 20:31:55 +01:00
commit 092c09065f
19 changed files with 182 additions and 107 deletions

View File

@ -28,13 +28,17 @@ matrix:
before_install: before_install:
# HOMEBREW_NO_AUTO_UPDATE needed so that Homebrew doesn't upgrade to the next # 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. # 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 if [ "$TRAVIS_OS_NAME" == "osx" ]; then
HOMEBREW_NO_AUTO_UPDATE=1 brew install yarn HOMEBREW_NO_AUTO_UPDATE=1 brew install yarn
else else
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - 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 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 fi
script: script:

View File

@ -6,6 +6,7 @@ const { Note } = require('lib/models/note.js');
const { Resource } = require('lib/models/resource.js'); const { Resource } = require('lib/models/resource.js');
const { cliUtils } = require('./cli-utils.js'); const { cliUtils } = require('./cli-utils.js');
const { reducer, defaultState } = require('lib/reducer.js'); const { reducer, defaultState } = require('lib/reducer.js');
const { splitCommandString } = require('lib/string-utils.js');
const { reg } = require('lib/registry.js'); const { reg } = require('lib/registry.js');
const { _ } = require('lib/locale.js'); const { _ } = require('lib/locale.js');
@ -520,7 +521,7 @@ class AppGui {
let note = this.widget('noteList').currentItem; let note = this.widget('noteList').currentItem;
let folder = this.widget('folderList').currentItem; let folder = this.widget('folderList').currentItem;
let args = cliUtils.splitCommandString(cmd); let args = splitCommandString(cmd);
for (let i = 0; i < args.length; i++) { for (let i = 0; i < args.length; i++) {
if (args[i] == '$n') { if (args[i] == '$n') {

View File

@ -5,75 +5,6 @@ const stringPadding = require('string-padding');
const cliUtils = {}; 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) { cliUtils.printArray = function(logFunction, rows, headers = null) {
if (!rows.length) return ''; if (!rows.length) return '';

View File

@ -544,6 +544,9 @@ msgstr ""
msgid "Separate each tag by a comma." msgid "Separate each tag by a comma."
msgstr "" msgstr ""
msgid "Rename notebook:"
msgstr ""
msgid "Layout" msgid "Layout"
msgstr "" msgstr ""
@ -584,6 +587,9 @@ msgstr ""
msgid "Remove this tag from all the notes?" msgid "Remove this tag from all the notes?"
msgstr "" msgstr ""
msgid "Rename"
msgstr ""
msgid "Notebooks" msgid "Notebooks"
msgstr "" msgstr ""

View File

@ -603,6 +603,10 @@ msgstr "Modifier les étiquettes"
msgid "Separate each tag by a comma." msgid "Separate each tag by a comma."
msgstr "" msgstr ""
#, fuzzy
msgid "Rename notebook:"
msgstr "Nouveau carnet"
msgid "Layout" msgid "Layout"
msgstr "" msgstr ""
@ -649,6 +653,9 @@ msgstr "Supprimer le carnet ?"
msgid "Remove this tag from all the notes?" msgid "Remove this tag from all the notes?"
msgstr "" msgstr ""
msgid "Rename"
msgstr ""
#, fuzzy #, fuzzy
msgid "Notebooks" msgid "Notebooks"
msgstr "Nouveau carnet" msgstr "Nouveau carnet"

View File

@ -544,6 +544,9 @@ msgstr ""
msgid "Separate each tag by a comma." msgid "Separate each tag by a comma."
msgstr "" msgstr ""
msgid "Rename notebook:"
msgstr ""
msgid "Layout" msgid "Layout"
msgstr "" msgstr ""
@ -584,6 +587,9 @@ msgstr ""
msgid "Remove this tag from all the notes?" msgid "Remove this tag from all the notes?"
msgstr "" msgstr ""
msgid "Rename"
msgstr ""
msgid "Notebooks" msgid "Notebooks"
msgstr "" msgstr ""

View File

@ -1,6 +1,6 @@
{ {
"name": "joplin", "name": "joplin",
"version": "0.10.68", "version": "0.10.69",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -18,7 +18,7 @@
], ],
"owner": "Laurent Cozic" "owner": "Laurent Cozic"
}, },
"version": "0.10.68", "version": "0.10.69",
"bin": { "bin": {
"joplin": "./main.js" "joplin": "./main.js"
}, },

View File

@ -280,16 +280,6 @@ class Application extends BaseApplication {
this.initRedux(); 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 // 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 // receive the SETTING_UPDATE_ALL even, which mean state.settings will not be
// initialised. So we manually call dispatchUpdateAll() to force an update. // initialised. So we manually call dispatchUpdateAll() to force an update.

View File

@ -97,13 +97,14 @@ class MainScreenComponent extends React.Component {
folder = await Folder.save({ title: answer }, { userSideValidation: true }); folder = await Folder.save({ title: answer }, { userSideValidation: true });
} catch (error) { } catch (error) {
bridge().showErrorMessageBox(error.message); bridge().showErrorMessageBox(error.message);
return;
} }
this.props.dispatch({ if (folder) {
type: 'FOLDER_SELECT', this.props.dispatch({
id: folder.id, type: 'FOLDER_SELECT',
}); id: folder.id,
});
}
} }
this.setState({ promptOptions: null }); 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 { } else {
commandProcessed = false; commandProcessed = false;
} }

View File

@ -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()); menu.popup(bridge().window());
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"name": "Joplin", "name": "Joplin",
"version": "0.10.16", "version": "0.10.18",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
@ -10,14 +10,22 @@
"integrity": "sha512-+rr4OgeTNrLuJAf09o3USdttEYiXvZshWMkhD6wR9v1ieXH0JM1Q2yT41/cJuJcqiPpSXlM/g3aR+Y5MWQdr0Q==", "integrity": "sha512-+rr4OgeTNrLuJAf09o3USdttEYiXvZshWMkhD6wR9v1ieXH0JM1Q2yT41/cJuJcqiPpSXlM/g3aR+Y5MWQdr0Q==",
"dev": true, "dev": true,
"requires": { "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": { "7zip-bin-win": {
"version": "1.0.1", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/7zip-bin-mac/-/7zip-bin-mac-1.0.1.tgz", "resolved": "https://registry.npmjs.org/7zip-bin-win/-/7zip-bin-win-2.1.1.tgz",
"integrity": "sha1-Pmh3i78JJq3GgVlCcHRQXUdVXAI=", "integrity": "sha512-6VGEW7PXGroTsoI2QW3b0ea95HJmbVBHvfANKLLMzSzFA1zKqVX5ybNuhmeGpf6vA0x8FJTt6twpprDANsY5WQ=="
"optional": true
}, },
"@types/node": { "@types/node": {
"version": "7.0.46", "version": "7.0.46",

View File

@ -1,6 +1,6 @@
{ {
"name": "Joplin", "name": "Joplin",
"version": "0.10.16", "version": "0.10.18",
"description": "Joplin for Desktop", "description": "Joplin for Desktop",
"main": "main.js", "main": "main.js",
"scripts": { "scripts": {
@ -39,7 +39,7 @@
"optionalDependencies": { "optionalDependencies": {
"7zip-bin-mac": "^1.0.1", "7zip-bin-mac": "^1.0.1",
"7zip-bin-linux": "^1.0.1", "7zip-bin-linux": "^1.0.1",
"7zip-bin-win": "^1.0.1" "7zip-bin-win": "^2.1.1"
}, },
"dependencies": { "dependencies": {
"app-module-path": "^2.2.0", "app-module-path": "^2.2.0",

View File

@ -5,6 +5,8 @@ APP_DIR="$ROOT_DIR/app"
cd "$APP_DIR" cd "$APP_DIR"
VERSION="$(npm version patch)" VERSION="$(npm version patch)"
git add -A git add -A
git commit -m "Version $VERSION" git commit -m "Electron release $VERSION"
git tag $VERSION git tag $VERSION
git push && git push --tags git push && git push --tags
echo "Open https://github.com/laurent22/joplin/tags and create a draft release for tag $VERSION"

View File

@ -90,8 +90,8 @@ android {
applicationId "net.cozic.joplin" applicationId "net.cozic.joplin"
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 22 targetSdkVersion 22
versionCode 55 versionCode 56
versionName "0.9.42" versionName "0.9.43"
ndk { ndk {
abiFilters "armeabi-v7a", "x86" abiFilters "armeabi-v7a", "x86"
} }

View File

@ -11,6 +11,7 @@ const { Note } = require('lib/models/note.js');
const { Tag } = require('lib/models/tag.js'); const { Tag } = require('lib/models/tag.js');
const { Setting } = require('lib/models/setting.js'); const { Setting } = require('lib/models/setting.js');
const { Logger } = require('lib/logger.js'); const { Logger } = require('lib/logger.js');
const { splitCommandString } = require('lib/string-utils.js');
const { sprintf } = require('sprintf-js'); const { sprintf } = require('sprintf-js');
const { reg } = require('lib/registry.js'); const { reg } = require('lib/registry.js');
const { fileExtension } = require('lib/path-utils.js'); const { fileExtension } = require('lib/path-utils.js');
@ -63,7 +64,7 @@ class BaseApplication {
// Handles the initial flags passed to main script and // Handles the initial flags passed to main script and
// returns the remaining args. // returns the remaining args.
async handleStartFlags_(argv) { async handleStartFlags_(argv, setDefaults = true) {
let matched = {}; let matched = {};
argv = argv.slice(0); argv = argv.slice(0);
argv.splice(0, 2); // First arguments are the node executable, and the node JS file 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 (setDefaults) {
if (!matched.env) matched.env = 'prod'; if (!matched.logLevel) matched.logLevel = Logger.LEVEL_INFO;
if (!matched.env) matched.env = 'prod';
}
return { return {
matched: matched, matched: matched,
@ -272,6 +275,22 @@ class BaseApplication {
reg.dispatch = this.store().dispatch; 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) { async start(argv) {
let startFlags = await this.handleStartFlags_(argv); let startFlags = await this.handleStartFlags_(argv);
@ -302,6 +321,9 @@ class BaseApplication {
await fs.mkdirp(resourceDir, 0o755); await fs.mkdirp(resourceDir, 0o755);
await fs.mkdirp(tempDir, 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('file', { path: profileDir + '/log.txt' });
//this.logger_.addTarget('console'); //this.logger_.addTarget('console');
this.logger_.setLevel(initArgs.logLevel); this.logger_.setLevel(initArgs.logLevel);

View File

@ -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 };