@ckeditor/ckeditor5-highlight 44.2.0 → 44.2.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/highlight.js +1 -1
- package/package.json +5 -5
package/build/highlight.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={809:(e,t,i)=>{"use strict";i.d(t,{A:()=>a});var n=i(758),r=i.n(n),o=i(935),l=i.n(o)()(r());l.push([e.id,":root{--ck-highlight-marker-yellow:#fdfd77;--ck-highlight-marker-green:#62f962;--ck-highlight-marker-pink:#fc7899;--ck-highlight-marker-blue:#72ccfd;--ck-highlight-pen-red:#e71313;--ck-highlight-pen-green:#128a00}.ck-content .marker-yellow{background-color:var(--ck-highlight-marker-yellow)}.ck-content .marker-green{background-color:var(--ck-highlight-marker-green)}.ck-content .marker-pink{background-color:var(--ck-highlight-marker-pink)}.ck-content .marker-blue{background-color:var(--ck-highlight-marker-blue)}.ck-content .pen-red{background-color:transparent;color:var(--ck-highlight-pen-red)}.ck-content .pen-green{background-color:transparent;color:var(--ck-highlight-pen-green)}",""]);const a=l},935:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var i="",n=void 0!==t[5];return t[4]&&(i+="@supports (".concat(t[4],") {")),t[2]&&(i+="@media ".concat(t[2]," {")),n&&(i+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),i+=e(t),n&&(i+="}"),t[2]&&(i+="}"),t[4]&&(i+="}"),i})).join("")},t.i=function(e,i,n,r,o){"string"==typeof e&&(e=[[null,e,void 0]]);var l={};if(n)for(var a=0;a<this.length;a++){var c=this[a][0];null!=c&&(l[c]=!0)}for(var s=0;s<e.length;s++){var h=[].concat(e[s]);n&&l[h[0]]||(void 0!==o&&(void 0===h[5]||(h[1]="@layer".concat(h[5].length>0?" ".concat(h[5]):""," {").concat(h[1],"}")),h[5]=o),i&&(h[2]?(h[1]="@media ".concat(h[2]," {").concat(h[1],"}"),h[2]=i):h[2]=i),r&&(h[4]?(h[1]="@supports (".concat(h[4],") {").concat(h[1],"}"),h[4]=r):h[4]="".concat(r)),t.push(h))}},t}},758:e=>{"use strict";e.exports=function(e){return e[1]}},591:e=>{"use strict";var t=[];function i(e){for(var i=-1,n=0;n<t.length;n++)if(t[n].identifier===e){i=n;break}return i}function n(e,n){for(var o={},l=[],a=0;a<e.length;a++){var c=e[a],s=n.base?c[0]+n.base:c[0],h=o[s]||0,u="".concat(s," ").concat(h);o[s]=h+1;var g=i(u),d={css:c[1],media:c[2],sourceMap:c[3],supports:c[4],layer:c[5]};if(-1!==g)t[g].references++,t[g].updater(d);else{var m=r(d,n);n.byIndex=a,t.splice(a,0,{identifier:u,updater:m,references:1})}l.push(u)}return l}function r(e,t){var i=t.domAPI(t);i.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;i.update(e=t)}else i.remove()}}e.exports=function(e,r){var o=n(e=e||[],r=r||{});return function(e){e=e||[];for(var l=0;l<o.length;l++){var a=i(o[l]);t[a].references--}for(var c=n(e,r),s=0;s<o.length;s++){var h=i(o[s]);0===t[h].references&&(t[h].updater(),t.splice(h,1))}o=c}}},128:e=>{"use strict";var t={};e.exports=function(e,i){var n=function(e){if(void 0===t[e]){var i=document.querySelector(e);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(e){i=null}t[e]=i}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(i)}},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}},21:e=>{"use strict";e.exports=function(e,t){Object.keys(t).forEach((function(i){e.setAttribute(i,t[i])}))}},639:e=>{"use strict";var t,i=(t=[],function(e,i){return t[e]=i,t.filter(Boolean).join("\n")});function n(e,t,n,r){var o;if(n)o="";else{o="",r.supports&&(o+="@supports (".concat(r.supports,") {")),r.media&&(o+="@media ".concat(r.media," {"));var l=void 0!==r.layer;l&&(o+="@layer".concat(r.layer.length>0?" ".concat(r.layer):""," {")),o+=r.css,l&&(o+="}"),r.media&&(o+="}"),r.supports&&(o+="}")}if(e.styleSheet)e.styleSheet.cssText=i(t,o);else{var a=document.createTextNode(o),c=e.childNodes;c[t]&&e.removeChild(c[t]),c.length?e.insertBefore(a,c[t]):e.appendChild(a)}}var r={singleton:null,singletonCounter:0};e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=r.singletonCounter++,i=r.singleton||(r.singleton=e.insertStyleElement(e));return{update:function(e){n(i,t,!1,e)},remove:function(e){n(i,t,!0,e)}}}},782:(e,t,i)=>{e.exports=i(237)("./src/core.js")},311:(e,t,i)=>{e.exports=i(237)("./src/ui.js")},237:e=>{"use strict";e.exports=CKEditor5.dll}},t={};function i(n){var r=t[n];if(void 0!==r)return r.exports;var o=t[n]={id:n,exports:{}};return e[n](o,o.exports,i),o.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{"use strict";i.r(n),i.d(n,{Highlight:()=>w,HighlightEditing:()=>r,HighlightUI:()=>k});var e=i(782);class t extends e.Command{refresh(){const e=this.editor.model,t=e.document;this.value=t.selection.getAttribute("highlight"),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,"highlight")}execute(e={}){const t=this.editor.model,i=t.document.selection,n=e.value;t.change((e=>{if(i.isCollapsed){const t=i.getFirstPosition();if(i.hasAttribute("highlight")){const i=e=>e.item.hasAttribute("highlight")&&e.item.getAttribute("highlight")===this.value,r=t.getLastMatchingPosition(i,{direction:"backward"}),o=t.getLastMatchingPosition(i),l=e.createRange(r,o);n&&this.value!==n?(t.isEqual(o)||e.setAttribute("highlight",n,l),e.setSelectionAttribute("highlight",n)):(t.isEqual(o)||e.removeAttribute("highlight",l),e.removeSelectionAttribute("highlight"))}else n&&e.setSelectionAttribute("highlight",n)}else{const r=t.schema.getValidRanges(i.getRanges(),"highlight");for(const t of r)n?e.setAttribute("highlight",n,t):e.removeAttribute("highlight",t)}}))}}class r extends e.Plugin{static get pluginName(){return"HighlightEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("highlight",{options:[{model:"yellowMarker",class:"marker-yellow",title:"Yellow marker",color:"var(--ck-highlight-marker-yellow)",type:"marker"},{model:"greenMarker",class:"marker-green",title:"Green marker",color:"var(--ck-highlight-marker-green)",type:"marker"},{model:"pinkMarker",class:"marker-pink",title:"Pink marker",color:"var(--ck-highlight-marker-pink)",type:"marker"},{model:"blueMarker",class:"marker-blue",title:"Blue marker",color:"var(--ck-highlight-marker-blue)",type:"marker"},{model:"redPen",class:"pen-red",title:"Red pen",color:"var(--ck-highlight-pen-red)",type:"pen"},{model:"greenPen",class:"pen-green",title:"Green pen",color:"var(--ck-highlight-pen-green)",type:"pen"}]})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"highlight"});const i=e.config.get("highlight.options");e.conversion.attributeToElement(function(e){const t={model:{key:"highlight",values:[]},view:{}};for(const i of e)t.model.values.push(i.model),t.view[i.model]={name:"mark",classes:i.class};return t}(i)),e.commands.add("highlight",new t(e))}}var o=i(311);var l=i(591),a=i.n(l),c=i(639),s=i.n(c),h=i(128),u=i.n(h),g=i(21),d=i.n(g),m=i(51),p=i.n(m),v=i(809),f={attributes:{"data-cke":!0}};f.setAttributes=d(),f.insert=u().bind(null,"head"),f.domAPI=s(),f.insertStyleElement=p();a()(v.A,f);v.A&&v.A.locals&&v.A.locals;class k extends e.Plugin{get localizedOptionTitles(){const e=this.editor.t;return{"Yellow marker":e("Yellow marker"),"Green marker":e("Green marker"),"Pink marker":e("Pink marker"),"Blue marker":e("Blue marker"),"Red pen":e("Red pen"),"Green pen":e("Green pen")}}static get pluginName(){return"HighlightUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor.config.get("highlight.options");for(const t of e)this._addHighlighterButton(t);this._addRemoveHighlightButton(),this._addDropdown(e),this._addMenuBarButton(e)}_addRemoveHighlightButton(){const t=this.editor.t,i=this.editor.commands.get("highlight");this._addButton("removeHighlight",t("Remove highlight"),e.icons.eraser,null,(e=>{e.bind("isEnabled").to(i,"isEnabled")}))}_addHighlighterButton(e){const t=this.editor.commands.get("highlight");this._addButton("highlight:"+e.model,e.title,b(e.type),e.model,(function(i){i.bind("isEnabled").to(t,"isEnabled"),i.bind("isOn").to(t,"value",(t=>t===e.model)),i.iconView.fillColor=e.color,i.isToggleable=!0}))}_addButton(e,t,i,n,r){const l=this.editor;l.ui.componentFactory.add(e,(e=>{const a=new o.ButtonView(e),c=this.localizedOptionTitles[t]?this.localizedOptionTitles[t]:t;return a.set({label:c,icon:i,tooltip:!0}),a.on("execute",(()=>{l.execute("highlight",{value:n}),l.editing.view.focus()})),r(a),a}))}_addDropdown(e){const t=this.editor,i=t.t,n=t.ui.componentFactory,r=e[0],l=e.reduce(((e,t)=>(e[t.model]=t,e)),{});n.add("highlight",(a=>{const c=t.commands.get("highlight"),s=(0,o.createDropdown)(a,o.SplitButtonView),h=s.buttonView;h.set({label:i("Highlight"),tooltip:!0,lastExecuted:r.model,commandValue:r.model,isToggleable:!0}),h.bind("icon").to(c,"value",(e=>b(u(e,"type")))),h.bind("color").to(c,"value",(e=>u(e,"color"))),h.bind("commandValue").to(c,"value",(e=>u(e,"model"))),h.bind("isOn").to(c,"value",(e=>!!e)),h.delegate("execute").to(s);function u(e,t){const i=e&&e!==h.lastExecuted?e:h.lastExecuted;return l[i][t]}return s.bind("isEnabled").to(c,"isEnabled"),(0,o.addToolbarToDropdown)(s,(()=>{const t=e.map((e=>{const t=n.create("highlight:"+e.model);return this.listenTo(t,"execute",(()=>{s.buttonView.set({lastExecuted:e.model})})),t}));return t.push(new o.ToolbarSeparatorView),t.push(n.create("removeHighlight")),t}),{enableActiveItemFocusOnDropdownOpen:!0,ariaLabel:i("Text highlight toolbar")}),function(e){const t=e.buttonView.actionView;t.iconView.bind("fillColor").to(e.buttonView,"color")}(s),h.on("execute",(()=>{t.execute("highlight",{value:h.commandValue})})),this.listenTo(s,"execute",(()=>{t.editing.view.focus()})),s}))}_addMenuBarButton(t){const i=this.editor,n=i.t,r=i.commands.get("highlight");i.ui.componentFactory.add("menuBar:highlight",(l=>{const a=new o.MenuBarMenuView(l);a.buttonView.set({label:n("Highlight"),icon:b("marker")}),a.bind("isEnabled").to(r),a.buttonView.iconView.fillColor="transparent";const c=new o.MenuBarMenuListView(l);for(const e of t){const t=new o.MenuBarMenuListItemView(l,a),n=new o.MenuBarMenuListItemButtonView(l);n.set({label:e.title,icon:b(e.type),role:"menuitemradio",isToggleable:!0}),n.iconView.fillColor=e.color,n.delegate("execute").to(a),n.bind("isOn").to(r,"value",(t=>t===e.model)),n.on("execute",(()=>{i.execute("highlight",{value:e.model}),i.editing.view.focus()})),t.children.add(n),c.items.add(t)}c.items.add(new o.ListSeparatorView(l));const s=new o.MenuBarMenuListItemView(l,a),h=new o.MenuBarMenuListItemButtonView(l);return h.set({label:n("Remove highlight"),icon:e.icons.eraser}),h.delegate("execute").to(a),h.on("execute",(()=>{i.execute("highlight",{value:null}),i.editing.view.focus()})),s.children.add(h),c.items.add(s),a.panelView.children.add(c),a}))}}function b(e){return"marker"===e?'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path class="ck-icon__fill" d="M10.798 1.59 3.002 12.875l1.895 1.852 2.521 1.402 6.997-12.194z"/><path d="m2.556 16.727.234-.348c-.297-.151-.462-.293-.498-.426-.036-.137.002-.416.115-.837.094-.25.15-.449.169-.595a4.495 4.495 0 0 0 0-.725c-.209-.621-.303-1.041-.284-1.26.02-.218.178-.506.475-.862l6.77-9.414c.539-.91 1.605-.85 3.199.18 1.594 1.032 2.188 1.928 1.784 2.686l-5.877 10.36c-.158.412-.333.673-.526.782-.193.108-.604.179-1.232.21-.362.131-.608.237-.738.318-.13.081-.305.238-.526.47-.293.265-.504.397-.632.397-.096 0-.27-.075-.524-.226l-.31.41-1.6-1.12zm-.279.415 1.575 1.103-.392.515H1.19l1.087-1.618zm8.1-13.656-4.953 6.9L8.75 12.57l4.247-7.574c.175-.25-.188-.647-1.092-1.192-.903-.546-1.412-.652-1.528-.32zM8.244 18.5 9.59 17h9.406v1.5H8.245z"/></svg>':'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path class="ck-icon__fill" d="M10.126 2.268 2.002 13.874l1.895 1.852 2.521 1.402L14.47 5.481l-1.543-2.568-2.801-.645z"/><path d="m4.5 18.088-2.645-1.852-.04-2.95-.006-.005.006-.008v-.025l.011.008L8.73 2.97c.165-.233.356-.417.567-.557l-1.212.308L4.604 7.9l-.83-.558 3.694-5.495 2.708-.69 1.65 1.145.046.018.85-1.216 2.16 1.512-.856 1.222c.828.967 1.144 2.141.432 3.158L7.55 17.286l.006.005-3.055.797H4.5zm-.634.166-1.976.516-.026-1.918 2.002 1.402zM9.968 3.817l-.006-.004-6.123 9.184 3.277 2.294 6.108-9.162.005.003c.317-.452-.16-1.332-1.064-1.966-.891-.624-1.865-.776-2.197-.349zM8.245 18.5 9.59 17h9.406v1.5H8.245z"/></svg>'}class w extends e.Plugin{static get requires(){return[r,k]}static get pluginName(){return"Highlight"}static get isOfficialPlugin(){return!0}}})(),(window.CKEditor5=window.CKEditor5||{}).highlight=n})();
|
5
|
+
*/(()=>{var e={21:e=>{"use strict";e.exports=function(e,t){Object.keys(t).forEach((function(i){e.setAttribute(i,t[i])}))}},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,i){var n=function(e){if(void 0===t[e]){var i=document.querySelector(e);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(e){i=null}t[e]=i}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(i)}},237:e=>{"use strict";e.exports=CKEditor5.dll},311:(e,t,i)=>{e.exports=i(237)("./src/ui.js")},591:e=>{"use strict";var t=[];function i(e){for(var i=-1,n=0;n<t.length;n++)if(t[n].identifier===e){i=n;break}return i}function n(e,n){for(var o={},l=[],a=0;a<e.length;a++){var c=e[a],s=n.base?c[0]+n.base:c[0],h=o[s]||0,u="".concat(s," ").concat(h);o[s]=h+1;var g=i(u),d={css:c[1],media:c[2],sourceMap:c[3],supports:c[4],layer:c[5]};if(-1!==g)t[g].references++,t[g].updater(d);else{var m=r(d,n);n.byIndex=a,t.splice(a,0,{identifier:u,updater:m,references:1})}l.push(u)}return l}function r(e,t){var i=t.domAPI(t);i.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;i.update(e=t)}else i.remove()}}e.exports=function(e,r){var o=n(e=e||[],r=r||{});return function(e){e=e||[];for(var l=0;l<o.length;l++){var a=i(o[l]);t[a].references--}for(var c=n(e,r),s=0;s<o.length;s++){var h=i(o[s]);0===t[h].references&&(t[h].updater(),t.splice(h,1))}o=c}}},639:e=>{"use strict";var t,i=(t=[],function(e,i){return t[e]=i,t.filter(Boolean).join("\n")});function n(e,t,n,r){var o;if(n)o="";else{o="",r.supports&&(o+="@supports (".concat(r.supports,") {")),r.media&&(o+="@media ".concat(r.media," {"));var l=void 0!==r.layer;l&&(o+="@layer".concat(r.layer.length>0?" ".concat(r.layer):""," {")),o+=r.css,l&&(o+="}"),r.media&&(o+="}"),r.supports&&(o+="}")}if(e.styleSheet)e.styleSheet.cssText=i(t,o);else{var a=document.createTextNode(o),c=e.childNodes;c[t]&&e.removeChild(c[t]),c.length?e.insertBefore(a,c[t]):e.appendChild(a)}}var r={singleton:null,singletonCounter:0};e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=r.singletonCounter++,i=r.singleton||(r.singleton=e.insertStyleElement(e));return{update:function(e){n(i,t,!1,e)},remove:function(e){n(i,t,!0,e)}}}},758:e=>{"use strict";e.exports=function(e){return e[1]}},782:(e,t,i)=>{e.exports=i(237)("./src/core.js")},809:(e,t,i)=>{"use strict";i.d(t,{A:()=>a});var n=i(758),r=i.n(n),o=i(935),l=i.n(o)()(r());l.push([e.id,":root{--ck-highlight-marker-yellow:#fdfd77;--ck-highlight-marker-green:#62f962;--ck-highlight-marker-pink:#fc7899;--ck-highlight-marker-blue:#72ccfd;--ck-highlight-pen-red:#e71313;--ck-highlight-pen-green:#128a00}.ck-content .marker-yellow{background-color:var(--ck-highlight-marker-yellow)}.ck-content .marker-green{background-color:var(--ck-highlight-marker-green)}.ck-content .marker-pink{background-color:var(--ck-highlight-marker-pink)}.ck-content .marker-blue{background-color:var(--ck-highlight-marker-blue)}.ck-content .pen-red{background-color:transparent;color:var(--ck-highlight-pen-red)}.ck-content .pen-green{background-color:transparent;color:var(--ck-highlight-pen-green)}",""]);const a=l},935:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var i="",n=void 0!==t[5];return t[4]&&(i+="@supports (".concat(t[4],") {")),t[2]&&(i+="@media ".concat(t[2]," {")),n&&(i+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),i+=e(t),n&&(i+="}"),t[2]&&(i+="}"),t[4]&&(i+="}"),i})).join("")},t.i=function(e,i,n,r,o){"string"==typeof e&&(e=[[null,e,void 0]]);var l={};if(n)for(var a=0;a<this.length;a++){var c=this[a][0];null!=c&&(l[c]=!0)}for(var s=0;s<e.length;s++){var h=[].concat(e[s]);n&&l[h[0]]||(void 0!==o&&(void 0===h[5]||(h[1]="@layer".concat(h[5].length>0?" ".concat(h[5]):""," {").concat(h[1],"}")),h[5]=o),i&&(h[2]?(h[1]="@media ".concat(h[2]," {").concat(h[1],"}"),h[2]=i):h[2]=i),r&&(h[4]?(h[1]="@supports (".concat(h[4],") {").concat(h[1],"}"),h[4]=r):h[4]="".concat(r)),t.push(h))}},t}}},t={};function i(n){var r=t[n];if(void 0!==r)return r.exports;var o=t[n]={id:n,exports:{}};return e[n](o,o.exports,i),o.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{"use strict";i.r(n),i.d(n,{Highlight:()=>w,HighlightEditing:()=>r,HighlightUI:()=>k});var e=i(782);class t extends e.Command{refresh(){const e=this.editor.model,t=e.document;this.value=t.selection.getAttribute("highlight"),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,"highlight")}execute(e={}){const t=this.editor.model,i=t.document.selection,n=e.value;t.change((e=>{if(i.isCollapsed){const t=i.getFirstPosition();if(i.hasAttribute("highlight")){const i=e=>e.item.hasAttribute("highlight")&&e.item.getAttribute("highlight")===this.value,r=t.getLastMatchingPosition(i,{direction:"backward"}),o=t.getLastMatchingPosition(i),l=e.createRange(r,o);n&&this.value!==n?(t.isEqual(o)||e.setAttribute("highlight",n,l),e.setSelectionAttribute("highlight",n)):(t.isEqual(o)||e.removeAttribute("highlight",l),e.removeSelectionAttribute("highlight"))}else n&&e.setSelectionAttribute("highlight",n)}else{const r=t.schema.getValidRanges(i.getRanges(),"highlight");for(const t of r)n?e.setAttribute("highlight",n,t):e.removeAttribute("highlight",t)}}))}}class r extends e.Plugin{static get pluginName(){return"HighlightEditing"}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define("highlight",{options:[{model:"yellowMarker",class:"marker-yellow",title:"Yellow marker",color:"var(--ck-highlight-marker-yellow)",type:"marker"},{model:"greenMarker",class:"marker-green",title:"Green marker",color:"var(--ck-highlight-marker-green)",type:"marker"},{model:"pinkMarker",class:"marker-pink",title:"Pink marker",color:"var(--ck-highlight-marker-pink)",type:"marker"},{model:"blueMarker",class:"marker-blue",title:"Blue marker",color:"var(--ck-highlight-marker-blue)",type:"marker"},{model:"redPen",class:"pen-red",title:"Red pen",color:"var(--ck-highlight-pen-red)",type:"pen"},{model:"greenPen",class:"pen-green",title:"Green pen",color:"var(--ck-highlight-pen-green)",type:"pen"}]})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"highlight"});const i=e.config.get("highlight.options");e.conversion.attributeToElement(function(e){const t={model:{key:"highlight",values:[]},view:{}};for(const i of e)t.model.values.push(i.model),t.view[i.model]={name:"mark",classes:i.class};return t}(i)),e.commands.add("highlight",new t(e))}}var o=i(311);var l=i(591),a=i.n(l),c=i(639),s=i.n(c),h=i(128),u=i.n(h),g=i(21),d=i.n(g),m=i(51),p=i.n(m),v=i(809),f={attributes:{"data-cke":!0}};f.setAttributes=d(),f.insert=u().bind(null,"head"),f.domAPI=s(),f.insertStyleElement=p();a()(v.A,f);v.A&&v.A.locals&&v.A.locals;class k extends e.Plugin{get localizedOptionTitles(){const e=this.editor.t;return{"Yellow marker":e("Yellow marker"),"Green marker":e("Green marker"),"Pink marker":e("Pink marker"),"Blue marker":e("Blue marker"),"Red pen":e("Red pen"),"Green pen":e("Green pen")}}static get pluginName(){return"HighlightUI"}static get isOfficialPlugin(){return!0}init(){const e=this.editor.config.get("highlight.options");for(const t of e)this._addHighlighterButton(t);this._addRemoveHighlightButton(),this._addDropdown(e),this._addMenuBarButton(e)}_addRemoveHighlightButton(){const t=this.editor.t,i=this.editor.commands.get("highlight");this._addButton("removeHighlight",t("Remove highlight"),e.icons.eraser,null,(e=>{e.bind("isEnabled").to(i,"isEnabled")}))}_addHighlighterButton(e){const t=this.editor.commands.get("highlight");this._addButton("highlight:"+e.model,e.title,b(e.type),e.model,(function(i){i.bind("isEnabled").to(t,"isEnabled"),i.bind("isOn").to(t,"value",(t=>t===e.model)),i.iconView.fillColor=e.color,i.isToggleable=!0}))}_addButton(e,t,i,n,r){const l=this.editor;l.ui.componentFactory.add(e,(e=>{const a=new o.ButtonView(e),c=this.localizedOptionTitles[t]?this.localizedOptionTitles[t]:t;return a.set({label:c,icon:i,tooltip:!0}),a.on("execute",(()=>{l.execute("highlight",{value:n}),l.editing.view.focus()})),r(a),a}))}_addDropdown(e){const t=this.editor,i=t.t,n=t.ui.componentFactory,r=e[0],l=e.reduce(((e,t)=>(e[t.model]=t,e)),{});n.add("highlight",(a=>{const c=t.commands.get("highlight"),s=(0,o.createDropdown)(a,o.SplitButtonView),h=s.buttonView;h.set({label:i("Highlight"),tooltip:!0,lastExecuted:r.model,commandValue:r.model,isToggleable:!0}),h.bind("icon").to(c,"value",(e=>b(u(e,"type")))),h.bind("color").to(c,"value",(e=>u(e,"color"))),h.bind("commandValue").to(c,"value",(e=>u(e,"model"))),h.bind("isOn").to(c,"value",(e=>!!e)),h.delegate("execute").to(s);function u(e,t){const i=e&&e!==h.lastExecuted?e:h.lastExecuted;return l[i][t]}return s.bind("isEnabled").to(c,"isEnabled"),(0,o.addToolbarToDropdown)(s,(()=>{const t=e.map((e=>{const t=n.create("highlight:"+e.model);return this.listenTo(t,"execute",(()=>{s.buttonView.set({lastExecuted:e.model})})),t}));return t.push(new o.ToolbarSeparatorView),t.push(n.create("removeHighlight")),t}),{enableActiveItemFocusOnDropdownOpen:!0,ariaLabel:i("Text highlight toolbar")}),function(e){const t=e.buttonView.actionView;t.iconView.bind("fillColor").to(e.buttonView,"color")}(s),h.on("execute",(()=>{t.execute("highlight",{value:h.commandValue})})),this.listenTo(s,"execute",(()=>{t.editing.view.focus()})),s}))}_addMenuBarButton(t){const i=this.editor,n=i.t,r=i.commands.get("highlight");i.ui.componentFactory.add("menuBar:highlight",(l=>{const a=new o.MenuBarMenuView(l);a.buttonView.set({label:n("Highlight"),icon:b("marker")}),a.bind("isEnabled").to(r),a.buttonView.iconView.fillColor="transparent";const c=new o.MenuBarMenuListView(l);for(const e of t){const t=new o.MenuBarMenuListItemView(l,a),n=new o.MenuBarMenuListItemButtonView(l);n.set({label:e.title,icon:b(e.type),role:"menuitemradio",isToggleable:!0}),n.iconView.fillColor=e.color,n.delegate("execute").to(a),n.bind("isOn").to(r,"value",(t=>t===e.model)),n.on("execute",(()=>{i.execute("highlight",{value:e.model}),i.editing.view.focus()})),t.children.add(n),c.items.add(t)}c.items.add(new o.ListSeparatorView(l));const s=new o.MenuBarMenuListItemView(l,a),h=new o.MenuBarMenuListItemButtonView(l);return h.set({label:n("Remove highlight"),icon:e.icons.eraser}),h.delegate("execute").to(a),h.on("execute",(()=>{i.execute("highlight",{value:null}),i.editing.view.focus()})),s.children.add(h),c.items.add(s),a.panelView.children.add(c),a}))}}function b(e){return"marker"===e?'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path class="ck-icon__fill" d="M10.798 1.59 3.002 12.875l1.895 1.852 2.521 1.402 6.997-12.194z"/><path d="m2.556 16.727.234-.348c-.297-.151-.462-.293-.498-.426-.036-.137.002-.416.115-.837.094-.25.15-.449.169-.595a4.495 4.495 0 0 0 0-.725c-.209-.621-.303-1.041-.284-1.26.02-.218.178-.506.475-.862l6.77-9.414c.539-.91 1.605-.85 3.199.18 1.594 1.032 2.188 1.928 1.784 2.686l-5.877 10.36c-.158.412-.333.673-.526.782-.193.108-.604.179-1.232.21-.362.131-.608.237-.738.318-.13.081-.305.238-.526.47-.293.265-.504.397-.632.397-.096 0-.27-.075-.524-.226l-.31.41-1.6-1.12zm-.279.415 1.575 1.103-.392.515H1.19l1.087-1.618zm8.1-13.656-4.953 6.9L8.75 12.57l4.247-7.574c.175-.25-.188-.647-1.092-1.192-.903-.546-1.412-.652-1.528-.32zM8.244 18.5 9.59 17h9.406v1.5H8.245z"/></svg>':'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path class="ck-icon__fill" d="M10.126 2.268 2.002 13.874l1.895 1.852 2.521 1.402L14.47 5.481l-1.543-2.568-2.801-.645z"/><path d="m4.5 18.088-2.645-1.852-.04-2.95-.006-.005.006-.008v-.025l.011.008L8.73 2.97c.165-.233.356-.417.567-.557l-1.212.308L4.604 7.9l-.83-.558 3.694-5.495 2.708-.69 1.65 1.145.046.018.85-1.216 2.16 1.512-.856 1.222c.828.967 1.144 2.141.432 3.158L7.55 17.286l.006.005-3.055.797H4.5zm-.634.166-1.976.516-.026-1.918 2.002 1.402zM9.968 3.817l-.006-.004-6.123 9.184 3.277 2.294 6.108-9.162.005.003c.317-.452-.16-1.332-1.064-1.966-.891-.624-1.865-.776-2.197-.349zM8.245 18.5 9.59 17h9.406v1.5H8.245z"/></svg>'}class w extends e.Plugin{static get requires(){return[r,k]}static get pluginName(){return"Highlight"}static get isOfficialPlugin(){return!0}}})(),(window.CKEditor5=window.CKEditor5||{}).highlight=n})();
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ckeditor/ckeditor5-highlight",
|
3
|
-
"version": "44.2.
|
3
|
+
"version": "44.2.1",
|
4
4
|
"description": "Highlight feature for CKEditor 5.",
|
5
5
|
"keywords": [
|
6
6
|
"ckeditor",
|
@@ -13,10 +13,10 @@
|
|
13
13
|
"type": "module",
|
14
14
|
"main": "src/index.js",
|
15
15
|
"dependencies": {
|
16
|
-
"@ckeditor/ckeditor5-core": "44.2.
|
17
|
-
"@ckeditor/ckeditor5-ui": "44.2.
|
18
|
-
"@ckeditor/ckeditor5-utils": "44.2.
|
19
|
-
"ckeditor5": "44.2.
|
16
|
+
"@ckeditor/ckeditor5-core": "44.2.1",
|
17
|
+
"@ckeditor/ckeditor5-ui": "44.2.1",
|
18
|
+
"@ckeditor/ckeditor5-utils": "44.2.1",
|
19
|
+
"ckeditor5": "44.2.1"
|
20
20
|
},
|
21
21
|
"author": "CKSource (http://cksource.com/)",
|
22
22
|
"license": "SEE LICENSE IN LICENSE.md",
|