Domanda

This following Code Running in FF & IE

TempNode= CKEDITOR.dom.element.createFromHtml("<span></span>");
TempNode.setHtml("<p>test</p>");

But below mentioned code losing user defined Tags In IE (FF Works Fine)

TempNode= CKEDITOR.dom.element.createFromHtml("<span></span>");
TempNode.setHtml("<myTag>test</myTag>");

Also same problem with *appendHtml()*

My Exact Requirement is :

 Element.setHtml(AnotherElement.getHtml());

original value in AnotherElement.getHtml() is:

<P><mytag id="test_39878" data-cke-expando="undefined">some. text</myTag></P>

after Element.sethtml() it containing value is :

<P>some. tex</MYTAG></P>
È stato utile?

Soluzione

If you want to use your own tags in IE you've got to create them first. This is the same situation that we've got with HTML5 tags.

So before setting HTML with <myTag>, create it CKEDITOR.document.createElement( 'mytag' ) just to let IE know it exists.

BTW. Remember that elements must be created in the same document in which they'll be used. So if you want to insert them into editor's content, then create them in editor's document (e.g. CKEDITOR.instances.editor1.document). Otherwise IE will throw an error.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top