mirror of
https://github.com/zadam/trilium.git
synced 2025-12-23 08:39:57 +01:00
add API to add plugin buttons, fixes
This commit is contained in:
11
src/scripts/today.js
Normal file
11
src/scripts/today.js
Normal 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);
|
||||
};
|
||||
@@ -65,6 +65,8 @@
|
||||
});
|
||||
}
|
||||
|
||||
data.sort((a, b) => a.date < b.date ? -1 : +1);
|
||||
|
||||
return data;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user