TuomoKu / SPX-GC

SPX is a graphics control client for live video productions and live streams using CasparCG, OBS, vMix, or similar software.
https://spx.graphics
MIT License
315 stars 64 forks source link

Playout inconsistencies with textarea newlines #69

Open petterw03 opened 2 years ago

petterw03 commented 2 years ago

If using the textarea field type and json dataformat, newlines are parsed differently depending on if play or update command is used.

Template definition:

  window.SPXGCTemplateDefinition = {
      "description": "Textarea test",
      "playserver": "OVERLAY",
      "playchannel": "1",
      "playlayer": "10",
      "webplayout": "10",
      "steps" : "1",
      "out": "manual",
      "uicolor": "2",
      "dataformat": "json",
      "DataFields": [
        {
          "field": "f0",
          "ftype": "textarea",
          "title": "Content",
          "value": "",
        },
      ],
    };

Example input: image

Value of f0 when using play: Test test test<br>Second line test

Value of f0 when using update: Test test test\nSecond line test

So on play(), the newline is converted to an escaped <br> tag, which seems to be happening here: https://github.com/TuomoKu/SPX-GC/blob/master/routes/routes-application.js#L1359-L1372

But for some reason, the same is not done on update(). This makes it hard to code template logic that detects newlines.

TuomoKu commented 1 week ago

Yeah, update functionlity is difficult and may need custom logic per template. And as such, update functionality still is problematic on many levels. Will keep this here as a reminder for future updates.