@ckeditor/ckeditor5-style 35.4.0 → 36.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +1 -1
- package/build/style.js +2 -2
- package/package.json +35 -35
- package/src/index.js +1 -1
- package/src/style.js +1 -1
- package/src/stylecommand.js +1 -1
- package/src/styleediting.js +1 -1
- package/src/styleui.js +15 -12
- package/src/ui/stylegridbuttonview.js +1 -1
- package/src/ui/stylegridview.js +1 -1
- package/src/ui/stylegroupview.js +1 -1
- package/src/ui/stylepanelview.js +1 -1
- package/src/utils.js +1 -1
- package/theme/style.css +1 -1
- package/theme/stylegrid.css +1 -1
- package/theme/stylegroup.css +1 -1
- package/theme/stylepanel.css +1 -1
package/LICENSE.md
CHANGED
|
@@ -2,7 +2,7 @@ Software License Agreement
|
|
|
2
2
|
==========================
|
|
3
3
|
|
|
4
4
|
**CKEditor 5 style feature** – https://github.com/ckeditor/ckeditor5-style <br>
|
|
5
|
-
Copyright (c) 2003-
|
|
5
|
+
Copyright (c) 2003-2023, [CKSource Holding sp. z o.o.](https://cksource.com) All rights reserved.
|
|
6
6
|
|
|
7
7
|
Licensed under the terms of [GNU General Public License Version 2 or later](http://www.gnu.org/licenses/gpl.html).
|
|
8
8
|
|
package/build/style.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
!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={})),
|
|
2
2
|
/*!
|
|
3
|
-
* @license Copyright (c) 2003-
|
|
3
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
4
4
|
* For licensing, see LICENSE.md.
|
|
5
|
-
*/(()=>{var e={529:(e,t,s)=>{"use strict";s.d(t,{Z:()=>l});var i=s(609),n=s.n(i)()((function(e){return e[1]}));n.push([e.id,".ck.ck-dropdown.ck-style-dropdown.ck-style-dropdown_multiple-active>.ck-button>.ck-button__label{font-style:italic}",""]);const l=n},945:(e,t,s)=>{"use strict";s.d(t,{Z:()=>l});var i=s(609),n=s.n(i)()((function(e){return e[1]}));n.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 l=n},561:(e,t,s)=>{"use strict";s.d(t,{Z:()=>l});var i=s(609),n=s.n(i)()((function(e){return e[1]}));n.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 l=n},662:(e,t,s)=>{"use strict";s.d(t,{Z:()=>l});var i=s(609),n=s.n(i)()((function(e){return e[1]}));n.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 l=n},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 n={};if(i)for(var l=0;l<this.length;l++){var o=this[l][0];null!=o&&(n[o]=!0)}for(var r=0;r<e.length;r++){var c=[].concat(e[r]);i&&n[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,n=function(){return void 0===i&&(i=Boolean(window&&document&&document.all&&!window.atob)),i},l=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]}}(),o=[];function r(e){for(var t=-1,s=0;s<o.length;s++)if(o[s].identifier===e){t=s;break}return t}function c(e,t){for(var s={},i=[],n=0;n<e.length;n++){var l=e[n],c=t.base?l[0]+t.base:l[0],a=s[c]||0,d="".concat(c," ").concat(a);s[c]=a+1;var u=r(d),h={css:l[1],media:l[2],sourceMap:l[3]};-1!==u?(o[u].references++,o[u].updater(h)):o.push({identifier:d,updater:g(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 n=s.nc;n&&(i.nonce=n)}if(Object.keys(i).forEach((function(e){t.setAttribute(e,i[e])})),"function"==typeof e.insert)e.insert(t);else{var o=l(e.insert||"head");if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.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 n=s?"":i.media?"@media ".concat(i.media," {").concat(i.css,"}"):i.css;if(e.styleSheet)e.styleSheet.cssText=u(t,n);else{var l=document.createTextNode(n),o=e.childNodes;o[t]&&e.removeChild(o[t]),o.length?e.insertBefore(l,o[t]):e.appendChild(l)}}function k(e,t,s){var i=s.css,n=s.media,l=s.sourceMap;if(n?e.setAttribute("media",n):e.removeAttribute("media"),l&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(l))))," */")),e.styleSheet)e.styleSheet.cssText=i;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(i))}}var y=null,b=0;function g(e,t){var s,i,n;if(t.singleton){var l=b++;s=y||(y=a(t)),i=h.bind(null,s,l,!1),n=h.bind(null,s,l,!0)}else s=a(t),i=k.bind(null,s,t),n=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 n()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=n());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 n=r(s[i]);o[n].references--}for(var l=c(e,t),a=0;a<s.length;a++){var d=r(s[a]);0===o[d].references&&(o[d].updater(),o.splice(d,1))}s=l}}}},704:(e,t,s)=>{e.exports=s(79)("./src/core.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 n=t[i];if(void 0!==n)return n.exports;var l=t[i]={id:i,exports:{}};return e[i](l,l.exports,s),l.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:()=>V,StyleEditing:()=>x,StyleUI:()=>w});var e=s(704),t=s(273),n=s(209);const l=["caption","colgroup","dd","dt","figcaption","legend","li","optgroup","option","rp","rt","summary","tbody","td","tfoot","th","thead","tr"];class o 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{element:e,classes:s}=this.styleDefinition,i=new t.View(this.locale);return i.setTemplate({tag:"div",attributes:{class:["ck","ck-reset_all-excluded","ck-style-grid__button__preview","ck-content"],"aria-hidden":"true"},children:[{tag:this._isPreviewable(e)?e:"div",attributes:{class:s},children:[{text:"AaBbCcDdEeFfGgHhIiJj"}]}]}),i}_isPreviewable(e){return!l.includes(e)}}var r=s(62),c=s.n(r),a=s(945),d={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};c()(a.Z,d);a.Z.locals;class u extends t.View{constructor(e,t){super(e),this.focusTracker=new n.FocusTracker,this.keystrokes=new n.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 o(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 h=s(561),k={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};c()(h.Z,k);h.Z.locals;class y extends t.View{constructor(e,s,i){super(e),this.labelView=new t.LabelView(e),this.labelView.text=s,this.gridView=new u(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 b=s(662),g={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};c()(b.Z,g);b.Z.locals;class p extends t.View{constructor(e,s){super(e);const i=e.t;this.focusTracker=new n.FocusTracker,this.keystrokes=new n.KeystrokeHandler,this.children=this.createCollection(),this.blockStylesGroupView=new y(e,i("Block styles"),s.block),this.inlineStylesGroupView=new y(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),this.inlineStylesGroupView.gridView.bind("activeStyles","enabledStyles").to(this),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()}}function f(e,t=[]){const s={block:[],inline:[]};for(const i of t){const t=[],n=[];for(const s of e.getDefinitionsForView(i.element))s.isBlock?t.push(s.model):n.push(s.model);t.length?s.block.push({...i,modelElements:t,isBlock:!0}):s.inline.push({...i,ghsAttributes:n})}return s}var m=s(529),v={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};c()(m.Z,v);m.Z.locals;class w extends e.Plugin{static get pluginName(){return"StyleUI"}init(){const e=this.editor,s=f(e.plugins.get("DataSchema"),e.config.get("style.definitions"));e.ui.componentFactory.add("style",(i=>{const n=i.t,l=(0,t.createDropdown)(i),o=new p(i,s),r=e.commands.get("style");return l.bind("isEnabled").to(r),l.panelView.children.add(o),l.buttonView.withText=!0,l.buttonView.bind("label").to(r,"value",(e=>e.length>1?n("Multiple styles"):1===e.length?e[0]:n("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(" ")})),o.delegate("execute").to(l),l.on("execute",(t=>{e.execute("style",{styleName:t.source.styleDefinition.name}),e.editing.view.focus()})),o.bind("activeStyles").to(r,"value"),o.bind("enabledStyles").to(r,"enabledStyles"),l}))}}class _ extends e.Command{constructor(e,t){super(e),this.set("value",[]),this.set("enabledStyles",[]),this._styleDefinitions=t}refresh(){const e=this.editor.model,t=e.document.selection,s=new Set,i=new Set;for(const n of this._styleDefinitions.inline)for(const l of n.ghsAttributes){e.schema.checkAttributeInSelection(t,l)&&i.add(n.name);S(this._getValueFromFirstAllowedNode(l),n.classes)&&s.add(n.name)}const l=(0,n.first)(t.getSelectedBlocks());if(l){const t=l.getAncestors({includeSelf:!0,parentFirst:!0});for(const n of t){if(e.schema.isLimit(n))break;if(e.schema.checkAttribute(n,"htmlAttributes"))for(const e of this._styleDefinitions.block){if(!e.modelElements.includes(n.name))continue;i.add(e.name);S(n.getAttribute("htmlAttributes"),e.classes)&&s.add(e.name)}}}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,n.logWarning)("style-command-executed-with-incorrect-style-name");const s=this.editor.model,i=s.document.selection,l=this.editor.plugins.get("GeneralHtmlSupport"),o=[...this._styleDefinitions.inline,...this._styleDefinitions.block].find((({name:t})=>t==e)),r=void 0===t?!this.value.includes(o.name):t;s.change((()=>{let e;e=o.isBlock?function(e,t,s){const i=new Set;for(const n of e){const e=n.getAncestors({includeSelf:!0,parentFirst:!0});for(const n of e){if(s.isLimit(n))break;if(t.includes(n.name)){i.add(n);break}}}return i}(i.getSelectedBlocks(),o.modelElements,s.schema):[i];for(const t of e)r?l.addModelHtmlClass(o.element,o.classes,t):l.removeModelHtmlClass(o.element,o.classes,t)}))}_getValueFromFirstAllowedNode(e){const t=this.editor.model,s=t.schema,i=t.document.selection;if(i.isCollapsed)return i.getAttribute(e);for(const t of i.getRanges())for(const i of t.getItems())if(s.checkAttribute(i,e))return i.getAttribute(e);return null}}function S(e,t){return!(!e||!e.classes)&&t.every((t=>e.classes.includes(t)))}class x extends e.Plugin{static get pluginName(){return"StyleEditing"}static get requires(){return["GeneralHtmlSupport"]}init(){const e=this.editor,t=f(e.plugins.get("DataSchema"),e.config.get("style.definitions"));e.commands.add("style",new _(e,t)),this._configureGHSDataFilter(t)}_configureGHSDataFilter({block:e,inline:t}){const s=this.editor.plugins.get("DataFilter");s.loadAllowedConfig(e.map(T)),s.loadAllowedConfig(t.map(T))}}function T({element:e,classes:t}){return{name:e,classes:t}}class V extends e.Plugin{static get pluginName(){return"Style"}static get requires(){return[x,w]}}})(),(window.CKEditor5=window.CKEditor5||{}).style=i})();
|
|
5
|
+
*/(()=>{var e={529:(e,t,s)=>{"use strict";s.d(t,{Z:()=>l});var i=s(609),n=s.n(i)()((function(e){return e[1]}));n.push([e.id,".ck.ck-dropdown.ck-style-dropdown.ck-style-dropdown_multiple-active>.ck-button>.ck-button__label{font-style:italic}",""]);const l=n},945:(e,t,s)=>{"use strict";s.d(t,{Z:()=>l});var i=s(609),n=s.n(i)()((function(e){return e[1]}));n.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 l=n},561:(e,t,s)=>{"use strict";s.d(t,{Z:()=>l});var i=s(609),n=s.n(i)()((function(e){return e[1]}));n.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 l=n},662:(e,t,s)=>{"use strict";s.d(t,{Z:()=>l});var i=s(609),n=s.n(i)()((function(e){return e[1]}));n.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 l=n},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 n={};if(i)for(var l=0;l<this.length;l++){var o=this[l][0];null!=o&&(n[o]=!0)}for(var r=0;r<e.length;r++){var c=[].concat(e[r]);i&&n[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,n=function(){return void 0===i&&(i=Boolean(window&&document&&document.all&&!window.atob)),i},l=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]}}(),o=[];function r(e){for(var t=-1,s=0;s<o.length;s++)if(o[s].identifier===e){t=s;break}return t}function c(e,t){for(var s={},i=[],n=0;n<e.length;n++){var l=e[n],c=t.base?l[0]+t.base:l[0],a=s[c]||0,d="".concat(c," ").concat(a);s[c]=a+1;var u=r(d),h={css:l[1],media:l[2],sourceMap:l[3]};-1!==u?(o[u].references++,o[u].updater(h)):o.push({identifier:d,updater:g(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 n=s.nc;n&&(i.nonce=n)}if(Object.keys(i).forEach((function(e){t.setAttribute(e,i[e])})),"function"==typeof e.insert)e.insert(t);else{var o=l(e.insert||"head");if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.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 n=s?"":i.media?"@media ".concat(i.media," {").concat(i.css,"}"):i.css;if(e.styleSheet)e.styleSheet.cssText=u(t,n);else{var l=document.createTextNode(n),o=e.childNodes;o[t]&&e.removeChild(o[t]),o.length?e.insertBefore(l,o[t]):e.appendChild(l)}}function k(e,t,s){var i=s.css,n=s.media,l=s.sourceMap;if(n?e.setAttribute("media",n):e.removeAttribute("media"),l&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(l))))," */")),e.styleSheet)e.styleSheet.cssText=i;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(i))}}var y=null,b=0;function g(e,t){var s,i,n;if(t.singleton){var l=b++;s=y||(y=a(t)),i=h.bind(null,s,l,!1),n=h.bind(null,s,l,!0)}else s=a(t),i=k.bind(null,s,t),n=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 n()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=n());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 n=r(s[i]);o[n].references--}for(var l=c(e,t),a=0;a<s.length;a++){var d=r(s[a]);0===o[d].references&&(o[d].updater(),o.splice(d,1))}s=l}}}},704:(e,t,s)=>{e.exports=s(79)("./src/core.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 n=t[i];if(void 0!==n)return n.exports;var l=t[i]={id:i,exports:{}};return e[i](l,l.exports,s),l.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:()=>V,StyleEditing:()=>x,StyleUI:()=>w});var e=s(704),t=s(273),n=s(209);const l=["caption","colgroup","dd","dt","figcaption","legend","li","optgroup","option","rp","rt","summary","tbody","td","tfoot","th","thead","tr"];class o 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{element:e,classes:s}=this.styleDefinition,i=new t.View(this.locale);return i.setTemplate({tag:"div",attributes:{class:["ck","ck-reset_all-excluded","ck-style-grid__button__preview","ck-content"],"aria-hidden":"true"},children:[{tag:this._isPreviewable(e)?e:"div",attributes:{class:s},children:[{text:"AaBbCcDdEeFfGgHhIiJj"}]}]}),i}_isPreviewable(e){return!l.includes(e)}}var r=s(62),c=s.n(r),a=s(945),d={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};c()(a.Z,d);a.Z.locals;class u extends t.View{constructor(e,t){super(e),this.focusTracker=new n.FocusTracker,this.keystrokes=new n.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 o(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 h=s(561),k={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};c()(h.Z,k);h.Z.locals;class y extends t.View{constructor(e,s,i){super(e),this.labelView=new t.LabelView(e),this.labelView.text=s,this.gridView=new u(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 b=s(662),g={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};c()(b.Z,g);b.Z.locals;class p extends t.View{constructor(e,s){super(e);const i=e.t;this.focusTracker=new n.FocusTracker,this.keystrokes=new n.KeystrokeHandler,this.children=this.createCollection(),this.blockStylesGroupView=new y(e,i("Block styles"),s.block),this.inlineStylesGroupView=new y(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),this.inlineStylesGroupView.gridView.bind("activeStyles","enabledStyles").to(this),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()}}function f(e,t=[]){const s={block:[],inline:[]};for(const i of t){const t=[],n=[];for(const s of e.getDefinitionsForView(i.element))s.isBlock?t.push(s.model):n.push(s.model);t.length?s.block.push({...i,modelElements:t,isBlock:!0}):s.inline.push({...i,ghsAttributes:n})}return s}var m=s(529),v={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};c()(m.Z,v);m.Z.locals;class w extends e.Plugin{static get pluginName(){return"StyleUI"}init(){const e=this.editor,s=f(e.plugins.get("DataSchema"),e.config.get("style.definitions"));e.ui.componentFactory.add("style",(i=>{const n=i.t,l=(0,t.createDropdown)(i),o=e.commands.get("style");return l.once("change:isOpen",(()=>{const e=new p(i,s);l.panelView.children.add(e),e.delegate("execute").to(l),e.bind("activeStyles").to(o,"value"),e.bind("enabledStyles").to(o,"enabledStyles")})),l.bind("isEnabled").to(o),l.buttonView.withText=!0,l.buttonView.bind("label").to(o,"value",(e=>e.length>1?n("Multiple styles"):1===e.length?e[0]:n("Styles"))),l.bind("class").to(o,"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 _ extends e.Command{constructor(e,t){super(e),this.set("value",[]),this.set("enabledStyles",[]),this._styleDefinitions=t}refresh(){const e=this.editor.model,t=e.document.selection,s=new Set,i=new Set;for(const n of this._styleDefinitions.inline)for(const l of n.ghsAttributes){e.schema.checkAttributeInSelection(t,l)&&i.add(n.name);S(this._getValueFromFirstAllowedNode(l),n.classes)&&s.add(n.name)}const l=(0,n.first)(t.getSelectedBlocks());if(l){const t=l.getAncestors({includeSelf:!0,parentFirst:!0});for(const n of t){if(e.schema.isLimit(n))break;if(e.schema.checkAttribute(n,"htmlAttributes"))for(const e of this._styleDefinitions.block){if(!e.modelElements.includes(n.name))continue;i.add(e.name);S(n.getAttribute("htmlAttributes"),e.classes)&&s.add(e.name)}}}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,n.logWarning)("style-command-executed-with-incorrect-style-name");const s=this.editor.model,i=s.document.selection,l=this.editor.plugins.get("GeneralHtmlSupport"),o=[...this._styleDefinitions.inline,...this._styleDefinitions.block].find((({name:t})=>t==e)),r=void 0===t?!this.value.includes(o.name):t;s.change((()=>{let e;e=o.isBlock?function(e,t,s){const i=new Set;for(const n of e){const e=n.getAncestors({includeSelf:!0,parentFirst:!0});for(const n of e){if(s.isLimit(n))break;if(t.includes(n.name)){i.add(n);break}}}return i}(i.getSelectedBlocks(),o.modelElements,s.schema):[i];for(const t of e)r?l.addModelHtmlClass(o.element,o.classes,t):l.removeModelHtmlClass(o.element,o.classes,t)}))}_getValueFromFirstAllowedNode(e){const t=this.editor.model,s=t.schema,i=t.document.selection;if(i.isCollapsed)return i.getAttribute(e);for(const t of i.getRanges())for(const i of t.getItems())if(s.checkAttribute(i,e))return i.getAttribute(e);return null}}function S(e,t){return!(!e||!e.classes)&&t.every((t=>e.classes.includes(t)))}class x extends e.Plugin{static get pluginName(){return"StyleEditing"}static get requires(){return["GeneralHtmlSupport"]}init(){const e=this.editor,t=f(e.plugins.get("DataSchema"),e.config.get("style.definitions"));e.commands.add("style",new _(e,t)),this._configureGHSDataFilter(t)}_configureGHSDataFilter({block:e,inline:t}){const s=this.editor.plugins.get("DataFilter");s.loadAllowedConfig(e.map(T)),s.loadAllowedConfig(t.map(T))}}function T({element:e,classes:t}){return{name:e,classes:t}}class V extends e.Plugin{static get pluginName(){return"Style"}static get requires(){return[x,w]}}})(),(window.CKEditor5=window.CKEditor5||{}).style=i})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-style",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "36.0.0",
|
|
4
4
|
"description": "Style feature for CKEditor 5.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ckeditor",
|
|
@@ -12,42 +12,42 @@
|
|
|
12
12
|
],
|
|
13
13
|
"main": "src/index.js",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"ckeditor5": "^
|
|
15
|
+
"ckeditor5": "^36.0.0"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@ckeditor/ckeditor5-alignment": "^
|
|
19
|
-
"@ckeditor/ckeditor5-basic-styles": "^
|
|
20
|
-
"@ckeditor/ckeditor5-block-quote": "^
|
|
21
|
-
"@ckeditor/ckeditor5-cloud-services": "^
|
|
22
|
-
"@ckeditor/ckeditor5-code-block": "^
|
|
23
|
-
"@ckeditor/ckeditor5-core": "^
|
|
24
|
-
"@ckeditor/ckeditor5-dev-utils": "^
|
|
25
|
-
"@ckeditor/ckeditor5-easy-image": "^
|
|
26
|
-
"@ckeditor/ckeditor5-editor-classic": "^
|
|
27
|
-
"@ckeditor/ckeditor5-engine": "^
|
|
28
|
-
"@ckeditor/ckeditor5-font": "^
|
|
29
|
-
"@ckeditor/ckeditor5-heading": "^
|
|
30
|
-
"@ckeditor/ckeditor5-highlight": "^
|
|
31
|
-
"@ckeditor/ckeditor5-horizontal-line": "^
|
|
32
|
-
"@ckeditor/ckeditor5-html-embed": "^
|
|
33
|
-
"@ckeditor/ckeditor5-html-support": "^
|
|
34
|
-
"@ckeditor/ckeditor5-image": "^
|
|
35
|
-
"@ckeditor/ckeditor5-indent": "^
|
|
36
|
-
"@ckeditor/ckeditor5-language": "^
|
|
37
|
-
"@ckeditor/ckeditor5-link": "^
|
|
38
|
-
"@ckeditor/ckeditor5-list": "^
|
|
39
|
-
"@ckeditor/ckeditor5-mention": "^
|
|
40
|
-
"@ckeditor/ckeditor5-page-break": "^
|
|
41
|
-
"@ckeditor/ckeditor5-paragraph": "^
|
|
42
|
-
"@ckeditor/ckeditor5-paste-from-office": "^
|
|
43
|
-
"@ckeditor/ckeditor5-remove-format": "^
|
|
44
|
-
"@ckeditor/ckeditor5-source-editing": "^
|
|
45
|
-
"@ckeditor/ckeditor5-table": "^
|
|
46
|
-
"@ckeditor/ckeditor5-theme-lark": "^
|
|
47
|
-
"@ckeditor/ckeditor5-typing": "^
|
|
48
|
-
"@ckeditor/ckeditor5-ui": "^
|
|
49
|
-
"@ckeditor/ckeditor5-utils": "^
|
|
50
|
-
"@ckeditor/ckeditor5-word-count": "^
|
|
18
|
+
"@ckeditor/ckeditor5-alignment": "^36.0.0",
|
|
19
|
+
"@ckeditor/ckeditor5-basic-styles": "^36.0.0",
|
|
20
|
+
"@ckeditor/ckeditor5-block-quote": "^36.0.0",
|
|
21
|
+
"@ckeditor/ckeditor5-cloud-services": "^36.0.0",
|
|
22
|
+
"@ckeditor/ckeditor5-code-block": "^36.0.0",
|
|
23
|
+
"@ckeditor/ckeditor5-core": "^36.0.0",
|
|
24
|
+
"@ckeditor/ckeditor5-dev-utils": "^32.0.0",
|
|
25
|
+
"@ckeditor/ckeditor5-easy-image": "^36.0.0",
|
|
26
|
+
"@ckeditor/ckeditor5-editor-classic": "^36.0.0",
|
|
27
|
+
"@ckeditor/ckeditor5-engine": "^36.0.0",
|
|
28
|
+
"@ckeditor/ckeditor5-font": "^36.0.0",
|
|
29
|
+
"@ckeditor/ckeditor5-heading": "^36.0.0",
|
|
30
|
+
"@ckeditor/ckeditor5-highlight": "^36.0.0",
|
|
31
|
+
"@ckeditor/ckeditor5-horizontal-line": "^36.0.0",
|
|
32
|
+
"@ckeditor/ckeditor5-html-embed": "^36.0.0",
|
|
33
|
+
"@ckeditor/ckeditor5-html-support": "^36.0.0",
|
|
34
|
+
"@ckeditor/ckeditor5-image": "^36.0.0",
|
|
35
|
+
"@ckeditor/ckeditor5-indent": "^36.0.0",
|
|
36
|
+
"@ckeditor/ckeditor5-language": "^36.0.0",
|
|
37
|
+
"@ckeditor/ckeditor5-link": "^36.0.0",
|
|
38
|
+
"@ckeditor/ckeditor5-list": "^36.0.0",
|
|
39
|
+
"@ckeditor/ckeditor5-mention": "^36.0.0",
|
|
40
|
+
"@ckeditor/ckeditor5-page-break": "^36.0.0",
|
|
41
|
+
"@ckeditor/ckeditor5-paragraph": "^36.0.0",
|
|
42
|
+
"@ckeditor/ckeditor5-paste-from-office": "^36.0.0",
|
|
43
|
+
"@ckeditor/ckeditor5-remove-format": "^36.0.0",
|
|
44
|
+
"@ckeditor/ckeditor5-source-editing": "^36.0.0",
|
|
45
|
+
"@ckeditor/ckeditor5-table": "^36.0.0",
|
|
46
|
+
"@ckeditor/ckeditor5-theme-lark": "^36.0.0",
|
|
47
|
+
"@ckeditor/ckeditor5-typing": "^36.0.0",
|
|
48
|
+
"@ckeditor/ckeditor5-ui": "^36.0.0",
|
|
49
|
+
"@ckeditor/ckeditor5-utils": "^36.0.0",
|
|
50
|
+
"@ckeditor/ckeditor5-word-count": "^36.0.0",
|
|
51
51
|
"webpack": "^5.58.1",
|
|
52
52
|
"webpack-cli": "^4.9.0"
|
|
53
53
|
},
|
package/src/index.js
CHANGED
package/src/style.js
CHANGED
package/src/stylecommand.js
CHANGED
package/src/styleediting.js
CHANGED
package/src/styleui.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -43,15 +43,25 @@ export default class StyleUI extends Plugin {
|
|
|
43
43
|
editor.ui.componentFactory.add( 'style', locale => {
|
|
44
44
|
const t = locale.t;
|
|
45
45
|
const dropdown = createDropdown( locale );
|
|
46
|
-
const panelView = new StylePanelView( locale, normalizedStyleDefinitions );
|
|
47
46
|
const styleCommand = editor.commands.get( 'style' );
|
|
48
47
|
|
|
48
|
+
dropdown.once( 'change:isOpen', () => {
|
|
49
|
+
const panelView = new StylePanelView( locale, normalizedStyleDefinitions );
|
|
50
|
+
|
|
51
|
+
// Put the styles panel is the dropdown.
|
|
52
|
+
dropdown.panelView.children.add( panelView );
|
|
53
|
+
|
|
54
|
+
// Close the dropdown when a style is selected in the styles panel.
|
|
55
|
+
panelView.delegate( 'execute' ).to( dropdown );
|
|
56
|
+
|
|
57
|
+
// Bind the state of the styles panel to the command.
|
|
58
|
+
panelView.bind( 'activeStyles' ).to( styleCommand, 'value' );
|
|
59
|
+
panelView.bind( 'enabledStyles' ).to( styleCommand, 'enabledStyles' );
|
|
60
|
+
} );
|
|
61
|
+
|
|
49
62
|
// The entire dropdown will be disabled together with the command (e.g. when the editor goes read-only).
|
|
50
63
|
dropdown.bind( 'isEnabled' ).to( styleCommand );
|
|
51
64
|
|
|
52
|
-
// Put the styles panel is the dropdown.
|
|
53
|
-
dropdown.panelView.children.add( panelView );
|
|
54
|
-
|
|
55
65
|
// This dropdown has no icon. It displays text label depending on the selection.
|
|
56
66
|
dropdown.buttonView.withText = true;
|
|
57
67
|
|
|
@@ -81,9 +91,6 @@ export default class StyleUI extends Plugin {
|
|
|
81
91
|
return classes.join( ' ' );
|
|
82
92
|
} );
|
|
83
93
|
|
|
84
|
-
// Close the dropdown when a style is selected in the styles panel.
|
|
85
|
-
panelView.delegate( 'execute' ).to( dropdown );
|
|
86
|
-
|
|
87
94
|
// Execute the command when a style is selected in the styles panel.
|
|
88
95
|
// Also focus the editable after executing the command.
|
|
89
96
|
// It overrides a default behaviour where the focus is moved to the dropdown button (#12125).
|
|
@@ -92,10 +99,6 @@ export default class StyleUI extends Plugin {
|
|
|
92
99
|
editor.editing.view.focus();
|
|
93
100
|
} );
|
|
94
101
|
|
|
95
|
-
// Bind the state of the styles panel to the command.
|
|
96
|
-
panelView.bind( 'activeStyles' ).to( styleCommand, 'value' );
|
|
97
|
-
panelView.bind( 'enabledStyles' ).to( styleCommand, 'enabledStyles' );
|
|
98
|
-
|
|
99
102
|
return dropdown;
|
|
100
103
|
} );
|
|
101
104
|
}
|
package/src/ui/stylegridview.js
CHANGED
package/src/ui/stylegroupview.js
CHANGED
package/src/ui/stylepanelview.js
CHANGED
package/src/utils.js
CHANGED
package/theme/style.css
CHANGED
package/theme/stylegrid.css
CHANGED
package/theme/stylegroup.css
CHANGED
package/theme/stylepanel.css
CHANGED