diff --git a/fr-calendar.css b/fr-calendar.css index 046d022..1417f04 100644 --- a/fr-calendar.css +++ b/fr-calendar.css @@ -17,6 +17,7 @@ width: 100%; display: flex; min-width: 1000px; + z-index: 10; } .frcal__month_first { diff --git a/main.js b/main.js index fb328f1..cd76382 100644 --- a/main.js +++ b/main.js @@ -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)