fix position of mounth view

This commit is contained in:
Laila van Reenen 2024-05-15 19:48:31 +02:00
parent 7b36ee9094
commit 99bcc99ce4
Signed by: LailaTheElf
GPG Key ID: 1F4E6EE3E6DDF769
2 changed files with 12 additions and 2 deletions

View File

@ -17,6 +17,7 @@
width: 100%;
display: flex;
min-width: 1000px;
z-index: 10;
}
.frcal__month_first {

13
main.js
View File

@ -293,7 +293,7 @@ class CalendarView extends ItemView
this.eventsEls = {};
// mount view
this.mountView = container.createEl("div", { cls: "frcal__mountView" });
this.mountView = container.createEl('div', { attr: { style: "height:0" } }).createEl("div", { cls: "frcal__mountView" });
// month
this.monthEl = container.createEl("div", { cls: "frcal__month" });
@ -399,9 +399,11 @@ class CalendarView extends ItemView
let table = this.mountView.createEl('table');
for (let week = moment(startMonth); week < endMonth; week.add(1, "weeks"))
{
let date = stringifySingleDate(week).match(DateFormat.week);
let row = table.createEl("tr", {
attr: {
onclick: "app.workspace.getLeavesOfType('" + VIEW_TYPE_CALENDAR + "')[0].view.mountViewClick('" + stringifySingleDate(week).match(DateFormat.week) + "')"
'id': "frcal_mountview_" + date,
'onclick': "app.workspace.getLeavesOfType('" + VIEW_TYPE_CALENDAR + "')[0].view.mountViewClick('" + date + "')"
}
});
@ -434,6 +436,13 @@ class CalendarView extends ItemView
}
}
this.mountView.style.display = "block";
setTimeout(() => {
document.getElementById('frcal_mountview_' + stringifySingleDate(moment()).match(DateFormat.week)).scrollIntoView({
behavior: 'instant',
block: 'center',
inline: 'center'
});
}, 10);
}
mountViewClick(week)