Socket
Socket
Sign inDemoInstall

@ckeditor/ckeditor5-highlight

Package Overview
Dependencies
Maintainers
1
Versions
613
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ckeditor/ckeditor5-highlight - npm Package Compare versions

Comparing version 29.1.0 to 29.2.0

build/translations/ar.js

2

build/highlight.js

@@ -5,2 +5,2 @@ /*!

*/
window.CKEditor5=window.CKEditor5||{},window.CKEditor5.highlight=function(e){var t={};function i(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(n,r,function(t){return e[t]}.bind(null,r));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=6)}([function(e,t,i){e.exports=i(2)("./src/core.js")},function(e,t,i){e.exports=i(2)("./src/ui.js")},function(e,t){e.exports=CKEditor5.dll},function(e,t,i){var n=i(4),r=i(5);"string"==typeof(r=r.__esModule?r.default:r)&&(r=[[e.i,r,""]]);var o={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(r,o);e.exports=r.locals||{}},function(e,t,i){"use strict";var n,r=function(){return void 0===n&&(n=Boolean(window&&document&&document.all&&!window.atob)),n},o=function(){var e={};return function(t){if(void 0===e[t]){var i=document.querySelector(t);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(e){i=null}e[t]=i}return e[t]}}(),l=[];function a(e){for(var t=-1,i=0;i<l.length;i++)if(l[i].identifier===e){t=i;break}return t}function c(e,t){for(var i={},n=[],r=0;r<e.length;r++){var o=e[r],c=t.base?o[0]+t.base:o[0],s=i[c]||0,h="".concat(c," ").concat(s);i[c]=s+1;var d=a(h),u={css:o[1],media:o[2],sourceMap:o[3]};-1!==d?(l[d].references++,l[d].updater(u)):l.push({identifier:h,updater:p(u,t),references:1}),n.push(h)}return n}function s(e){var t=document.createElement("style"),n=e.attributes||{};if(void 0===n.nonce){var r=i.nc;r&&(n.nonce=r)}if(Object.keys(n).forEach((function(e){t.setAttribute(e,n[e])})),"function"==typeof e.insert)e.insert(t);else{var l=o(e.insert||"head");if(!l)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");l.appendChild(t)}return t}var h,d=(h=[],function(e,t){return h[e]=t,h.filter(Boolean).join("\n")});function u(e,t,i,n){var r=i?"":n.media?"@media ".concat(n.media," {").concat(n.css,"}"):n.css;if(e.styleSheet)e.styleSheet.cssText=d(t,r);else{var o=document.createTextNode(r),l=e.childNodes;l[t]&&e.removeChild(l[t]),l.length?e.insertBefore(o,l[t]):e.appendChild(o)}}function g(e,t,i){var n=i.css,r=i.media,o=i.sourceMap;if(r?e.setAttribute("media",r):e.removeAttribute("media"),o&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(o))))," */")),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}var m=null,f=0;function p(e,t){var i,n,r;if(t.singleton){var o=f++;i=m||(m=s(t)),n=u.bind(null,i,o,!1),r=u.bind(null,i,o,!0)}else i=s(t),n=g.bind(null,i,t),r=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(i)};return n(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;n(e=t)}else r()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=r());var i=c(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var n=0;n<i.length;n++){var r=a(i[n]);l[r].references--}for(var o=c(e,t),s=0;s<i.length;s++){var h=a(i[s]);0===l[h].references&&(l[h].updater(),l.splice(h,1))}i=o}}}},function(e,t){e.exports=":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{color:var(--ck-highlight-pen-red);background-color:transparent}.ck-content .pen-green{color:var(--ck-highlight-pen-green);background-color:transparent}"},function(e,t,i){"use strict";i.r(t),i.d(t,"Highlight",(function(){return s})),i.d(t,"HighlightEditing",(function(){return o})),i.d(t,"HighlightUI",(function(){return a}));var n=i(0);class r extends n.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=>{const r=t.schema.getValidRanges(i.getRanges(),"highlight");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?(e.setAttribute("highlight",n,l),e.setSelectionAttribute("highlight",n)):(e.removeAttribute("highlight",l),e.removeSelectionAttribute("highlight"))}else n&&e.setSelectionAttribute("highlight",n)}else for(const t of r)n?e.setAttribute("highlight",n,t):e.removeAttribute("highlight",t)})}}class o extends n.Plugin{static get pluginName(){return"HighlightEditing"}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 t=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}(t)),e.commands.add("highlight",new r(e))}}var l=i(1);i(3);class a extends n.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"}init(){const e=this.editor.config.get("highlight.options");for(const t of e)this._addHighlighterButton(t);this._addRemoveHighlightButton(),this._addDropdown(e)}_addRemoveHighlightButton(){const e=this.editor.t,t=this.editor.commands.get("highlight");this._addButton("removeHighlight",e("Remove highlight"),n.icons.eraser,null,e=>{e.bind("isEnabled").to(t,"isEnabled")})}_addHighlighterButton(e){const t=this.editor.commands.get("highlight");this._addButton("highlight:"+e.model,e.title,c(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 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:i,tooltip:!0}),a.on("execute",()=>{o.execute("highlight",{value:n}),o.editing.view.focus()}),r(a),a})}_addDropdown(e){const t=this.editor,i=t.t,n=t.ui.componentFactory,r=e[0],o=e.reduce((e,t)=>(e[t.model]=t,e),{});n.add("highlight",a=>{const s=t.commands.get("highlight"),h=Object(l.createDropdown)(a,l.SplitButtonView),d=h.buttonView;d.set({tooltip:i("Highlight"),lastExecuted:r.model,commandValue:r.model,isToggleable:!0}),d.bind("icon").to(s,"value",e=>c(g(e,"type"))),d.bind("color").to(s,"value",e=>g(e,"color")),d.bind("commandValue").to(s,"value",e=>g(e,"model")),d.bind("isOn").to(s,"value",e=>!!e),d.delegate("execute").to(h);const u=e.map(e=>{const t=n.create("highlight:"+e.model);return this.listenTo(t,"execute",()=>h.buttonView.set({lastExecuted:e.model})),t});function g(e,t){const i=e&&e!==d.lastExecuted?e:d.lastExecuted;return o[i][t]}return h.bind("isEnabled").toMany(u,"isEnabled",(...e)=>e.some(e=>e)),u.push(new l.ToolbarSeparatorView),u.push(n.create("removeHighlight")),Object(l.addToolbarToDropdown)(h,u),function(e){e.buttonView.actionView.iconView.bind("fillColor").to(e.buttonView,"color")}(h),h.toolbarView.ariaLabel=i("Text highlight toolbar"),d.on("execute",()=>{t.execute("highlight",{value:d.commandValue}),t.editing.view.focus()}),h})}}function c(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 s extends n.Plugin{static get requires(){return[o,a]}static get pluginName(){return"Highlight"}}}]);
!function(e){const t=e.en=e.en||{};t.dictionary=Object.assign(t.dictionary||{},{"Blue marker":"Blue marker","Green marker":"Green marker","Green pen":"Green pen",Highlight:"Highlight","Pink marker":"Pink marker","Red pen":"Red pen","Remove highlight":"Remove highlight","Text highlight toolbar":"Text highlight toolbar","Yellow marker":"Yellow marker"})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={})),window.CKEditor5=window.CKEditor5||{},window.CKEditor5.highlight=function(e){var t={};function i(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(n,r,function(t){return e[t]}.bind(null,r));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=6)}([function(e,t,i){e.exports=i(2)("./src/core.js")},function(e,t,i){e.exports=i(2)("./src/ui.js")},function(e,t){e.exports=CKEditor5.dll},function(e,t,i){var n=i(4),r=i(5);"string"==typeof(r=r.__esModule?r.default:r)&&(r=[[e.i,r,""]]);var o={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(r,o);e.exports=r.locals||{}},function(e,t,i){"use strict";var n,r=function(){return void 0===n&&(n=Boolean(window&&document&&document.all&&!window.atob)),n},o=function(){var e={};return function(t){if(void 0===e[t]){var i=document.querySelector(t);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(e){i=null}e[t]=i}return e[t]}}(),l=[];function a(e){for(var t=-1,i=0;i<l.length;i++)if(l[i].identifier===e){t=i;break}return t}function c(e,t){for(var i={},n=[],r=0;r<e.length;r++){var o=e[r],c=t.base?o[0]+t.base:o[0],s=i[c]||0,h="".concat(c," ").concat(s);i[c]=s+1;var d=a(h),g={css:o[1],media:o[2],sourceMap:o[3]};-1!==d?(l[d].references++,l[d].updater(g)):l.push({identifier:h,updater:f(g,t),references:1}),n.push(h)}return n}function s(e){var t=document.createElement("style"),n=e.attributes||{};if(void 0===n.nonce){var r=i.nc;r&&(n.nonce=r)}if(Object.keys(n).forEach((function(e){t.setAttribute(e,n[e])})),"function"==typeof e.insert)e.insert(t);else{var l=o(e.insert||"head");if(!l)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");l.appendChild(t)}return t}var h,d=(h=[],function(e,t){return h[e]=t,h.filter(Boolean).join("\n")});function g(e,t,i,n){var r=i?"":n.media?"@media ".concat(n.media," {").concat(n.css,"}"):n.css;if(e.styleSheet)e.styleSheet.cssText=d(t,r);else{var o=document.createTextNode(r),l=e.childNodes;l[t]&&e.removeChild(l[t]),l.length?e.insertBefore(o,l[t]):e.appendChild(o)}}function u(e,t,i){var n=i.css,r=i.media,o=i.sourceMap;if(r?e.setAttribute("media",r):e.removeAttribute("media"),o&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(o))))," */")),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}var m=null,p=0;function f(e,t){var i,n,r;if(t.singleton){var o=p++;i=m||(m=s(t)),n=g.bind(null,i,o,!1),r=g.bind(null,i,o,!0)}else i=s(t),n=u.bind(null,i,t),r=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(i)};return n(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;n(e=t)}else r()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=r());var i=c(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var n=0;n<i.length;n++){var r=a(i[n]);l[r].references--}for(var o=c(e,t),s=0;s<i.length;s++){var h=a(i[s]);0===l[h].references&&(l[h].updater(),l.splice(h,1))}i=o}}}},function(e,t){e.exports=":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{color:var(--ck-highlight-pen-red);background-color:transparent}.ck-content .pen-green{color:var(--ck-highlight-pen-green);background-color:transparent}"},function(e,t,i){"use strict";i.r(t),i.d(t,"Highlight",(function(){return s})),i.d(t,"HighlightEditing",(function(){return o})),i.d(t,"HighlightUI",(function(){return a}));var n=i(0);class r extends n.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 o extends n.Plugin{static get pluginName(){return"HighlightEditing"}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 t=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}(t)),e.commands.add("highlight",new r(e))}}var l=i(1);i(3);class a extends n.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"}init(){const e=this.editor.config.get("highlight.options");for(const t of e)this._addHighlighterButton(t);this._addRemoveHighlightButton(),this._addDropdown(e)}_addRemoveHighlightButton(){const e=this.editor.t,t=this.editor.commands.get("highlight");this._addButton("removeHighlight",e("Remove highlight"),n.icons.eraser,null,e=>{e.bind("isEnabled").to(t,"isEnabled")})}_addHighlighterButton(e){const t=this.editor.commands.get("highlight");this._addButton("highlight:"+e.model,e.title,c(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 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:i,tooltip:!0}),a.on("execute",()=>{o.execute("highlight",{value:n}),o.editing.view.focus()}),r(a),a})}_addDropdown(e){const t=this.editor,i=t.t,n=t.ui.componentFactory,r=e[0],o=e.reduce((e,t)=>(e[t.model]=t,e),{});n.add("highlight",a=>{const s=t.commands.get("highlight"),h=Object(l.createDropdown)(a,l.SplitButtonView),d=h.buttonView;d.set({tooltip:i("Highlight"),lastExecuted:r.model,commandValue:r.model,isToggleable:!0}),d.bind("icon").to(s,"value",e=>c(u(e,"type"))),d.bind("color").to(s,"value",e=>u(e,"color")),d.bind("commandValue").to(s,"value",e=>u(e,"model")),d.bind("isOn").to(s,"value",e=>!!e),d.delegate("execute").to(h);const g=e.map(e=>{const t=n.create("highlight:"+e.model);return this.listenTo(t,"execute",()=>h.buttonView.set({lastExecuted:e.model})),t});function u(e,t){const i=e&&e!==d.lastExecuted?e:d.lastExecuted;return o[i][t]}return h.bind("isEnabled").toMany(g,"isEnabled",(...e)=>e.some(e=>e)),g.push(new l.ToolbarSeparatorView),g.push(n.create("removeHighlight")),Object(l.addToolbarToDropdown)(h,g),function(e){e.buttonView.actionView.iconView.bind("fillColor").to(e.buttonView,"color")}(h),h.toolbarView.ariaLabel=i("Text highlight toolbar"),d.on("execute",()=>{t.execute("highlight",{value:d.commandValue}),t.editing.view.focus()}),h})}}function c(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 s extends n.Plugin{static get requires(){return[o,a]}static get pluginName(){return"Highlight"}}}]);
{
"name": "@ckeditor/ckeditor5-highlight",
"version": "29.1.0",
"version": "29.2.0",
"description": "Highlight feature for CKEditor 5.",

@@ -15,18 +15,18 @@ "keywords": [

"dependencies": {
"ckeditor5": "^29.1.0"
"ckeditor5": "^29.2.0"
},
"devDependencies": {
"@ckeditor/ckeditor5-block-quote": "^29.1.0",
"@ckeditor/ckeditor5-core": "^29.1.0",
"@ckeditor/ckeditor5-dev-utils": "^25.3.0",
"@ckeditor/ckeditor5-editor-classic": "^29.1.0",
"@ckeditor/ckeditor5-engine": "^29.1.0",
"@ckeditor/ckeditor5-enter": "^29.1.0",
"@ckeditor/ckeditor5-heading": "^29.1.0",
"@ckeditor/ckeditor5-image": "^29.1.0",
"@ckeditor/ckeditor5-list": "^29.1.0",
"@ckeditor/ckeditor5-paragraph": "^29.1.0",
"@ckeditor/ckeditor5-theme-lark": "^29.1.0",
"@ckeditor/ckeditor5-typing": "^29.1.0",
"@ckeditor/ckeditor5-utils": "^29.1.0",
"@ckeditor/ckeditor5-block-quote": "^29.2.0",
"@ckeditor/ckeditor5-core": "^29.2.0",
"@ckeditor/ckeditor5-dev-utils": "^25.4.0",
"@ckeditor/ckeditor5-editor-classic": "^29.2.0",
"@ckeditor/ckeditor5-engine": "^29.2.0",
"@ckeditor/ckeditor5-enter": "^29.2.0",
"@ckeditor/ckeditor5-heading": "^29.2.0",
"@ckeditor/ckeditor5-image": "^29.2.0",
"@ckeditor/ckeditor5-list": "^29.2.0",
"@ckeditor/ckeditor5-paragraph": "^29.2.0",
"@ckeditor/ckeditor5-theme-lark": "^29.2.0",
"@ckeditor/ckeditor5-typing": "^29.2.0",
"@ckeditor/ckeditor5-utils": "^29.2.0",
"webpack": "^4.43.0",

@@ -33,0 +33,0 @@ "webpack-cli": "^3.3.11"

@@ -60,4 +60,2 @@ /**

model.change( writer => {
const ranges = model.schema.getValidRanges( selection.getRanges(), 'highlight' );
if ( selection.isCollapsed ) {

@@ -81,7 +79,17 @@ const position = selection.getFirstPosition();

// ...remove attribute when passing highlighter different then current or executing "eraser".
writer.removeAttribute( 'highlight', highlightRange );
// If we're at the end of the highlighted range, we don't want to remove highlight of the range.
if ( !position.isEqual( highlightEnd ) ) {
writer.removeAttribute( 'highlight', highlightRange );
}
writer.removeSelectionAttribute( 'highlight' );
} else {
// ...update `highlight` value.
writer.setAttribute( 'highlight', highlighter, highlightRange );
// If we're at the end of the highlighted range, we don't want to change the highlight of the range.
if ( !position.isEqual( highlightEnd ) ) {
writer.setAttribute( 'highlight', highlighter, highlightRange );
}
writer.setSelectionAttribute( 'highlight', highlighter );

@@ -93,2 +101,4 @@ }

} else {
const ranges = model.schema.getValidRanges( selection.getRanges(), 'highlight' );
for ( const range of ranges ) {

@@ -95,0 +105,0 @@ if ( highlighter ) {

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc