I use rangy highlight selection text (it wrap selection text by a span tag). But when i select text and image, it generate a span tag but span can't wrap img tag. it append before img tag.
My code
cssApplier = rangy.createCssClassApplier("highlight", {
ignoreWhiteSpace: true,
elementTagName: "span",
elementProperties: {
id: randomId,
onclick: function () {
SelectComment(this);
return false;
}
}
})
cssApplier.applyToRange(sel.getRangeAt(0));
i change elementTagName to div but no change.
<span id="1356599579267" class="highlight current">
</span>
<img type="photo" title="" templatetype="default" style="width:200px " src="http://sohanews2.vcmedia.vn/k:2012/1350782211-hongque_thoitrang_eva--3--f7897/my-nhan-showbiz-va-lo-hong-ve-tam-nhan-thuc.jpg" rel="http://sohanews2.vcmedia.vn/2012/1350782211-hongque_thoitrang_eva--3--f7897.jpg" photoid="24109" id="img_24109" alt="">
So, how to wrap img or object tag or input tag. by highlight element by rangy?