numbas / editor

An editor for the Numbas e-learning system.
http://numbas.mathcentre.ac.uk
Apache License 2.0
59 stars 61 forks source link

Pasting into pre blocks loses indentation #733

Open aarchiba opened 1 year ago

aarchiba commented 1 year ago

If I select and copy a block of Python code, then set up a preformatted-text section in a question statement or part prompt, when I paste the Python code into the pre block all indentation is lost. It doesn't matter where I copy it from. This makes it very difficult to include Python code in questions.

I am using Firefox on Linux.

christianp commented 1 year ago

It looks like it's the TinyMCE 'paste' plugin that's doing this. The point of that plugin is to clean up HTML that comes from Microsoft Word. I can't see a configuration option that would let us disable it when pasting into a <pre> tag. I'll keep looking around.

christianp commented 1 year ago

For now, you could paste the code into the raw HTML editor: click the icon labelled "Source code" at the end of the editor toolbar.