[nodebb-plugin-ns-spoiler] NS Spoiler


  • Plugin & Theme Dev

    Seems to break post with item lists


  • Plugin & Theme Dev

    Show code (markdown) and screenshot, will see is any solution for it 😉


  • Plugin & Theme Dev

    @Nicolas

    just add some posts with

    :::
    - 1
    - 2
    :::
    
    ::: 
    - ok
    - good
    :::
    

    and thrad will be broken

    seems to affect to profile pages also


  • Plugin & Theme Dev

    @exodo thanks.

    I think such construction will work well:

    :::
    Some text goes here

    • ok
    • good

    :::

    Code:

    ::: 
    Some text goes here
    
    - ok
    - good
    
    :::
    

    You could use for now, until solution will be provided.
    I think main problem here, list is relies on empty space around it.


  • Plugin & Theme Dev

    @Nicolas
    thank you, i dont use lists much but breaking the thread makes imposible to edit or open editor without console tricks so its important bug

    also i noticed this


  • Plugin & Theme Dev

    Ye, they are rendered in preview.
    They should be excluded in the same way as images, I think.

    https://github.com/NodeBB/NodeBB/issues/3896


  • Plugin & Theme Dev

    Ok, it works well with lists, but extra space around list is very important...
    Actually, if you don't have extra space (blank line) around list items, It also doesn't look good in composer preview. But yes, if you omit blank lines list with dashes (-) break layout. So some safe checks should be added to prevent such cases.

    0_1448326047376_Screen Shot 2015-11-23 at 7.45.35 PM.png


  • Plugin & Theme Dev

    Version 1.1.1

    Summary: safer to use

    • Additional handler for Markdown Plugin: unwrap lists. It's a safe check, so html will still be valid
    • Additional paragraph handlers for Markdown Plugin: shift spoiler tag (start or end) around artificial multilines
    • Extra paragraph wrapper around spoiler tag now be removed

    Performance of the plugin will be much-much higher, if Core devs provide some solution here 😉

    https://github.com/NodeBB/NodeBB/issues/3897


  • Plugin & Theme Dev

    Working good thank you



  • @Nicolas
    After a user created a longer posting with multiple spoilers, the forum stopped working properly for me (unresponsive buttons / missing pop-up menus).

    I played around with the posting that was made and figured out some problems related to the spoiler plugin.

    First, using a list before a spoiler containing a list breaks the spoiler.
    Here's the code:

    - asd
    - asd
    - asd
    
    ::: 
    This is a spoiler containing a list:
    
    - asd
    - asd
    - asd
    
    ::: 
    

    producing the output

    • asd
    • asd
    • asd

    This is a spoiler containing a list:

    • asd
    • asd
    • asd

    [empty spoiler tag]

    This part on its own does not yet break anything but just creates a badly formatted posting.

    Second (probably somewhat related), different kinds of lists inside the same spoiler will break the next spoiler following.

    Example code:

    ::: 
    - asd
    - asd
    - asd
    
    1) asd
    2) asd
    3) asd
    ::: 
    
    ::: 
    - asd
    - asd
    - asd
    ::: 
    

    results in

    [spoiler containing the part between the first spoiler tags]

    • asd
    • asd
    • asd
      [empty spoiler]

    Again, this problem alone does not result in a broken nodebb but just in malformatted output.

    Finally, I reduced the problem to a situation when both of the above examples are combined.

    A posting like this

    ::: 
    1) asd
    2) asd
    3) asd
    
    - asd
    ::: 
    
    - asd
    
    :::
    1) asd
    2) asd
    3) asd
    ::: 
    

    will break nodebb. The problematic thread / posting becomes impossible to delete without deactivating plugins because the moderation tools cannot be displayed.


  • Plugin & Theme Dev

    @phl thanks for extended info. Indeed, there is a problem with Markdown Plugin.
    For example, lists parsing will always try to concatenate ::: blocks. I already added several additional rules to address some list issues.
    But, It looks for me now a bit problematic, to have a dozen rules, just to handle parsing result from another plugin.

    There is a related issue, https://github.com/NodeBB/NodeBB/issues/3897
    As you can see, It's closed, and there is no alternative solution/proposition.

    I'm sure, that, if you have blank lines around ::: everything should be fine. But there is no way for now, to ask users to have blank lines around spoiler tags.

    Initially I thought about 2 pass parsing. 1 pass - add blank lines around spoiler tokens ::: before Markdown plugin, and 2 pass - apply spoiler rules. But, plugin hooks doesn't support 2 same hooks with different priorities.


  • Plugin & Theme Dev

    Version 2.0.0

    New version is available. Summary: compatibility is changed, now It's only NodeBB v1

    • Add Redactor WYSIWYG support
    • Add installation support for NodeBB v1

    P.S.
    Started to think about an implementation of true spoiler, where data should be fetched from the server.


  • Plugin & Theme Dev

    Version 3.0.0

    New version is available. Summary: different approach how spoiler content is populated. If you are not interested in major feature of v3, I recommend to use v2 of the plugin. Idea of v3 is to lazy load spoiler content only when It's needed. When web page is downloaded by the client there is no spoiler content.

    • Change spoiler delivering. Content of a spoiler isn't delivered anymore to the client.
    • Change HTML manipulation to create more safe result for paragraphs
    • Add requirement for multi-line spoiler, i.e. inline spoiler will not be parsed (will be converted to multiline)


  • After enabling the plugin and restarting the forum uses a very high CPU power, seconds alter the forum goes offline.

    0_1476010054818_upload-736b0c22-f91c-4cb2-85f5-a2b452e44d35

    The part in the red area is when I tested the plugin.

    After resetting the NS spoilers plugin, the forum was back online and accessible again.

    I installed the version in the ACP.

    The testpost I made was

    :::
    Sander hallo
    :::

    In a topic with 2200+ posts

    NodeBB v1.2.1.


  • Plugin & Theme Dev

    v3 version of the plugin?
    Did you have any errors in the console?
    Do you use other plugins which parse posts?



  • @Nicolas said in [nodebb-plugin-ns-spoiler] NS Spoiler:

    v3 version of the plugin?

    nodebb-plugin-ns-spoiler
    Latest 3.0.0

    Did you have any errors in the console?

    warn: [plugins/load] The following plugins may not be compatible with your version of NodeBB. This may cause unintended behaviour or crashing. In the event of an unresponsive NodeBB caused by this plugin, run ./nodebb reset -p PLUGINNAME to disable it.
     * nodebb-plugin-dailymotion

    Do you use other plugins which parse posts?

    I use these plugins

    nodebb-plugin-composer-default
    nodebb-plugin-custom-pages
    nodebb-plugin-dailymotion
    nodebb-plugin-dbsearch
    nodebb-plugin-embed-combo
    nodebb-plugin-google-analytics
    nodebb-plugin-google-search
    nodebb-plugin-gravatar
    nodebb-plugin-imgbed
    nodebb-plugin-imgur
    nodebb-plugin-markdown
    nodebb-plugin-mentions
    nodebb-plugin-ns-points
    nodebb-plugin-soundpack-default
    nodebb-plugin-youtube-embed
    nodebb-rewards-essentials
    nodebb-theme-persona
    nodebb-widget-essentials


  • Plugin & Theme Dev

    Embed Plugins parse content. Content parsing is an important step for the spoiler. When you are trying to get spoiler content, it goes though parsing process again, but only content. Maybe some plugin relies on the content. I think there could be a problem, when someone clicks on the spoiler to get It's content. Would be great if you can isolate your system for the single user, and just surf your forum, don't click spoilers. will you have CPU load?



  • @Nicolas said in [nodebb-plugin-ns-spoiler] NS Spoiler:

    Embed Plugins parse content. Content parsing is an important step for the spoiler. When you are trying to get spoiler content, it goes though parsing process again, but only content. Maybe some plugin relies on the content. I think there could be a problem, when someone clicks on the spoiler to get It's content. Would be great if you can isolate your system for the single user, and just surf your forum, don't click spoilers. will you have CPU load?

    I did. Always when I install a new plugin I set the forum to 'maintenance mode'. So I was the only one who was at the site. I try it again tonight when it's empty on my forum. I post the result 🙂


  • Plugin & Theme Dev

    @Nicolas said in [nodebb-plugin-ns-spoiler] NS Spoiler:

    Version 3.0.0

    New version is available. Summary: different approach how spoiler content is populated. If you are not interested in major feature of v3, I recommend to use v2 of the plugin. Idea of v3 is to lazy load spoiler content only when It's needed. When web page is downloaded by the client there is no spoiler content.

    • Change spoiler delivering. Content of a spoiler isn't delivered anymore to the client.
    • Change HTML manipulation to create more safe result for paragraphs
    • Add requirement for multi-line spoiler, i.e. inline spoiler will not be parsed (will be converted to multiline)

    new update breaks my forum

    ==== JS stack trace =========================================

    Security context: 0x3090f03b4629 <JS Object>
    2: format [util.js:~20] [pc=0x373b8e220cb1] (this=0x1ad68a34bb09 <an Object with map 0xd5216ae4a91>,f=0x5aa3e282289 <String[213]: <div class="ns-spoiler" data-index="%d" data-open="false"><div class="ns-spoiler-control"><a class="btn btn-default" href="#"><i class="fa fa-eye"></i> spoiler</a></div><div class="ns-spoiler-content"></div></div>>)
    3: arguments adaptor frame: 2->1
    4: /* ...


  • Plugin & Theme Dev

    @exodo Your error is related to V8.

    Both issues (@MJ and @exodo ) I can reproduce, when I downgrade to Node 4.0.0.
    I will investigate issue and push a patch update



Suggested Topics

| |