1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-15 23:00:36 +02:00

All: Allow sorting notes by various fields

This commit is contained in:
Laurent Cozic
2018-02-22 18:58:15 +00:00
parent 74d255c056
commit 8a96cf3434
13 changed files with 252 additions and 51 deletions

View File

@ -33,17 +33,20 @@ dialogs.confirm = (parentComponent, message) => {
});
};
dialogs.pop = (parentComponent, message, buttons) => {
dialogs.pop = (parentComponent, message, buttons, options = null) => {
if (!parentComponent) throw new Error('parentComponent is required');
if (!('dialogbox' in parentComponent)) throw new Error('A "dialogbox" component must be defined on the parent component!');
if (!options) options = {};
if (!('buttonFlow' in options)) options.buttonFlow = 'auto';
return new Promise((resolve, reject) => {
Keyboard.dismiss();
let btns = [];
for (let i = 0; i < buttons.length; i++) {
btns.push({
text: buttons[i].title,
text: buttons[i].text,
callback: () => {
parentComponent.dialogbox.close();
resolve(buttons[i].id);
@ -54,6 +57,7 @@ dialogs.pop = (parentComponent, message, buttons) => {
parentComponent.dialogbox.pop({
content: message,
btns: btns,
buttonFlow: options.buttonFlow,
});
});
}