add API to add plugin buttons, fixes

This commit is contained in:
azivner
2018-02-03 10:37:57 -05:00
parent 05575913db
commit 5bffba4e2f
8 changed files with 50 additions and 38 deletions

11
src/scripts/today.js Normal file
View File

@@ -0,0 +1,11 @@
api.addButtonToToolbar('go-today', $('<button class="btn btn-xs" onclick="goToday();"><span class="ui-icon ui-icon-calendar"></span> Today</button>'));
window.goToday = async function() {
const todayDateStr = formatDateISO(new Date());
const todayNoteId = await server.exec([todayDateStr], async todayDateStr => {
return await this.getDateNoteId(todayDateStr);
});
api.activateNote(todayNoteId);
};

View File

@@ -65,6 +65,8 @@
});
}
data.sort((a, b) => a.date < b.date ? -1 : +1);
return data;
});