Lua command incorrectly saves text

I’m using a Lua command to send Slack messages to my workspace. Using an emoji string at the end of the text string does not get saved correctly.

payload = json.encode({
  text = "I've finished photographing the garden. :camera_with_flash:"
})

gets saved as

payload = json.encode({
  text = "I've finished photographing the garden.
})

or

payload = json.encode({
  text = "I've finished photographing the garden. :camera
})

Note that it seems inconsistent in what is saved, but key here is that it’s missing a closing double quote which breaks the script.

I’m entering these strings from my phone, and I have to turn off the monospaced editor for me to even be able to enter text. I tap the A button on the command to switch to plain text mode which allows me to type.

Tried to reproduce, but it worked fine for me all the time. Writing things in the “fancy editor” doesn’t really work on smartphone as you said. Using the backspace on the onscreen keyboard doesn’t work which makes typos really painful.

1 Like

@mdingena This sounds like an issue on mobile, as I have previously built Lua scripts that use emojis (on desktop). I will add this to the backlog.

1 Like

Status update: We were unable to reproduce. We are considering disabling the fancy editor on mobile entirely. More investigation is required.

I copy pasted the emoji codes from Slack, perhaps it has something to do with pasting text rather than manually typing with individual keystrokes (don’t know if there is some JS listening for keyup events or something that may be missed with pasting from a soft keyboard).

It’s likely related to using a soft keyboard and not fully registering keystroke events or paste events.

I’ve since managed to get correct messages simply by using a desktop. I think a viable solution for now would be to disable the fancy but please add some CSS to give the not-fancy editor a monospaced font!

1 Like

Are you using any browser extensions that modify/read text input boxes? Examples are password managers, grammar plugins such as Grammarly, etc…

EDIT: I updated the previous comment with regards to your monospace font comment. I read the “not-fancy” part as “fancy”.

I understand what you’re saying about the monospace font. I will add that to the list.

On work Macbook I use 1Password. On my own desktop no such plugins. On my Android phone I don’t use browser plugins. It uses the Gboard soft keyboard. In all cases it would be in the Chrome browser.

@mdingena Quick update: I was able to reproduce yesterday, so that’s good. The bad part is I still don’t have a consistent set of steps to reproduce (only happened ~10% of the time on my machine).

Can you take a screenshot of your Javascript console next time it happens? I think this might be a problem with Monaco (the library that powers the fancy editor).

It’s been a while since I use DevTools on my phone. I hope the experience has been improved since. I’ll let you know if I find anything.

1 Like