support <track> elements in rich content

fixes CNVS-30404

test plan:
- add a video/audio with a track tag in the html editor
- toggle back and forth between rich text and html and make sure it
stays
- save and edit and make sure it stays

Change-Id: I18418ef98ed2c03d1a4901a4bf15cf82474c6131
Reviewed-on: https://gerrit.instructure.com/85159
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
This commit is contained in:
Simon Williams 2016-07-13 12:01:16 -06:00
parent 67a193fea3
commit 8b04f05d4f
2 changed files with 7 additions and 1 deletions

View File

@ -80,7 +80,7 @@ module CanvasSanitize #:nodoc:
'del', 'ins', 'iframe', 'font',
'colgroup', 'dd', 'div', 'dl', 'dt', 'em', 'figure', 'figcaption', 'i', 'img', 'li', 'ol', 'p', 'pre',
'q', 'small', 'source', 'span', 'strike', 'strong', 'sub', 'sup', 'table', 'tbody', 'td',
'tfoot', 'th', 'thead', 'tr', 'u', 'ul', 'object', 'embed', 'param', 'video', 'audio',
'tfoot', 'th', 'thead', 'tr', 'u', 'ul', 'object', 'embed', 'param', 'video', 'track', 'audio',
# MathML
'annotation', 'annotation-xml', 'maction', 'maligngroup', 'malignmark', 'math',
'menclose', 'merror', 'mfenced', 'mfrac', 'mglyph', 'mi', 'mlabeledtr', 'mlongdiv',
@ -156,6 +156,7 @@ module CanvasSanitize #:nodoc:
'embed' => ['name', 'src', 'type', 'allowfullscreen', 'pluginspage', 'wmode',
'allowscriptaccess', 'width', 'height'].freeze,
'video' => ['name', 'src', 'allowfullscreen', 'muted', 'poster', 'width', 'height', 'controls'].freeze,
'track' => ['default', 'kind', 'label', 'src', 'srclang'].freeze,
'audio' => ['name', 'src', 'muted'].freeze,
'font' => ['face', 'color', 'size'].freeze,
# MathML

View File

@ -33,4 +33,9 @@ describe CanvasSanitize do
cleaned = Sanitize.clean("<p data-item-id='1234'>Item1234</p>", CanvasSanitize::SANITIZE)
expect(cleaned).to eq("<p data-item-id=\"1234\">Item1234</p>")
end
it "does not strip track elements" do
cleaned = Sanitize.clean("<track src=\"http://google.com\"></track>", CanvasSanitize::SANITIZE)
expect(cleaned).to eq("<track src=\"http://google.com\"></track>")
end
end