cancel
Showing results for 
Search instead for 
Did you mean: 
feliciapacifica
Community Member

Paste into discussion loses indentation

Jump to solution

When pasting text into either the Rich or HTML editors for discussions, the indentation of the source text is loss.

This is a HUGE problem for computer science courses where indentation of code is vital.

This is a major bug that needs to be addressed.  I have used many online text editors and they always honor the indentations of source text.

Attached you can see how the indentation from the source text is lost.  This should NEVER happen, especially for an online learning discussion forum.

1 Solution

Accepted Solutions
James
Navigator

feliciapacifica,

The issue  @chofer  pointed to is, I believe, a different one than what you're experiencing. That was about submission comments and this one is about discussions. Discussions have the Rich Content Editor available, while submission comments do not.

That said, there is a trick you can use to get the code to come out indented.

Choose Preformatted from the toolbar.

251719_pastedImage_4.png

It's what comes next that makes the difference.

If you paste the code while in the Rich Content Editor, it will not keep any formatting. 

However, if you choose Preformatted from the toolbar, switch to HTML Editor, and then paste your code between the <pre></pre> codes that are there, then it will keep the formatting.

Here is part of a discussion tested both ways. The top portion is pasted directly into the Rich Content Editor and the bottom portion was pasted after I switched to the HTML editor.

251710_pastedImage_1.png

If you don't want to click Preformatted from the toolbar, you can of course, switch to HTML editor and manually type the <pre></pre>.

View solution in original post

4 Replies
chofer
Community Coach
Community Coach

Hello feliciapacifica...

While I don't necessarily have an answer for you, I wanted to share with you a link to a different discussion topic which is sort of related.  It's probably not going to answer your question, unfortunately, but it may give you some insights as to how Canvas currently operates.  In particular, I would point you to the explanation from  @James ‌.  Here is the discussion: Keeping spaces in Speed Grader comments.  I hope this is helpful to you.

James
Navigator

feliciapacifica,

The issue  @chofer  pointed to is, I believe, a different one than what you're experiencing. That was about submission comments and this one is about discussions. Discussions have the Rich Content Editor available, while submission comments do not.

That said, there is a trick you can use to get the code to come out indented.

Choose Preformatted from the toolbar.

251719_pastedImage_4.png

It's what comes next that makes the difference.

If you paste the code while in the Rich Content Editor, it will not keep any formatting. 

However, if you choose Preformatted from the toolbar, switch to HTML Editor, and then paste your code between the <pre></pre> codes that are there, then it will keep the formatting.

Here is part of a discussion tested both ways. The top portion is pasted directly into the Rich Content Editor and the bottom portion was pasted after I switched to the HTML editor.

251710_pastedImage_1.png

If you don't want to click Preformatted from the toolbar, you can of course, switch to HTML editor and manually type the <pre></pre>.

View solution in original post

chofer
Community Coach
Community Coach

Oh!  Thank you for this info, James!  I totally forgot about the "Preformatted" text option in the RCE.  Also, thanks for pointing out the difference between the text input box in the SpeedGrader and in Discussions.  Smiley Happy

rus19023
Community Member

The solution does not work when pasting HTML code...it convert all the html tags.  I need to show the code, not the results.

any suggestions?