Unable to paste from spreadsheet

Affected version
2.3
I'm trying to copy and paste a table from Microsoft excel into a post, however the editor is unable to handle it.

I have disabled all addons and the issue persist.

I have attached two screenshots. The first one shows what the editor looks like. At first when you paste the table it looks correct. When you toggle BB code, it turns into the image. That is also the final result when you post.

I also attached a picture of the console log.

This previously worked before upgrading to 2.3
 

Attachments

  • 2024-07-16_11-31.webp
    2024-07-16_11-31.webp
    5.3 KB · Views: 56
  • 1721097169679.webp
    1721097169679.webp
    104.6 KB · Views: 53
i can't reproduce it with my sample workbook.

have you tried another workbook? perhaps theres something funky in the sheet source that's causing the issue.
 
I'm trying to copy and paste a table from Microsoft excel into a post, however the editor is unable to handle it.

I have disabled all addons and the issue persist.

I have attached two screenshots. The first one shows what the editor looks like. At first when you paste the table it looks correct. When you toggle BB code, it turns into the image. That is also the final result when you post.

I also attached a picture of the console log.

This previously worked before upgrading to 2.3
Attach the microsoft excel file here so that we can test it out.
 
The spreadsheet table is simple, it's just:

a1
b2
c3

It doesn't look like I'm able to attach a .xlsx file here and i'm not sure if I"m allowed to link to a third party file uploader.
I've attached a picture of the sheet itself.

Interestingly, I just noticed it doesn't work here as well when I paste it in. I have checked my other xenforo site which is still on 2.2 and it's working fine.
 

Attachments

  • 2024-07-17_21-59.webp
    2024-07-17_21-59.webp
    4.9 KB · Views: 33
I noted it only did it on NUMBER cols (as they are right aligned. throwing the RIGHT bbcode in there causes the issue


aAI
bBII
cCIII
dDIV

all letters is ok so long as you don't align it.


As a stop gap, set the numeric cols to left align in your workbook and paste again
 
I've had trouble with it messing up tables after the update myself. such as...

Original: https://web.archive.org/web/2021100...ortable-2-infinity-cwcheats-npjh-50332-a.html

2.3's version.... https://www.vgcheat.com/threads/phantasy-star-portable-2-infinity-cwcheats-npjh-50332.181792/

One is from archive.org where vbulletin displayed it properly, the other is after the xenforo 2.3 update. Some tables have similar issues.

It's important to not also that xenforo 2.2 did not have any issues, and this seems to have occurred with xenforo 2.3 update.
Even test threads here suffer from the same issue.
 

Attachments

  • Screenshot (221).webp
    Screenshot (221).webp
    63.7 KB · Views: 15
  • Screenshot (220).webp
    Screenshot (220).webp
    34.7 KB · Views: 11
Last edited:
Our users are rightfully complaining from this bug. We have a lot of posts which contains table. Any quick fix would be great.
 
Our users are rightfully complaining from this bug. We have a lot of posts which contains table. Any quick fix would be great.
I have not tried it but this may possibly fix it. Let us know.

 
Paste from Google spreadsheet looks fine at first

Here is screenshot:

Screenshot 2024-08-05 at 13.44.37.webp


But this is how it renders



[td]
1

[/td][td]
2

[/td][td]
3

[/td]
[td]
4

[/td][td]
5

[/td][td]
6

[/td]

The initial bbcode has a FONT

Code:
[FONT=Arial][TABLE width="0px"]
[TR]
[RIGHT][td][RIGHT]1[/RIGHT][/td][td][RIGHT]2[/RIGHT][/td][td][RIGHT]3[/RIGHT][/td][/RIGHT]
[/TR]
[TR]
[RIGHT][td][RIGHT]4[/RIGHT][/td][td][RIGHT]5[/RIGHT][/td][td][RIGHT]6[/RIGHT][/td][/RIGHT]
[/TR]
[/TABLE][/FONT]

But when xenForo to strips out the font it also takes out out the TABLE and TD
 
Ugh, this bug was unexpected. Copy-pasting tables into XenForo 2.3 is completely broken and our users are complaining.

In my tests, the bug is not caused by the FONT BBCode but by the LEFT and/or RIGHT BBCodes that mess up the table structure.
 
Ugh, this bug was unexpected. Copy-pasting tables into XenForo 2.3 is completely broken and our users are complaining.

In my tests, the bug is not caused by the FONT BBCode but by the LEFT and/or RIGHT BBCodes that mess up the table structure.

You should give it a try:

 
Thanks but I'm not keen on installing an add-on to fix this bug. The add-on has more features than fixing this bug which users would likely use and which would break once we uninstall it again.
 
A possible quick and dirty workaround:

Diff:
--- a/src/XF/Html/Renderer/BbCode.php
+++ b/src/XF/Html/Renderer/BbCode.php
@@ -1424,6 +1424,12 @@ class BbCode
                    }
                }
 
+               // Workaround: https://xenforo.com/community/threads/unable-to-paste-from-spreadsheet.223298/
+               if (preg_match('/^\[(th|td)/i', $text))
+               {
+                   return $text;
+               }
+
                return "[$alignmentUpper]{$text}[/$alignmentUpper]";
 
            default:
 
Back
Top Bottom