@ckeditor/ckeditor5-font 44.3.0 → 45.0.0-alpha.1
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/build/font.js +1 -1
- package/build/translations/be.js +1 -0
- package/ckeditor5-metadata.json +4 -4
- package/dist/index.js +7 -14
- package/dist/index.js.map +1 -1
- package/dist/translations/be.d.ts +8 -0
- package/dist/translations/be.js +5 -0
- package/dist/translations/be.umd.js +11 -0
- package/lang/translations/be.po +52 -0
- package/package.json +7 -6
- package/src/fontbackgroundcolor/fontbackgroundcolorui.d.ts +0 -3
- package/src/fontbackgroundcolor/fontbackgroundcolorui.js +2 -2
- package/src/fontcolor/fontcolorui.d.ts +0 -3
- package/src/fontcolor/fontcolorui.js +2 -2
- package/src/fontcommand.js +4 -0
- package/src/fontfamily/fontfamilyui.js +3 -3
- package/src/fontsize/fontsizeui.js +3 -3
- package/src/ui/colorui.js +21 -0
- package/theme/icons/font-background.svg +0 -1
- package/theme/icons/font-color.svg +0 -1
- package/theme/icons/font-family.svg +0 -1
- package/theme/icons/font-size.svg +0 -1
package/build/font.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
/*!
|
|
3
3
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
4
4
|
* For licensing, see LICENSE.md.
|
|
5
|
-
*/(()=>{var e={21:e=>{"use strict";e.exports=function(e,t){Object.keys(t).forEach((function(o){e.setAttribute(o,t[o])}))}},51:e=>{"use strict";e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},128:e=>{"use strict";var t={};e.exports=function(e,o){var n=function(e){if(void 0===t[e]){var o=document.querySelector(e);if(window.HTMLIFrameElement&&o instanceof window.HTMLIFrameElement)try{o=o.contentDocument.head}catch(e){o=null}t[e]=o}return t[e]}(e);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");n.appendChild(o)}},237:e=>{"use strict";e.exports=CKEditor5.dll},311:(e,t,o)=>{e.exports=o(237)("./src/ui.js")},485:(e,t,o)=>{"use strict";o.d(t,{A:()=>s});var n=o(758),r=o.n(n),i=o(935),l=o.n(i)()(r());l.push([e.id,".ck-content .text-tiny{font-size:.7em}.ck-content .text-small{font-size:.85em}.ck-content .text-big{font-size:1.4em}.ck-content .text-huge{font-size:1.8em}",""]);const s=l},584:(e,t,o)=>{e.exports=o(237)("./src/utils.js")},591:e=>{"use strict";var t=[];function o(e){for(var o=-1,n=0;n<t.length;n++)if(t[n].identifier===e){o=n;break}return o}function n(e,n){for(var i={},l=[],s=0;s<e.length;s++){var a=e[s],c=n.base?a[0]+n.base:a[0],u=i[c]||0,d="".concat(c," ").concat(u);i[c]=u+1;var m=o(d),p={css:a[1],media:a[2],sourceMap:a[3],supports:a[4],layer:a[5]};if(-1!==m)t[m].references++,t[m].updater(p);else{var g=r(p,n);n.byIndex=s,t.splice(s,0,{identifier:d,updater:g,references:1})}l.push(d)}return l}function r(e,t){var o=t.domAPI(t);o.update(e);return function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;o.update(e=t)}else o.remove()}}e.exports=function(e,r){var i=n(e=e||[],r=r||{});return function(e){e=e||[];for(var l=0;l<i.length;l++){var s=o(i[l]);t[s].references--}for(var a=n(e,r),c=0;c<i.length;c++){var u=o(i[c]);0===t[u].references&&(t[u].updater(),t.splice(u,1))}i=a}}},639:e=>{"use strict";var t,o=(t=[],function(e,o){return t[e]=o,t.filter(Boolean).join("\n")});function n(e,t,n,r){var i;if(n)i="";else{i="",r.supports&&(i+="@supports (".concat(r.supports,") {")),r.media&&(i+="@media ".concat(r.media," {"));var l=void 0!==r.layer;l&&(i+="@layer".concat(r.layer.length>0?" ".concat(r.layer):""," {")),i+=r.css,l&&(i+="}"),r.media&&(i+="}"),r.supports&&(i+="}")}if(e.styleSheet)e.styleSheet.cssText=o(t,i);else{var s=document.createTextNode(i),a=e.childNodes;a[t]&&e.removeChild(a[t]),a.length?e.insertBefore(s,a[t]):e.appendChild(s)}}var r={singleton:null,singletonCounter:0};e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=r.singletonCounter++,o=r.singleton||(r.singleton=e.insertStyleElement(e));return{update:function(e){n(o,t,!1,e)},remove:function(e){n(o,t,!0,e)}}}},758:e=>{"use strict";e.exports=function(e){return e[1]}},782:(e,t,o)=>{e.exports=o(237)("./src/core.js")},783:(e,t,o)=>{e.exports=o(237)("./src/engine.js")},935:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var o="",n=void 0!==t[5];return t[4]&&(o+="@supports (".concat(t[4],") {")),t[2]&&(o+="@media ".concat(t[2]," {")),n&&(o+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),o+=e(t),n&&(o+="}"),t[2]&&(o+="}"),t[4]&&(o+="}"),o})).join("")},t.i=function(e,o,n,r,i){"string"==typeof e&&(e=[[null,e,void 0]]);var l={};if(n)for(var s=0;s<this.length;s++){var a=this[s][0];null!=a&&(l[a]=!0)}for(var c=0;c<e.length;c++){var u=[].concat(e[c]);n&&l[u[0]]||(void 0!==i&&(void 0===u[5]||(u[1]="@layer".concat(u[5].length>0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),o&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=o):u[2]=o),r&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=r):u[4]="".concat(r)),t.push(u))}},t}}},t={};function o(n){var r=t[n];if(void 0!==r)return r.exports;var i=t[n]={id:n,exports:{}};return e[n](i,i.exports,o),i.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{"use strict";o.r(n),o.d(n,{Font:()=>X,FontBackgroundColor:()=>Q,FontBackgroundColorEditing:()=>Y,FontBackgroundColorUI:()=>J,FontColor:()=>U,FontColorEditing:()=>R,FontColorUI:()=>q,FontFamily:()=>y,FontFamilyEditing:()=>h,FontFamilyUI:()=>w,FontSize:()=>$,FontSizeEditing:()=>P,FontSizeUI:()=>j});var e=o(782);class t extends e.Command{constructor(e,t){super(e),this.attributeKey=t}refresh(){const e=this.editor.model,t=e.document;this.value=t.selection.getAttribute(this.attributeKey),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,this.attributeKey)}execute(e={}){const t=this.editor.model,o=t.document.selection,n=e.value,r=e.batch,i=e=>{if(o.isCollapsed)n?e.setSelectionAttribute(this.attributeKey,n):e.removeSelectionAttribute(this.attributeKey);else{const r=t.schema.getValidRanges(o.getRanges(),this.attributeKey);for(const t of r)n?e.setAttribute(this.attributeKey,n,t):e.removeAttribute(this.attributeKey,t)}};r?t.enqueueChange(r,(e=>{i(e)})):t.change((e=>{i(e)}))}}var r=o(311);const i="fontSize",l="fontFamily",s="fontColor",a="fontBackgroundColor";function c(e,t){const o={model:{key:e,values:[]},view:{},upcastAlso:{}};for(const e of t)o.model.values.push(e.model),o.view[e.model]=e.view,e.upcastAlso&&(o.upcastAlso[e.model]=e.upcastAlso);return o}function u(e){return t=>t.getStyle(e).replace(/\s/g,"")}function d(e){return(t,{writer:o})=>o.createAttributeElement("span",{style:`${e}:${t}`},{priority:7})}class m extends t{constructor(e){super(e,l)}}function p(e){return e.map(g).filter((e=>void 0!==e))}function g(e){return"object"==typeof e?e:"default"===e?{title:"Default",model:void 0}:"string"==typeof e?function(e){const t=e.replace(/"|'/g,"").split(","),o=t[0],n=t.map(f).join(", ");return{title:o,model:n,view:{name:"span",styles:{"font-family":n},priority:7}}}(e):void 0}function f(e){return(e=e.trim()).indexOf(" ")>0&&(e=`'${e}'`),e}class h extends e.Plugin{static get pluginName(){return"FontFamilyEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define(l,{options:["default","Arial, Helvetica, sans-serif","Courier New, Courier, monospace","Georgia, serif","Lucida Sans Unicode, Lucida Grande, sans-serif","Tahoma, Geneva, sans-serif","Times New Roman, Times, serif","Trebuchet MS, Helvetica, sans-serif","Verdana, Geneva, sans-serif"],supportAllValues:!1})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:l}),e.model.schema.setAttributeProperties(l,{isFormatting:!0,copyOnEnter:!0});const t=p(e.config.get("fontFamily.options")).filter((e=>e.model)),o=c(l,t);e.config.get("fontFamily.supportAllValues")?(this._prepareAnyValueConverters(),this._prepareCompatibilityConverter()):e.conversion.attributeToElement(o),e.commands.add(l,new m(e))}_prepareAnyValueConverters(){const e=this.editor;e.conversion.for("downcast").attributeToElement({model:l,view:(e,{writer:t})=>t.createAttributeElement("span",{style:"font-family:"+e},{priority:7})}),e.conversion.for("upcast").elementToAttribute({model:{key:l,value:e=>e.getStyle("font-family")},view:{name:"span",styles:{"font-family":/.*/}}})}_prepareCompatibilityConverter(){this.editor.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{face:/.*/}},model:{key:l,value:e=>e.getAttribute("face")}})}}var b=o(584);const v='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.03 3h6.149a.75.75 0 1 1 0 1.5h-5.514L11.03 3zm1.27 3h4.879a.75.75 0 1 1 0 1.5h-4.244L12.3 6zm1.27 3h3.609a.75.75 0 1 1 0 1.5h-2.973L13.57 9zm-2.754 2.5L8.038 4.785 5.261 11.5h5.555zm.62 1.5H4.641l-1.666 4.028H1.312l5.789-14h1.875l5.789 14h-1.663L11.436 13z"/></svg>';class w extends e.Plugin{static get pluginName(){return"FontFamilyUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.t,o=this._getLocalizedOptions(),n=e.commands.get(l),i=t("Font Family"),s=function(e,t){const o=new b.Collection;for(const n of e){const e={type:"button",model:new r.ViewModel({commandName:l,commandParam:n.model,label:n.title,role:"menuitemradio",withText:!0})};e.model.bind("isOn").to(t,"value",(e=>e===n.model||!(!e||!n.model)&&e.split(",")[0].replace(/'/g,"").toLowerCase()===n.model.toLowerCase())),n.view&&"string"!=typeof n.view&&n.view.styles&&e.model.set("labelStyle",`font-family: ${n.view.styles["font-family"]}`),o.add(e)}return o}(o,n);e.ui.componentFactory.add(l,(t=>{const o=(0,r.createDropdown)(t);return(0,r.addListToDropdown)(o,s,{role:"menu",ariaLabel:i}),o.buttonView.set({label:i,icon:v,tooltip:!0}),o.extendTemplate({attributes:{class:"ck-font-family-dropdown"}}),o.bind("isEnabled").to(n),this.listenTo(o,"execute",(t=>{e.execute(t.source.commandName,{value:t.source.commandParam}),e.editing.view.focus()})),o})),e.ui.componentFactory.add(`menuBar:${l}`,(t=>{const o=new r.MenuBarMenuView(t);o.buttonView.set({label:i,icon:v}),o.bind("isEnabled").to(n);const l=new r.MenuBarMenuListView(t);for(const n of s){const i=new r.MenuBarMenuListItemView(t,o),s=new r.MenuBarMenuListItemButtonView(t);s.set({role:"menuitemradio",isToggleable:!0}),s.bind(...Object.keys(n.model)).to(n.model),s.delegate("execute").to(o),s.on("execute",(()=>{e.execute(n.model.commandName,{value:n.model.commandParam}),e.editing.view.focus()})),i.children.add(s),l.items.add(i)}return o.panelView.children.add(l),o}))}_getLocalizedOptions(){const e=this.editor,t=e.t;return p(e.config.get(l).options).map((e=>("Default"===e.title&&(e.title=t("Default")),e)))}}class y extends e.Plugin{static get requires(){return[h,w]}static get pluginName(){return"FontFamily"}static get isOfficialPlugin(){return!0}}var x=o(783);class C extends t{constructor(e){super(e,i)}}function F(e){return e.map((e=>function(e){"number"==typeof e&&(e=String(e));if("object"==typeof e&&(t=e,t.title&&t.model&&t.view))return L(e);var t;const o=function(e){return"string"==typeof e?S[e]:S[e.model]}(e);if(o)return L(o);if("default"===e)return{model:void 0,title:"Default"};if(function(e){let t;if("object"==typeof e){if(!e.model)throw new b.CKEditorError("font-size-invalid-definition",null,e);t=parseFloat(e.model)}else t=parseFloat(e);return isNaN(t)}(e))return;return function(e){"string"==typeof e&&(e={title:e,model:`${parseFloat(e)}px`});return e.view={name:"span",styles:{"font-size":e.model}},L(e)}(e)}(e))).filter((e=>void 0!==e))}const S={get tiny(){return{title:"Tiny",model:"tiny",view:{name:"span",classes:"text-tiny",priority:7}}},get small(){return{title:"Small",model:"small",view:{name:"span",classes:"text-small",priority:7}}},get big(){return{title:"Big",model:"big",view:{name:"span",classes:"text-big",priority:7}}},get huge(){return{title:"Huge",model:"huge",view:{name:"span",classes:"text-huge",priority:7}}}};function L(e){return e.view&&"string"!=typeof e.view&&!e.view.priority&&(e.view.priority=7),e}const B=["x-small","x-small","small","medium","large","x-large","xx-large","xxx-large"];class P extends e.Plugin{static get pluginName(){return"FontSizeEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define(i,{options:["tiny","small","default","big","huge"],supportAllValues:!1})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:i}),e.model.schema.setAttributeProperties(i,{isFormatting:!0,copyOnEnter:!0});const t=e.config.get("fontSize.supportAllValues"),o=F(this.editor.config.get("fontSize.options")).filter((e=>e.model)),n=c(i,o);t?(this._prepareAnyValueConverters(n),this._prepareCompatibilityConverter()):e.conversion.attributeToElement(n),e.commands.add(i,new C(e))}_prepareAnyValueConverters(e){const t=this.editor,o=e.model.values.filter((e=>!(0,x.isLength)(String(e))&&!(0,x.isPercentage)(String(e))));if(o.length)throw new b.CKEditorError("font-size-invalid-use-of-named-presets",null,{presets:o});t.conversion.for("downcast").attributeToElement({model:i,view:(e,{writer:t})=>{if(e)return t.createAttributeElement("span",{style:"font-size:"+e},{priority:7})}}),t.conversion.for("upcast").elementToAttribute({model:{key:i,value:e=>e.getStyle("font-size")},view:{name:"span",styles:{"font-size":/.*/}}})}_prepareCompatibilityConverter(){this.editor.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{size:/^[+-]?\d{1,3}$/}},model:{key:i,value:e=>{const t=e.getAttribute("size"),o="-"===t[0]||"+"===t[0];let n=parseInt(t,10);o&&(n=3+n);const r=B.length-1,i=Math.min(Math.max(n,0),r);return B[i]}}})}}var A=o(591),k=o.n(A),z=o(639),O=o.n(z),T=o(128),N=o.n(T),V=o(21),E=o.n(V),M=o(51),D=o.n(M),I=o(485),_={attributes:{"data-cke":!0}};_.setAttributes=E(),_.insert=N().bind(null,"head"),_.domAPI=O(),_.insertStyleElement=D();k()(I.A,_);I.A&&I.A.locals&&I.A.locals;const H='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M9.816 11.5 7.038 4.785 4.261 11.5h5.555zm.62 1.5H3.641l-1.666 4.028H.312l5.789-14h1.875l5.789 14h-1.663L10.436 13zm7.55 2.279.779-.779.707.707-2.265 2.265-2.193-2.265.707-.707.765.765V4.825c0-.042 0-.083.002-.123l-.77.77-.707-.707L17.207 2.5l2.265 2.265-.707.707-.782-.782c.002.043.003.089.003.135v10.454z"/></svg>';class j extends e.Plugin{static get pluginName(){return"FontSizeUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.t,o=this._getLocalizedOptions(),n=e.commands.get(i),l=t("Font Size"),s=function(e,t){const o=new b.Collection;for(const n of e){const e={type:"button",model:new r.ViewModel({commandName:i,commandParam:n.model,label:n.title,class:"ck-fontsize-option",role:"menuitemradio",withText:!0})};n.view&&"string"!=typeof n.view&&(n.view.styles&&e.model.set("labelStyle",`font-size:${n.view.styles["font-size"]}`),n.view.classes&&e.model.set("class",`${e.model.class} ${n.view.classes}`)),e.model.bind("isOn").to(t,"value",(e=>e===n.model)),o.add(e)}return o}(o,n);e.ui.componentFactory.add(i,(t=>{const o=(0,r.createDropdown)(t);return(0,r.addListToDropdown)(o,s,{role:"menu",ariaLabel:l}),o.buttonView.set({label:l,icon:H,tooltip:!0}),o.extendTemplate({attributes:{class:["ck-font-size-dropdown"]}}),o.bind("isEnabled").to(n),this.listenTo(o,"execute",(t=>{e.execute(t.source.commandName,{value:t.source.commandParam}),e.editing.view.focus()})),o})),e.ui.componentFactory.add(`menuBar:${i}`,(t=>{const o=new r.MenuBarMenuView(t);o.buttonView.set({label:l,icon:H}),o.bind("isEnabled").to(n);const i=new r.MenuBarMenuListView(t);for(const n of s){const l=new r.MenuBarMenuListItemView(t,o),s=new r.MenuBarMenuListItemButtonView(t);s.set({role:"menuitemradio",isToggleable:!0}),s.bind(...Object.keys(n.model)).to(n.model),s.delegate("execute").to(o),s.on("execute",(()=>{e.execute(n.model.commandName,{value:n.model.commandParam}),e.editing.view.focus()})),l.children.add(s),i.items.add(l)}return o.panelView.children.add(i),o}))}_getLocalizedOptions(){const e=this.editor,t=e.t,o={Default:t("Default"),Tiny:t("Tiny"),Small:t("Small"),Big:t("Big"),Huge:t("Huge")};return F(e.config.get(i).options).map((e=>{const t=o[e.title];return t&&t!=e.title&&(e=Object.assign({},e,{title:t})),e}))}}class $ extends e.Plugin{static get requires(){return[P,j]}static get pluginName(){return"FontSize"}static get isOfficialPlugin(){return!0}normalizeSizeOptions(e){return F(e)}}class K extends t{constructor(e){super(e,s)}}class R extends e.Plugin{static get pluginName(){return"FontColorEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define(s,{colors:[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}],columns:5}),e.conversion.for("upcast").elementToAttribute({view:{name:"span",styles:{color:/[\s\S]+/}},model:{key:s,value:u("color")}}),e.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{color:/^#?\w+$/}},model:{key:s,value:e=>e.getAttribute("color")}}),e.conversion.for("downcast").attributeToElement({model:s,view:d("color")}),e.commands.add(s,new K(e)),e.model.schema.extend("$text",{allowAttributes:s}),e.model.schema.setAttributeProperties(s,{isFormatting:!0,copyOnEnter:!0})}}class G extends e.Plugin{constructor(e,{commandName:t,componentName:o,icon:n,dropdownLabel:r}){super(e),this.commandName=t,this.componentName=o,this.icon=n,this.dropdownLabel=r,this.columns=e.config.get(`${this.componentName}.columns`)}init(){const e=this.editor,t=e.locale,o=t.t,n=e.commands.get(this.commandName),i=e.config.get(this.componentName),l=(0,r.normalizeColorOptions)(i.colors),s=(0,r.getLocalizedColorOptions)(t,l),a=i.documentColors,c=!1!==i.colorPicker;e.ui.componentFactory.add(this.componentName,(t=>{const l=(0,r.createDropdown)(t);let u=!1;const d=function({dropdownView:e,colors:t,columns:o,removeButtonLabel:n,colorPickerLabel:i,documentColorsLabel:l,documentColorsCount:s,colorPickerViewConfig:a}){const c=e.locale,u=new r.ColorSelectorView(c,{colors:t,columns:o,removeButtonLabel:n,colorPickerLabel:i,documentColorsLabel:l,documentColorsCount:s,colorPickerViewConfig:a});return e.colorSelectorView=u,e.panelView.children.add(u),u}({dropdownView:l,colors:s.map((e=>({label:e.label,color:e.model,options:{hasBorder:e.hasBorder}}))),columns:this.columns,removeButtonLabel:o("Remove color"),colorPickerLabel:o("Color picker"),documentColorsLabel:0!==a?o("Document colors"):"",documentColorsCount:void 0===a?this.columns:a,colorPickerViewConfig:!!c&&(i.colorPicker||{})});return d.bind("selectedColor").to(n,"value"),l.buttonView.set({label:this.dropdownLabel,icon:this.icon,tooltip:!0}),l.extendTemplate({attributes:{class:"ck-color-ui-dropdown"}}),l.bind("isEnabled").to(n),d.on("execute",((t,o)=>{l.isOpen&&e.execute(this.commandName,{value:o.value,batch:this._undoStepBatch}),"colorPicker"!==o.source&&e.editing.view.focus(),"colorPickerSaveButton"===o.source&&(l.isOpen=!1)})),d.on("colorPicker:show",(()=>{this._undoStepBatch=e.model.createBatch()})),d.on("colorPicker:cancel",(()=>{this._undoStepBatch.operations.length&&(l.isOpen=!1,e.execute("undo",this._undoStepBatch)),e.editing.view.focus()})),l.on("change:isOpen",((t,o,n)=>{u||(u=!0,l.colorSelectorView.appendUI()),n&&(0!==a&&d.updateDocumentColors(e.model,this.componentName),d.updateSelectedColors(),d.showColorGridsFragment())})),(0,r.focusChildOnDropdownOpen)(l,(()=>l.colorSelectorView.colorGridsFragmentView.staticColorsGrid.items.find((e=>e.isOn)))),l})),e.ui.componentFactory.add(`menuBar:${this.componentName}`,(t=>{const i=new r.MenuBarMenuView(t);i.buttonView.set({label:this.dropdownLabel,icon:this.icon}),i.bind("isEnabled").to(n);let l=!1;const c=new r.ColorSelectorView(t,{colors:s.map((e=>({label:e.label,color:e.model,options:{hasBorder:e.hasBorder}}))),columns:this.columns,removeButtonLabel:o("Remove color"),colorPickerLabel:o("Color picker"),documentColorsLabel:0!==a?o("Document colors"):"",documentColorsCount:void 0===a?this.columns:a,colorPickerViewConfig:!1});return c.bind("selectedColor").to(n,"value"),c.delegate("execute").to(i),c.on("execute",((t,o)=>{e.execute(this.commandName,{value:o.value,batch:this._undoStepBatch}),e.editing.view.focus()})),i.on("change:isOpen",((t,o,n)=>{l||(l=!0,c.appendUI()),n&&(0!==a&&c.updateDocumentColors(e.model,this.componentName),c.updateSelectedColors(),c.showColorGridsFragment())})),i.panelView.children.add(c),i}))}}class q extends G{constructor(e){const t=e.locale.t;super(e,{commandName:s,componentName:s,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M12.4 10.3 10 4.5l-2.4 5.8h4.8zm.5 1.2H7.1L5.7 15H4.2l5-12h1.6l5 12h-1.5L13 11.5zm3.1 7H4a1 1 0 0 1 0-2h12a1 1 0 0 1 0 2z"/></svg>',dropdownLabel:t("Font Color")})}static get pluginName(){return"FontColorUI"}}class U extends e.Plugin{static get requires(){return[R,q]}static get pluginName(){return"FontColor"}static get isOfficialPlugin(){return!0}}class W extends t{constructor(e){super(e,a)}}class Y extends e.Plugin{static get pluginName(){return"FontBackgroundColorEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define(a,{colors:[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}],columns:5}),e.data.addStyleProcessorRules(x.addBackgroundRules),e.conversion.for("upcast").elementToAttribute({view:{name:"span",styles:{"background-color":/[\s\S]+/}},model:{key:a,value:u("background-color")}}),e.conversion.for("downcast").attributeToElement({model:a,view:d("background-color")}),e.commands.add(a,new W(e)),e.model.schema.extend("$text",{allowAttributes:a}),e.model.schema.setAttributeProperties(a,{isFormatting:!0,copyOnEnter:!0})}}class J extends G{constructor(e){const t=e.locale.t;super(e,{commandName:a,componentName:a,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M4 2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2zm8.38 9.262H7.62L10 5.506l2.38 5.756zm.532 1.285L14.34 16h1.426L10.804 4H9.196L4.234 16H5.66l1.428-3.453h5.824z"/></svg>',dropdownLabel:t("Font Background Color")})}static get pluginName(){return"FontBackgroundColorUI"}}class Q extends e.Plugin{static get requires(){return[Y,J]}static get pluginName(){return"FontBackgroundColor"}static get isOfficialPlugin(){return!0}}class X extends e.Plugin{static get requires(){return[y,$,U,Q]}static get pluginName(){return"Font"}static get isOfficialPlugin(){return!0}}})(),(window.CKEditor5=window.CKEditor5||{}).font=n})();
|
|
5
|
+
*/(()=>{var e={21:e=>{"use strict";e.exports=function(e,t){Object.keys(t).forEach((function(o){e.setAttribute(o,t[o])}))}},51:e=>{"use strict";e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},128:e=>{"use strict";var t={};e.exports=function(e,o){var n=function(e){if(void 0===t[e]){var o=document.querySelector(e);if(window.HTMLIFrameElement&&o instanceof window.HTMLIFrameElement)try{o=o.contentDocument.head}catch(e){o=null}t[e]=o}return t[e]}(e);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");n.appendChild(o)}},237:e=>{"use strict";e.exports=CKEditor5.dll},311:(e,t,o)=>{e.exports=o(237)("./src/ui.js")},355:(e,t,o)=>{e.exports=o(237)("./src/icons.js")},485:(e,t,o)=>{"use strict";o.d(t,{A:()=>s});var n=o(758),r=o.n(n),i=o(935),l=o.n(i)()(r());l.push([e.id,".ck-content .text-tiny{font-size:.7em}.ck-content .text-small{font-size:.85em}.ck-content .text-big{font-size:1.4em}.ck-content .text-huge{font-size:1.8em}",""]);const s=l},584:(e,t,o)=>{e.exports=o(237)("./src/utils.js")},591:e=>{"use strict";var t=[];function o(e){for(var o=-1,n=0;n<t.length;n++)if(t[n].identifier===e){o=n;break}return o}function n(e,n){for(var i={},l=[],s=0;s<e.length;s++){var a=e[s],c=n.base?a[0]+n.base:a[0],u=i[c]||0,d="".concat(c," ").concat(u);i[c]=u+1;var m=o(d),p={css:a[1],media:a[2],sourceMap:a[3],supports:a[4],layer:a[5]};if(-1!==m)t[m].references++,t[m].updater(p);else{var f=r(p,n);n.byIndex=s,t.splice(s,0,{identifier:d,updater:f,references:1})}l.push(d)}return l}function r(e,t){var o=t.domAPI(t);o.update(e);return function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;o.update(e=t)}else o.remove()}}e.exports=function(e,r){var i=n(e=e||[],r=r||{});return function(e){e=e||[];for(var l=0;l<i.length;l++){var s=o(i[l]);t[s].references--}for(var a=n(e,r),c=0;c<i.length;c++){var u=o(i[c]);0===t[u].references&&(t[u].updater(),t.splice(u,1))}i=a}}},639:e=>{"use strict";var t,o=(t=[],function(e,o){return t[e]=o,t.filter(Boolean).join("\n")});function n(e,t,n,r){var i;if(n)i="";else{i="",r.supports&&(i+="@supports (".concat(r.supports,") {")),r.media&&(i+="@media ".concat(r.media," {"));var l=void 0!==r.layer;l&&(i+="@layer".concat(r.layer.length>0?" ".concat(r.layer):""," {")),i+=r.css,l&&(i+="}"),r.media&&(i+="}"),r.supports&&(i+="}")}if(e.styleSheet)e.styleSheet.cssText=o(t,i);else{var s=document.createTextNode(i),a=e.childNodes;a[t]&&e.removeChild(a[t]),a.length?e.insertBefore(s,a[t]):e.appendChild(s)}}var r={singleton:null,singletonCounter:0};e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=r.singletonCounter++,o=r.singleton||(r.singleton=e.insertStyleElement(e));return{update:function(e){n(o,t,!1,e)},remove:function(e){n(o,t,!0,e)}}}},758:e=>{"use strict";e.exports=function(e){return e[1]}},782:(e,t,o)=>{e.exports=o(237)("./src/core.js")},783:(e,t,o)=>{e.exports=o(237)("./src/engine.js")},935:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var o="",n=void 0!==t[5];return t[4]&&(o+="@supports (".concat(t[4],") {")),t[2]&&(o+="@media ".concat(t[2]," {")),n&&(o+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),o+=e(t),n&&(o+="}"),t[2]&&(o+="}"),t[4]&&(o+="}"),o})).join("")},t.i=function(e,o,n,r,i){"string"==typeof e&&(e=[[null,e,void 0]]);var l={};if(n)for(var s=0;s<this.length;s++){var a=this[s][0];null!=a&&(l[a]=!0)}for(var c=0;c<e.length;c++){var u=[].concat(e[c]);n&&l[u[0]]||(void 0!==i&&(void 0===u[5]||(u[1]="@layer".concat(u[5].length>0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),o&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=o):u[2]=o),r&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=r):u[4]="".concat(r)),t.push(u))}},t}}},t={};function o(n){var r=t[n];if(void 0!==r)return r.exports;var i=t[n]={id:n,exports:{}};return e[n](i,i.exports,o),i.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{"use strict";o.r(n),o.d(n,{Font:()=>Q,FontBackgroundColor:()=>J,FontBackgroundColorEditing:()=>W,FontBackgroundColorUI:()=>Y,FontColor:()=>U,FontColorEditing:()=>R,FontColorUI:()=>q,FontFamily:()=>y,FontFamilyEditing:()=>b,FontFamilyUI:()=>w,FontSize:()=>$,FontSizeEditing:()=>k,FontSizeUI:()=>j});var e=o(782);class t extends e.Command{attributeKey;constructor(e,t){super(e),this.attributeKey=t}refresh(){const e=this.editor.model,t=e.document;this.value=t.selection.getAttribute(this.attributeKey),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,this.attributeKey)}execute(e={}){const t=this.editor.model,o=t.document.selection,n=e.value,r=e.batch,i=e=>{if(o.isCollapsed)n?e.setSelectionAttribute(this.attributeKey,n):e.removeSelectionAttribute(this.attributeKey);else{const r=t.schema.getValidRanges(o.getRanges(),this.attributeKey);for(const t of r)n?e.setAttribute(this.attributeKey,n,t):e.removeAttribute(this.attributeKey,t)}};r?t.enqueueChange(r,(e=>{i(e)})):t.change((e=>{i(e)}))}}var r=o(311);const i="fontSize",l="fontFamily",s="fontColor",a="fontBackgroundColor";function c(e,t){const o={model:{key:e,values:[]},view:{},upcastAlso:{}};for(const e of t)o.model.values.push(e.model),o.view[e.model]=e.view,e.upcastAlso&&(o.upcastAlso[e.model]=e.upcastAlso);return o}function u(e){return t=>t.getStyle(e).replace(/\s/g,"")}function d(e){return(t,{writer:o})=>o.createAttributeElement("span",{style:`${e}:${t}`},{priority:7})}class m extends t{constructor(e){super(e,l)}}function p(e){return e.map(f).filter((e=>void 0!==e))}function f(e){return"object"==typeof e?e:"default"===e?{title:"Default",model:void 0}:"string"==typeof e?function(e){const t=e.replace(/"|'/g,"").split(","),o=t[0],n=t.map(g).join(", ");return{title:o,model:n,view:{name:"span",styles:{"font-family":n},priority:7}}}(e):void 0}function g(e){return(e=e.trim()).indexOf(" ")>0&&(e=`'${e}'`),e}class b extends e.Plugin{static get pluginName(){return"FontFamilyEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define(l,{options:["default","Arial, Helvetica, sans-serif","Courier New, Courier, monospace","Georgia, serif","Lucida Sans Unicode, Lucida Grande, sans-serif","Tahoma, Geneva, sans-serif","Times New Roman, Times, serif","Trebuchet MS, Helvetica, sans-serif","Verdana, Geneva, sans-serif"],supportAllValues:!1})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:l}),e.model.schema.setAttributeProperties(l,{isFormatting:!0,copyOnEnter:!0});const t=p(e.config.get("fontFamily.options")).filter((e=>e.model)),o=c(l,t);e.config.get("fontFamily.supportAllValues")?(this._prepareAnyValueConverters(),this._prepareCompatibilityConverter()):e.conversion.attributeToElement(o),e.commands.add(l,new m(e))}_prepareAnyValueConverters(){const e=this.editor;e.conversion.for("downcast").attributeToElement({model:l,view:(e,{writer:t})=>t.createAttributeElement("span",{style:"font-family:"+e},{priority:7})}),e.conversion.for("upcast").elementToAttribute({model:{key:l,value:e=>e.getStyle("font-family")},view:{name:"span",styles:{"font-family":/.*/}}})}_prepareCompatibilityConverter(){this.editor.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{face:/.*/}},model:{key:l,value:e=>e.getAttribute("face")}})}}var h=o(584),v=o(355);class w extends e.Plugin{static get pluginName(){return"FontFamilyUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.t,o=this._getLocalizedOptions(),n=e.commands.get(l),i=t("Font Family"),s=function(e,t){const o=new h.Collection;for(const n of e){const e={type:"button",model:new r.ViewModel({commandName:l,commandParam:n.model,label:n.title,role:"menuitemradio",withText:!0})};e.model.bind("isOn").to(t,"value",(e=>e===n.model||!(!e||!n.model)&&e.split(",")[0].replace(/'/g,"").toLowerCase()===n.model.toLowerCase())),n.view&&"string"!=typeof n.view&&n.view.styles&&e.model.set("labelStyle",`font-family: ${n.view.styles["font-family"]}`),o.add(e)}return o}(o,n);e.ui.componentFactory.add(l,(t=>{const o=(0,r.createDropdown)(t);return(0,r.addListToDropdown)(o,s,{role:"menu",ariaLabel:i}),o.buttonView.set({label:i,icon:v.IconFontFamily,tooltip:!0}),o.extendTemplate({attributes:{class:"ck-font-family-dropdown"}}),o.bind("isEnabled").to(n),this.listenTo(o,"execute",(t=>{e.execute(t.source.commandName,{value:t.source.commandParam}),e.editing.view.focus()})),o})),e.ui.componentFactory.add(`menuBar:${l}`,(t=>{const o=new r.MenuBarMenuView(t);o.buttonView.set({label:i,icon:v.IconFontFamily}),o.bind("isEnabled").to(n);const l=new r.MenuBarMenuListView(t);for(const n of s){const i=new r.MenuBarMenuListItemView(t,o),s=new r.MenuBarMenuListItemButtonView(t);s.set({role:"menuitemradio",isToggleable:!0}),s.bind(...Object.keys(n.model)).to(n.model),s.delegate("execute").to(o),s.on("execute",(()=>{e.execute(n.model.commandName,{value:n.model.commandParam}),e.editing.view.focus()})),i.children.add(s),l.items.add(i)}return o.panelView.children.add(l),o}))}_getLocalizedOptions(){const e=this.editor,t=e.t;return p(e.config.get(l).options).map((e=>("Default"===e.title&&(e.title=t("Default")),e)))}}class y extends e.Plugin{static get requires(){return[b,w]}static get pluginName(){return"FontFamily"}static get isOfficialPlugin(){return!0}}var x=o(783);class C extends t{constructor(e){super(e,i)}}function F(e){return e.map((e=>function(e){"number"==typeof e&&(e=String(e));if("object"==typeof e&&(t=e,t.title&&t.model&&t.view))return P(e);var t;const o=function(e){return"string"==typeof e?S[e]:S[e.model]}(e);if(o)return P(o);if("default"===e)return{model:void 0,title:"Default"};if(function(e){let t;if("object"==typeof e){if(!e.model)throw new h.CKEditorError("font-size-invalid-definition",null,e);t=parseFloat(e.model)}else t=parseFloat(e);return isNaN(t)}(e))return;return function(e){"string"==typeof e&&(e={title:e,model:`${parseFloat(e)}px`});return e.view={name:"span",styles:{"font-size":e.model}},P(e)}(e)}(e))).filter((e=>void 0!==e))}const S={get tiny(){return{title:"Tiny",model:"tiny",view:{name:"span",classes:"text-tiny",priority:7}}},get small(){return{title:"Small",model:"small",view:{name:"span",classes:"text-small",priority:7}}},get big(){return{title:"Big",model:"big",view:{name:"span",classes:"text-big",priority:7}}},get huge(){return{title:"Huge",model:"huge",view:{name:"span",classes:"text-huge",priority:7}}}};function P(e){return e.view&&"string"!=typeof e.view&&!e.view.priority&&(e.view.priority=7),e}const A=["x-small","x-small","small","medium","large","x-large","xx-large","xxx-large"];class k extends e.Plugin{static get pluginName(){return"FontSizeEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define(i,{options:["tiny","small","default","big","huge"],supportAllValues:!1})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:i}),e.model.schema.setAttributeProperties(i,{isFormatting:!0,copyOnEnter:!0});const t=e.config.get("fontSize.supportAllValues"),o=F(this.editor.config.get("fontSize.options")).filter((e=>e.model)),n=c(i,o);t?(this._prepareAnyValueConverters(n),this._prepareCompatibilityConverter()):e.conversion.attributeToElement(n),e.commands.add(i,new C(e))}_prepareAnyValueConverters(e){const t=this.editor,o=e.model.values.filter((e=>!(0,x.isLength)(String(e))&&!(0,x.isPercentage)(String(e))));if(o.length)throw new h.CKEditorError("font-size-invalid-use-of-named-presets",null,{presets:o});t.conversion.for("downcast").attributeToElement({model:i,view:(e,{writer:t})=>{if(e)return t.createAttributeElement("span",{style:"font-size:"+e},{priority:7})}}),t.conversion.for("upcast").elementToAttribute({model:{key:i,value:e=>e.getStyle("font-size")},view:{name:"span",styles:{"font-size":/.*/}}})}_prepareCompatibilityConverter(){this.editor.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{size:/^[+-]?\d{1,3}$/}},model:{key:i,value:e=>{const t=e.getAttribute("size"),o="-"===t[0]||"+"===t[0];let n=parseInt(t,10);o&&(n=3+n);const r=A.length-1,i=Math.min(Math.max(n,0),r);return A[i]}}})}}var B=o(591),L=o.n(B),O=o(639),N=o.n(O),T=o(128),E=o.n(T),V=o(21),z=o.n(V),I=o(51),M=o.n(I),D=o(485),_={attributes:{"data-cke":!0}};_.setAttributes=z(),_.insert=E().bind(null,"head"),_.domAPI=N(),_.insertStyleElement=M();L()(D.A,_);D.A&&D.A.locals&&D.A.locals;class j extends e.Plugin{static get pluginName(){return"FontSizeUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor,t=e.t,o=this._getLocalizedOptions(),n=e.commands.get(i),l=t("Font Size"),s=function(e,t){const o=new h.Collection;for(const n of e){const e={type:"button",model:new r.ViewModel({commandName:i,commandParam:n.model,label:n.title,class:"ck-fontsize-option",role:"menuitemradio",withText:!0})};n.view&&"string"!=typeof n.view&&(n.view.styles&&e.model.set("labelStyle",`font-size:${n.view.styles["font-size"]}`),n.view.classes&&e.model.set("class",`${e.model.class} ${n.view.classes}`)),e.model.bind("isOn").to(t,"value",(e=>e===n.model)),o.add(e)}return o}(o,n);e.ui.componentFactory.add(i,(t=>{const o=(0,r.createDropdown)(t);return(0,r.addListToDropdown)(o,s,{role:"menu",ariaLabel:l}),o.buttonView.set({label:l,icon:v.IconFontSize,tooltip:!0}),o.extendTemplate({attributes:{class:["ck-font-size-dropdown"]}}),o.bind("isEnabled").to(n),this.listenTo(o,"execute",(t=>{e.execute(t.source.commandName,{value:t.source.commandParam}),e.editing.view.focus()})),o})),e.ui.componentFactory.add(`menuBar:${i}`,(t=>{const o=new r.MenuBarMenuView(t);o.buttonView.set({label:l,icon:v.IconFontSize}),o.bind("isEnabled").to(n);const i=new r.MenuBarMenuListView(t);for(const n of s){const l=new r.MenuBarMenuListItemView(t,o),s=new r.MenuBarMenuListItemButtonView(t);s.set({role:"menuitemradio",isToggleable:!0}),s.bind(...Object.keys(n.model)).to(n.model),s.delegate("execute").to(o),s.on("execute",(()=>{e.execute(n.model.commandName,{value:n.model.commandParam}),e.editing.view.focus()})),l.children.add(s),i.items.add(l)}return o.panelView.children.add(i),o}))}_getLocalizedOptions(){const e=this.editor,t=e.t,o={Default:t("Default"),Tiny:t("Tiny"),Small:t("Small"),Big:t("Big"),Huge:t("Huge")};return F(e.config.get(i).options).map((e=>{const t=o[e.title];return t&&t!=e.title&&(e=Object.assign({},e,{title:t})),e}))}}class $ extends e.Plugin{static get requires(){return[k,j]}static get pluginName(){return"FontSize"}static get isOfficialPlugin(){return!0}normalizeSizeOptions(e){return F(e)}}class K extends t{constructor(e){super(e,s)}}class R extends e.Plugin{static get pluginName(){return"FontColorEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define(s,{colors:[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}],columns:5}),e.conversion.for("upcast").elementToAttribute({view:{name:"span",styles:{color:/[\s\S]+/}},model:{key:s,value:u("color")}}),e.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{color:/^#?\w+$/}},model:{key:s,value:e=>e.getAttribute("color")}}),e.conversion.for("downcast").attributeToElement({model:s,view:d("color")}),e.commands.add(s,new K(e)),e.model.schema.extend("$text",{allowAttributes:s}),e.model.schema.setAttributeProperties(s,{isFormatting:!0,copyOnEnter:!0})}}class G extends e.Plugin{commandName;componentName;icon;dropdownLabel;columns;constructor(e,{commandName:t,componentName:o,icon:n,dropdownLabel:r}){super(e),this.commandName=t,this.componentName=o,this.icon=n,this.dropdownLabel=r,this.columns=e.config.get(`${this.componentName}.columns`)}init(){const e=this.editor,t=e.locale,o=t.t,n=e.commands.get(this.commandName),i=e.config.get(this.componentName),l=(0,r.normalizeColorOptions)(i.colors),s=(0,r.getLocalizedColorOptions)(t,l),a=i.documentColors,c=!1!==i.colorPicker;e.ui.componentFactory.add(this.componentName,(t=>{const l=(0,r.createDropdown)(t);let u=!1;const d=function({dropdownView:e,colors:t,columns:o,removeButtonLabel:n,colorPickerLabel:i,documentColorsLabel:l,documentColorsCount:s,colorPickerViewConfig:a}){const c=e.locale,u=new r.ColorSelectorView(c,{colors:t,columns:o,removeButtonLabel:n,colorPickerLabel:i,documentColorsLabel:l,documentColorsCount:s,colorPickerViewConfig:a});return e.colorSelectorView=u,e.panelView.children.add(u),u}({dropdownView:l,colors:s.map((e=>({label:e.label,color:e.model,options:{hasBorder:e.hasBorder}}))),columns:this.columns,removeButtonLabel:o("Remove color"),colorPickerLabel:o("Color picker"),documentColorsLabel:0!==a?o("Document colors"):"",documentColorsCount:void 0===a?this.columns:a,colorPickerViewConfig:!!c&&(i.colorPicker||{})});return d.bind("selectedColor").to(n,"value"),l.buttonView.set({label:this.dropdownLabel,icon:this.icon,tooltip:!0}),l.extendTemplate({attributes:{class:"ck-color-ui-dropdown"}}),l.bind("isEnabled").to(n),d.on("execute",((t,o)=>{l.isOpen&&e.execute(this.commandName,{value:o.value,batch:this._undoStepBatch}),"colorPicker"!==o.source&&e.editing.view.focus(),"colorPickerSaveButton"===o.source&&(l.isOpen=!1)})),d.on("colorPicker:show",(()=>{this._undoStepBatch=e.model.createBatch()})),d.on("colorPicker:cancel",(()=>{this._undoStepBatch.operations.length&&(l.isOpen=!1,e.execute("undo",this._undoStepBatch)),e.editing.view.focus()})),l.on("change:isOpen",((t,o,n)=>{u||(u=!0,l.colorSelectorView.appendUI()),n&&(0!==a&&d.updateDocumentColors(e.model,this.componentName),d.updateSelectedColors(),d.showColorGridsFragment())})),(0,r.focusChildOnDropdownOpen)(l,(()=>l.colorSelectorView.colorGridsFragmentView.staticColorsGrid.items.find((e=>e.isOn)))),l})),e.ui.componentFactory.add(`menuBar:${this.componentName}`,(t=>{const i=new r.MenuBarMenuView(t);i.buttonView.set({label:this.dropdownLabel,icon:this.icon}),i.bind("isEnabled").to(n);let l=!1;const c=new r.ColorSelectorView(t,{colors:s.map((e=>({label:e.label,color:e.model,options:{hasBorder:e.hasBorder}}))),columns:this.columns,removeButtonLabel:o("Remove color"),colorPickerLabel:o("Color picker"),documentColorsLabel:0!==a?o("Document colors"):"",documentColorsCount:void 0===a?this.columns:a,colorPickerViewConfig:!1});return c.bind("selectedColor").to(n,"value"),c.delegate("execute").to(i),c.on("execute",((t,o)=>{e.execute(this.commandName,{value:o.value,batch:this._undoStepBatch}),e.editing.view.focus()})),i.on("change:isOpen",((t,o,n)=>{l||(l=!0,c.appendUI()),n&&(0!==a&&c.updateDocumentColors(e.model,this.componentName),c.updateSelectedColors(),c.showColorGridsFragment())})),i.panelView.children.add(c),i}))}}class q extends G{constructor(e){const t=e.locale.t;super(e,{commandName:s,componentName:s,icon:v.IconFontColor,dropdownLabel:t("Font Color")})}static get pluginName(){return"FontColorUI"}}class U extends e.Plugin{static get requires(){return[R,q]}static get pluginName(){return"FontColor"}static get isOfficialPlugin(){return!0}}class H extends t{constructor(e){super(e,a)}}class W extends e.Plugin{static get pluginName(){return"FontBackgroundColorEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define(a,{colors:[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}],columns:5}),e.data.addStyleProcessorRules(x.addBackgroundRules),e.conversion.for("upcast").elementToAttribute({view:{name:"span",styles:{"background-color":/[\s\S]+/}},model:{key:a,value:u("background-color")}}),e.conversion.for("downcast").attributeToElement({model:a,view:d("background-color")}),e.commands.add(a,new H(e)),e.model.schema.extend("$text",{allowAttributes:a}),e.model.schema.setAttributeProperties(a,{isFormatting:!0,copyOnEnter:!0})}}class Y extends G{constructor(e){const t=e.locale.t;super(e,{commandName:a,componentName:a,icon:v.IconFontBackground,dropdownLabel:t("Font Background Color")})}static get pluginName(){return"FontBackgroundColorUI"}}class J extends e.Plugin{static get requires(){return[W,Y]}static get pluginName(){return"FontBackgroundColor"}static get isOfficialPlugin(){return!0}}class Q extends e.Plugin{static get requires(){return[y,$,U,J]}static get pluginName(){return"Font"}static get isOfficialPlugin(){return!0}}})(),(window.CKEditor5=window.CKEditor5||{}).font=n})();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(o){const n=o.be=o.be||{};n.dictionary=Object.assign(n.dictionary||{},{Big:"Крупны",Default:"Па ўмове","Document colors":"Колеры дакумента","Font Background Color":"Колер фону шрыфту","Font Color":"Колер шрыфту","Font Family":"Сям'я шрыфтаў","Font Size":"Памер шрыфту",Huge:"Вельмі крупны",Small:"Мелкі",Tiny:"Вельмі малы"})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={}));
|
package/ckeditor5-metadata.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
{
|
|
11
11
|
"type": "SplitButton",
|
|
12
12
|
"name": "fontBackgroundColor",
|
|
13
|
-
"iconPath": "theme/icons/font-background.svg"
|
|
13
|
+
"iconPath": "@ckeditor/ckeditor5-icons/theme/icons/font-background.svg"
|
|
14
14
|
}
|
|
15
15
|
],
|
|
16
16
|
"htmlOutput": [
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
{
|
|
31
31
|
"type": "SplitButton",
|
|
32
32
|
"name": "fontColor",
|
|
33
|
-
"iconPath": "theme/icons/font-color.svg"
|
|
33
|
+
"iconPath": "@ckeditor/ckeditor5-icons/theme/icons/font-color.svg"
|
|
34
34
|
}
|
|
35
35
|
],
|
|
36
36
|
"htmlOutput": [
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
{
|
|
51
51
|
"type": "SplitButton",
|
|
52
52
|
"name": "fontSize",
|
|
53
|
-
"iconPath": "theme/icons/font-size.svg"
|
|
53
|
+
"iconPath": "@ckeditor/ckeditor5-icons/theme/icons/font-size.svg"
|
|
54
54
|
}
|
|
55
55
|
],
|
|
56
56
|
"htmlOutput": [
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
{
|
|
90
90
|
"type": "SplitButton",
|
|
91
91
|
"name": "fontFamily",
|
|
92
|
-
"iconPath": "theme/icons/font-family.svg"
|
|
92
|
+
"iconPath": "@ckeditor/ckeditor5-icons/theme/icons/font-family.svg"
|
|
93
93
|
}
|
|
94
94
|
],
|
|
95
95
|
"htmlOutput": [
|
package/dist/index.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { Command, Plugin } from '@ckeditor/ckeditor5-core/dist/index.js';
|
|
6
6
|
import { ColorSelectorView, createDropdown, addListToDropdown, MenuBarMenuView, MenuBarMenuListView, MenuBarMenuListItemView, MenuBarMenuListItemButtonView, ViewModel, normalizeColorOptions, getLocalizedColorOptions, focusChildOnDropdownOpen } from '@ckeditor/ckeditor5-ui/dist/index.js';
|
|
7
7
|
import { Collection, CKEditorError } from '@ckeditor/ckeditor5-utils/dist/index.js';
|
|
8
|
+
import { IconFontFamily, IconFontSize, IconFontColor, IconFontBackground } from '@ckeditor/ckeditor5-icons/dist/index.js';
|
|
8
9
|
import { isLength, isPercentage, addBackgroundRules } from '@ckeditor/ckeditor5-engine/dist/index.js';
|
|
9
10
|
|
|
10
11
|
/**
|
|
@@ -359,8 +360,6 @@ import { isLength, isPercentage, addBackgroundRules } from '@ckeditor/ckeditor5-
|
|
|
359
360
|
}
|
|
360
361
|
}
|
|
361
362
|
|
|
362
|
-
var fontFamilyIcon = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M11.03 3h6.149a.75.75 0 1 1 0 1.5h-5.514L11.03 3zm1.27 3h4.879a.75.75 0 1 1 0 1.5h-4.244L12.3 6zm1.27 3h3.609a.75.75 0 1 1 0 1.5h-2.973L13.57 9zm-2.754 2.5L8.038 4.785 5.261 11.5h5.555zm.62 1.5H4.641l-1.666 4.028H1.312l5.789-14h1.875l5.789 14h-1.663L11.436 13z\"/></svg>";
|
|
363
|
-
|
|
364
363
|
/**
|
|
365
364
|
* The font family UI plugin. It introduces the `'fontFamily'` dropdown.
|
|
366
365
|
*/ class FontFamilyUI extends Plugin {
|
|
@@ -392,7 +391,7 @@ var fontFamilyIcon = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/
|
|
|
392
391
|
});
|
|
393
392
|
dropdownView.buttonView.set({
|
|
394
393
|
label: accessibleLabel,
|
|
395
|
-
icon:
|
|
394
|
+
icon: IconFontFamily,
|
|
396
395
|
tooltip: true
|
|
397
396
|
});
|
|
398
397
|
dropdownView.extendTemplate({
|
|
@@ -414,7 +413,7 @@ var fontFamilyIcon = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/
|
|
|
414
413
|
const menuView = new MenuBarMenuView(locale);
|
|
415
414
|
menuView.buttonView.set({
|
|
416
415
|
label: accessibleLabel,
|
|
417
|
-
icon:
|
|
416
|
+
icon: IconFontFamily
|
|
418
417
|
});
|
|
419
418
|
menuView.bind('isEnabled').to(command);
|
|
420
419
|
const listView = new MenuBarMenuListView(locale);
|
|
@@ -846,8 +845,6 @@ const styleFontSize = [
|
|
|
846
845
|
}
|
|
847
846
|
}
|
|
848
847
|
|
|
849
|
-
var fontSizeIcon = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M9.816 11.5 7.038 4.785 4.261 11.5h5.555zm.62 1.5H3.641l-1.666 4.028H.312l5.789-14h1.875l5.789 14h-1.663L10.436 13zm7.55 2.279.779-.779.707.707-2.265 2.265-2.193-2.265.707-.707.765.765V4.825c0-.042 0-.083.002-.123l-.77.77-.707-.707L17.207 2.5l2.265 2.265-.707.707-.782-.782c.002.043.003.089.003.135v10.454z\"/></svg>";
|
|
850
|
-
|
|
851
848
|
/**
|
|
852
849
|
* The font size UI plugin. It introduces the `'fontSize'` dropdown.
|
|
853
850
|
*/ class FontSizeUI extends Plugin {
|
|
@@ -880,7 +877,7 @@ var fontSizeIcon = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/sv
|
|
|
880
877
|
// Create dropdown model.
|
|
881
878
|
dropdownView.buttonView.set({
|
|
882
879
|
label: accessibleLabel,
|
|
883
|
-
icon:
|
|
880
|
+
icon: IconFontSize,
|
|
884
881
|
tooltip: true
|
|
885
882
|
});
|
|
886
883
|
dropdownView.extendTemplate({
|
|
@@ -904,7 +901,7 @@ var fontSizeIcon = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/sv
|
|
|
904
901
|
const menuView = new MenuBarMenuView(locale);
|
|
905
902
|
menuView.buttonView.set({
|
|
906
903
|
label: accessibleLabel,
|
|
907
|
-
icon:
|
|
904
|
+
icon: IconFontSize
|
|
908
905
|
});
|
|
909
906
|
menuView.bind('isEnabled').to(command);
|
|
910
907
|
const listView = new MenuBarMenuListView(locale);
|
|
@@ -1357,8 +1354,6 @@ var fontSizeIcon = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/sv
|
|
|
1357
1354
|
}
|
|
1358
1355
|
}
|
|
1359
1356
|
|
|
1360
|
-
var fontColorIcon = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M12.4 10.3 10 4.5l-2.4 5.8h4.8zm.5 1.2H7.1L5.7 15H4.2l5-12h1.6l5 12h-1.5L13 11.5zm3.1 7H4a1 1 0 0 1 0-2h12a1 1 0 0 1 0 2z\"/></svg>";
|
|
1361
|
-
|
|
1362
1357
|
/**
|
|
1363
1358
|
* The font color UI plugin. It introduces the `'fontColor'` dropdown.
|
|
1364
1359
|
*/ class FontColorUI extends ColorUI {
|
|
@@ -1369,7 +1364,7 @@ var fontColorIcon = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/s
|
|
|
1369
1364
|
super(editor, {
|
|
1370
1365
|
commandName: FONT_COLOR,
|
|
1371
1366
|
componentName: FONT_COLOR,
|
|
1372
|
-
icon:
|
|
1367
|
+
icon: IconFontColor,
|
|
1373
1368
|
dropdownLabel: t('Font Color')
|
|
1374
1369
|
});
|
|
1375
1370
|
}
|
|
@@ -1544,8 +1539,6 @@ var fontColorIcon = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/s
|
|
|
1544
1539
|
}
|
|
1545
1540
|
}
|
|
1546
1541
|
|
|
1547
|
-
var fontBackgroundColorIcon = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M4 2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2zm8.38 9.262H7.62L10 5.506l2.38 5.756zm.532 1.285L14.34 16h1.426L10.804 4H9.196L4.234 16H5.66l1.428-3.453h5.824z\"/></svg>";
|
|
1548
|
-
|
|
1549
1542
|
/**
|
|
1550
1543
|
* The font background color UI plugin. It introduces the `'fontBackgroundColor'` dropdown.
|
|
1551
1544
|
*/ class FontBackgroundColorUI extends ColorUI {
|
|
@@ -1556,7 +1549,7 @@ var fontBackgroundColorIcon = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.
|
|
|
1556
1549
|
super(editor, {
|
|
1557
1550
|
commandName: FONT_BACKGROUND_COLOR,
|
|
1558
1551
|
componentName: FONT_BACKGROUND_COLOR,
|
|
1559
|
-
icon:
|
|
1552
|
+
icon: IconFontBackground,
|
|
1560
1553
|
dropdownLabel: t('Font Background Color')
|
|
1561
1554
|
});
|
|
1562
1555
|
}
|