Socket
Socket
Sign inDemoInstall

@ckeditor/ckeditor5-style

Package Overview
Dependencies
Maintainers
1
Versions
599
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ckeditor/ckeditor5-style - npm Package Compare versions

Comparing version 38.0.1 to 38.1.0

2

build/style.js

@@ -5,2 +5,2 @@ !function(e){const t=e.en=e.en||{};t.dictionary=Object.assign(t.dictionary||{},{"Block styles":"Block styles","Multiple styles":"Multiple styles",Styles:"Styles","Text styles":"Text styles"})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={})),

* For licensing, see LICENSE.md.
*/(()=>{var e={529:(e,t,s)=>{"use strict";s.d(t,{Z:()=>n});var i=s(609),l=s.n(i)()((function(e){return e[1]}));l.push([e.id,".ck.ck-dropdown.ck-style-dropdown.ck-style-dropdown_multiple-active>.ck-button>.ck-button__label{font-style:italic}",""]);const n=l},945:(e,t,s)=>{"use strict";s.d(t,{Z:()=>n});var i=s(609),l=s.n(i)()((function(e){return e[1]}));l.push([e.id,":root{--ck-style-panel-columns:3}.ck.ck-style-panel .ck-style-grid{display:grid;grid-template-columns:repeat(var(--ck-style-panel-columns),auto);justify-content:start}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button{display:flex;flex-direction:column;justify-content:space-between}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button .ck-style-grid__button__preview{align-content:center;align-items:center;display:flex;flex-basis:100%;flex-grow:1;justify-content:flex-start}:root{--ck-style-panel-button-width:120px;--ck-style-panel-button-height:80px;--ck-style-panel-button-label-background:#f0f0f0;--ck-style-panel-button-hover-label-background:#ebebeb;--ck-style-panel-button-hover-border-color:#b3b3b3}.ck.ck-style-panel .ck-style-grid{column-gap:var(--ck-spacing-large);row-gap:var(--ck-spacing-large)}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button{--ck-color-button-default-hover-background:var(--ck-color-base-background);--ck-color-button-default-active-background:var(--ck-color-base-background);height:var(--ck-style-panel-button-height);padding:0;width:var(--ck-style-panel-button-width)}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button:not(:focus){border:1px solid var(--ck-color-base-border)}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button .ck-button__label{flex-shrink:0;height:22px;line-height:22px;overflow:hidden;padding:0 var(--ck-spacing-medium);text-overflow:ellipsis;width:100%}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button .ck-style-grid__button__preview{background:var(--ck-color-base-background);border:2px solid var(--ck-color-base-background);opacity:.9;overflow:hidden;padding:var(--ck-spacing-medium);width:100%}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button.ck-disabled{--ck-color-button-default-disabled-background:var(--ck-color-base-foreground)}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button.ck-disabled:not(:focus){border-color:var(--ck-style-panel-button-label-background)}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button.ck-disabled .ck-style-grid__button__preview{border-color:var(--ck-color-base-foreground);filter:saturate(.3);opacity:.4}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button.ck-on{border-color:var(--ck-color-base-active)}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button.ck-on .ck-button__label{box-shadow:0 -1px 0 var(--ck-color-base-active);z-index:1}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button.ck-on:hover{border-color:var(--ck-color-base-active-focus)}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button:not(.ck-on) .ck-button__label{background:var(--ck-style-panel-button-label-background)}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button:not(.ck-on):hover .ck-button__label{background:var(--ck-style-panel-button-hover-label-background)}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button:hover:not(.ck-disabled):not(.ck-on){border-color:var(--ck-style-panel-button-hover-border-color)}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button:hover:not(.ck-disabled):not(.ck-on) .ck-style-grid__button__preview{opacity:1}",""]);const n=l},561:(e,t,s)=>{"use strict";s.d(t,{Z:()=>n});var i=s(609),l=s.n(i)()((function(e){return e[1]}));l.push([e.id,".ck.ck-style-panel .ck-style-panel__style-group>.ck-label{margin:var(--ck-spacing-large) 0}.ck.ck-style-panel .ck-style-panel__style-group:first-child>.ck-label{margin-top:0}",""]);const n=l},662:(e,t,s)=>{"use strict";s.d(t,{Z:()=>n});var i=s(609),l=s.n(i)()((function(e){return e[1]}));l.push([e.id,":root{--ck-style-panel-max-height:470px}.ck.ck-style-panel{max-height:var(--ck-style-panel-max-height);overflow-y:auto;padding:var(--ck-spacing-large)}",""]);const n=l},609:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var s=e(t);return t[2]?"@media ".concat(t[2]," {").concat(s,"}"):s})).join("")},t.i=function(e,s,i){"string"==typeof e&&(e=[[null,e,""]]);var l={};if(i)for(var n=0;n<this.length;n++){var r=this[n][0];null!=r&&(l[r]=!0)}for(var o=0;o<e.length;o++){var c=[].concat(e[o]);i&&l[c[0]]||(s&&(c[2]?c[2]="".concat(s," and ").concat(c[2]):c[2]=s),t.push(c))}},t}},62:(e,t,s)=>{"use strict";var i,l=function(){return void 0===i&&(i=Boolean(window&&document&&document.all&&!window.atob)),i},n=function(){var e={};return function(t){if(void 0===e[t]){var s=document.querySelector(t);if(window.HTMLIFrameElement&&s instanceof window.HTMLIFrameElement)try{s=s.contentDocument.head}catch(e){s=null}e[t]=s}return e[t]}}(),r=[];function o(e){for(var t=-1,s=0;s<r.length;s++)if(r[s].identifier===e){t=s;break}return t}function c(e,t){for(var s={},i=[],l=0;l<e.length;l++){var n=e[l],c=t.base?n[0]+t.base:n[0],a=s[c]||0,d="".concat(c," ").concat(a);s[c]=a+1;var u=o(d),h={css:n[1],media:n[2],sourceMap:n[3]};-1!==u?(r[u].references++,r[u].updater(h)):r.push({identifier:d,updater:f(h,t),references:1}),i.push(d)}return i}function a(e){var t=document.createElement("style"),i=e.attributes||{};if(void 0===i.nonce){var l=s.nc;l&&(i.nonce=l)}if(Object.keys(i).forEach((function(e){t.setAttribute(e,i[e])})),"function"==typeof e.insert)e.insert(t);else{var r=n(e.insert||"head");if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(t)}return t}var d,u=(d=[],function(e,t){return d[e]=t,d.filter(Boolean).join("\n")});function h(e,t,s,i){var l=s?"":i.media?"@media ".concat(i.media," {").concat(i.css,"}"):i.css;if(e.styleSheet)e.styleSheet.cssText=u(t,l);else{var n=document.createTextNode(l),r=e.childNodes;r[t]&&e.removeChild(r[t]),r.length?e.insertBefore(n,r[t]):e.appendChild(n)}}function g(e,t,s){var i=s.css,l=s.media,n=s.sourceMap;if(l?e.setAttribute("media",l):e.removeAttribute("media"),n&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(n))))," */")),e.styleSheet)e.styleSheet.cssText=i;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(i))}}var y=null,p=0;function f(e,t){var s,i,l;if(t.singleton){var n=p++;s=y||(y=a(t)),i=h.bind(null,s,n,!1),l=h.bind(null,s,n,!0)}else s=a(t),i=g.bind(null,s,t),l=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(s)};return i(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;i(e=t)}else l()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=l());var s=c(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var i=0;i<s.length;i++){var l=o(s[i]);r[l].references--}for(var n=c(e,t),a=0;a<s.length;a++){var d=o(s[a]);0===r[d].references&&(r[d].updater(),r.splice(d,1))}s=n}}}},704:(e,t,s)=>{e.exports=s(79)("./src/core.js")},181:(e,t,s)=>{e.exports=s(79)("./src/typing.js")},273:(e,t,s)=>{e.exports=s(79)("./src/ui.js")},209:(e,t,s)=>{e.exports=s(79)("./src/utils.js")},79:e=>{"use strict";e.exports=CKEditor5.dll}},t={};function s(i){var l=t[i];if(void 0!==l)return l.exports;var n=t[i]={id:i,exports:{}};return e[i](n,n.exports,s),n.exports}s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var i in t)s.o(t,i)&&!s.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.nc=void 0;var i={};(()=>{"use strict";s.r(i),s.d(i,{Style:()=>L,StyleEditing:()=>O,StyleUI:()=>U,StyleUtils:()=>B});var e=s(704),t=s(273),l=s(209);class n extends t.ButtonView{constructor(e,t){super(e),this.styleDefinition=t,this.previewView=this._createPreview(),this.set({label:t.name,class:"ck-style-grid__button",withText:!0}),this.extendTemplate({attributes:{role:"option"}}),this.children.add(this.previewView,0)}_createPreview(){const e=new t.View(this.locale);return e.setTemplate({tag:"div",attributes:{class:["ck","ck-reset_all-excluded","ck-style-grid__button__preview","ck-content"],"aria-hidden":"true"},children:[this.styleDefinition.previewTemplate]}),e}}var r=s(62),o=s.n(r),c=s(945),a={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o()(c.Z,a);c.Z.locals;class d extends t.View{constructor(e,t){super(e),this.focusTracker=new l.FocusTracker,this.keystrokes=new l.KeystrokeHandler,this.set("activeStyles",[]),this.set("enabledStyles",[]),this.children=this.createCollection(),this.children.delegate("execute").to(this);for(const s of t){const t=new n(e,s);this.children.add(t)}this.on("change:activeStyles",(()=>{for(const e of this.children)e.isOn=this.activeStyles.includes(e.styleDefinition.name)})),this.on("change:enabledStyles",(()=>{for(const e of this.children)e.isEnabled=this.enabledStyles.includes(e.styleDefinition.name)})),this.setTemplate({tag:"div",attributes:{class:["ck","ck-style-grid"],role:"listbox"},children:this.children})}render(){super.render();for(const e of this.children)this.focusTracker.add(e.element);(0,t.addKeyboardHandlingForGrid)({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.children,numberOfColumns:3,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection}),this.keystrokes.listenTo(this.element)}focus(){this.children.first.focus()}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}}var u=s(561),h={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o()(u.Z,h);u.Z.locals;class g extends t.View{constructor(e,s,i){super(e),this.labelView=new t.LabelView(e),this.labelView.text=s,this.gridView=new d(e,i),this.setTemplate({tag:"div",attributes:{class:["ck","ck-style-panel__style-group"],role:"group","aria-labelledby":this.labelView.id},children:[this.labelView,this.gridView]})}}var y=s(662),p={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o()(y.Z,p);y.Z.locals;class f extends t.View{constructor(e,s){super(e);const i=e.t;this.focusTracker=new l.FocusTracker,this.keystrokes=new l.KeystrokeHandler,this.children=this.createCollection(),this.blockStylesGroupView=new g(e,i("Block styles"),s.block),this.inlineStylesGroupView=new g(e,i("Text styles"),s.inline),this.set("activeStyles",[]),this.set("enabledStyles",[]),this._focusables=new t.ViewCollection,this._focusCycler=new t.FocusCycler({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:["shift + tab"],focusNext:["tab"]}}),s.block.length&&this.children.add(this.blockStylesGroupView),s.inline.length&&this.children.add(this.inlineStylesGroupView),this.blockStylesGroupView.gridView.delegate("execute").to(this),this.inlineStylesGroupView.gridView.delegate("execute").to(this),this.blockStylesGroupView.gridView.bind("activeStyles","enabledStyles").to(this,"activeStyles","enabledStyles"),this.inlineStylesGroupView.gridView.bind("activeStyles","enabledStyles").to(this,"activeStyles","enabledStyles"),this.setTemplate({tag:"div",attributes:{class:["ck","ck-style-panel"]},children:this.children})}render(){super.render(),this._focusables.add(this.blockStylesGroupView.gridView),this._focusables.add(this.inlineStylesGroupView.gridView),this.focusTracker.add(this.blockStylesGroupView.gridView.element),this.focusTracker.add(this.inlineStylesGroupView.gridView.element),this.keystrokes.listenTo(this.element)}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}}const b=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};var k=Object.defineProperty,m=Object.defineProperties,v=Object.getOwnPropertyDescriptors,_=Object.getOwnPropertySymbols,S=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable,A=(e,t,s)=>t in e?k(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,x=(e,t)=>{for(var s in t||(t={}))S.call(t,s)&&A(e,s,t[s]);if(_)for(var s of _(t))w.call(t,s)&&A(e,s,t[s]);return e},T=(e,t)=>m(e,v(t));const F=["caption","colgroup","dd","dt","figcaption","legend","li","optgroup","option","rp","rt","summary","tbody","td","tfoot","th","thead","tr"];class B extends e.Plugin{constructor(e){super(e),this.decorate("isStyleEnabledForBlock"),this.decorate("isStyleActiveForBlock"),this.decorate("getAffectedBlocks"),this.decorate("isStyleEnabledForInlineSelection"),this.decorate("isStyleActiveForInlineSelection"),this.decorate("getAffectedInlineSelectable"),this.decorate("getStylePreview"),this.decorate("configureGHSDataFilter")}static get pluginName(){return"StyleUtils"}init(){this._htmlSupport=this.editor.plugins.get("GeneralHtmlSupport")}normalizeConfig(e,t=[]){const s={block:[],inline:[]};for(const i of t){const t=[],l=[];for(const s of e.getDefinitionsForView(i.element)){const e="appliesToBlock"in s&&s.appliesToBlock;s.isBlock||e?"string"==typeof e?t.push(e):s.isBlock&&t.push(s.model):l.push(s.model)}const n=this.getStylePreview(i,[{text:"AaBbCcDdEeFfGgHhIiJj"}]);t.length?s.block.push(T(x({},i),{previewTemplate:n,modelElements:t,isBlock:!0})):s.inline.push(T(x({},i),{previewTemplate:n,ghsAttributes:l}))}return s}isStyleEnabledForBlock(e,t){const s=this.editor.model,i=this._htmlSupport.getGhsAttributeNameForElement(e.element);return!!s.schema.checkAttribute(t,i)&&e.modelElements.includes(t.name)}isStyleActiveForBlock(e,t){const s=this._htmlSupport.getGhsAttributeNameForElement(e.element),i=t.getAttribute(s);return this.hasAllClasses(i,e.classes)}getAffectedBlocks(e,t){return e.modelElements.includes(t.name)?[t]:null}isStyleEnabledForInlineSelection(e,t){const s=this.editor.model;for(const i of e.ghsAttributes)if(s.schema.checkAttributeInSelection(t,i))return!0;return!1}isStyleActiveForInlineSelection(e,t){for(const s of e.ghsAttributes){const i=this._getValueFromFirstAllowedNode(t,s);if(this.hasAllClasses(i,e.classes))return!0}return!1}getAffectedInlineSelectable(e,t){return t}getStylePreview(e,t){const{element:s,classes:i}=e;return{tag:(l=s,F.includes(l)?"div":s),attributes:{class:i},children:t};var l}hasAllClasses(e,t){return b(e)&&(s=e,Boolean(s.classes)&&Array.isArray(s.classes))&&t.every((t=>e.classes.includes(t)));var s}configureGHSDataFilter({block:e,inline:t}){const s=this.editor.plugins.get("DataFilter");s.loadAllowedConfig(e.map(C)),s.loadAllowedConfig(t.map(C))}_getValueFromFirstAllowedNode(e,t){const s=this.editor.model.schema;if(e.isCollapsed)return e.getAttribute(t);for(const i of e.getRanges())for(const e of i.getItems())if(s.checkAttribute(e,t))return e.getAttribute(t);return null}}function C({element:e,classes:t}){return{name:e,classes:t}}var E=s(529),V={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o()(E.Z,V);E.Z.locals;class U extends e.Plugin{static get pluginName(){return"StyleUI"}static get requires(){return[B]}init(){const e=this.editor,s=e.plugins.get("DataSchema"),i=e.plugins.get("StyleUtils"),l=e.config.get("style.definitions"),n=i.normalizeConfig(s,l);e.ui.componentFactory.add("style",(s=>{const i=s.t,l=(0,t.createDropdown)(s),r=e.commands.get("style");return l.once("change:isOpen",(()=>{const e=new f(s,n);l.panelView.children.add(e),e.delegate("execute").to(l),e.bind("activeStyles").to(r,"value"),e.bind("enabledStyles").to(r,"enabledStyles")})),l.bind("isEnabled").to(r),l.buttonView.withText=!0,l.buttonView.bind("label").to(r,"value",(e=>e.length>1?i("Multiple styles"):1===e.length?e[0]:i("Styles"))),l.bind("class").to(r,"value",(e=>{const t=["ck-style-dropdown"];return e.length>1&&t.push("ck-style-dropdown_multiple-active"),t.join(" ")})),l.on("execute",(t=>{e.execute("style",{styleName:t.source.styleDefinition.name}),e.editing.view.focus()})),l}))}}class I extends e.Command{constructor(e,t){super(e),this.set("value",[]),this.set("enabledStyles",[]),this._styleDefinitions=t,this._styleUtils=this.editor.plugins.get(B)}refresh(){const e=this.editor.model,t=e.document.selection,s=new Set,i=new Set;for(const e of this._styleDefinitions.inline)this._styleUtils.isStyleEnabledForInlineSelection(e,t)&&i.add(e.name),this._styleUtils.isStyleActiveForInlineSelection(e,t)&&s.add(e.name);const n=(0,l.first)(t.getSelectedBlocks())||t.getFirstPosition().parent;if(n){const t=n.getAncestors({includeSelf:!0,parentFirst:!0});for(const l of t){if(l.is("rootElement"))break;for(const e of this._styleDefinitions.block)this._styleUtils.isStyleEnabledForBlock(e,l)&&(i.add(e.name),this._styleUtils.isStyleActiveForBlock(e,l)&&s.add(e.name));if(e.schema.isObject(l))break}}this.enabledStyles=Array.from(i).sort(),this.isEnabled=this.enabledStyles.length>0,this.value=this.isEnabled?Array.from(s).sort():[]}execute({styleName:e,forceValue:t}){if(!this.enabledStyles.includes(e))return void(0,l.logWarning)("style-command-executed-with-incorrect-style-name");const s=this.editor.model,i=s.document.selection,n=this.editor.plugins.get("GeneralHtmlSupport"),r=[...this._styleDefinitions.inline,...this._styleDefinitions.block],o=r.filter((({name:e})=>this.value.includes(e))),c=r.find((({name:t})=>t==e)),a=void 0===t?!this.value.includes(c.name):t;s.change((()=>{let e;e=function(e){return"isBlock"in e}(c)?this._findAffectedBlocks(function(e){const t=Array.from(e.getSelectedBlocks());if(t.length)return t;return[e.getFirstPosition().parent]}(i),c):[this._styleUtils.getAffectedInlineSelectable(c,i)];for(const t of e)a?n.addModelHtmlClass(c.element,c.classes,t):n.removeModelHtmlClass(c.element,j(o,c),t)}))}_findAffectedBlocks(e,t){const s=new Set;for(const i of e){const e=i.getAncestors({includeSelf:!0,parentFirst:!0});for(const i of e){if(i.is("rootElement"))break;const e=this._styleUtils.getAffectedBlocks(t,i);if(e){for(const t of e)s.add(t);break}}}return s}}function j(e,t){return e.reduce(((e,s)=>s.name===t.name?e:e.filter((e=>!s.classes.includes(e)))),t.classes)}class P extends e.Plugin{static get pluginName(){return"DocumentListStyleSupport"}static get requires(){return[B,"GeneralHtmlSupport"]}init(){const e=this.editor;e.plugins.has("DocumentListEditing")&&(this._styleUtils=e.plugins.get(B),this._documentListUtils=this.editor.plugins.get("DocumentListUtils"),this._htmlSupport=this.editor.plugins.get("GeneralHtmlSupport"),this.listenTo(this._styleUtils,"isStyleEnabledForBlock",((e,[t,s])=>{this._isStyleEnabledForBlock(t,s)&&(e.return=!0,e.stop())}),{priority:"high"}),this.listenTo(this._styleUtils,"isStyleActiveForBlock",((e,[t,s])=>{this._isStyleActiveForBlock(t,s)&&(e.return=!0,e.stop())}),{priority:"high"}),this.listenTo(this._styleUtils,"getAffectedBlocks",((e,[t,s])=>{const i=this._getAffectedBlocks(t,s);i&&(e.return=i,e.stop())}),{priority:"high"}),this.listenTo(this._styleUtils,"getStylePreview",((e,[t,s])=>{const i=this._getStylePreview(t,s);i&&(e.return=i,e.stop())}),{priority:"high"}))}_isStyleEnabledForBlock(e,t){const s=this.editor.model;if(!["ol","ul","li"].includes(e.element))return!1;if(!this._documentListUtils.isListItemBlock(t))return!1;const i=this._htmlSupport.getGhsAttributeNameForElement(e.element);if("ol"==e.element||"ul"==e.element){if(!s.schema.checkAttribute(t,i))return!1;const l="numbered"==t.getAttribute("listType")?"ol":"ul";return e.element==l}return s.schema.checkAttribute(t,i)}_isStyleActiveForBlock(e,t){const s=this._htmlSupport.getGhsAttributeNameForElement(e.element),i=t.getAttribute(s);return this._styleUtils.hasAllClasses(i,e.classes)}_getAffectedBlocks(e,t){return this._isStyleEnabledForBlock(e,t)?"li"==e.element?this._documentListUtils.expandListBlocksToCompleteItems(t,{withNested:!1}):this._documentListUtils.expandListBlocksToCompleteList(t):null}_getStylePreview(e,t){const{element:s,classes:i}=e;return"ol"==s||"ul"==s?{tag:s,attributes:{class:i},children:[{tag:"li",children:t}]}:"li"==s?{tag:"ol",children:[{tag:s,attributes:{class:i},children:t}]}:null}}class D extends e.Plugin{static get pluginName(){return"TableStyleSupport"}static get requires(){return[B]}init(){const e=this.editor;e.plugins.has("TableEditing")&&(this._styleUtils=e.plugins.get(B),this._tableUtils=this.editor.plugins.get("TableUtils"),this.listenTo(this._styleUtils,"isStyleEnabledForBlock",((e,[t,s])=>{this._isApplicable(t,s)&&(e.return=this._isStyleEnabledForBlock(t,s),e.stop())}),{priority:"high"}),this.listenTo(this._styleUtils,"getAffectedBlocks",((e,[t,s])=>{this._isApplicable(t,s)&&(e.return=this._getAffectedBlocks(t,s),e.stop())}),{priority:"high"}),this.listenTo(this._styleUtils,"configureGHSDataFilter",((e,[{block:t}])=>{this.editor.plugins.get("DataFilter").loadAllowedConfig(t.filter((e=>"figcaption"==e.element)).map((e=>({name:"caption",classes:e.classes}))))})))}_isApplicable(e,t){return["td","th"].includes(e.element)?"tableCell"==t.name:!!["thead","tbody"].includes(e.element)&&"table"==t.name}_isStyleEnabledForBlock(e,t){if(["td","th"].includes(e.element)){const s=this._tableUtils.getCellLocation(t),i=t.parent.parent,l=i.getAttribute("headingRows")||0,n=i.getAttribute("headingColumns")||0,r=s.row<l||s.column<n;return"th"==e.element?r:!r}if(["thead","tbody"].includes(e.element)){const s=t.getAttribute("headingRows")||0;return"thead"==e.element?s>0:s<this._tableUtils.getRows(t)}return!1}_getAffectedBlocks(e,t){return this._isStyleEnabledForBlock(e,t)?[t]:null}}var G=s(181);class H extends e.Plugin{static get pluginName(){return"LinkStyleSupport"}static get requires(){return[B,"GeneralHtmlSupport"]}init(){const e=this.editor;e.plugins.has("LinkEditing")&&(this._styleUtils=e.plugins.get(B),this._htmlSupport=this.editor.plugins.get("GeneralHtmlSupport"),this.listenTo(this._styleUtils,"isStyleEnabledForInlineSelection",((e,[t,s])=>{"a"==t.element&&(e.return=this._isStyleEnabled(t,s),e.stop())}),{priority:"high"}),this.listenTo(this._styleUtils,"isStyleActiveForInlineSelection",((e,[t,s])=>{"a"==t.element&&(e.return=this._isStyleActive(t,s),e.stop())}),{priority:"high"}),this.listenTo(this._styleUtils,"getAffectedInlineSelectable",((e,[t,s])=>{if("a"!=t.element)return;const i=this._getAffectedSelectable(t,s);i&&(e.return=i,e.stop())}),{priority:"high"}))}_isStyleEnabled(e,t){const s=this.editor.model;if(t.isCollapsed)return t.hasAttribute("linkHref");for(const e of t.getRanges())for(const t of e.getItems())if((t.is("$textProxy")||s.schema.isInline(t))&&t.hasAttribute("linkHref"))return!0;return!1}_isStyleActive(e,t){const s=this.editor.model,i=this._htmlSupport.getGhsAttributeNameForElement(e.element);if(t.isCollapsed){if(t.hasAttribute("linkHref")){const s=t.getAttribute(i);if(this._styleUtils.hasAllClasses(s,e.classes))return!0}return!1}for(const l of t.getRanges())for(const t of l.getItems())if((t.is("$textProxy")||s.schema.isInline(t))&&t.hasAttribute("linkHref")){const s=t.getAttribute(i);return this._styleUtils.hasAllClasses(s,e.classes)}return!1}_getAffectedSelectable(e,t){const s=this.editor.model;if(t.isCollapsed){const e=t.getAttribute("linkHref");return(0,G.findAttributeRange)(t.getFirstPosition(),"linkHref",e,s)}const i=[];for(const e of t.getRanges()){const t=s.createRange(N(e.start,"linkHref",!0,s),N(e.end,"linkHref",!1,s));for(const e of t.getItems())(e.is("$textProxy")||s.schema.isInline(e))&&e.hasAttribute("linkHref")&&i.push(this.editor.model.createRangeOn(e))}return function(e){for(let t=1;t<e.length;t++){const s=e[t-1].getJoined(e[t]);s&&e.splice(--t,2,s)}return e}(i)}}function N(e,t,s,i){const l=e.textNode||(s?e.nodeAfter:e.nodeBefore);if(!l||!l.hasAttribute(t))return e;const n=l.getAttribute(t);return(0,G.findAttributeRangeBound)(e,t,n,s,i)}class O extends e.Plugin{static get pluginName(){return"StyleEditing"}static get requires(){return["GeneralHtmlSupport",B,P,D,H]}init(){const e=this.editor,t=e.plugins.get("DataSchema"),s=e.plugins.get("StyleUtils"),i=e.config.get("style.definitions"),l=s.normalizeConfig(t,i);e.commands.add("style",new I(e,l)),s.configureGHSDataFilter(l)}}class L extends e.Plugin{static get pluginName(){return"Style"}static get requires(){return[O,U]}}})(),(window.CKEditor5=window.CKEditor5||{}).style=i})();
*/(()=>{var e={529:(e,t,s)=>{"use strict";s.d(t,{Z:()=>n});var i=s(609),l=s.n(i)()((function(e){return e[1]}));l.push([e.id,".ck.ck-dropdown.ck-style-dropdown.ck-style-dropdown_multiple-active>.ck-button>.ck-button__label{font-style:italic}",""]);const n=l},945:(e,t,s)=>{"use strict";s.d(t,{Z:()=>n});var i=s(609),l=s.n(i)()((function(e){return e[1]}));l.push([e.id,":root{--ck-style-panel-columns:3}.ck.ck-style-panel .ck-style-grid{display:grid;grid-template-columns:repeat(var(--ck-style-panel-columns),auto);justify-content:start}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button{display:flex;flex-direction:column;justify-content:space-between}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button .ck-style-grid__button__preview{align-content:center;align-items:center;display:flex;flex-basis:100%;flex-grow:1;justify-content:flex-start}:root{--ck-style-panel-button-width:120px;--ck-style-panel-button-height:80px;--ck-style-panel-button-label-background:#f0f0f0;--ck-style-panel-button-hover-label-background:#ebebeb;--ck-style-panel-button-hover-border-color:#b3b3b3}.ck.ck-style-panel .ck-style-grid{column-gap:var(--ck-spacing-large);row-gap:var(--ck-spacing-large)}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button{--ck-color-button-default-hover-background:var(--ck-color-base-background);--ck-color-button-default-active-background:var(--ck-color-base-background);height:var(--ck-style-panel-button-height);padding:0;width:var(--ck-style-panel-button-width)}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button:not(:focus){border:1px solid var(--ck-color-base-border)}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button .ck-button__label{flex-shrink:0;height:22px;line-height:22px;overflow:hidden;padding:0 var(--ck-spacing-medium);text-overflow:ellipsis;width:100%}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button .ck-style-grid__button__preview{background:var(--ck-color-base-background);border:2px solid var(--ck-color-base-background);opacity:.9;overflow:hidden;padding:var(--ck-spacing-medium);width:100%}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button.ck-disabled{--ck-color-button-default-disabled-background:var(--ck-color-base-foreground)}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button.ck-disabled:not(:focus){border-color:var(--ck-style-panel-button-label-background)}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button.ck-disabled .ck-style-grid__button__preview{border-color:var(--ck-color-base-foreground);filter:saturate(.3);opacity:.4}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button.ck-on{border-color:var(--ck-color-base-active)}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button.ck-on .ck-button__label{box-shadow:0 -1px 0 var(--ck-color-base-active);z-index:1}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button.ck-on:hover{border-color:var(--ck-color-base-active-focus)}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button:not(.ck-on) .ck-button__label{background:var(--ck-style-panel-button-label-background)}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button:not(.ck-on):hover .ck-button__label{background:var(--ck-style-panel-button-hover-label-background)}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button:hover:not(.ck-disabled):not(.ck-on){border-color:var(--ck-style-panel-button-hover-border-color)}.ck.ck-style-panel .ck-style-grid .ck-style-grid__button:hover:not(.ck-disabled):not(.ck-on) .ck-style-grid__button__preview{opacity:1}",""]);const n=l},561:(e,t,s)=>{"use strict";s.d(t,{Z:()=>n});var i=s(609),l=s.n(i)()((function(e){return e[1]}));l.push([e.id,".ck.ck-style-panel .ck-style-panel__style-group>.ck-label{margin:var(--ck-spacing-large) 0}.ck.ck-style-panel .ck-style-panel__style-group:first-child>.ck-label{margin-top:0}",""]);const n=l},662:(e,t,s)=>{"use strict";s.d(t,{Z:()=>n});var i=s(609),l=s.n(i)()((function(e){return e[1]}));l.push([e.id,":root{--ck-style-panel-max-height:470px}.ck.ck-style-panel{max-height:var(--ck-style-panel-max-height);overflow-y:auto;padding:var(--ck-spacing-large)}",""]);const n=l},609:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var s=e(t);return t[2]?"@media ".concat(t[2]," {").concat(s,"}"):s})).join("")},t.i=function(e,s,i){"string"==typeof e&&(e=[[null,e,""]]);var l={};if(i)for(var n=0;n<this.length;n++){var r=this[n][0];null!=r&&(l[r]=!0)}for(var o=0;o<e.length;o++){var c=[].concat(e[o]);i&&l[c[0]]||(s&&(c[2]?c[2]="".concat(s," and ").concat(c[2]):c[2]=s),t.push(c))}},t}},62:(e,t,s)=>{"use strict";var i,l=function(){return void 0===i&&(i=Boolean(window&&document&&document.all&&!window.atob)),i},n=function(){var e={};return function(t){if(void 0===e[t]){var s=document.querySelector(t);if(window.HTMLIFrameElement&&s instanceof window.HTMLIFrameElement)try{s=s.contentDocument.head}catch(e){s=null}e[t]=s}return e[t]}}(),r=[];function o(e){for(var t=-1,s=0;s<r.length;s++)if(r[s].identifier===e){t=s;break}return t}function c(e,t){for(var s={},i=[],l=0;l<e.length;l++){var n=e[l],c=t.base?n[0]+t.base:n[0],a=s[c]||0,d="".concat(c," ").concat(a);s[c]=a+1;var u=o(d),h={css:n[1],media:n[2],sourceMap:n[3]};-1!==u?(r[u].references++,r[u].updater(h)):r.push({identifier:d,updater:f(h,t),references:1}),i.push(d)}return i}function a(e){var t=document.createElement("style"),i=e.attributes||{};if(void 0===i.nonce){var l=s.nc;l&&(i.nonce=l)}if(Object.keys(i).forEach((function(e){t.setAttribute(e,i[e])})),"function"==typeof e.insert)e.insert(t);else{var r=n(e.insert||"head");if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(t)}return t}var d,u=(d=[],function(e,t){return d[e]=t,d.filter(Boolean).join("\n")});function h(e,t,s,i){var l=s?"":i.media?"@media ".concat(i.media," {").concat(i.css,"}"):i.css;if(e.styleSheet)e.styleSheet.cssText=u(t,l);else{var n=document.createTextNode(l),r=e.childNodes;r[t]&&e.removeChild(r[t]),r.length?e.insertBefore(n,r[t]):e.appendChild(n)}}function g(e,t,s){var i=s.css,l=s.media,n=s.sourceMap;if(l?e.setAttribute("media",l):e.removeAttribute("media"),n&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(n))))," */")),e.styleSheet)e.styleSheet.cssText=i;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(i))}}var p=null,y=0;function f(e,t){var s,i,l;if(t.singleton){var n=y++;s=p||(p=a(t)),i=h.bind(null,s,n,!1),l=h.bind(null,s,n,!0)}else s=a(t),i=g.bind(null,s,t),l=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(s)};return i(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;i(e=t)}else l()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=l());var s=c(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var i=0;i<s.length;i++){var l=o(s[i]);r[l].references--}for(var n=c(e,t),a=0;a<s.length;a++){var d=o(s[a]);0===r[d].references&&(r[d].updater(),r.splice(d,1))}s=n}}}},704:(e,t,s)=>{e.exports=s(79)("./src/core.js")},181:(e,t,s)=>{e.exports=s(79)("./src/typing.js")},273:(e,t,s)=>{e.exports=s(79)("./src/ui.js")},209:(e,t,s)=>{e.exports=s(79)("./src/utils.js")},79:e=>{"use strict";e.exports=CKEditor5.dll}},t={};function s(i){var l=t[i];if(void 0!==l)return l.exports;var n=t[i]={id:i,exports:{}};return e[i](n,n.exports,s),n.exports}s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var i in t)s.o(t,i)&&!s.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.nc=void 0;var i={};(()=>{"use strict";s.r(i),s.d(i,{Style:()=>U,StyleEditing:()=>V,StyleUI:()=>w,StyleUtils:()=>m});var e=s(704),t=s(273),l=s(209);class n extends t.ButtonView{constructor(e,t){super(e),this.styleDefinition=t,this.previewView=this._createPreview(),this.set({label:t.name,class:"ck-style-grid__button",withText:!0}),this.extendTemplate({attributes:{role:"option"}}),this.children.add(this.previewView,0)}_createPreview(){const e=new t.View(this.locale);return e.setTemplate({tag:"div",attributes:{class:["ck","ck-reset_all-excluded","ck-style-grid__button__preview","ck-content"],"aria-hidden":"true"},children:[this.styleDefinition.previewTemplate]}),e}}var r=s(62),o=s.n(r),c=s(945),a={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o()(c.Z,a);c.Z.locals;class d extends t.View{constructor(e,t){super(e),this.focusTracker=new l.FocusTracker,this.keystrokes=new l.KeystrokeHandler,this.set("activeStyles",[]),this.set("enabledStyles",[]),this.children=this.createCollection(),this.children.delegate("execute").to(this);for(const s of t){const t=new n(e,s);this.children.add(t)}this.on("change:activeStyles",(()=>{for(const e of this.children)e.isOn=this.activeStyles.includes(e.styleDefinition.name)})),this.on("change:enabledStyles",(()=>{for(const e of this.children)e.isEnabled=this.enabledStyles.includes(e.styleDefinition.name)})),this.setTemplate({tag:"div",attributes:{class:["ck","ck-style-grid"],role:"listbox"},children:this.children})}render(){super.render();for(const e of this.children)this.focusTracker.add(e.element);(0,t.addKeyboardHandlingForGrid)({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.children,numberOfColumns:3,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection}),this.keystrokes.listenTo(this.element)}focus(){this.children.first.focus()}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}}var u=s(561),h={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o()(u.Z,h);u.Z.locals;class g extends t.View{constructor(e,s,i){super(e),this.labelView=new t.LabelView(e),this.labelView.text=s,this.gridView=new d(e,i),this.setTemplate({tag:"div",attributes:{class:["ck","ck-style-panel__style-group"],role:"group","aria-labelledby":this.labelView.id},children:[this.labelView,this.gridView]})}}var p=s(662),y={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o()(p.Z,y);p.Z.locals;class f extends t.View{constructor(e,s){super(e);const i=e.t;this.focusTracker=new l.FocusTracker,this.keystrokes=new l.KeystrokeHandler,this.children=this.createCollection(),this.blockStylesGroupView=new g(e,i("Block styles"),s.block),this.inlineStylesGroupView=new g(e,i("Text styles"),s.inline),this.set("activeStyles",[]),this.set("enabledStyles",[]),this._focusables=new t.ViewCollection,this._focusCycler=new t.FocusCycler({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:["shift + tab"],focusNext:["tab"]}}),s.block.length&&this.children.add(this.blockStylesGroupView),s.inline.length&&this.children.add(this.inlineStylesGroupView),this.blockStylesGroupView.gridView.delegate("execute").to(this),this.inlineStylesGroupView.gridView.delegate("execute").to(this),this.blockStylesGroupView.gridView.bind("activeStyles","enabledStyles").to(this,"activeStyles","enabledStyles"),this.inlineStylesGroupView.gridView.bind("activeStyles","enabledStyles").to(this,"activeStyles","enabledStyles"),this.setTemplate({tag:"div",attributes:{class:["ck","ck-style-panel"]},children:this.children})}render(){super.render(),this._focusables.add(this.blockStylesGroupView.gridView),this._focusables.add(this.inlineStylesGroupView.gridView),this.focusTracker.add(this.blockStylesGroupView.gridView.element),this.focusTracker.add(this.inlineStylesGroupView.gridView.element),this.keystrokes.listenTo(this.element)}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}}const k=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},b=["caption","colgroup","dd","dt","figcaption","legend","li","optgroup","option","rp","rt","summary","tbody","td","tfoot","th","thead","tr"];class m extends e.Plugin{static get pluginName(){return"StyleUtils"}constructor(e){super(e),this.decorate("isStyleEnabledForBlock"),this.decorate("isStyleActiveForBlock"),this.decorate("getAffectedBlocks"),this.decorate("isStyleEnabledForInlineSelection"),this.decorate("isStyleActiveForInlineSelection"),this.decorate("getAffectedInlineSelectable"),this.decorate("getStylePreview"),this.decorate("configureGHSDataFilter")}init(){this._htmlSupport=this.editor.plugins.get("GeneralHtmlSupport")}normalizeConfig(e,t=[]){const s={block:[],inline:[]};for(const i of t){const t=[],l=[];for(const s of e.getDefinitionsForView(i.element)){const e="appliesToBlock"in s&&s.appliesToBlock;if(s.isBlock||e){if("string"==typeof e)t.push(e);else if(s.isBlock){const e=s;t.push(s.model),e.paragraphLikeModel&&t.push(e.paragraphLikeModel)}}else l.push(s.model)}const n=this.getStylePreview(i,[{text:"AaBbCcDdEeFfGgHhIiJj"}]);t.length?s.block.push({...i,previewTemplate:n,modelElements:t,isBlock:!0}):s.inline.push({...i,previewTemplate:n,ghsAttributes:l})}return s}isStyleEnabledForBlock(e,t){const s=this.editor.model,i=this._htmlSupport.getGhsAttributeNameForElement(e.element);return!!s.schema.checkAttribute(t,i)&&e.modelElements.includes(t.name)}isStyleActiveForBlock(e,t){const s=this._htmlSupport.getGhsAttributeNameForElement(e.element),i=t.getAttribute(s);return this.hasAllClasses(i,e.classes)}getAffectedBlocks(e,t){return e.modelElements.includes(t.name)?[t]:null}isStyleEnabledForInlineSelection(e,t){const s=this.editor.model;for(const i of e.ghsAttributes)if(s.schema.checkAttributeInSelection(t,i))return!0;return!1}isStyleActiveForInlineSelection(e,t){for(const s of e.ghsAttributes){const i=this._getValueFromFirstAllowedNode(t,s);if(this.hasAllClasses(i,e.classes))return!0}return!1}getAffectedInlineSelectable(e,t){return t}getStylePreview(e,t){const{element:s,classes:i}=e;return{tag:(l=s,b.includes(l)?"div":s),attributes:{class:i},children:t};var l}hasAllClasses(e,t){return k(e)&&(s=e,Boolean(s.classes)&&Array.isArray(s.classes))&&t.every((t=>e.classes.includes(t)));var s}configureGHSDataFilter({block:e,inline:t}){const s=this.editor.plugins.get("DataFilter");s.loadAllowedConfig(e.map(v)),s.loadAllowedConfig(t.map(v))}_getValueFromFirstAllowedNode(e,t){const s=this.editor.model.schema;if(e.isCollapsed)return e.getAttribute(t);for(const i of e.getRanges())for(const e of i.getItems())if(s.checkAttribute(e,t))return e.getAttribute(t);return null}}function v({element:e,classes:t}){return{name:e,classes:t}}var _=s(529),S={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};o()(_.Z,S);_.Z.locals;class w extends e.Plugin{static get pluginName(){return"StyleUI"}static get requires(){return[m]}init(){const e=this.editor,s=e.plugins.get("DataSchema"),i=e.plugins.get("StyleUtils"),l=e.config.get("style.definitions"),n=i.normalizeConfig(s,l);e.ui.componentFactory.add("style",(s=>{const i=s.t,l=(0,t.createDropdown)(s),r=e.commands.get("style");return l.once("change:isOpen",(()=>{const e=new f(s,n);l.panelView.children.add(e),e.delegate("execute").to(l),e.bind("activeStyles").to(r,"value"),e.bind("enabledStyles").to(r,"enabledStyles")})),l.bind("isEnabled").to(r),l.buttonView.withText=!0,l.buttonView.bind("label").to(r,"value",(e=>e.length>1?i("Multiple styles"):1===e.length?e[0]:i("Styles"))),l.bind("class").to(r,"value",(e=>{const t=["ck-style-dropdown"];return e.length>1&&t.push("ck-style-dropdown_multiple-active"),t.join(" ")})),l.on("execute",(t=>{e.execute("style",{styleName:t.source.styleDefinition.name}),e.editing.view.focus()})),l}))}}class A extends e.Command{constructor(e,t){super(e),this.set("value",[]),this.set("enabledStyles",[]),this._styleDefinitions=t,this._styleUtils=this.editor.plugins.get(m)}refresh(){const e=this.editor.model,t=e.document.selection,s=new Set,i=new Set;for(const e of this._styleDefinitions.inline)this._styleUtils.isStyleEnabledForInlineSelection(e,t)&&i.add(e.name),this._styleUtils.isStyleActiveForInlineSelection(e,t)&&s.add(e.name);const n=(0,l.first)(t.getSelectedBlocks())||t.getFirstPosition().parent;if(n){const t=n.getAncestors({includeSelf:!0,parentFirst:!0});for(const l of t){if(l.is("rootElement"))break;for(const e of this._styleDefinitions.block)this._styleUtils.isStyleEnabledForBlock(e,l)&&(i.add(e.name),this._styleUtils.isStyleActiveForBlock(e,l)&&s.add(e.name));if(e.schema.isObject(l))break}}this.enabledStyles=Array.from(i).sort(),this.isEnabled=this.enabledStyles.length>0,this.value=this.isEnabled?Array.from(s).sort():[]}execute({styleName:e,forceValue:t}){if(!this.enabledStyles.includes(e))return void(0,l.logWarning)("style-command-executed-with-incorrect-style-name");const s=this.editor.model,i=s.document.selection,n=this.editor.plugins.get("GeneralHtmlSupport"),r=[...this._styleDefinitions.inline,...this._styleDefinitions.block],o=r.filter((({name:e})=>this.value.includes(e))),c=r.find((({name:t})=>t==e)),a=void 0===t?!this.value.includes(c.name):t;s.change((()=>{let e;e=function(e){return"isBlock"in e}(c)?this._findAffectedBlocks(function(e){const t=Array.from(e.getSelectedBlocks());if(t.length)return t;return[e.getFirstPosition().parent]}(i),c):[this._styleUtils.getAffectedInlineSelectable(c,i)];for(const t of e)a?n.addModelHtmlClass(c.element,c.classes,t):n.removeModelHtmlClass(c.element,x(o,c),t)}))}_findAffectedBlocks(e,t){const s=new Set;for(const i of e){const e=i.getAncestors({includeSelf:!0,parentFirst:!0});for(const i of e){if(i.is("rootElement"))break;const e=this._styleUtils.getAffectedBlocks(t,i);if(e){for(const t of e)s.add(t);break}}}return s}}function x(e,t){return e.reduce(((e,s)=>s.name===t.name?e:e.filter((e=>!s.classes.includes(e)))),t.classes)}class T extends e.Plugin{static get pluginName(){return"DocumentListStyleSupport"}static get requires(){return[m,"GeneralHtmlSupport"]}init(){const e=this.editor;e.plugins.has("DocumentListEditing")&&(this._styleUtils=e.plugins.get(m),this._documentListUtils=this.editor.plugins.get("DocumentListUtils"),this._htmlSupport=this.editor.plugins.get("GeneralHtmlSupport"),this.listenTo(this._styleUtils,"isStyleEnabledForBlock",((e,[t,s])=>{this._isStyleEnabledForBlock(t,s)&&(e.return=!0,e.stop())}),{priority:"high"}),this.listenTo(this._styleUtils,"isStyleActiveForBlock",((e,[t,s])=>{this._isStyleActiveForBlock(t,s)&&(e.return=!0,e.stop())}),{priority:"high"}),this.listenTo(this._styleUtils,"getAffectedBlocks",((e,[t,s])=>{const i=this._getAffectedBlocks(t,s);i&&(e.return=i,e.stop())}),{priority:"high"}),this.listenTo(this._styleUtils,"getStylePreview",((e,[t,s])=>{const i=this._getStylePreview(t,s);i&&(e.return=i,e.stop())}),{priority:"high"}))}_isStyleEnabledForBlock(e,t){const s=this.editor.model;if(!["ol","ul","li"].includes(e.element))return!1;if(!this._documentListUtils.isListItemBlock(t))return!1;const i=this._htmlSupport.getGhsAttributeNameForElement(e.element);if("ol"==e.element||"ul"==e.element){if(!s.schema.checkAttribute(t,i))return!1;const l="numbered"==t.getAttribute("listType")?"ol":"ul";return e.element==l}return s.schema.checkAttribute(t,i)}_isStyleActiveForBlock(e,t){const s=this._htmlSupport.getGhsAttributeNameForElement(e.element),i=t.getAttribute(s);return this._styleUtils.hasAllClasses(i,e.classes)}_getAffectedBlocks(e,t){return this._isStyleEnabledForBlock(e,t)?"li"==e.element?this._documentListUtils.expandListBlocksToCompleteItems(t,{withNested:!1}):this._documentListUtils.expandListBlocksToCompleteList(t):null}_getStylePreview(e,t){const{element:s,classes:i}=e;return"ol"==s||"ul"==s?{tag:s,attributes:{class:i},children:[{tag:"li",children:t}]}:"li"==s?{tag:"ol",children:[{tag:s,attributes:{class:i},children:t}]}:null}}class F extends e.Plugin{static get pluginName(){return"TableStyleSupport"}static get requires(){return[m]}init(){const e=this.editor;e.plugins.has("TableEditing")&&(this._styleUtils=e.plugins.get(m),this._tableUtils=this.editor.plugins.get("TableUtils"),this.listenTo(this._styleUtils,"isStyleEnabledForBlock",((e,[t,s])=>{this._isApplicable(t,s)&&(e.return=this._isStyleEnabledForBlock(t,s),e.stop())}),{priority:"high"}),this.listenTo(this._styleUtils,"getAffectedBlocks",((e,[t,s])=>{this._isApplicable(t,s)&&(e.return=this._getAffectedBlocks(t,s),e.stop())}),{priority:"high"}),this.listenTo(this._styleUtils,"configureGHSDataFilter",((e,[{block:t}])=>{this.editor.plugins.get("DataFilter").loadAllowedConfig(t.filter((e=>"figcaption"==e.element)).map((e=>({name:"caption",classes:e.classes}))))})))}_isApplicable(e,t){return["td","th"].includes(e.element)?"tableCell"==t.name:!!["thead","tbody"].includes(e.element)&&"table"==t.name}_isStyleEnabledForBlock(e,t){if(["td","th"].includes(e.element)){const s=this._tableUtils.getCellLocation(t),i=t.parent.parent,l=i.getAttribute("headingRows")||0,n=i.getAttribute("headingColumns")||0,r=s.row<l||s.column<n;return"th"==e.element?r:!r}if(["thead","tbody"].includes(e.element)){const s=t.getAttribute("headingRows")||0;return"thead"==e.element?s>0:s<this._tableUtils.getRows(t)}return!1}_getAffectedBlocks(e,t){return this._isStyleEnabledForBlock(e,t)?[t]:null}}var B=s(181);class C extends e.Plugin{static get pluginName(){return"LinkStyleSupport"}static get requires(){return[m,"GeneralHtmlSupport"]}init(){const e=this.editor;e.plugins.has("LinkEditing")&&(this._styleUtils=e.plugins.get(m),this._htmlSupport=this.editor.plugins.get("GeneralHtmlSupport"),this.listenTo(this._styleUtils,"isStyleEnabledForInlineSelection",((e,[t,s])=>{"a"==t.element&&(e.return=this._isStyleEnabled(t,s),e.stop())}),{priority:"high"}),this.listenTo(this._styleUtils,"isStyleActiveForInlineSelection",((e,[t,s])=>{"a"==t.element&&(e.return=this._isStyleActive(t,s),e.stop())}),{priority:"high"}),this.listenTo(this._styleUtils,"getAffectedInlineSelectable",((e,[t,s])=>{if("a"!=t.element)return;const i=this._getAffectedSelectable(t,s);i&&(e.return=i,e.stop())}),{priority:"high"}))}_isStyleEnabled(e,t){const s=this.editor.model;if(t.isCollapsed)return t.hasAttribute("linkHref");for(const e of t.getRanges())for(const t of e.getItems())if((t.is("$textProxy")||s.schema.isInline(t))&&t.hasAttribute("linkHref"))return!0;return!1}_isStyleActive(e,t){const s=this.editor.model,i=this._htmlSupport.getGhsAttributeNameForElement(e.element);if(t.isCollapsed){if(t.hasAttribute("linkHref")){const s=t.getAttribute(i);if(this._styleUtils.hasAllClasses(s,e.classes))return!0}return!1}for(const l of t.getRanges())for(const t of l.getItems())if((t.is("$textProxy")||s.schema.isInline(t))&&t.hasAttribute("linkHref")){const s=t.getAttribute(i);return this._styleUtils.hasAllClasses(s,e.classes)}return!1}_getAffectedSelectable(e,t){const s=this.editor.model;if(t.isCollapsed){const e=t.getAttribute("linkHref");return(0,B.findAttributeRange)(t.getFirstPosition(),"linkHref",e,s)}const i=[];for(const e of t.getRanges()){const t=s.createRange(E(e.start,"linkHref",!0,s),E(e.end,"linkHref",!1,s));for(const e of t.getItems())(e.is("$textProxy")||s.schema.isInline(e))&&e.hasAttribute("linkHref")&&i.push(this.editor.model.createRangeOn(e))}return function(e){for(let t=1;t<e.length;t++){const s=e[t-1].getJoined(e[t]);s&&e.splice(--t,2,s)}return e}(i)}}function E(e,t,s,i){const l=e.textNode||(s?e.nodeAfter:e.nodeBefore);if(!l||!l.hasAttribute(t))return e;const n=l.getAttribute(t);return(0,B.findAttributeRangeBound)(e,t,n,s,i)}class V extends e.Plugin{static get pluginName(){return"StyleEditing"}static get requires(){return["GeneralHtmlSupport",m,T,F,C]}init(){const e=this.editor,t=e.plugins.get("DataSchema"),s=e.plugins.get("StyleUtils"),i=e.config.get("style.definitions"),l=s.normalizeConfig(t,i);e.commands.add("style",new A(e,l)),s.configureGHSDataFilter(l)}}class U extends e.Plugin{static get pluginName(){return"Style"}static get requires(){return[V,w]}}})(),(window.CKEditor5=window.CKEditor5||{}).style=i})();
{
"name": "@ckeditor/ckeditor5-style",
"version": "38.0.1",
"version": "38.1.0",
"description": "Style feature for CKEditor 5.",

@@ -15,46 +15,5 @@ "keywords": [

"dependencies": {
"ckeditor5": "^38.0.1",
"ckeditor5": "38.1.0",
"lodash-es": "^4.17.15"
},
"devDependencies": {
"@ckeditor/ckeditor5-alignment": "^38.0.1",
"@ckeditor/ckeditor5-autoformat": "^38.0.1",
"@ckeditor/ckeditor5-basic-styles": "^38.0.1",
"@ckeditor/ckeditor5-block-quote": "^38.0.1",
"@ckeditor/ckeditor5-cloud-services": "^38.0.1",
"@ckeditor/ckeditor5-code-block": "^38.0.1",
"@ckeditor/ckeditor5-core": "^38.0.1",
"@ckeditor/ckeditor5-dev-utils": "^37.0.0",
"@ckeditor/ckeditor5-easy-image": "^38.0.1",
"@ckeditor/ckeditor5-editor-classic": "^38.0.1",
"@ckeditor/ckeditor5-engine": "^38.0.1",
"@ckeditor/ckeditor5-essentials": "^38.0.1",
"@ckeditor/ckeditor5-font": "^38.0.1",
"@ckeditor/ckeditor5-heading": "^38.0.1",
"@ckeditor/ckeditor5-highlight": "^38.0.1",
"@ckeditor/ckeditor5-horizontal-line": "^38.0.1",
"@ckeditor/ckeditor5-html-embed": "^38.0.1",
"@ckeditor/ckeditor5-html-support": "^38.0.1",
"@ckeditor/ckeditor5-image": "^38.0.1",
"@ckeditor/ckeditor5-indent": "^38.0.1",
"@ckeditor/ckeditor5-language": "^38.0.1",
"@ckeditor/ckeditor5-link": "^38.0.1",
"@ckeditor/ckeditor5-list": "^38.0.1",
"@ckeditor/ckeditor5-media-embed": "^38.0.1",
"@ckeditor/ckeditor5-mention": "^38.0.1",
"@ckeditor/ckeditor5-page-break": "^38.0.1",
"@ckeditor/ckeditor5-paragraph": "^38.0.1",
"@ckeditor/ckeditor5-paste-from-office": "^38.0.1",
"@ckeditor/ckeditor5-remove-format": "^38.0.1",
"@ckeditor/ckeditor5-source-editing": "^38.0.1",
"@ckeditor/ckeditor5-table": "^38.0.1",
"@ckeditor/ckeditor5-theme-lark": "^38.0.1",
"@ckeditor/ckeditor5-typing": "^38.0.1",
"@ckeditor/ckeditor5-ui": "^38.0.1",
"@ckeditor/ckeditor5-utils": "^38.0.1",
"@ckeditor/ckeditor5-word-count": "^38.0.1",
"typescript": "^4.8.4",
"webpack": "^5.58.1",
"webpack-cli": "^4.9.0"
},
"engines": {

@@ -82,8 +41,3 @@ "node": ">=16.0.0",

],
"scripts": {
"dll:build": "webpack",
"build": "tsc -p ./tsconfig.json",
"postversion": "npm run build"
},
"types": "src/index.d.ts"
}

@@ -12,4 +12,4 @@ /**

export { default as StyleUtils } from './styleutils';
export type { StyleConfig } from './styleconfig';
export type { StyleConfig, StyleDefinition } from './styleconfig';
export type { default as StyleCommand } from './stylecommand';
import './augmentation';

@@ -17,3 +17,3 @@ /**

*/
static get pluginName(): 'DocumentListStyleSupport';
static get pluginName(): "DocumentListStyleSupport";
/**

@@ -20,0 +20,0 @@ * @inheritDoc

@@ -16,3 +16,3 @@ /**

*/
static get pluginName(): 'LinkStyleSupport';
static get pluginName(): "LinkStyleSupport";
/**

@@ -19,0 +19,0 @@ * @inheritDoc

@@ -16,3 +16,3 @@ /**

*/
static get pluginName(): 'TableStyleSupport';
static get pluginName(): "TableStyleSupport";
/**

@@ -19,0 +19,0 @@ * @inheritDoc

@@ -21,3 +21,3 @@ /**

*/
static get pluginName(): 'Style';
static get pluginName(): "Style";
/**

@@ -24,0 +24,0 @@ * @inheritDoc

@@ -24,3 +24,3 @@ /**

*/
static get pluginName(): 'StyleEditing';
static get pluginName(): "StyleEditing";
/**

@@ -27,0 +27,0 @@ * @inheritDoc

@@ -21,3 +21,3 @@ /**

*/
static get pluginName(): 'StyleUI';
static get pluginName(): "StyleUI";
/**

@@ -24,0 +24,0 @@ * @inheritDoc

@@ -19,3 +19,3 @@ /**

*/
static get pluginName(): 'StyleUtils';
static get pluginName(): "StyleUtils";
/**

@@ -22,0 +22,0 @@ * @inheritDoc

@@ -78,3 +78,7 @@ /**

else if (ghsDefinition.isBlock) {
const ghsBlockDefinition = ghsDefinition;
modelElements.push(ghsDefinition.model);
if (ghsBlockDefinition.paragraphLikeModel) {
modelElements.push(ghsBlockDefinition.paragraphLikeModel);
}
}

@@ -81,0 +85,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc