Closed nwbowensby closed 4 years ago
Right after I submitted this ticket I thought of a google search I could try. Turns out this is a bug in Froala where the URL includes an @ sign. The @ sign is because the username I'm using on the test environment is an email address. I'm also noticing that the URL that appears to be saved for the link appears to be a preview link instead of a regular link. I am thinking this may also be an issue that needs to be looked at as you wouldn't want that link to go live.
I've been following this ticket out of curiosity and I've seen the commits thus far. I was curious to see if I could implement a temporary workaround using your code changes and thought you might find it helpful to learn what I found out.
I was able to set the MAIL_REGEX like you did but with the URLs generated off the page selector it still doesn't work. When you pick a page (or media) the URL is relative. I noticed in my debugging (trying to understand why your fix didn't work for me the way I did it) and noticed there is another regex for a url. It is a very complicated regex and I didn't break it down but I do not think it matches a relative url. I changed the url to be https://blahblahblah/witheverythingelsethesame and it didn't change it to a mailto. Not saying I have a solution but was able to learn a little bit more that might help point to one.
For the record I used the feature you have for creating a plugin to get access to the FroalaEditor object and set the regex. If you want me to test anything else for you since I'm the one who found the issue initially please let me know. I'll keep an eye out on the ticket and emails.
Hi @nwbowensby, thank you for trying it out to adjust the MAIL_REGEX through your custom plugin. That approach should have also worked for you, however as it turns it's a bug where a wrong FroalaEditor object was being passed when initializing custom plugins. There's a pull request #102 which fixes this.
Brief bug description
On our test site we have check in/out turned on. In this environment if we add a URL in the rich text editor for a page or media "mailto:" is prepended to the src when you look at it on the live site or a preview. In fact I just did another test and you can see it without ever leaving the editor. Here are the steps: