New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Indentation is lost when pasting in the RTE #9264
Comments
When I copy from GitHub with formatting, it seems to work (and code blocks are created). When copying without formatting (e.g. using the "copy" button to the right of the code block), I can confirm that indentation is lost. |
The difference between the behavior from when you "select everything and copy" and using the copy button is that in the first action you are also copying HTML to the clipboard. When we have HTML in the clipboard, the It is in the "format plain text to HTML" where the bug happens. One fix would be to: Change joplin/packages/lib/htmlUtils.ts Lines 177 to 205 in 07ee20a
And since HTML doesn't know spaces we would need to change espapeHTML to something like this: function escapeHtml(s) {
return s
.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/"/g, '"')
.replace(/'/g, ''')
.replace(/ /g, ' ')
.replace(/\t/g, ' ');
} joplin/packages/lib/string-utils.js Line 213 in 07ee20a
This would fix the problem, but I'm not sure if this is the correct approach. |
When pasting the text below in the RTE, the indentation is lost:
The text was updated successfully, but these errors were encountered: