Merge pull request #2754 from kolbyjack/broadcast-custom-symbols

This commit is contained in:
Michael Teeuw 2021-12-29 09:14:00 +01:00 committed by GitHub
commit 7a7ed48063
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 12 deletions

View File

@ -44,6 +44,7 @@ _This release is scheduled to be released on 2022-01-01._
- Fixed Calendar recurring cross timezone error (add/subtract a day, not just offset hours) (#2632)
- Fixed Calendar showEnd and Full Date overlay (#2629)
- Fixed regression on #2632, #2752
- Broadcast custom symbols in CALENDAR_EVENTS
## [2.17.1] - 2021-10-01

View File

@ -237,18 +237,6 @@ Module.register("calendar", {
symbolWrapper.className = "symbol align-right " + symbolClass;
const symbols = this.symbolsForEvent(event);
// If symbols are displayed and custom symbol is set, replace event symbol
if (this.config.displaySymbol && this.config.customEvents.length > 0) {
for (let ev in this.config.customEvents) {
if (typeof this.config.customEvents[ev].symbol !== "undefined" && this.config.customEvents[ev].symbol !== "") {
let needle = new RegExp(this.config.customEvents[ev].keyword, "gi");
if (needle.test(event.title)) {
symbols[0] = this.config.customEvents[ev].symbol;
break;
}
}
}
}
symbols.forEach((s, index) => {
const symbol = document.createElement("span");
symbol.className = "fa fa-fw fa-" + s;
@ -640,6 +628,17 @@ Module.register("calendar", {
symbols = this.mergeUnique(this.getCalendarPropertyAsArray(event.url, "fullDaySymbol", this.config.defaultSymbol), symbols);
}
// If custom symbol is set, replace event symbol
for (let ev of this.config.customEvents) {
if (typeof ev.symbol !== "undefined" && ev.symbol !== "") {
let needle = new RegExp(ev.keyword, "gi");
if (needle.test(event.title)) {
symbols[0] = ev.symbol;
break;
}
}
}
return symbols;
},