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
CRLF not processed when pasting in code block #3270
Comments
morecup
changed the title
In configuration,EndOfLine default in win10 is 'lf' .Should be 'crlf'.
Dislocation occurs
May 22, 2022
我调试了源码,发现在代码块里粘贴的时候是以原格式粘贴,只有当做一个删除或者其他操作时才会把/r/n转为/n,我认为粘贴时应该对/r/n进行处理。 if (startBlock.type === 'span' && startBlock.functionType === 'codeContent') {
const blockText = startBlock.text
const prePartText = blockText.substring(0, start.offset)
const postPartText = blockText.substring(end.offset)
startBlock.text = prePartText + text + postPartText
const { key } = startBlock
const offset = start.offset + text.length
this.cursor = {
start: { key, offset },
end: { key, offset }
}
return this.partialRender()
} |
morecup
changed the title
CRLF not processed when pasting
CRLF not processed when pasting in code block
May 23, 2022
fix code: startBlock.text = prePartText + text.replace(/\r\n/g, '\n') + postPartText |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
Steps to reproduce
Versions
The text was updated successfully, but these errors were encountered: