Closed live627 closed 1 year ago
I'm a bit confused about what the issue is. Is it to do with pasting or lines being lost?
From what I can see in the linked thread, there is a video showing an issue with lines being lost, is that the issue? If so, the issue is the editor is generating the BBCode:
[center]test[/center]
[center]
[/center]
[center]lines above lost[/center]
[center]
[/center]
[center]lines above lost[/center]
The SMF BBcode parser is removing the [center]
tags which contain only newlines which is causing them to be lost.
The editor doesn't currently merge the [center]
tags together as I'm not sure how safe it would be to do that automatically.
If that isn't the issue, would it be possible to create a video of the issue as I'm a bit confused as to what it is.
I'm a bit confused about what the issue is. Is it to do with pasting or lines being lost?
From what I can see in the linked thread, there is a video showing an issue with lines being lost, is that the issue? If so, the issue is the editor is generating the BBCode:
[center]test[/center] [center] [/center] [center]lines above lost[/center] [center] [/center] [center]lines above lost[/center]
The SMF BBcode parser is removing the
[center]
tags which contain only newlines which is causing them to be lost.The editor doesn't currently merge the
[center]
tags together as I'm not sure how safe it would be to do that automatically.If that isn't the issue, would it be possible to create a video of the issue as I'm a bit confused as to what it is.
Hi, I'm the one who made the video. I am using google translator, the error is simply when using the rich text editor, as you will see in the video, when trying to put blank spaces from the editor, they are lost.
On the other hand, if I use the plain text editor, everything works correctly.
New video... @samclarke
Thanks for the video. In that case, the issue is down to the SMF parser removing [center]
tags which contain only white space.
The editor can't really do much to fix this as, even if it merged [center]
tags, it's easy to create an empty one surrounded by other non-center tags which is not an invalid thing to do.
For example, if someone types some text, hits center, adds some newlines then changes their mind and sets the alignment to something else, there will be a center tag with only whitespace.
One possible fix would be to update editors BBCode's like [center]
to not wrap white space, something like:
sceditor.formats.bbcode.set('center', {
format: function (element, content) {
var isWhitespace = /^[\s]+$/;
// Don't wrap whitespace in [center] tag so isn't removed
if (isWhitespace.test(content)) {
return content;
}
return '[center]' + content + '[/center]';
}
});
That will cause the centring to be lost from white space if toggling between WYSIWYG and code or if editing a post later on but is less likely to be an issue compared to the current behaviour. A better solution might be for the SMF parser to do that as then the BBCode remains intact.
I'm going to close this as it doesn't appear to be an issue with the editor. Feel free to reopen if I've missed something/misunderstood the issue.
Steps to reproduce the problem
reproducible on https://www.sceditor.com/
reported to me from https://www.simplemachines.org/community/index.php?topic=585072.0