Oficial Spoiler BBCode Bug

Get help developing custom BBCodes or request one.
Post Reply
Tarantino
Registered User
Posts: 874
Joined: Sat Feb 18, 2012 1:51 pm

Oficial Spoiler BBCode Bug

Post by Tarantino »

So according to this: https://s9etextformatter.readthedocs.io ... y/#spoiler

I'm using:

[spoil]{TEXT}[/spoil]

Code: Select all

<div class="spoiler text-center">
    <div class="spoiler-header">
        <button class="btn center-block" onclick="var a=parentNode.nextSibling.style,b=firstChild.style,c=lastChild.style;b.display=a.display;a.display=c.display=(b.display)?'':'none'"><span>Show</span><span style="display:none">Hide</span></button>
    </div>
    <div class="spoiler-content" style="display:none">{TEXT}</div>
</div>
But when I'm previewing a post: posting.php?mode=edit&f=xx&t=yy&p=zz#preview

The Spoiler appears perfectly but when I click "Show", the page auto-refresh and I lose all my text. :?
User avatar
JoshyPHP
Code Contributor
Posts: 1288
Joined: Mon Jul 11, 2011 12:28 am

Re: Oficial Spoiler BBCode Bug

Post by JoshyPHP »

That's interesting. The content of the preview must be displayed inside of a form somehow. You can update the definition to include ;return!1 at the end of the onclick handler.

Also note that those definitions are not specifically designed for phpBB, they're just my own recommendation for a set of general BBCodes.
I wrote the library that handles markup in phpBB 3.2+.
Tarantino
Registered User
Posts: 874
Joined: Sat Feb 18, 2012 1:51 pm

Re: Oficial Spoiler BBCode Bug

Post by Tarantino »

Thanks, that worked!
Post Reply

Return to “Custom BBCode Development and Requests”