As of a few weeks, the Key Text field in Prismic strips out white space. We were using this to allow editors to work on SRT files for video and sound captions. White space is important in SRTs which will break if the white space is stripped out. As a result, our editors are having to go back in and add the line breaks caption by caption, which is a big job when there are hundreds of captions. We’ve been using Prismic for years, the Key Text field always used to respect white space and I don’t see why it should stop.
Hey @smithj,
Thanks for raising this. I’m not able to recreate the behavior – key text fields I’ve tried keep the white space on save and on publish, even when copy pasting from another source. Could you show me what’s going on with screenshots or (even better) a Jam recording? Seeing what you see will help us troubleshoot this better. Thanks!
Hey @Ezekiel, thanks for coming back to me. I don’t use Jam, but I made a brief screen recording of the issue that you can watch here. I hope that explains everything:
Hey @smithj,
Thanks for the video, that does provide more context.
I’m able to reproduce this, I think it comes from the .srt file extension, as the spaces work perfectly with a text file. I’m going to file a bug report for this, but as I can’t promise when it will get fixed and prioritised, for now I can recommend switching the file to a .txt file (or others) and copy/pasting it from there. I know it’s not ideal, but at least it should be faster than re-adding the lines one by one in Prismic. You might even be able to paste it from a .srt file to something else and then into Prismic. That worked for me and was only 1 in-between step.
Let me know if that works for you!
Thanks @Ezekiel, I don’t see why the .srt file extension should have any effect. In my screen recording, I just copied the text in the srt from VS Code into Prismic. There’s no reason for the text encoding to have changed from VS Code → Prismic simply because it came from an .srt file.
I tried to repeat your solution, of changing the file extension from .srt to .txt and had the same results as in my screen recording.
The most likely explanation (I think) is that code running on the Prismic client is stripping out extra line breaks when text is pasted into the Key Text field. This didn’t used to happen, we’ve been using Prismic for years and it only started doing this recently.
Thanks for the fast response @Ezekiel. No frustration, we’re all bug fixers here!
Here’s the .srt file I used in my example: https://share-stuff.fra1.digitaloceanspaces.com/example.srt
After a couple exchanges with the team, can confirm the behavior may be linked to a recent modification of the Key Text field on our side – the workaround is still for the time being to use not a .txt file like I said previously but a .rtf file. This preserves the whitespace. This bug has been logged, and I’ll update this thread when we have an update on a fix ![]()