Closed gigaj0ule closed 5 months ago
I am also in trouble with this issue. Because of this code, full-width spaces(\u3000) are also collapsed in UTF8. I think it's better not to replace "\s".
I find solution for Quill 2.0.0-dev.4
:
import Quill from 'quill';
const CodeBlock = Quill.import('formats/code-block');
// See - https://github.com/quilljs/quill/blob/develop/modules/clipboard.js#L513
CodeBlock.tagName = 'PRE';
Quill.register({
'formats/code-block': CodeBlock
});
Quill 2.0 has been released (announcement post) with many changes and fixes. If this is still an issue please create a new issue after reviewing our updated Contributing guide :pray:
I have found that white space is collapsed in code blocks when you get a delta of the quill editor contents. This of course leads to corrupt python programs!
The offending line seems to be
text = text.replace(/\s\s+/g, replacer.bind(replacer, true)); // collapse whitespace
in modules/clipboard.js.
When commenting out this line, the problem is resolved.