plugin.js 1.3 KB

12345
  1. /*
  2. Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
  3. For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  4. */
  5. !function(){function e(e,t,s){var n,l=[],r=[];for(n=0;n<e.styleSheets.length;n++){var o=e.styleSheets[n];if(!((o.ownerNode||o.owningElement).getAttribute("data-cke-temp")||o.href&&"chrome://"==o.href.substr(0,9)))try{for(var c=o.cssRules||o.rules,o=0;o<c.length;o++)r.push(c[o].selectorText)}catch(i){}}for(n=r.join(" "),n=n.replace(/(,|>|\+|~)/g," "),n=n.replace(/\[[^\]]*/g,""),n=n.replace(/#[^\s]*/g,""),n=n.replace(/\:{1,2}[^\s]*/g,""),n=n.replace(/\s+/g," "),n=n.split(" "),e=[],r=0;r<n.length;r++)c=n[r],s.test(c)&&!t.test(c)&&-1==CKEDITOR.tools.indexOf(e,c)&&e.push(c);for(n=0;n<e.length;n++)s=e[n].split("."),t=s[0].toLowerCase(),s=s[1],l.push({name:t+"."+s,element:t,attributes:{"class":s}});return l}CKEDITOR.plugins.add("stylesheetparser",{init:function(t){t.filter.disable();var s;t.once("stylesSet",function(n){n.cancel(),t.once("contentDom",function(){t.getStylesSet(function(n){s=n.concat(e(t.document.$,t.config.stylesheetParser_skipSelectors||/(^body\.|^\.)/i,t.config.stylesheetParser_validSelectors||/\w+\.\w+/)),t.getStylesSet=function(e){return s?e(s):void 0},t.fire("stylesSet",{styles:s})})})},null,null,1)}})}();