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:
commit
0707a0e05f
@ -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);
|
||||
|
||||
|
@ -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, {
|
||||
|
@ -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'),
|
||||
|
Loading…
Reference in New Issue
Block a user