mirror of
https://github.com/laurent22/joplin.git
synced 2024-11-24 08:12:24 +02:00
* 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:
parent
16cf0a3058
commit
1e9a0036e7
@ -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