The discussion centers on the Snapblocks Discourse plugin, which allows users to render Snap! script blocks in posts using [snapblocks] or [sb] BBCode tags. The plugin is a fork of scratchblocks and offers various configuration options, including block styles, scaling, zebra coloring, and Santa hats. ego-lay_atman-bay explains that while scratchblocks code is largely compatible, a separate plugin is recommended for Scratch-specific forums due to minor syntax differences and polish issues. thoka asks about incompatibilities, and ego-lay_atman-bay clarifies that while compatible, a dedicated Scratch plugin would require more effort due to API differences. thoka suggests allowing separate block styles for the [scratchblocks] alias, a feature ego-lay_atman-bay agrees to investigate.
A significant portion of the thread discusses the plugin’s architecture. RGJ suggests converting the plugin into a theme component since it lacks server-side logic. ego-lay_atman-bay initially resists, citing the need for message parser hooks and WYSIWYG composer support, and concerns about admin configuration across multiple themes. However, RGJ argues that theme components can handle these JavaScript functionalities, have settings, and are easier to update without requiring server rebuilds. ego-lay_atman-bay acknowledges these points, noting that while plugin installation is simple for some, theme components are more accessible for admins without command-line access or for hosted plans. ego-lay_atman-bay agrees to attempt rewriting it as a theme component when possible. NateDhaliwal offers to help with the conversion, and ego-lay_atman-bay welcomes the assistance.
Snapblocks is a fork of scratchblocks that allows users to convert text into images of Snap! scripts. This Discourse plugin allows users to use snapblocks in their posts.
You can create snapblocks in a post, by typing snapblocks code inside [snapblocks][/snapblocks] bbcode tags. For example:
I’d say that the only incompatibilities are mainly just some minor syntax tweaks, like dropdown menus and the define block. For the most part, scratchblocks code is mostly compatible with snapblocks.
I do still think there should be a separate plugin for scratchblocks, since I know forums that are for scratch/scratch mods might not want to use snapblocks, since snapblocks is geared to work best for snap (and I have been lacking on the scratch styles polish), not to mention, I didn’t add the ability to switch the toolbar shortcut to use scratchblocks instead.
If anyone would like to try and create a scratchblocks plugin using this plugin as a base (I’m probably not going to get around to making one myself), I think it’s worth noting that the render function I used is not in the scratchblocks api, so it would take a bit more work than just dropping in scratchblocks.
It appears, at first glance, that there is no objection to utilizing this plugin for initial experiments (my environment being a school setting) and only then investing time into a Scratch plugin should the necessity arise.
Feature request: The block-style could be defined separately for the [scratchblocks] alias.
This would allow effortless usage of different styled Scratch and Snap! elements.
It’s hooking into the message parser in order to make sure nothing inside the tags are parsed, and includes many options for configuring the behavior. I also want to have the new WYSIWYG message composer support, but I’ve been having trouble getting that working well. I also mainly do not want the forum admins to have to enable it for every theme, cause that can cause problems and confusion (I’ve already seen that happen before).
So is there something I’m not understanding with the capabilities of a theme component, and can it just be an enable once globally and forget it type thing?
Installing a plugin is much more cumbersome than this and won’t work on Discourse.org hosted plans.
Besides, I think most forums only have one active theme.
Theme components can have settings and they can do everything that the Javascript side of a plugin can do. With the current state of the plugin you would not lose any functionality.
Don’t you just clone the repo into the plugins directory? I feel like that’s not very cumbersome. However, not working for the discourse hosted plans is valid.
Not the forum that this plugin was made for. But I did just check, and it seems the theme component settings ui has had a massive overhaul since the last time I had to deal with them, so it looks easier to manage than I remember.
I see, then I’ll try out rewriting it as a theme component, but I don’t think I’ll be able to get to it for a while due to other obligations.
That would be helpful, since I assume you might know more about discourse than I do (this plugin was mostly hacked together from reading other plugins).