Fixed  Using [img] tag directly in WYSIWYG editor parses incorrectly

wwwicked

Active member
When using a WYSIWYG editor, I find it's often quicker to explicitly type BB codes than not, particularly for simple tags.

I've noticed that the [ img] tag is parsed incorrectly when I do this, resulting in broken images. For example, if I type:

Code:
[img]http://red-rose.com/images/halloween2.jpg[/img]

It gets translated into:

Code:
[IMG]http://[URL]http://red-rose.com/images/halloween2.jpg[/URL][/IMG]
 
There's clearly something with automatic URL parsing there, but I can't reproduce this. What browser are you using? As far as I know, IE is the only one which does automatic URL linking now.

I could get something to happen if I pasted the URL in and then tried to wrap it in image tags. That's really hard to handle though, as IE actually sticks the linked URL through half of the closing image tag.
 
I am using Chrome on Windows Vista.

I can't seem to reproduce it either at the moment, but it wasn't just me who noticed it. I had reports of the same behaviour from other people using my forum. Odd, as I double checked it was a reproducible bug a few times before I posted. I'll keep trying to reproduce it again, and update the thread if and when I encounter the problem.
 
OK, I've worked it out, I think.

When I copy a URL from Chrome's address bar, and paste it in to the Xenforo edit box, it gets copied with formatting (i.e. wrapped in [ URL][/ URL]). This doesn't happen in Firefox; in Firefox, the image URL is pasted plain, without any magic wrapping.

In Chrome, if I right click an image and select "Copy image URL", it's also pasted plain. So it only seems to be an issue when copying from the Chrome address bar.

As an aside to this, is it possible to tell Xenforo not to use "smart pasting" (aside from using the plain text editor)? Most of the time, I find people just want to paste text, not all the formatting.

I haven't tested IE, Safari, Opera or anything else.

Seems IE9 Beta does the smart/formatted paste (therefore is broken), while Opera 10 pastes the URL plain, so wrapping it in [ img] works as desired.
 
Top Bottom