@ckeditor/ckeditor5-highlight 47.2.0 → 47.3.0-alpha.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 +3 -3
- package/build/highlight.js +1 -1
- package/package.json +6 -6
package/LICENSE.md
CHANGED
|
@@ -11,10 +11,10 @@ Licensed under a dual-license model, this software is available under:
|
|
|
11
11
|
|
|
12
12
|
For more information, see: [https://ckeditor.com/legal/ckeditor-licensing-options](https://ckeditor.com/legal/ckeditor-licensing-options).
|
|
13
13
|
|
|
14
|
-
Sources of Intellectual Property Included in CKEditor
|
|
15
|
-
|
|
14
|
+
Sources of Intellectual Property Included in CKEditor 5
|
|
15
|
+
------------------------------------------------------------
|
|
16
16
|
|
|
17
|
-
Where not otherwise indicated, all CKEditor content is authored by CKSource engineers and consists of CKSource-owned intellectual property. In some specific instances, CKEditor will incorporate work done by developers outside of CKSource with their express permission.
|
|
17
|
+
Where not otherwise indicated, all CKEditor 5 content is authored by CKSource engineers and consists of CKSource-owned intellectual property. In some specific instances, CKEditor 5 will incorporate work done by developers outside of CKSource with their express permission.
|
|
18
18
|
|
|
19
19
|
Trademarks
|
|
20
20
|
----------
|
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={20:e=>{"use strict";var t,n=(t=[],function(e,n){return t[e]=n,t.filter(Boolean).join("\n")});function i(e,t,i,r){var o;if(i)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=n(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++,n=r.singleton||(r.singleton=e.insertStyleElement(e));return{update:function(e){i(n,t,!1,e)},remove:function(e){i(n,t,!0,e)}}}},28:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var n="",i=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),i&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),i&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n}).join("")},t.i=function(e,n,i,r,o){"string"==typeof e&&(e=[[null,e,void 0]]);var l={};if(i)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]);i&&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),n&&(h[2]?(h[1]="@media ".concat(h[2]," {").concat(h[1],"}"),h[2]=n):h[2]=n),r&&(h[4]?(h[1]="@supports (".concat(h[4],") {").concat(h[1],"}"),h[4]=r):h[4]="".concat(r)),t.push(h))}},t}},48:e=>{"use strict";var t=[];function n(e){for(var n=-1,i=0;i<t.length;i++)if(t[i].identifier===e){n=i;break}return n}function i(e,i){for(var o={},l=[],a=0;a<e.length;a++){var c=e[a],s=i.base?c[0]+i.base:c[0],h=o[s]||0,u="".concat(s," ").concat(h);o[s]=h+1;var g=n(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,i);i.byIndex=a,t.splice(a,0,{identifier:u,updater:m,references:1})}l.push(u)}return l}function r(e,t){var n=t.domAPI(t);n.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;n.update(e=t)}else n.remove()}}e.exports=function(e,r){var o=i(e=e||[],r=r||{});return function(e){e=e||[];for(var l=0;l<o.length;l++){var a=n(o[l]);t[a].references--}for(var c=i(e,r),s=0;s<o.length;s++){var h=n(o[s]);0===t[h].references&&(t[h].updater(),t.splice(h,1))}o=c}}},180:e=>{"use strict";e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},237:e=>{"use strict";e.exports=CKEditor5.dll},311:(e,t,n)=>{e.exports=n(237)("./src/ui.js")},355:(e,t,n)=>{e.exports=n(237)("./src/icons.js")},388:e=>{"use strict";e.exports=function(e,t){Object.keys(t).forEach(function(n){e.setAttribute(n,t[n])})}},627:e=>{"use strict";e.exports=function(e){return e[1]}},691:e=>{"use strict";var t={};e.exports=function(e,n){var i=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(n)}},782:(e,t,n)=>{e.exports=n(237)("./src/core.js")},897:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var i=n(627),r=n.n(i),o=n(28),l=n.n(o)()(r());l.push([e.id,":root{--ck-content-highlight-marker-yellow:#fdfd77;--ck-content-highlight-marker-green:#62f962;--ck-content-highlight-marker-pink:#fc7899;--ck-content-highlight-marker-blue:#72ccfd;--ck-content-highlight-pen-red:#e71313;--ck-content-highlight-pen-green:#128a00}.ck-content .marker-yellow{background-color:var(--ck-content-highlight-marker-yellow)}.ck-content .marker-green{background-color:var(--ck-content-highlight-marker-green)}.ck-content .marker-pink{background-color:var(--ck-content-highlight-marker-pink)}.ck-content .marker-blue{background-color:var(--ck-content-highlight-marker-blue)}.ck-content .pen-red{background-color:transparent;color:var(--ck-content-highlight-pen-red)}.ck-content .pen-green{background-color:transparent;color:var(--ck-content-highlight-pen-green)}",""]);const a=l}},t={};function n(i){var r=t[i];if(void 0!==r)return r.exports;var o=t[i]={id:i,exports:{}};return e[i](o,o.exports,n),o.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};(()=>{"use strict";n.r(i),n.d(i,{Highlight:()=>y,HighlightCommand:()=>t,HighlightEditing:()=>r,HighlightUI:()=>b});var e=n(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,n=t.document.selection,i=e.value;t.change(e=>{if(n.isCollapsed){const t=n.getFirstPosition();if(n.hasAttribute("highlight")){const n=e=>e.item.hasAttribute("highlight")&&e.item.getAttribute("highlight")===this.value,r=t.getLastMatchingPosition(n,{direction:"backward"}),o=t.getLastMatchingPosition(n),l=e.createRange(r,o);i&&this.value!==i?(t.isEqual(o)||e.setAttribute("highlight",i,l),e.setSelectionAttribute("highlight",i)):(t.isEqual(o)||e.removeAttribute("highlight",l),e.removeSelectionAttribute("highlight"))}else i&&e.setSelectionAttribute("highlight",i)}else{const r=t.schema.getValidRanges(n.getRanges(),"highlight");for(const t of r)i?e.setAttribute("highlight",i,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-content-highlight-marker-yellow)",type:"marker"},{model:"greenMarker",class:"marker-green",title:"Green marker",color:"var(--ck-content-highlight-marker-green)",type:"marker"},{model:"pinkMarker",class:"marker-pink",title:"Pink marker",color:"var(--ck-content-highlight-marker-pink)",type:"marker"},{model:"blueMarker",class:"marker-blue",title:"Blue marker",color:"var(--ck-content-highlight-marker-blue)",type:"marker"},{model:"redPen",class:"pen-red",title:"Red pen",color:"var(--ck-content-highlight-pen-red)",type:"pen"},{model:"greenPen",class:"pen-green",title:"Green pen",color:"var(--ck-content-highlight-pen-green)",type:"pen"}]})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"highlight"});const n=e.config.get("highlight.options");e.conversion.attributeToElement(function(e){const t={model:{key:"highlight",values:[]},view:{}};for(const n of e)t.model.values.push(n.model),t.view[n.model]={name:"mark",classes:n.class};return t}(n)),e.commands.add("highlight",new t(e))}}var o=n(355),l=n(311),a=n(48),c=n.n(a),s=n(20),h=n.n(s),u=n(691),g=n.n(u),d=n(388),m=n.n(d),p=n(180),f=n.n(p),v=n(897),k={attributes:{"data-cke":!0}};k.setAttributes=m(),k.insert=g().bind(null,"head"),k.domAPI=h(),k.insertStyleElement=f();c()(v.A,k);v.A&&v.A.locals&&v.A.locals;class b 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 e=this.editor.t,t=this.editor.commands.get("highlight");this._addButton("removeHighlight",e("Remove highlight"),o.IconEraser,null,e=>{e.bind("isEnabled").to(t,"isEnabled")})}_addHighlighterButton(e){const t=this.editor.commands.get("highlight");this._addButton("highlight:"+e.model,e.title,w(e.type),e.model,function(n){n.bind("isEnabled").to(t,"isEnabled"),n.bind("isOn").to(t,"value",t=>t===e.model),n.iconView.fillColor=e.color,n.isToggleable=!0})}_addButton(e,t,n,i,r){const o=this.editor;o.ui.componentFactory.add(e,e=>{const a=new l.ButtonView(e),c=this.localizedOptionTitles[t]?this.localizedOptionTitles[t]:t;return a.set({label:c,icon:n,tooltip:!0}),a.on("execute",()=>{o.execute("highlight",{value:i}),o.editing.view.focus()}),r(a),a})}_addDropdown(e){const t=this.editor,n=t.t,i=t.ui.componentFactory,r=e[0],o=e.reduce((e,t)=>(e[t.model]=t,e),{});i.add("highlight",a=>{const c=t.commands.get("highlight"),s=(0,l.createDropdown)(a,l.SplitButtonView),h=s.buttonView;h.set({label:n("Highlight"),tooltip:!0,lastExecuted:r.model,commandValue:r.model,isToggleable:!0}),h.bind("icon").to(c,"value",e=>w(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 n=e&&e!==h.lastExecuted?e:h.lastExecuted;return o[n][t]}return s.bind("isEnabled").to(c,"isEnabled"),(0,l.addToolbarToDropdown)(s,()=>{const t=e.map(e=>{const t=i.create("highlight:"+e.model);return this.listenTo(t,"execute",()=>{s.buttonView.set({lastExecuted:e.model})}),t});return t.push(new l.ToolbarSeparatorView),t.push(i.create("removeHighlight")),t},{enableActiveItemFocusOnDropdownOpen:!0,ariaLabel:n("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(e){const t=this.editor,n=t.t,i=t.commands.get("highlight");t.ui.componentFactory.add("menuBar:highlight",r=>{const a=new l.MenuBarMenuView(r);a.buttonView.set({label:n("Highlight"),icon:w("marker")}),a.bind("isEnabled").to(i),a.buttonView.iconView.fillColor="transparent";const c=new l.MenuBarMenuListView(r);for(const n of e){const e=new l.MenuBarMenuListItemView(r,a),o=new l.MenuBarMenuListItemButtonView(r);o.set({label:n.title,icon:w(n.type),role:"menuitemradio",isToggleable:!0}),o.iconView.fillColor=n.color,o.delegate("execute").to(a),o.bind("isOn").to(i,"value",e=>e===n.model),o.on("execute",()=>{t.execute("highlight",{value:n.model}),t.editing.view.focus()}),e.children.add(o),c.items.add(e)}c.items.add(new l.ListSeparatorView(r));const s=new l.MenuBarMenuListItemView(r,a),h=new l.MenuBarMenuListItemButtonView(r);return h.set({label:n("Remove highlight"),icon:o.IconEraser}),h.delegate("execute").to(a),h.on("execute",()=>{t.execute("highlight",{value:null}),t.editing.view.focus()}),s.children.add(h),c.items.add(s),a.panelView.children.add(c),a})}}function w(e){return"marker"===e?o.IconMarker:o.IconPen}class y extends e.Plugin{static get requires(){return[r,b]}static get pluginName(){return"Highlight"}static get isOfficialPlugin(){return!0}}})(),(window.CKEditor5=window.CKEditor5||{}).highlight=i})();
|
|
5
|
+
*/(()=>{var e={163:e=>{"use strict";e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},237:e=>{"use strict";e.exports=CKEditor5.dll},251:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var i=n(792),r=n.n(i),o=n(305),l=n.n(o)()(r());l.push([e.id,":root{--ck-content-highlight-marker-yellow:#fdfd77;--ck-content-highlight-marker-green:#62f962;--ck-content-highlight-marker-pink:#fc7899;--ck-content-highlight-marker-blue:#72ccfd;--ck-content-highlight-pen-red:#e71313;--ck-content-highlight-pen-green:#128a00}.ck-content .marker-yellow{background-color:var(--ck-content-highlight-marker-yellow)}.ck-content .marker-green{background-color:var(--ck-content-highlight-marker-green)}.ck-content .marker-pink{background-color:var(--ck-content-highlight-marker-pink)}.ck-content .marker-blue{background-color:var(--ck-content-highlight-marker-blue)}.ck-content .pen-red{background-color:transparent;color:var(--ck-content-highlight-pen-red)}.ck-content .pen-green{background-color:transparent;color:var(--ck-content-highlight-pen-green)}",""]);const a=l},305:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var n="",i=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),i&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),i&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n}).join("")},t.i=function(e,n,i,r,o){"string"==typeof e&&(e=[[null,e,void 0]]);var l={};if(i)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]);i&&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),n&&(h[2]?(h[1]="@media ".concat(h[2]," {").concat(h[1],"}"),h[2]=n):h[2]=n),r&&(h[4]?(h[1]="@supports (".concat(h[4],") {").concat(h[1],"}"),h[4]=r):h[4]="".concat(r)),t.push(h))}},t}},311:(e,t,n)=>{e.exports=n(237)("./src/ui.js")},355:(e,t,n)=>{e.exports=n(237)("./src/icons.js")},424:e=>{"use strict";var t={};e.exports=function(e,n){var i=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(n)}},517:e=>{"use strict";e.exports=function(e,t){Object.keys(t).forEach(function(n){e.setAttribute(n,t[n])})}},719:e=>{"use strict";var t=[];function n(e){for(var n=-1,i=0;i<t.length;i++)if(t[i].identifier===e){n=i;break}return n}function i(e,i){for(var o={},l=[],a=0;a<e.length;a++){var c=e[a],s=i.base?c[0]+i.base:c[0],h=o[s]||0,u="".concat(s," ").concat(h);o[s]=h+1;var g=n(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,i);i.byIndex=a,t.splice(a,0,{identifier:u,updater:m,references:1})}l.push(u)}return l}function r(e,t){var n=t.domAPI(t);n.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;n.update(e=t)}else n.remove()}}e.exports=function(e,r){var o=i(e=e||[],r=r||{});return function(e){e=e||[];for(var l=0;l<o.length;l++){var a=n(o[l]);t[a].references--}for(var c=i(e,r),s=0;s<o.length;s++){var h=n(o[s]);0===t[h].references&&(t[h].updater(),t.splice(h,1))}o=c}}},782:(e,t,n)=>{e.exports=n(237)("./src/core.js")},792:e=>{"use strict";e.exports=function(e){return e[1]}},863:e=>{"use strict";var t,n=(t=[],function(e,n){return t[e]=n,t.filter(Boolean).join("\n")});function i(e,t,i,r){var o;if(i)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=n(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++,n=r.singleton||(r.singleton=e.insertStyleElement(e));return{update:function(e){i(n,t,!1,e)},remove:function(e){i(n,t,!0,e)}}}}},t={};function n(i){var r=t[i];if(void 0!==r)return r.exports;var o=t[i]={id:i,exports:{}};return e[i](o,o.exports,n),o.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};(()=>{"use strict";n.r(i),n.d(i,{Highlight:()=>y,HighlightCommand:()=>t,HighlightEditing:()=>r,HighlightUI:()=>b});var e=n(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,n=t.document.selection,i=e.value;t.change(e=>{if(n.isCollapsed){const t=n.getFirstPosition();if(n.hasAttribute("highlight")){const n=e=>e.item.hasAttribute("highlight")&&e.item.getAttribute("highlight")===this.value,r=t.getLastMatchingPosition(n,{direction:"backward"}),o=t.getLastMatchingPosition(n),l=e.createRange(r,o);i&&this.value!==i?(t.isEqual(o)||e.setAttribute("highlight",i,l),e.setSelectionAttribute("highlight",i)):(t.isEqual(o)||e.removeAttribute("highlight",l),e.removeSelectionAttribute("highlight"))}else i&&e.setSelectionAttribute("highlight",i)}else{const r=t.schema.getValidRanges(n.getRanges(),"highlight");for(const t of r)i?e.setAttribute("highlight",i,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-content-highlight-marker-yellow)",type:"marker"},{model:"greenMarker",class:"marker-green",title:"Green marker",color:"var(--ck-content-highlight-marker-green)",type:"marker"},{model:"pinkMarker",class:"marker-pink",title:"Pink marker",color:"var(--ck-content-highlight-marker-pink)",type:"marker"},{model:"blueMarker",class:"marker-blue",title:"Blue marker",color:"var(--ck-content-highlight-marker-blue)",type:"marker"},{model:"redPen",class:"pen-red",title:"Red pen",color:"var(--ck-content-highlight-pen-red)",type:"pen"},{model:"greenPen",class:"pen-green",title:"Green pen",color:"var(--ck-content-highlight-pen-green)",type:"pen"}]})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"highlight"});const n=e.config.get("highlight.options");e.conversion.attributeToElement(function(e){const t={model:{key:"highlight",values:[]},view:{}};for(const n of e)t.model.values.push(n.model),t.view[n.model]={name:"mark",classes:n.class};return t}(n)),e.commands.add("highlight",new t(e))}}var o=n(355),l=n(311),a=n(719),c=n.n(a),s=n(863),h=n.n(s),u=n(424),g=n.n(u),d=n(517),m=n.n(d),p=n(163),f=n.n(p),v=n(251),k={attributes:{"data-cke":!0}};k.setAttributes=m(),k.insert=g().bind(null,"head"),k.domAPI=h(),k.insertStyleElement=f();c()(v.A,k);v.A&&v.A.locals&&v.A.locals;class b 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 e=this.editor.t,t=this.editor.commands.get("highlight");this._addButton("removeHighlight",e("Remove highlight"),o.IconEraser,null,e=>{e.bind("isEnabled").to(t,"isEnabled")})}_addHighlighterButton(e){const t=this.editor.commands.get("highlight");this._addButton("highlight:"+e.model,e.title,w(e.type),e.model,function(n){n.bind("isEnabled").to(t,"isEnabled"),n.bind("isOn").to(t,"value",t=>t===e.model),n.iconView.fillColor=e.color,n.isToggleable=!0})}_addButton(e,t,n,i,r){const o=this.editor;o.ui.componentFactory.add(e,e=>{const a=new l.ButtonView(e),c=this.localizedOptionTitles[t]?this.localizedOptionTitles[t]:t;return a.set({label:c,icon:n,tooltip:!0}),a.on("execute",()=>{o.execute("highlight",{value:i}),o.editing.view.focus()}),r(a),a})}_addDropdown(e){const t=this.editor,n=t.t,i=t.ui.componentFactory,r=e[0],o=e.reduce((e,t)=>(e[t.model]=t,e),{});i.add("highlight",a=>{const c=t.commands.get("highlight"),s=(0,l.createDropdown)(a,l.SplitButtonView),h=s.buttonView;h.set({label:n("Highlight"),tooltip:!0,lastExecuted:r.model,commandValue:r.model,isToggleable:!0}),h.bind("icon").to(c,"value",e=>w(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 n=e&&e!==h.lastExecuted?e:h.lastExecuted;return o[n][t]}return s.bind("isEnabled").to(c,"isEnabled"),(0,l.addToolbarToDropdown)(s,()=>{const t=e.map(e=>{const t=i.create("highlight:"+e.model);return this.listenTo(t,"execute",()=>{s.buttonView.set({lastExecuted:e.model})}),t});return t.push(new l.ToolbarSeparatorView),t.push(i.create("removeHighlight")),t},{enableActiveItemFocusOnDropdownOpen:!0,ariaLabel:n("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(e){const t=this.editor,n=t.t,i=t.commands.get("highlight");t.ui.componentFactory.add("menuBar:highlight",r=>{const a=new l.MenuBarMenuView(r);a.buttonView.set({label:n("Highlight"),icon:w("marker")}),a.bind("isEnabled").to(i),a.buttonView.iconView.fillColor="transparent";const c=new l.MenuBarMenuListView(r);for(const n of e){const e=new l.MenuBarMenuListItemView(r,a),o=new l.MenuBarMenuListItemButtonView(r);o.set({label:n.title,icon:w(n.type),role:"menuitemradio",isToggleable:!0}),o.iconView.fillColor=n.color,o.delegate("execute").to(a),o.bind("isOn").to(i,"value",e=>e===n.model),o.on("execute",()=>{t.execute("highlight",{value:n.model}),t.editing.view.focus()}),e.children.add(o),c.items.add(e)}c.items.add(new l.ListSeparatorView(r));const s=new l.MenuBarMenuListItemView(r,a),h=new l.MenuBarMenuListItemButtonView(r);return h.set({label:n("Remove highlight"),icon:o.IconEraser}),h.delegate("execute").to(a),h.on("execute",()=>{t.execute("highlight",{value:null}),t.editing.view.focus()}),s.children.add(h),c.items.add(s),a.panelView.children.add(c),a})}}function w(e){return"marker"===e?o.IconMarker:o.IconPen}class y extends e.Plugin{static get requires(){return[r,b]}static get pluginName(){return"Highlight"}static get isOfficialPlugin(){return!0}}})(),(window.CKEditor5=window.CKEditor5||{}).highlight=i})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-highlight",
|
|
3
|
-
"version": "47.
|
|
3
|
+
"version": "47.3.0-alpha.0",
|
|
4
4
|
"description": "Highlight feature for CKEditor 5.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ckeditor",
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
"type": "module",
|
|
14
14
|
"main": "src/index.js",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@ckeditor/ckeditor5-core": "47.
|
|
17
|
-
"@ckeditor/ckeditor5-icons": "47.
|
|
18
|
-
"@ckeditor/ckeditor5-ui": "47.
|
|
19
|
-
"@ckeditor/ckeditor5-utils": "47.
|
|
20
|
-
"ckeditor5": "47.
|
|
16
|
+
"@ckeditor/ckeditor5-core": "47.3.0-alpha.0",
|
|
17
|
+
"@ckeditor/ckeditor5-icons": "47.3.0-alpha.0",
|
|
18
|
+
"@ckeditor/ckeditor5-ui": "47.3.0-alpha.0",
|
|
19
|
+
"@ckeditor/ckeditor5-utils": "47.3.0-alpha.0",
|
|
20
|
+
"ckeditor5": "47.3.0-alpha.0"
|
|
21
21
|
},
|
|
22
22
|
"author": "CKSource (http://cksource.com/)",
|
|
23
23
|
"license": "SEE LICENSE IN LICENSE.md",
|