开发者

pasteHTML removes markup

开发者 https://www.devze.com 2022-12-27 16:59 出处:网络
I am writing a plugin to an old IE-only WYSIWYG-editor which resides in an old CMS. I\'ve created a plugin that opens an popup where the user can enter the url of an youtube clip.

I am writing a plugin to an old IE-only WYSIWYG-editor which resides in an old CMS. I've created a plugin that opens an popup where the user can enter the url of an youtube clip.

The popup then creates the corrent <object..><param..> markup for the embed and uses Internet Explorers pasteHTML function;

var range = plugin.editorDocument.selection.createRange();
var embedHtml = OpenDialog(dialogUrl, null, 400, 200);

if (!embedHtml) {
    return;
}
range.pasteHTML(embedHtml);

I know it's missing a bit of information about some of th开发者_StackOverflow中文版e variables but you get the picture. The problem is that the <param>-tags gets removed when i run the pasteHTML. I wonder if anyone have an idea of fixing this, and letting me keep my param-tags


I'd suggest putting an ID on the <object> element, getting hold of it after the pasteHTML call via document.getElementById and using document.createElement and the object element's appendChild method to create and add <param> elements.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号