/** * @file plugin.js * QnA plugin for Ckeditor. * Wraps the selected words/text in p element with custom class. */ ( function() { CKEDITOR.plugins.add( 'qna', { icons: 'qna',   init: function( editor ) {     editor.addCommand( 'insertQna', {       exec : function( editor ) {    var selected_text = editor.getSelection().getSelectedText(); var newElement = new CKEDITOR.dom.element("p"); newElement.setAttributes({class: 'qna'}) newElement.setText(selected_text); editor.insertElement(newElement);       }     });     editor.ui.addButton( 'qna', { label: 'Insert QnA', command: 'insertQna', icon: this.path + 'icons/qna.png' }); editor.config.contentsCss = this.path + 'css/qna.css';   } }); })();