Preformatted plugin improvement - #1683
Conversation
add ukrainian language
Alex-D
left a comment
There was a problem hiding this comment.
I've added some feedbacks, also, can you rebase on the main branch since I've merge your other PR?
Thank you :)
| var container = null; | ||
|
|
||
| if (document.selection) { //for IE | ||
| if (document.selection) { |
There was a problem hiding this comment.
OK, the comment may stay. I accidentally removed it while cleaning up my own comments.
| return html .replace(/<p>/gi, '') | ||
| .replace(/<\/p>/gi, '\n') | ||
| .replace(/<br\s*\/?>/gi, '\n') | ||
| .replace(/<h[1-6]>|<\/h[1-6]>/gi, '\n') | ||
| .replace(/<li>/gi, '- ') | ||
| .replace(/<\/li>/gi, '\n'); |
There was a problem hiding this comment.
I'm unsure about this way to do it, there are a lot more tags missing here, no?
What's the goal of this function?
There was a problem hiding this comment.
You are right. That was indeed not my final version of that conversion function. I rewrote it now completely in my final version.
| // step 2: keep whitespaces & line breaks | ||
| html = html | ||
| .replace(/ /g, ' ') // keep double spaces | ||
| .replace(/\t/g, ' ') // keep tabs |
There was a problem hiding this comment.
Why replacing tabs with 4 spaces? Can't we use 	?
There was a problem hiding this comment.
Yes. good point. Let's use &tab; here.
Co-authored-by: Alexandre Demode <contact@alex-d.fr>
b5eb79c to
f6b6882
Compare
|
I rebased with main and tried to commit my final changes. Not sure if everything went well 🙈 |
The preformat-function is imho ment to wrap and convert a pre-formatted text (e.g. code example) to a proper
preorcodeblock.Current behaviour (on the trumbowyg homepage):

Expected behavior (in this PR):
