drlippman/IMathAS

InlineText element with HTML copied from Zoom includes offensive formatting code

Opened this issue · 4 comments

If an instructor copies code from Zoom and pastes it into the TinyMCE editor for an inlineText element, the pasted code includes offensive formatting that causes the course page to appear corrupted. The offensive code is the class names (itemhdrdd dropdown itemsum), e.g.:

<div class="itemhdrdd dropdown">
<div class="itemsum">
 <p>Join Zoom Meeting Click Link below and Enter Password when prompted.<br /><a title="ZOOM LINK STATISTICS" href="https://zoom.us/j/2110416192?pwd=Qm4zYlJPNzJ2YXF6dno4cXMrYm9rQT09" target="_blank" rel="noopener">https://zoom.us/j/2110416192?pwd=Qm4zYlJPNzJ2YXF6dno4cXMrYm9rQT09<span class="sr-only openext">Opens externally</span></a></p>
 <p>Meeting ID: 211 041 6192<br />Password: 11235<br /><br /></p>
</div>
</div>

The best solution (of course) is for instructors to paste as plain text, but... Perhaps all class names should be stripped when the text is saved (or displayed).

Where exactly is this getting copied from? It looks to me like maybe someone copy and pasted from one inlinetext item to another, and that was the source of the problem.

It doesn't look like Tinymce has a built in "strip classes on paste" option, but there might be some way to wrangle something in.

Oh. I see what you mean -- the unwanted classes suggest that the instructor copied the gear menu along with selected text!

It looks like there may be a tinymce option to force plain text pasting by default:

https://stackoverflow.com/questions/2695731/how-to-make-tinymce-paste-in-plain-text-by-default

But, of course, more users might be frustrated by the loss of pasted formats than are troubled by the error we saw today.

Yeah, I saw that option, but agree the loss of format would be a bigger idea, plus it would probably break images and other stuff in the copied text too. There is a preprocessor option; it might be possible to strip out classes using it.