[OzzModz] Table BBcode Tweak

[OzzModz] Table BBcode Tweak 2.3.0

No permission to download

Mr. Jinx

Well-known member
Mr. Jinx submitted a new resource:

Table BBcode Tweak - Add [TABLE=full] and [TABLE=collapse] to BBcode

By default all BBcode tables are full width (100%) with XenForo 2.1.
This add-on makes it possible to use full or collapse width.

[TABLE=collapse]:

View attachment 195148

[TABLE=full]:
View attachment 195149

Options:

Set forum default to display tables with full or collapse width:
View attachment 195150

Add extra spacing between cells if needed:
[ATTACH...

Read more about this resource...
 
happy to see this :)

i was thinking tho, sometimes one is better, sometimes the other....seems like the bbcode option can be manually edited in post, but if it was possible to have it in table options that would be pretty tight!
 
I tried to do that that too, but doesn't seem possible. The WYSIWYG editor is a vendor javascript (froala), which comes as a compiled version for XF.
As far as I know, the add-on system has no nice way to hack into that. If someone knows more about this please let me know.
 
i wonder perhaps even as a custom bbcode buttons?
...its a side thought but anyway, but i was wondering what if it had the normal default table option....but if you select a table then click one or the other custom buttons it applies the option code....i guess there could be no way to toggle tho really without manual deletion....yeah messy one i guess hmm..

thanks anyway for this
 
for us it´s not working under 2.1. After installing the addon we put the BB-Code into the editor by clicking the BB-Code Icon on the right side. But we can only see the code - not the table.
 

Attachments

  • table.webp
    table.webp
    12.4 KB · Views: 16
Not sure, when you toggle the BB-code view, you can modify the table bbcode.
When you go back to the normal view (or press preview), you still see bbcode?
 
And another thing to check...
Are these files on the server:
\src\addons\MrJinx\TableTweak\XF\BbCode\Renderer\Html.php
\src\addons\MrJinx\TableTweak\XF\BbCode\Renderer\EditorHtml.php
 
for us it´s not working under 2.1. After installing the addon we put the BB-Code into the editor by clicking the BB-Code Icon on the right side. But we can only see the code - not the table.
There is actually a related bug to this.. :X3:

I've posted the following:
Code:
[TABLE]
[TR][TH]Header 1[/TH][TH]Header 2[/TH][/TR]
[TR][TD]Content 1[/TD][TD]Content 2[/TD][/TR]
[/TABLE]

[TABLE=collapse]
[TR][TH]Header 1[/TH][TH]Header 2[/TH][/TR]
[TR][TD]Content 1[/TD][TD]Content 2[/TD][/TR]
[/TABLE]

[TABLE=full]
[TR][TH]Header 1[/TH][TH]Header 2[/TH][/TR]
[TR][TD]Content 1[/TD][TD]Content 2[/TD][/TR]
[/TABLE]
Which works just fine.. I go to edit it, still fine.

Click the "Toggle BB code" button on the editor, and the table codes are stripped of the options set, they each change to [TABLE]
 
I am not sure which one of your addon has this, but I get this in my server error logs:

public/js/MrJinx/vendor/jscookie/js.cookie.min.js" failed (2: No such file or directory)
 
In the older versions, I didn't include external files to the health check, so that explains :)
Right now, with the latest version, all files are included so you would notice if something is missing.
 
  • Like
Reactions: sbj
This is a really nice function, thank you.
Some ideas for it:

1. Very often programers use a name that has a meaning, but they forget that writers have to write it maybe many times in a day. Instead of full/collapsed i would prefer here f/c, so i will try to add it. Maybe some programers could learn to remember the time writers need to work and always add a normal and a short version.

2. Another problem from my view is:
inside/block of td - i will do this by hand for my tables, but maybe other would like to have it easier with a form inside the options like "block yes with mx of [____] pixel".

3. The biggest problem, i see with width of td, so it would be perfect to pass another var to the regex like:

[table=c,33%]

means the td should have 33% (also we need to define a breakpoint max for auto/value)

4. vertical align is another candidate

All together i wished we could have

(table=
{c|f|collapsed|full}
{n%}
{top}
and maybe also
{tn%} for the width of the table itself
{a} as trigger for nth:child even/odd to

With such small regex this would be wonderful to work with tables. :)
I had these things and some more with the add-on from TH in xf1, now i will have a look how things are done in xf2.[/table]
 
Fast result is something like:

Code:
                $col = "bbTable-{$defaultWidth} bbTable-{$defaultWidth}--default";
                $top = $wid = "";

                $arr = preg_split("|,|", $tagOption);


                foreach ($arr AS $k => $v) {
                    if ($v == "top")
                    {
                        $top = " vt";
                    }
                    elseif($v=="25" || $v=="33" || $v=="50")
                    {
                        $wid = " w".$v;
                    }
                    elseif($v=="c")
                    {
                        $col = "bbTable-{collapsed}";
                    }
                }

                return "<div class=\"bbTable\">\n<table class=\"".$col.$top.$wid."\">$tableHtml</table></div>";


While vt, w25, w33, w50 needs to be set as css also.
 
Nice! Especially the custom width was something I wanted to add, but the other features are also cool.
I will test this and post an update if it works. Thanks for providing an example.
 
Top Bottom