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 21:14:49 +00:00
commit 7d58763fe9
32 changed files with 182 additions and 108 deletions

View File

@ -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:

View File

@ -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') {

View File

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

View File

@ -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 ""

View File

@ -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"

View File

@ -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 ""

View File

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

View File

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

View File

@ -1,4 +1,3 @@
build/
app/node_modules/
dist/
app/lib/

View File

@ -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.

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 679 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 968 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

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

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());
}

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",
"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",

View File

@ -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
View File

View 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"

View File

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

View File

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

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