Skip to content
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

Fix length mismatch when copying code #3028

Merged
merged 1 commit into from
Apr 30, 2020
Merged

Fix length mismatch when copying code #3028

merged 1 commit into from
Apr 30, 2020

Conversation

luin
Copy link
Member

@luin luin commented Apr 28, 2020

CodeBlockContainer#html() generates duplicated \n when deals with empty lines. See the test plan for reproduction steps.

This PR added a fix for that, also fixed a related issue that copying & pasting code block doesn't keep the highlighting language.

Test Plan

  1. Run npm start
  2. Visit http://localhost:9000/standalone/full/
  3. Copy the following code block to the editor:
start





end
  1. Add some plain text after the code block. See the screenshot below.

CleanShot 2020-04-28 at 22 31 21@2x

  1. Copy the code block in the editor and paste after the plain text.
  2. Make sure the pasted code block has the same content as the original one.
  3. Set a highlighting language after step 3 and try again. Make sure the pasted code block keeps the language setting.

@jhchen jhchen merged commit 125bc3c into slab:develop Apr 30, 2020
@luin luin deleted the copy-code branch May 5, 2020 04:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants