/* Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved. For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license */ !function(){function e(e,t,n,o){var a=new CKEDITOR.dom.walker(e);if(!(e=e.startContainer.getAscendant(t,!0)||e.endContainer.getAscendant(t,!0))||(n(e),!o))for(;(e=a.next())&&(!(e=e.getAscendant(t,!0))||(n(e),!o)););}function t(e,t){var n={ul:"ol",ol:"ul"};return-1!==o(t,function(t){return t.element===e||t.element===n[e]})}function n(e){this.styles=null,this.sticky=!1,this.editor=e,this.filter=new CKEDITOR.filter(e,e.config.copyFormatting_allowRules),!0===e.config.copyFormatting_allowRules&&(this.filter.disabled=!0),e.config.copyFormatting_disallowRules&&this.filter.disallow(e.config.copyFormatting_disallowRules)}var o=CKEDITOR.tools.indexOf,a=CKEDITOR.tools.getMouseButton,r=!1;CKEDITOR.plugins.add("copyformatting",{lang:"ar,az,bg,cs,da,de,de-ch,el,en,en-au,eo,es-mx,et,eu,fa,fr,gl,hr,hu,it,ja,ko,ku,lv,nb,nl,oc,pl,pt,pt-br,ro,ru,sk,sq,sr,sr-latn,sv,tr,uk,vi,zh,zh-cn",icons:"copyformatting",hidpi:!0,init:function(e){var n=CKEDITOR.plugins.copyformatting;n._addScreenReaderContainer(),r||(CKEDITOR.document.appendStyleSheet(this.path+"styles/copyformatting.css"),r=!0),e.addContentsCss&&e.addContentsCss(this.path+"styles/copyformatting.css"),e.copyFormatting=new n.state(e),e.addCommand("copyFormatting",n.commands.copyFormatting),e.addCommand("applyFormatting",n.commands.applyFormatting),e.ui.addButton("CopyFormatting",{label:e.lang.copyformatting.label,command:"copyFormatting",toolbar:"cleanup,0"}),e.on("contentDom",function(){var t=e.getCommand("copyFormatting"),n=e.editable(),o=n.isInline()?n:e.document,r=e.ui.get("CopyFormatting");n.attachListener(o,"mouseup",function(n){a(n)===CKEDITOR.MOUSE_BUTTON_LEFT&&t.state===CKEDITOR.TRISTATE_ON&&e.execCommand("applyFormatting")}),n.attachListener(CKEDITOR.document,"mouseup",function(o){a(o)!==CKEDITOR.MOUSE_BUTTON_LEFT||t.state!==CKEDITOR.TRISTATE_ON||n.contains(o.data.getTarget())||e.execCommand("copyFormatting")}),r&&(o=CKEDITOR.document.getById(r._.id),n.attachListener(o,"dblclick",function(){e.execCommand("copyFormatting",{sticky:!0})}),n.attachListener(o,"mouseup",function(e){e.data.stopPropagation()}))}),e.config.copyFormatting_keystrokeCopy&&e.setKeystroke(e.config.copyFormatting_keystrokeCopy,"copyFormatting"),e.on("key",function(t){var n=e.getCommand("copyFormatting");t=t.data.domEvent,t.getKeystroke&&27===t.getKeystroke()&&n.state===CKEDITOR.TRISTATE_ON&&e.execCommand("copyFormatting")}),e.copyFormatting.on("extractFormatting",function(t){var o=t.data.element;return o.contains(e.editable())||o.equals(e.editable())?t.cancel():(o=n._convertElementToStyleDef(o),e.copyFormatting.filter.check(new CKEDITOR.style(o),!0,!0)?void(t.data.styleDef=o):t.cancel())}),e.copyFormatting.on("applyFormatting",function(a){if(!a.data.preventFormatStripping){var r,i,l=a.data.range,s=n._extractStylesFromRange(e,l),c=n._determineContext(l);if(e.copyFormatting._isContextAllowed(c))for(i=0;i <\/span>/g,""),e.replace(/<.*?>/g,"")):e.getText()}function a(e,r){var i,l,s=e,c=/\s/g,m="p br ol ul li td th div caption body".split(" "),d=!1,g=!1;do{for(i=t(s,r);!i&&s.getParent();){if(s=s.getParent(),-1!==o(m,s.getName())){g=d=!0;break}i=t(s,r)}if(i&&i.getName&&-1!==o(m,i.getName())){d=!0;break}s=i}while(s&&s.getStyle&&("none"==s.getStyle("display")||!s.getText()));for(s||(s=e);s.type!==CKEDITOR.NODE_TEXT;)s=!d||r||g?s.getChild(0):s.getChild(s.getChildCount()-1);for(m=n(s);null!=(g=c.exec(m))&&(l=g.index,r););if("number"!=typeof l&&!d)return a(s,r);if(d)r?l=0:(c=/([\.\b]*$)/,l=(g=c.exec(m))?g.index:m.length);else if(r&&(l+=1,l>m.length))return a(s);return{node:s,offset:l}}var r,i,l,s,c,m=/\b\w+\b/gi;for(l=s=c=e.startContainer,r=n(l);null!=(i=m.exec(r));)if(i.index+i[0].length>=e.startOffset)return e=i.index,m=i.index+i[0].length,0===i.index&&(i=a(l,!0),s=i.node,e=i.offset),m>=r.length&&(r=a(l),c=r.node,m=r.offset),{startNode:s,startOffset:e,endNode:c,endOffset:m};return null},_filterStyles:function(e){var t,n,o=CKEDITOR.tools.isEmpty,a=[];for(n=0;n
')).getChild(0)},_getScreenReaderContainer:function(){return CKEDITOR.env.ie6Compat||CKEDITOR.env.ie7Compat?void 0:CKEDITOR.document.getBody().findOne(".cke_copyformatting_notification div[aria-live]")},_attachPasteKeystrokeHandler:function(e){var t=e.config.copyFormatting_keystrokePaste;t&&(this._initialKeystrokePasteCommand=e.keystrokeHandler.keystrokes[t],e.setKeystroke(t,"applyFormatting"))},_detachPasteKeystrokeHandler:function(e){var t=e.config.copyFormatting_keystrokePaste;t&&e.setKeystroke(t,this._initialKeystrokePasteCommand||!1)}},CKEDITOR.config.copyFormatting_outerCursor=!0,CKEDITOR.config.copyFormatting_allowRules="b s u i em strong span p div td th ol ul li(*)[*]{*}",CKEDITOR.config.copyFormatting_disallowRules="*[data-cke-widget*,data-widget*,data-cke-realelement](cke_widget*)",CKEDITOR.config.copyFormatting_allowedContexts=!0,CKEDITOR.config.copyFormatting_keystrokeCopy=CKEDITOR.CTRL+CKEDITOR.SHIFT+67,CKEDITOR.config.copyFormatting_keystrokePaste=CKEDITOR.CTRL+CKEDITOR.SHIFT+86}();