CKEDITOR.plugins.add("ipsspoiler",{requires:"widget",icons:"ipsspoiler",init:function(c){c.widgets.add("ipsspoiler",{button:ips.getString("editorSpoiler"),template:ips.templates.render("core.editor.spoiler"),editables:{content:{selector:".ipsSpoiler_contents"}},upcast:function(a){if("div"==a.name&&a.hasClass("ipsSpoiler")||"blockquote"==a.name&&a.hasClass("ipsStyle_spoiler"))return a.children[0].hasClass("ipsSpoiler_header")||a.setHtml(ips.templates.render("core.editor.legacySpoilerUpcast",{contents:a.getHtml()})),
!0},init:function(){var a=c.getSelectedHtml(!0),b=c.getSelection(),b=b?b.getSelectedElement():null;if(!b||!b.hasClass("cke_widget_wrapper"))this.once("focus",function(){if(a){"<p>"===a.substr(0,1)?this.editables.content.setHtml(a):this.editables.content.setHtml("<p>"+a+"</p>");var b=c.createRange();b.moveToElementEditablePosition(this.wrapper.getNext())}else b=c.createRange(),b.moveToElementEditablePosition(this.editables.content);b.select()},this)}})}});