SimpleMachines / SMF

Simple Machines Forum — SMF in short — is free and open-source community forum software, delivering professional grade features in a package that allows you to set up your own online community within minutes!
https://www.simplemachines.org/
Other
581 stars 251 forks source link

"Toggle source view" strips hyperlinks in pasted rich-text #7455

Closed Geremia closed 2 years ago

Geremia commented 2 years ago

Description

Clicking "Toggle source view" strips hyperlinks in pasted rich-text.

Steps to reproduce

  1. Paste rich-text with hyperlinks into textarea.
  2. Click the "Toggle source view" button.

Environment (complete as necessary)

Additional information/references

Copying this: Screenshot 2022-05-08 at 14-41-31 Do married couples need to live sexually and pasting into the textarea: Screenshot 2022-05-08 at 14-43-21 Start new topic gives this, after clicking "Toggle source view":

Cappello, S.J., [i]Tractatus Canonico-Moralis de Sacramentis. Vol V. De Matrimonio[/i], p. 805 (quoted in McAuliffe, [i]Catholic Moral Teaching on the Nature and Object of Conjugal Love[/i] p. 77):

clicking "Toggle source view" again: Screenshot 2022-05-08 at 14-45-34 Start new topic

Sesquipedalian commented 2 years ago

Do the links work if you click on them in the editor immediately after pasting the text?

Geremia commented 2 years ago

@Sesquipedalian No.

The HTML of the rich-text I copied:

Cappello, S.J., <a href="https://archive.org/details/Cappello1947N.822840PA" rel="nofollow noreferrer">
<em>Tractatus Canonico-Moralis de Sacramentis. Vol V. De Matrimonio</em></a>, p. 805 (quoted in McAuliffe, 
<a href="https://isidore.co/calibre/#panel=book_details&amp;book_id=5766" rel="nofollow noreferrer">
<em>Catholic Moral Teaching on the Nature and Object of Conjugal Love</em></a> p. 77):

Pasting the rich-text copied in Firefox into a Thunderbird email retains the links, however.

Copying the hyperlinks from the editor and pasting that into Thunderbird also retains the hyperlinks.

Sesquipedalian commented 2 years ago

That means that those links are not being recognized by the editor as links at all. That is the reason they are not formatted as links when you toggle into source mode.

So the question is, why are these links not recognized as links?

To help diagnose that, first please tell us exactly what URLs those links are supposed to point to. Maybe that will give us a clue.

Sesquipedalian commented 2 years ago

Oh, you edited your comment while I was replying. Thanks for the additional information. Based on that, my first idea was wrong.

Next question: what rich text editor is this text being copied from?

Geremia commented 2 years ago

@Sesquipedalian I copied it from here.

Geremia commented 2 years ago

This bug is present in SMF 2.1.2, too.

Sesquipedalian commented 2 years ago

That's not surprising. SMF 2.1.2 had already been finalized before this issue report was opened. But we've got it on the milestone for 2.1.3, and @live627 definitely knows what he is doing with SCEditor, so it'll be fixed. 🙂