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

Desktop: Resolves #2296: Right-click to move note to notebook (#2566)

* Assign Notebook functionality added

* Made the changes acc. to laurent22

* Changes done till 9/03/20

* Removed NoteContentPropertiesDialog.js

* Render notebooks in tree hierarchy

* Update PromptDialog.jsx

Co-authored-by: Laurent Cozic <laurent22@users.noreply.github.com>
This commit is contained in:
Siddhant Sehgal 2020-04-04 22:33:09 +05:30 committed by GitHub
parent 16cf0a3058
commit 1e9a0036e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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'),