update menu text

This commit is contained in:
2024-05-15 11:19:01 +02:00
parent c91a015e79
commit 0c5f577464

29
main.js
View File

@@ -183,7 +183,7 @@ function processLine(line, noDate, date, data)
"date": stringifyDate(date),
"title": "Untitled",
"group": "default",
"location": null,
"location": "",
"state": "reminder",
"type": "reminder"
};
@@ -659,12 +659,12 @@ class CalendarView extends ItemView
{
this.touchEvent = { "event": event, "location": {x: e.touches[0].clientX, y: e.touches[0].clientY}, "time": new Date().getTime() };
setTimeout(() => {
if (this.touchEvent != null && ((new Date().getTime() - this.touchEvent.time) > 900))
if (this.touchEvent != null && ((new Date().getTime() - this.touchEvent.time) > 700))
{
this.openMenu(this.touchEvent.event, this.touchEvent.location);
this.touchEvent = null;
}
}, 1000);
}, 750);
}
else
{
@@ -710,10 +710,25 @@ class CalendarView extends ItemView
openMenu(event, location)
{
let text = "";
Object.keys(event).forEach(key => {
text += key + ": " + event[key] + "\n"
});
let time = [...event.date.matchAll(DateFormat.time)];
if (time.length == 1)
{
time = time[0];
}
else if (time.length == 2)
{
time = time[0] + "-" + time[1];
}
else
{
time = "<??>";
}
let loc = event.location;
if (loc != "")
{
loc = " {" + loc + "}";
}
let text = event.group + " " + time + loc;
let menu = new obsidian.Menu();
menu.addItem((item) => {