2021-09-16 23:09:48 +02:00
|
|
|
import ButtonWidget from "./button_widget.js";
|
|
|
|
import appContext from "../../services/app_context.js";
|
2021-10-05 22:08:02 +02:00
|
|
|
import froca from "../../services/froca.js";
|
2021-09-17 10:09:42 +02:00
|
|
|
|
2021-09-16 23:09:48 +02:00
|
|
|
export default class OpenNoteButtonWidget extends ButtonWidget {
|
|
|
|
targetNote(noteId) {
|
2021-10-05 22:08:02 +02:00
|
|
|
froca.getNote(noteId).then(note => {
|
|
|
|
this.icon(note.getIcon());
|
|
|
|
this.title(note.title);
|
|
|
|
|
|
|
|
this.refreshIcon();
|
|
|
|
});
|
|
|
|
|
2021-09-16 23:09:48 +02:00
|
|
|
this.onClick(() => appContext.tabManager.openTabWithNoteWithHoisting(noteId, true));
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
2021-10-05 22:08:02 +02:00
|
|
|
|
|
|
|
initialRenderCompleteEvent() {
|
|
|
|
// we trigger refresh above
|
|
|
|
}
|
2021-09-16 23:09:48 +02:00
|
|
|
}
|