Dummy(Duplicate) Node in Ckeditor [IE]

2019-04-15 04:20发布

问题:

in CKEDITOR Document I have a node named User_Image

<User_Image><sometags><sometags>sometext<sometags>sometext</sometags></sometags></sometags></User_Image>

User_Image node i stored in Variable Uimage

var Duimage=CKEDITOR.dom.element.createFromHtml(Uimage.getOuterHtml());

now just i created (dummy) duplicate node but this code supported me in all browsers other than IE. in IE Missing Customtags. the all tags are dynamic.

then i try with following :

var Duimage=ediInstance.document.createElement("User_Image");
 Uimage.appendTo(Duimage);

but in this code if i changed in Duimage it also affect in CKEDITOR Document

any other Idea to get Duplicate Node ?

回答1:

First of all - check my answer here IE lose custom tag while sethtml

Second - after you add support for custom tag in IE (remember to do this in the document in which element will be used) you can use element's clone() method. Here's its doc: http://nightly-v4.ckeditor.com/ckeditor_api/#!/api/CKEDITOR.dom.node-method-clone