Starting with 1.5.0, if you have a link in the Google Calendar event, it breaks in the PGC tooltip.
Here’s an example. When I create an event using Google Calendar, I use the “Insert Link” toolbar button:
This is how the PGC tooltip used to look using PGC version 1.4.1. Note the “More info” link that was added as a link in Google Calendar, and is clickable in the PGC tooltip.
Now check out how the tooltip looks in 1.5.0. I see that you are now parsing bare URLs to turn them into links, but that breaks existing links.
On my site, I changed the pgcal_urlify() code in helpers.js so it skips any URLs already inside <a> tags or between <a> and </a> tags.
Here’s the updated code for that function (it uses the “Greatest Regex Trick Ever” described by Rex Egg to avoid replacing inside tags):
/**
* Detect URLs and encase them in <a>
*
* @param {*} text
* @returns
*/
function pgcal_urlify(text) {
const urlRegex = /<a[\s>].*?<\/a>|(https?:\/\/[^\s]+)/g;
if (text) {
return text.replace(urlRegex, function(m,group1) {
if (group1 === undefined || group1 === "") return m;
else return '<a target="_blank" href="'+m+'">'+m+'</a>';
})
}
return "";
}
I tried editing a (past — Sept 17) Google Calendar Event so that it has both a bare URL ) as well as a hyperlinked phrase (More info)…
… and the code now correctly fixes the bare URL (and has the nicer time and location you added in 1.5.0 !) but doesn’t break the existing hyperlink: