[Editor] Synopsis single-line editor clobbers all newlines

Contributor
Joined
Jan 18, 2018
Messages
74
As in thread title, making any changes to the Synopsis box in its single-line view causes the entire existing synopsis to lose any newlines/line breaks it has.
There are two reasons for this:
1) The Synopsis single-line input box uses <input>, which automatically strips all line breaks from its value property, instead if <textarea>
2) There is logic being performed on all input boxes in the editor (I only have obfuscated site code, sorry) that strips all newlines anyways, where it should instead check inputCategory before stripping newlines:
Code:
...
            const $ = a.value;
            y.inputType === "insertParagraph" && y.preventDefault();
            let R = $.value.replaceAll(/\r?\n|\r/g, ""); // THIS LINE
            if (o.inputCategory === "Author Contact" && (R = R.replaceAll(/\s/g, "")),
            o.options.length > 0 && o.options[0]) {
                let W = [];
...

At the very least, if the section of the synopsis being edited in the single-line editor doesn't involve any newlines, other newlines later in the synopsis shouldn't be removed.

(What I mean by single-line editor):
Screenshot 2025-04-04 at 2.39.50 AM.png

There are two solutions I can see here, either:
Swap this input for a <textarea> and disable the newline replaceAll for Synopsis. There are existing solutions around the web for a textarea that takes up a single line but maintains any newlines in its value that can be used here to achieve the same appearance without clobbering the newlines in the existing value.
- or -
Disallow editing Synopsis from the single-line view entirely, only allowing it to be viewed from the single-line view without allowing any text entry in it. This would simply involve adding disabled to the input. I'd also recommend adding a style cursor: not-allowed for clarity.

I'd be happy to try my hand at either of these changes on the codebase if that's something that MD allows.
 
Last edited:
୧⍢⃝୨
Staff
Super Moderator
Joined
Jan 7, 2023
Messages
261
Hi, for the record, I created a new ticket in our internal issue tracker for this bug.
 

Users who are viewing this thread

Top