Mark
Mark

Reputation: 3271

How to create a self closing element in CKEditor?

I want to create a custom self closing node in CKeditor, is there a way to do this? My code so far:

this.videoElement = editor.document.createElement('cfwvideo');
this.videoElement.setAttribute('src', videoSource);
editor.insertElement(this.videoElement);

Upvotes: 2

Views: 682

Answers (1)

Mark
Mark

Reputation: 3271

Ah found it, you'll have to add the control name to the $empty list in CKEDITOR.dtd like this: CKEDITOR.dtd.$empty['cfwvideo'] = 1;

Upvotes: 2

Related Questions