MyBB Community Forums

Full Version: JavaScript Error with Multiline Smilies (Disables Editor)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
In the ACP, you can add multiple lines to the "Text to Replace" section when adding a new smiley, so that the smiley displays when either line is typed.

However in the WYSIWYG editor, this breaks the JSON object containing the smilies (as a JSON key will have a newline character in it), which will result in a JavaScript error message (unterminated string literal) and the entire editor will fail to load.
Can't reproduce - I separated 4 replacements with \n and all of them are working fine.
1. Which WYSIWYG editor do you mean? Default SCEditor or anything else?
2. Which MyBB version do you use? 1.8.4 or 1.8.5 development from github?
3. What's exactly your replacement text?
Please let us know.

EDIT: found another bug though btw: https://github.com/mybb/mybb/issues/1955
(2015-04-12, 06:37 AM)Destroy666 Wrote: [ -> ]Can't reproduce - I separated 4 replacements with \n and all of them are working fine.
1. Which WYSIWYG editor do you mean? Default SCEditor or anything else?
2. Which MyBB version do you use? 1.8.4 or 1.8.5 development from github?
3. What's exactly your replacement text?
Please let us know.

EDIT: found another bug though btw: https://github.com/mybb/mybb/issues/1955

1. Default. Just upgraded my forums to 1.8.4 and customised the default templates (but no customisations to templates which handle the smiley code)
2) 1.8.4
3) The replacement text is:


:D
:big-grin:

I just added the :big-grin: one back and the problem still occurs. The HTML source code that generates is below (have stripped out irrelevant details)

emoticons: {
 // Emoticons to be included in the dropdown
 dropdown: {
 ":D
": "https://xxx/images/smilies/biggrin.gif",":@": "...",
 },
 // Emoticons that are not shown in the dropdown but will still be converted. Can be used for things like aliases
 hidden: {
 ":big-grin:": "https://xxx/images/smilies/biggrin.gif",
 }
 },


It looks like the newline character isn't being stripped out of the key properly. I'm using OS X with Firefox to make the edits if that makes any difference at all.
I still can't reproduce with that replacement. Please check if disabling that Cloudflare feature fixed this too. If not, which web server software do you use? Is it perhaps something from Microsoft?
Just checked and no, the issue still arises even with the disabled CloudFlare feature. This occurred before I even configured CloudFlare so I don't think it's anything to do with that.

I'm using an nginx server, and the forum has run on nginx for 3 years or so with no problems with the smilies. As far as I can tell, this problem arose when we upgraded to MyBB 1.8 and the new WYSIWYG editor was implemented.
Ok, found the cause. It happens only when saving multireplacement smilies in Mass Edit because the code which takes care of imploding by \n was never added to it.

Hi,

Thank you for your report. We have pushed this issue to our Github repository for further analysis where you can track our commits and progress with fixing this bug. Discussions regarding this bug may also take place there too.

Follow this link to visit the issue on Github: https://github.com/mybb/mybb/issues/1975

Thanks for contributing to MyBB!

Regards,
The MyBB Group