Hello, I want to add some fake element without a plugin, only using a button in the page.
I Use this script:
function Fake() { var editor = CKEDITOR.instances.editor1; CKEDITOR.addCss( 'img.cke_iframe' + '{' + 'background-image: url(' + CKEDITOR.getUrl( this.path + 'images/placeholder.png' ) + ');' + 'background-position: center center;' + 'background-repeat: no-repeat;' + 'border: 1px solid #a9a9a9;' + 'width: 500px;' + 'height: 400px;' + '}' ); var dataProcessor = editor.dataProcessor, dataFilter = dataProcessor && dataProcessor.dataFilter; if ( dataFilter ) { dataFilter.addRules({ elements: { iframe: function( element ) { return editor.createFakeParserElement( element, 'cke_iframe', 'div', true ); } } }); } var sHTML = "<object> class=mizu-video selThisselThis</object>"; var realElement = CKEDITOR.dom.element.createFromHtml( sHTML ); var fakeElement = editor.createFakeElement( realElement, 'cke_iframe', 'video', true ); editor.insertElement(fakeElement); }
And it work the first time i launch Fake() with a button. But if I switch to source mode and then i return the placeholder disappear and also the content: in the source I have only
<object></object>
Can you help me?