Open Bug 517470 Opened 15 years ago Updated 3 years ago

Can't insert a video or audio element into an editor

Categories

(Core :: DOM: Editor, defect, P5)

defect

Tracking

()

People

(Reporter: standard8, Unassigned)

References

Details

(Keywords: helpwanted)

Attachments

(1 file)

Attached patch Possible fixSplinter Review
Following the work Thunderbird has done with video in emails, I did some work to see if I could insert a video element into a editor element via an extension.

This didn't work. What I was doing was:

---------------------------------
let editor = GetCurrentEditor();

editor.beginTransaction();

let videoElement = editor.createElementWithDefaults("video");
let useElement = videoElement.cloneNode(false);

var src = thevideo;
var URIFixup = Components.classes["@mozilla.org/docshell/urifixup;1"]
                         .getService(Components.interfaces.nsIURIFixup);
src = URIFixup.createFixupURI(src, Components.interfaces.nsIURIFixup).spec;
useElement.setAttribute("src", src);

editor.insertElementAtSelection(videoElement, true);

editor.cloneAttributes(videoElement, useElement);
editor.endTransaction();
---------------------------------

it would fail at the insertElementAtSelection stage. It appears that when the video/audio code was added in bug 382267 the video/audio elements were specified as belonging to no groups.

Changing them to belong to GROUP_SPECIAL meant I could at least insert them.

Attached is the changes I did, although I haven't really tested them.

If anyone can comment on the changes that would be useful although I haven't got time to pick them up myself for the next month or so.

Bulk-downgrade of unassigned, >=5 years untouched DOM/Storage bugs' priority.

If you have reason to believe this is wrong (especially for the severity), please write a comment and ni :jstutte.

Severity: normal → S4
Priority: -- → P5
You need to log in before you can comment on or make changes to this bug.