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 2020-04-04 18:31:56 +01:00
commit 0707a0e05f
3 changed files with 44 additions and 1 deletions

View File

@ -208,6 +208,35 @@ class MainScreenComponent extends React.Component {
},
},
});
} else if (command.name === 'moveToFolder') {
const startFolders = [];
const maxDepth = 15;
const addOptions = (folders, depth) => {
for (let i = 0; i < folders.length; i++) {
const folder = folders[i];
startFolders.push({ key: folder.id, value: folder.id, label: folder.title, indentDepth: depth });
if (folder.children) addOptions(folder.children, (depth + 1) < maxDepth ? depth + 1 : maxDepth);
}
};
addOptions(await Folder.allAsTree(), 0);
this.setState({
promptOptions: {
label: _('Move to notebook:'),
inputType: 'dropdown',
value: '',
autocomplete: startFolders,
onClose: async answer => {
if (answer != null) {
for (let i = 0; i < command.noteIds.length; i++) {
await Note.moveToFolder(command.noteIds[i], answer.value);
}
}
this.setState({ promptOptions: null });
},
},
});
} else if (command.name === 'renameFolder') {
const folder = await Folder.load(command.id);

View File

@ -117,10 +117,11 @@ class PromptDialog extends React.Component {
fontFamily: theme.fontFamily,
backgroundColor: theme.backgroundColor,
}),
option: provided =>
option: (provided, state) =>
Object.assign(provided, {
color: theme.color,
fontFamily: theme.fontFamily,
paddingLeft: `${10 + (state.data.indentDepth || 0) * 20}px`,
}),
multiValueLabel: provided =>
Object.assign(provided, {

View File

@ -35,6 +35,19 @@ class NoteListUtils {
})
);
menu.append(
new MenuItem({
label: _('Move to notebook'),
click: () => {
props.dispatch({
type: 'WINDOW_COMMAND',
name: 'moveToFolder',
noteIds: noteIds,
});
},
})
);
menu.append(
new MenuItem({
label: _('Duplicate'),