-
Notifications
You must be signed in to change notification settings - Fork 378
Open
Description
I added this listener to improve the link popup window a bit (adding mailto: and https:// if needed, so people don't need to know this):
editor.events.on('afterOpenPopup.link', (popup) => {
const urlField = popup.container.querySelector('input[data-ref="url_input"]');
if (!urlField) return;
const urlval = urlField.value.trim();
if (!urlval) {
const contentval = popup.container.querySelector('input[data-ref="content_input"]').value.trim();
if (/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(contentval)) {
urlField.value = 'mailto:' + contentval;
} else if (/^(https?:\/\/)/i.test(contentval)) {
urlField.value = contentval;
} else {
urlField.value = 'https://' + contentval;
}
}
});
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels