bogdancondorachi / kirby-table-field

📈 Table field plugin for Kirby CMS
https://getkirby.com/plugins/bogdancondorachi/table-field
MIT License
35 stars 2 forks source link

Formatting leads to additional columns after saving #11

Open ToGe88 opened 3 months ago

ToGe88 commented 3 months ago

So there is a very specific problem with the table formatting on save, i think. Here is what i found out so far:

When i type a quite long content inside a cell such as this (currently an exhibition title):

Bildschirmfoto 2024-05-30 um 20 38 40

and click safe, the plugin formats it to this:

Bildschirmfoto 2024-05-30 um 20 38 54

and in the content file to this:

Bildschirmfoto 2024-05-30 um 20 39 22

Unfortunately this happens whenever the page is safed. Currently i am on dev mode, but think it will be a problem when the page is live and the user wants to edit the table, which will happen some time since it is a client's CV Page.

Is there any possibility to prevent this behaviour?

gbdesign2023 commented 3 months ago

@ToGe88 I have been using the plugin successfully since the beginning, on almost all my installations. Unfortunately, I could not reproduce the problem you described. I have tried it with very long continuous text and also with manual line breaks. The text was saved and displayed correctly. Did you copy and paste the text or write it manually in the field? Can you post the code from the blueprint?

ToGe88 commented 3 months ago
image

It even happens when i type in long content like above. Blueprint is pretty straight-forward.

image

Also happens with a new draft page without anything pasted before:

image

Using Chrome on a Mac.

gbdesign2023 commented 3 months ago

@ToGe88 I have tried to reproduce your procedure. The text is saved as expected and also looks good in the .txt. I assume you are using the latest version of the plug-in and Kirby 4.2? It's best to wait for a response from @bogdancondorachi Maybe he can help.

table
"table": [
    [
        "",
        "",
        ""
    ],
    [
        "",
        "THE EYES THAT SAW <br>THE LIGHT MELTED<br>OUT OF SHEER <br>ECSTASY. BURN",
        "Brock Lesnar Proj"
    ]
]

However, I have noticed one difference: You use the table as a field and I use it in a block. Therefore, the output in our .txt looks different.

gbdesign2023 commented 3 months ago

@ToGe88 I have now been able to reproduce the problem when I use a table as a field. The problem does not occur with a block/layout.

tabel-test
twiro commented 3 months ago

I can confirm the buggy behavior described in this thread and noticed that the problem always appears whenever I type more than 40 characters in one cell (when the table is used as a field, not a block,as mentioned above)

With "Lorem Ipsum Lorem Ipsum Lorem Ipsum Lore" my table looks just fine and if I check the content in my .txt file it looks like this…

- 
  - ""
  - Lorem Ipsum Lorem Ipsum Lorem Ipsum Lore
  - ""

… but as soon as I add one more character and type "Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem" the whole table layout gets blown up and when I check the content in my .txt it has turned into this:

- 
  - ""
  - >
    Lorem Ipsum Lorem Ipsum Lorem Ipsum
    Lorem
  - ""

This formatting in the txt-file always seems to result in two additional columns in that specific row of the table layout and a weird behaviour in cell height all over the table.

And it can't be fixed by simply deleting the content of the concerned cells, the whole row has to be deleted to return to a well formatted table.

Would be awesome if you could release a fix for this bug, as it is a real showstopper for using tables as fields at the moment.

(My Setup is Kirby 4.2.0 and the latest release of this plugin)