Opened 10 years ago
Closed 10 years ago
#12214 closed Bug (invalid)
Issues with upcasting codesnippet using editor#insertElement
Reported by: | Marek Lewandowski | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | General | Version: | |
Keywords: | Cc: |
Description
Generally widgets seems not to have issues with upcasting items inserted by editor#insertElement(). I've tested it at our demo with SimpleBox and Image2.
As a sample I will include steps to include valid widget to image2 and codesnippet (which does not work).
Image2
Execute following code in JavaScript console:
var el = new CKEDITOR.dom.element( 'figure' ); el.setHtml( '<img alt="Saturn V" src="http://c.cksource.com/a/1/img/demo/apollo-csm-lm.png" width="200" /><figcaption>foobar</figcaption>' ); // This will insert image into editor below the "Enhanced Image" headline. CKEDITOR.instances.editor3.insertElement( el );
Image widget is created.
Code Snippet
Execute following code in JavaScript console:
var el = new CKEDITOR.dom.element( 'pre' ); el.setHtml( '<code class="language-javascript">var x = 1;</code>' ); // This will insert image into editor below the "Enhanced Image" headline. CKEDITOR.instances.editor2.insertElement( el ); // Even calling this manually doesn't work: // CKEDITOR.instances.editor2.widgets.initOnAll();
Code snippet is not upcasted (but it will be after toggling source/wysiwyg mode it will be created as expected).
Code seems to be ok, pretty much the same for both cases.
See: http://stackoverflow.com/questions/20237845/ckeditor-initialize-widget-added-with-insertelement