I'm not sure if this is done by elk or sceditor but it's really annoying. If you're old like me and were taught to type two spaces after periods then in order to preserve that a nbsp is inserted. Yay, that's good. But here's the problem. On elk the nbsp is inserted as the second space and not the first one. Why is that a problem? Because if the word wrap happens to break there the word will be indented one space at the start of the next line which looks awful in left to right languages.
So what's responsible for putting in the nbsp so it can be fixed to put the normal space as the last space instead of the first for left to right languages?
Ok, now I'm even more confused. Sometimes it stores puts the nbsp first and other times second. Not sure what causes the differences.
The nbsp is "added" in parse_bbc, there is an strtr that replaces any double space with a space + nbsp.
It should be enough to change the order in the replacement here:
$message = strtr($message, array(' ' => ' ',
to:
$message = strtr($message, array(' ' => ' ',
/me crosses his fingers hoping Elk will escape the stuff in code blocks, but he feels it will not.
We should find a way to show stuff in code blocks exactly as it is... :-\
Adding here because I'm tired of editing the previous message: the change is in Subs.php.
Thanks for the fix. It's odd that it seems random whether or not it hits that line as many times the substitution is done in the correct order. I've not noticed the pattern of why though. I even grabbed one message that exhibited the problem, clicked quick edit then save and it magically fixed itself.
quick reply
full reply
full reply wyz
quick edit
quick reply to full
Here it is: start from quick reply, hit preview, and then post.
In that case the order is inverted (at least is you use the plain quick reply, not tested with the full editor).
I don't use quick reply, so I suspect it has something to do with going through preview.
Probably then the "new reply" warning or some other error.
So does the change
@emanuele proposed fix the issue?
I can't say for certain as I've only had it in place for a little while and am not certain the various conditions that triggered it. But I'm certain his fix is a change that should be made. Hopefully it's the only one. But if not and I see it again in new posts I'll report back that there's still a problem.
There are for sure other places...
Ema is right, there must be other places as I'm still seeing the problem. As I'm seeing it in posts by other people I still don't know which path(s) is(are) causing it.
I suspect: preparse, un_preparse (or whatever is called), maybe fixtags, maybe others.
/me is scared by the number of "maybe" in the previous sentence... :o
The following two javascript files could be the source of the problem too.
spellcheck.js:
thetext = thetext.replace(/\ \ /g, " \&\n\b\s\p\;");
jquery.sceditor.min.js:
replace(/ {2}/g," \&\n\b\s\p\;")
The excessive escaping is to prevent the editor from eating what I wrote here. it's not really escaped like that in the code.
This problem has reappeared in RC2. I notice that neither Subs.php nor either of the scripts have been modified.
https://github.com/elkarte/Elkarte/commit/49d415388f05448e1057f4fb1651d1f8ed2158b3
I think "it" ( :P ) missed RC2...
Ah, I figured it was done a long time back. I'll just have to manually edit sceditor each release. Or add something that does it every time just before a database update of a body.
I forgot the spellchecker... :-\
I didn't do SCEditor mainly because at the moment we are carrying the minified version (and
@Spuds is the SCEditor master anyway).
Spuds do you think it may be worth sending a PR to SCEditor for that? After thinking a bit, it seems to make sense in general to replace the first instead of the second. No?
I suppose so, yes.
Note that we already have a couple of "custom" things in our sceditor version :'( ... I hope at some point those will be added to the editor (they are reported and acknowledged as bugs) so we don't have to continue to carry a custom one. However since we do have a modified version I can add that change to it so we have it available now.
Also the next (minor) version did another one of those refactoring efforts so I'm more than a bit wary of moving to it when it goes to current.
I have to build out a PR with some minor changes, so I'll add that space tweak.
Now I'm scared. lol
Yeah sceditor is a bit of a liability right now. Sigh.
Indeed there are some issues!