Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ckeditor/ckeditor5-minimap

Package Overview
Dependencies
Maintainers
1
Versions
672
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ckeditor/ckeditor5-minimap - npm Package Compare versions

Comparing version 33.0.0 to 34.0.0

2

build/minimap.js
/*!
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md.
*/(()=>{var t={544:(t,e,i)=>{"use strict";i.d(e,{Z:()=>r});var n=i(609),o=i.n(n)()((function(t){return t[1]}));o.push([t.id,':root{--ck-color-minimap-tracker-background:208,0%,51%;--ck-color-minimap-iframe-outline:#bfbfbf;--ck-color-minimap-iframe-shadow:hsl(0deg 0% 0%/11%);--ck-color-minimap-progress-background:#666}.ck.ck-minimap{position:absolute;user-select:none;background:var(--ck-color-base-background)}.ck.ck-minimap,.ck.ck-minimap iframe{width:100%;height:100%}.ck.ck-minimap iframe{border:0;pointer-events:none;position:relative;outline:1px solid var(--ck-color-minimap-iframe-outline);box-shadow:0 2px 5px var(--ck-color-minimap-iframe-shadow);margin:0}.ck.ck-minimap .ck.ck-minimap__position-tracker{position:absolute;width:100%;top:0;background:hsla(var(--ck-color-minimap-tracker-background),.2);z-index:1;transition:background .1s ease-in-out}.ck.ck-minimap .ck.ck-minimap__position-tracker:hover{background:hsla(var(--ck-color-minimap-tracker-background),.3)}.ck.ck-minimap .ck.ck-minimap__position-tracker.ck-minimap__position-tracker_dragging,.ck.ck-minimap .ck.ck-minimap__position-tracker.ck-minimap__position-tracker_dragging:hover{background:hsla(var(--ck-color-minimap-tracker-background),.4)}.ck.ck-minimap .ck.ck-minimap__position-tracker.ck-minimap__position-tracker_dragging:after,.ck.ck-minimap .ck.ck-minimap__position-tracker.ck-minimap__position-tracker_dragging:hover:after{opacity:1}.ck.ck-minimap .ck.ck-minimap__position-tracker:after{content:attr(data-progress) "%";position:absolute;top:5px;right:5px;background:var(--ck-color-minimap-progress-background);color:var(--ck-color-base-background);border:1px solid var(--ck-color-base-background);padding:2px 4px;font-size:10px;border-radius:3px;opacity:0;transition:opacity .1s ease-in-out}',""]);const r=o},609:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var i=t(e);return e[2]?"@media ".concat(e[2]," {").concat(i,"}"):i})).join("")},e.i=function(t,i,n){"string"==typeof t&&(t=[[null,t,""]]);var o={};if(n)for(var r=0;r<this.length;r++){var s=this[r][0];null!=s&&(o[s]=!0)}for(var a=0;a<t.length;a++){var c=[].concat(t[a]);n&&o[c[0]]||(i&&(c[2]?c[2]="".concat(i," and ").concat(c[2]):c[2]=i),e.push(c))}},e}},62:(t,e,i)=>{"use strict";var n,o=function(){return void 0===n&&(n=Boolean(window&&document&&document.all&&!window.atob)),n},r=function(){var t={};return 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(t){i=null}t[e]=i}return t[e]}}(),s=[];function a(t){for(var e=-1,i=0;i<s.length;i++)if(s[i].identifier===t){e=i;break}return e}function c(t,e){for(var i={},n=[],o=0;o<t.length;o++){var r=t[o],c=e.base?r[0]+e.base:r[0],l=i[c]||0,h="".concat(c," ").concat(l);i[c]=l+1;var m=a(h),d={css:r[1],media:r[2],sourceMap:r[3]};-1!==m?(s[m].references++,s[m].updater(d)):s.push({identifier:h,updater:f(d,e),references:1}),n.push(h)}return n}function l(t){var e=document.createElement("style"),n=t.attributes||{};if(void 0===n.nonce){var o=i.nc;o&&(n.nonce=o)}if(Object.keys(n).forEach((function(t){e.setAttribute(t,n[t])})),"function"==typeof t.insert)t.insert(e);else{var s=r(t.insert||"head");if(!s)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");s.appendChild(e)}return e}var h,m=(h=[],function(t,e){return h[t]=e,h.filter(Boolean).join("\n")});function d(t,e,i,n){var o=i?"":n.media?"@media ".concat(n.media," {").concat(n.css,"}"):n.css;if(t.styleSheet)t.styleSheet.cssText=m(e,o);else{var r=document.createTextNode(o),s=t.childNodes;s[e]&&t.removeChild(s[e]),s.length?t.insertBefore(r,s[e]):t.appendChild(r)}}function p(t,e,i){var n=i.css,o=i.media,r=i.sourceMap;if(o?t.setAttribute("media",o):t.removeAttribute("media"),r&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(r))))," */")),t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}var u=null,g=0;function f(t,e){var i,n,o;if(e.singleton){var r=g++;i=u||(u=l(e)),n=d.bind(null,i,r,!1),o=d.bind(null,i,r,!0)}else i=l(e),n=p.bind(null,i,e),o=function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(i)};return n(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;n(t=e)}else o()}}t.exports=function(t,e){(e=e||{}).singleton||"boolean"==typeof e.singleton||(e.singleton=o());var i=c(t=t||[],e);return function(t){if(t=t||[],"[object Array]"===Object.prototype.toString.call(t)){for(var n=0;n<i.length;n++){var o=a(i[n]);s[o].references--}for(var r=c(t,e),l=0;l<i.length;l++){var h=a(i[l]);0===s[h].references&&(s[h].updater(),s.splice(h,1))}i=r}}}},704:(t,e,i)=>{t.exports=i(79)("./src/core.js")},492:(t,e,i)=>{t.exports=i(79)("./src/engine.js")},273:(t,e,i)=>{t.exports=i(79)("./src/ui.js")},209:(t,e,i)=>{t.exports=i(79)("./src/utils.js")},79:t=>{"use strict";t.exports=CKEditor5.dll}},e={};function i(n){var o=e[n];if(void 0!==o)return o.exports;var r=e[n]={id:n,exports:{}};return t[n](r,r.exports,i),r.exports}i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e},i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};(()=>{"use strict";i.r(n),i.d(n,{Minimap:()=>b});var t=i(704),e=i(209),o=i(273);const r=(0,e.toUnit)("px");class s extends o.IframeView{constructor(t,e){super(t);const i=this.bindTemplate;this.set("top",0),this.set("height",0),this._options=e,this.extendTemplate({attributes:{class:["ck-minimap__iframe"],style:{top:i.to("top",(t=>r(t))),height:i.to("height",(t=>r(t)))}}})}render(){return super.render().then((()=>{this._prepareDocument()}))}setHeight(t){this.height=t}setTopOffset(t){this.top=t}_prepareDocument(){const t=this.element.contentWindow.document,e=t.adoptNode(this._options.domRootClone),i=this._options.useSimplePreview?"\n\t\t\t.ck.ck-editor__editable_inline img {\n\t\t\t\tfilter: contrast( 0 );\n\t\t\t}\n\n\t\t\tp, li, a, figcaption, span {\n\t\t\t\tbackground: hsl(0, 0%, 80%) !important;\n\t\t\t\tcolor: hsl(0, 0%, 80%) !important;\n\t\t\t}\n\n\t\t\th1, h2, h3, h4 {\n\t\t\t\tbackground: hsl(0, 0%, 60%) !important;\n\t\t\t\tcolor: hsl(0, 0%, 60%) !important;\n\t\t\t}\n\t\t":"",n=`<!DOCTYPE html><html lang="en">\n\t\t\t<head>\n\t\t\t\t<meta charset="utf-8">\n\t\t\t\t<meta name="viewport" content="width=device-width, initial-scale=1">\n\t\t\t\t${this._options.pageStyles.map((t=>"string"==typeof t?`<style>${t}</style>`:`<link rel="stylesheet" type="text/css" href="${t.href}">`)).join("\n")}\n\t\t\t\t<style>\n\t\t\t\t\thtml, body {\n\t\t\t\t\t\tmargin: 0 !important;\n\t\t\t\t\t\tpadding: 0 !important;\n\t\t\t\t\t}\n\n\t\t\t\t\thtml {\n\t\t\t\t\t\toverflow: hidden;\n\t\t\t\t\t}\n\n\t\t\t\t\tbody {\n\t\t\t\t\t\ttransform: scale( ${this._options.scaleRatio} );\n\t\t\t\t\t\ttransform-origin: 0 0;\n\t\t\t\t\t\toverflow: visible;\n\t\t\t\t\t}\n\n\t\t\t\t\t.ck.ck-editor__editable_inline {\n\t\t\t\t\t\tmargin: 0 !important;\n\t\t\t\t\t\tborder-color: transparent !important;\n\t\t\t\t\t\toutline-color: transparent !important;\n\t\t\t\t\t\tbox-shadow: none !important;\n\t\t\t\t\t}\n\n\t\t\t\t\t.ck.ck-content {\n\t\t\t\t\t\tbackground: white;\n\t\t\t\t\t}\n\n\t\t\t\t\t${i}\n\t\t\t\t</style>\n\t\t\t</head>\n\t\t\t<body class="${this._options.extraClasses||""}"></body>\n\t\t</html>`;t.open(),t.write(n),t.close(),t.body.appendChild(e)}}const a=(0,e.toUnit)("px");class c extends o.View{constructor(t){super(t);const e=this.bindTemplate;this.set("height",0),this.set("top",0),this.set("scrollProgress",0),this.set("_isDragging",!1),this.setTemplate({tag:"div",attributes:{class:["ck","ck-minimap__position-tracker",e.if("_isDragging","ck-minimap__position-tracker_dragging")],style:{top:e.to("top",(t=>a(t))),height:e.to("height",(t=>a(t)))},"data-progress":e.to("scrollProgress")},on:{mousedown:e.to((()=>{this._isDragging=!0}))}})}render(){super.render(),this.listenTo(e.global.document,"mousemove",((t,e)=>{this._isDragging&&this.fire("drag",e.movementY)}),{useCapture:!0}),this.listenTo(e.global.document,"mouseup",(()=>{this._isDragging=!1}),{useCapture:!0})}setHeight(t){this.height=t}setTopOffset(t){this.top=t}setScrollProgress(t){this.scrollProgress=t}}class l extends o.View{constructor({locale:t,scaleRatio:e,pageStyles:i,extraClasses:n,useSimplePreview:o,domRootClone:r}){super(t);const a=this.bindTemplate;this._positionTrackerView=new c(t),this._positionTrackerView.delegate("drag").to(this),this._scaleRatio=e,this._minimapIframeView=new s(t,{useSimplePreview:o,pageStyles:i,extraClasses:n,scaleRatio:e,domRootClone:r}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-minimap"]},children:[this._positionTrackerView],on:{click:a.to(this._handleMinimapClick.bind(this)),wheel:a.to(this._handleMinimapMouseWheel.bind(this))}})}destroy(){this._minimapIframeView.destroy(),super.destroy()}get height(){return new e.Rect(this.element).height}get scrollHeight(){return Math.max(0,Math.min(this.height,this._minimapIframeView.height)-this._positionTrackerView.height)}render(){super.render(),this._minimapIframeView.render(),this.element.appendChild(this._minimapIframeView.element)}setContentHeight(t){this._minimapIframeView.setHeight(t*this._scaleRatio)}setScrollProgress(t){const e=this._minimapIframeView,i=this._positionTrackerView;if(e.height<this.height)e.setTopOffset(0),i.setTopOffset((e.height-i.height)*t);else{const n=e.height-this.height;e.setTopOffset(-n*t),i.setTopOffset((this.height-i.height)*t)}i.setScrollProgress(Math.round(100*t))}setPositionTrackerHeight(t){this._positionTrackerView.setHeight(t*this._scaleRatio)}_handleMinimapClick(t){const i=this._positionTrackerView;if(t.target===i.element)return;const n=new e.Rect(i.element),o=(t.clientY-n.top-n.height/2)/this._minimapIframeView.height;this.fire("click",o)}_handleMinimapMouseWheel(t){this.fire("drag",t.deltaY*this._scaleRatio)}}var h=i(492);function m(t,e){const i=t.editing.view.document,n=i.getRoot(e),o=new h.DomConverter(i),r=new h.Renderer(o,i.selection),s=t.editing.view.getDomRoot().cloneNode();return o.bindElements(s,n),r.markToSync("children",n),r.markToSync("attributes",n),n.on("change:children",((t,e)=>r.markToSync("children",e))),n.on("change:attributes",((t,e)=>r.markToSync("attributes",e))),n.on("change:text",((t,e)=>r.markToSync("text",e))),r.render(),t.editing.view.on("render",(()=>r.render())),t.on("destroy",(()=>{o.unbindDomElement(s)})),s}function d(t){return new e.Rect(t===e.global.document.body?e.global.window:t)}function p(t){return t===e.global.document.body?e.global.window:t}var u=i(62),g=i.n(u),f=i(544),k={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};g()(f.Z,k);f.Z.locals;class b extends t.Plugin{static get pluginName(){return"Minimap"}init(){const t=this.editor;this._minimapView=null,this._scrollableRootAncestor=null,this.listenTo(t.ui,"ready",this._onUiReady.bind(this))}destroy(){this._minimapView.destroy(),this._minimapView.element.remove()}_onUiReady(){const t=this.editor,i=this._editingRootElement=t.ui.getEditableElement();this._scrollableRootAncestor=function(t){do{if(!(t=t.parentElement))return null;const i=e.global.window.getComputedStyle(t).overflowY;if("auto"===i||"scroll"===i)break}while("BODY"!=t.tagName);return t}(i),i.ownerDocument.body.contains(i)?(this._initializeMinimapView(),this.listenTo(t.editing.view,"render",(()=>{this._syncMinimapToEditingRootScrollPosition()})),this._syncMinimapToEditingRootScrollPosition()):t.ui.once("update",this._onUiReady.bind(this))}_initializeMinimapView(){const t=this.editor,i=t.locale,n=t.config.get("minimap.useSimplePreview"),o=t.config.get("minimap.container"),r=this._scrollableRootAncestor,s=d(this._editingRootElement).width,a=d(o).width/s,c=this._minimapView=new l({locale:i,scaleRatio:a,pageStyles:Array.from(e.global.document.styleSheets).map((t=>t.href&&!t.href.startsWith(e.global.window.location.origin)?{href:t.href}:Array.from(t.cssRules).filter((t=>!(t instanceof CSSMediaRule))).map((t=>t.cssText)).join(" \n"))),extraClasses:t.config.get("minimap.extraClasses"),useSimplePreview:n,domRootClone:m(t)});c.render(),c.listenTo(e.global.document,"scroll",((t,i)=>{if(r===e.global.document.body){if(i.target!==e.global.document)return}else if(i.target!==r)return;this._syncMinimapToEditingRootScrollPosition()}),{useCapture:!0,usePassive:!0}),c.listenTo(e.global.window,"resize",(()=>{this._syncMinimapToEditingRootScrollPosition()})),c.on("drag",((t,i)=>{let n;n=0===c.scrollHeight?0:i/c.scrollHeight;const o=n*(r.scrollHeight-((s=r)===e.global.document.body?e.global.window.innerHeight:s.clientHeight));var s;p(r).scrollBy(0,Math.round(o))})),c.on("click",((t,e)=>{const i=e*r.scrollHeight;p(r).scrollBy(0,Math.round(i))})),o.appendChild(c.element)}_syncMinimapToEditingRootScrollPosition(){const t=this._editingRootElement,e=this._minimapView;e.setContentHeight(t.offsetHeight);const i=d(t),n=d(this._scrollableRootAncestor);let o;n.contains(i)||i.top>n.top?o=0:(o=(i.top-n.top)/(n.height-i.height),o=Math.max(0,Math.min(o,1))),e.setPositionTrackerHeight(n.getIntersection(i).height),e.setScrollProgress(o)}}})(),(window.CKEditor5=window.CKEditor5||{}).minimap=n})();
*/(()=>{var t={544:(t,e,i)=>{"use strict";i.d(e,{Z:()=>r});var n=i(609),o=i.n(n)()((function(t){return t[1]}));o.push([t.id,':root{--ck-color-minimap-tracker-background:208,0%,51%;--ck-color-minimap-iframe-outline:#bfbfbf;--ck-color-minimap-iframe-shadow:rgba(0,0,0,.11);--ck-color-minimap-progress-background:#666}.ck.ck-minimap{background:var(--ck-color-base-background);position:absolute;user-select:none}.ck.ck-minimap,.ck.ck-minimap iframe{height:100%;width:100%}.ck.ck-minimap iframe{border:0;box-shadow:0 2px 5px var(--ck-color-minimap-iframe-shadow);margin:0;outline:1px solid var(--ck-color-minimap-iframe-outline);pointer-events:none;position:relative}.ck.ck-minimap .ck.ck-minimap__position-tracker{background:hsla(var(--ck-color-minimap-tracker-background),.2);position:absolute;top:0;transition:background .1s ease-in-out;width:100%;z-index:1}.ck.ck-minimap .ck.ck-minimap__position-tracker:hover{background:hsla(var(--ck-color-minimap-tracker-background),.3)}.ck.ck-minimap .ck.ck-minimap__position-tracker.ck-minimap__position-tracker_dragging,.ck.ck-minimap .ck.ck-minimap__position-tracker.ck-minimap__position-tracker_dragging:hover{background:hsla(var(--ck-color-minimap-tracker-background),.4)}.ck.ck-minimap .ck.ck-minimap__position-tracker.ck-minimap__position-tracker_dragging:after,.ck.ck-minimap .ck.ck-minimap__position-tracker.ck-minimap__position-tracker_dragging:hover:after{opacity:1}.ck.ck-minimap .ck.ck-minimap__position-tracker:after{background:var(--ck-color-minimap-progress-background);border:1px solid var(--ck-color-base-background);border-radius:3px;color:var(--ck-color-base-background);content:attr(data-progress) "%";font-size:10px;opacity:0;padding:2px 4px;position:absolute;right:5px;top:5px;transition:opacity .1s ease-in-out}',""]);const r=o},609:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var i=t(e);return e[2]?"@media ".concat(e[2]," {").concat(i,"}"):i})).join("")},e.i=function(t,i,n){"string"==typeof t&&(t=[[null,t,""]]);var o={};if(n)for(var r=0;r<this.length;r++){var s=this[r][0];null!=s&&(o[s]=!0)}for(var a=0;a<t.length;a++){var c=[].concat(t[a]);n&&o[c[0]]||(i&&(c[2]?c[2]="".concat(i," and ").concat(c[2]):c[2]=i),e.push(c))}},e}},62:(t,e,i)=>{"use strict";var n,o=function(){return void 0===n&&(n=Boolean(window&&document&&document.all&&!window.atob)),n},r=function(){var t={};return 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(t){i=null}t[e]=i}return t[e]}}(),s=[];function a(t){for(var e=-1,i=0;i<s.length;i++)if(s[i].identifier===t){e=i;break}return e}function c(t,e){for(var i={},n=[],o=0;o<t.length;o++){var r=t[o],c=e.base?r[0]+e.base:r[0],l=i[c]||0,h="".concat(c," ").concat(l);i[c]=l+1;var m=a(h),d={css:r[1],media:r[2],sourceMap:r[3]};-1!==m?(s[m].references++,s[m].updater(d)):s.push({identifier:h,updater:f(d,e),references:1}),n.push(h)}return n}function l(t){var e=document.createElement("style"),n=t.attributes||{};if(void 0===n.nonce){var o=i.nc;o&&(n.nonce=o)}if(Object.keys(n).forEach((function(t){e.setAttribute(t,n[t])})),"function"==typeof t.insert)t.insert(e);else{var s=r(t.insert||"head");if(!s)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");s.appendChild(e)}return e}var h,m=(h=[],function(t,e){return h[t]=e,h.filter(Boolean).join("\n")});function d(t,e,i,n){var o=i?"":n.media?"@media ".concat(n.media," {").concat(n.css,"}"):n.css;if(t.styleSheet)t.styleSheet.cssText=m(e,o);else{var r=document.createTextNode(o),s=t.childNodes;s[e]&&t.removeChild(s[e]),s.length?t.insertBefore(r,s[e]):t.appendChild(r)}}function p(t,e,i){var n=i.css,o=i.media,r=i.sourceMap;if(o?t.setAttribute("media",o):t.removeAttribute("media"),r&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(r))))," */")),t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}var u=null,g=0;function f(t,e){var i,n,o;if(e.singleton){var r=g++;i=u||(u=l(e)),n=d.bind(null,i,r,!1),o=d.bind(null,i,r,!0)}else i=l(e),n=p.bind(null,i,e),o=function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(i)};return n(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;n(t=e)}else o()}}t.exports=function(t,e){(e=e||{}).singleton||"boolean"==typeof e.singleton||(e.singleton=o());var i=c(t=t||[],e);return function(t){if(t=t||[],"[object Array]"===Object.prototype.toString.call(t)){for(var n=0;n<i.length;n++){var o=a(i[n]);s[o].references--}for(var r=c(t,e),l=0;l<i.length;l++){var h=a(i[l]);0===s[h].references&&(s[h].updater(),s.splice(h,1))}i=r}}}},704:(t,e,i)=>{t.exports=i(79)("./src/core.js")},492:(t,e,i)=>{t.exports=i(79)("./src/engine.js")},273:(t,e,i)=>{t.exports=i(79)("./src/ui.js")},209:(t,e,i)=>{t.exports=i(79)("./src/utils.js")},79:t=>{"use strict";t.exports=CKEditor5.dll}},e={};function i(n){var o=e[n];if(void 0!==o)return o.exports;var r=e[n]={id:n,exports:{}};return t[n](r,r.exports,i),r.exports}i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e},i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};(()=>{"use strict";i.r(n),i.d(n,{Minimap:()=>b});var t=i(704),e=i(209),o=i(273);const r=(0,e.toUnit)("px");class s extends o.IframeView{constructor(t,e){super(t);const i=this.bindTemplate;this.set("top",0),this.set("height",0),this._options=e,this.extendTemplate({attributes:{class:["ck-minimap__iframe"],style:{top:i.to("top",(t=>r(t))),height:i.to("height",(t=>r(t)))}}})}render(){return super.render().then((()=>{this._prepareDocument()}))}setHeight(t){this.height=t}setTopOffset(t){this.top=t}_prepareDocument(){const t=this.element.contentWindow.document,e=t.adoptNode(this._options.domRootClone),i=this._options.useSimplePreview?"\n\t\t\t.ck.ck-editor__editable_inline img {\n\t\t\t\tfilter: contrast( 0 );\n\t\t\t}\n\n\t\t\tp, li, a, figcaption, span {\n\t\t\t\tbackground: hsl(0, 0%, 80%) !important;\n\t\t\t\tcolor: hsl(0, 0%, 80%) !important;\n\t\t\t}\n\n\t\t\th1, h2, h3, h4 {\n\t\t\t\tbackground: hsl(0, 0%, 60%) !important;\n\t\t\t\tcolor: hsl(0, 0%, 60%) !important;\n\t\t\t}\n\t\t":"",n=`<!DOCTYPE html><html lang="en">\n\t\t\t<head>\n\t\t\t\t<meta charset="utf-8">\n\t\t\t\t<meta name="viewport" content="width=device-width, initial-scale=1">\n\t\t\t\t${this._options.pageStyles.map((t=>"string"==typeof t?`<style>${t}</style>`:`<link rel="stylesheet" type="text/css" href="${t.href}">`)).join("\n")}\n\t\t\t\t<style>\n\t\t\t\t\thtml, body {\n\t\t\t\t\t\tmargin: 0 !important;\n\t\t\t\t\t\tpadding: 0 !important;\n\t\t\t\t\t}\n\n\t\t\t\t\thtml {\n\t\t\t\t\t\toverflow: hidden;\n\t\t\t\t\t}\n\n\t\t\t\t\tbody {\n\t\t\t\t\t\ttransform: scale( ${this._options.scaleRatio} );\n\t\t\t\t\t\ttransform-origin: 0 0;\n\t\t\t\t\t\toverflow: visible;\n\t\t\t\t\t}\n\n\t\t\t\t\t.ck.ck-editor__editable_inline {\n\t\t\t\t\t\tmargin: 0 !important;\n\t\t\t\t\t\tborder-color: transparent !important;\n\t\t\t\t\t\toutline-color: transparent !important;\n\t\t\t\t\t\tbox-shadow: none !important;\n\t\t\t\t\t}\n\n\t\t\t\t\t.ck.ck-content {\n\t\t\t\t\t\tbackground: white;\n\t\t\t\t\t}\n\n\t\t\t\t\t${i}\n\t\t\t\t</style>\n\t\t\t</head>\n\t\t\t<body class="${this._options.extraClasses||""}"></body>\n\t\t</html>`;t.open(),t.write(n),t.close(),t.body.appendChild(e)}}const a=(0,e.toUnit)("px");class c extends o.View{constructor(t){super(t);const e=this.bindTemplate;this.set("height",0),this.set("top",0),this.set("scrollProgress",0),this.set("_isDragging",!1),this.setTemplate({tag:"div",attributes:{class:["ck","ck-minimap__position-tracker",e.if("_isDragging","ck-minimap__position-tracker_dragging")],style:{top:e.to("top",(t=>a(t))),height:e.to("height",(t=>a(t)))},"data-progress":e.to("scrollProgress")},on:{mousedown:e.to((()=>{this._isDragging=!0}))}})}render(){super.render(),this.listenTo(e.global.document,"mousemove",((t,e)=>{this._isDragging&&this.fire("drag",e.movementY)}),{useCapture:!0}),this.listenTo(e.global.document,"mouseup",(()=>{this._isDragging=!1}),{useCapture:!0})}setHeight(t){this.height=t}setTopOffset(t){this.top=t}setScrollProgress(t){this.scrollProgress=t}}class l extends o.View{constructor({locale:t,scaleRatio:e,pageStyles:i,extraClasses:n,useSimplePreview:o,domRootClone:r}){super(t);const a=this.bindTemplate;this._positionTrackerView=new c(t),this._positionTrackerView.delegate("drag").to(this),this._scaleRatio=e,this._minimapIframeView=new s(t,{useSimplePreview:o,pageStyles:i,extraClasses:n,scaleRatio:e,domRootClone:r}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-minimap"]},children:[this._positionTrackerView],on:{click:a.to(this._handleMinimapClick.bind(this)),wheel:a.to(this._handleMinimapMouseWheel.bind(this))}})}destroy(){this._minimapIframeView.destroy(),super.destroy()}get height(){return new e.Rect(this.element).height}get scrollHeight(){return Math.max(0,Math.min(this.height,this._minimapIframeView.height)-this._positionTrackerView.height)}render(){super.render(),this._minimapIframeView.render(),this.element.appendChild(this._minimapIframeView.element)}setContentHeight(t){this._minimapIframeView.setHeight(t*this._scaleRatio)}setScrollProgress(t){const e=this._minimapIframeView,i=this._positionTrackerView;if(e.height<this.height)e.setTopOffset(0),i.setTopOffset((e.height-i.height)*t);else{const n=e.height-this.height;e.setTopOffset(-n*t),i.setTopOffset((this.height-i.height)*t)}i.setScrollProgress(Math.round(100*t))}setPositionTrackerHeight(t){this._positionTrackerView.setHeight(t*this._scaleRatio)}_handleMinimapClick(t){const i=this._positionTrackerView;if(t.target===i.element)return;const n=new e.Rect(i.element),o=(t.clientY-n.top-n.height/2)/this._minimapIframeView.height;this.fire("click",o)}_handleMinimapMouseWheel(t){this.fire("drag",t.deltaY*this._scaleRatio)}}var h=i(492);function m(t,e){const i=t.editing.view.document,n=i.getRoot(e),o=new h.DomConverter(i),r=new h.Renderer(o,i.selection),s=t.editing.view.getDomRoot().cloneNode();return o.bindElements(s,n),r.markToSync("children",n),r.markToSync("attributes",n),n.on("change:children",((t,e)=>r.markToSync("children",e))),n.on("change:attributes",((t,e)=>r.markToSync("attributes",e))),n.on("change:text",((t,e)=>r.markToSync("text",e))),r.render(),t.editing.view.on("render",(()=>r.render())),t.on("destroy",(()=>{o.unbindDomElement(s)})),s}function d(t){return new e.Rect(t===e.global.document.body?e.global.window:t)}function p(t){return t===e.global.document.body?e.global.window:t}var u=i(62),g=i.n(u),f=i(544),k={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};g()(f.Z,k);f.Z.locals;class b extends t.Plugin{static get pluginName(){return"Minimap"}init(){const t=this.editor;this._minimapView=null,this._scrollableRootAncestor=null,this.listenTo(t.ui,"ready",this._onUiReady.bind(this))}destroy(){this._minimapView.destroy(),this._minimapView.element.remove()}_onUiReady(){const t=this.editor,i=this._editingRootElement=t.ui.getEditableElement();this._scrollableRootAncestor=function(t){do{if(!(t=t.parentElement))return null;const i=e.global.window.getComputedStyle(t).overflowY;if("auto"===i||"scroll"===i)break}while("BODY"!=t.tagName);return t}(i),i.ownerDocument.body.contains(i)?(this._initializeMinimapView(),this.listenTo(t.editing.view,"render",(()=>{this._syncMinimapToEditingRootScrollPosition()})),this._syncMinimapToEditingRootScrollPosition()):t.ui.once("update",this._onUiReady.bind(this))}_initializeMinimapView(){const t=this.editor,i=t.locale,n=t.config.get("minimap.useSimplePreview"),o=t.config.get("minimap.container"),r=this._scrollableRootAncestor,s=d(this._editingRootElement).width,a=d(o).width/s,c=this._minimapView=new l({locale:i,scaleRatio:a,pageStyles:Array.from(e.global.document.styleSheets).map((t=>t.href&&!t.href.startsWith(e.global.window.location.origin)?{href:t.href}:Array.from(t.cssRules).filter((t=>!(t instanceof CSSMediaRule))).map((t=>t.cssText)).join(" \n"))),extraClasses:t.config.get("minimap.extraClasses"),useSimplePreview:n,domRootClone:m(t)});c.render(),c.listenTo(e.global.document,"scroll",((t,i)=>{if(r===e.global.document.body){if(i.target!==e.global.document)return}else if(i.target!==r)return;this._syncMinimapToEditingRootScrollPosition()}),{useCapture:!0,usePassive:!0}),c.listenTo(e.global.window,"resize",(()=>{this._syncMinimapToEditingRootScrollPosition()})),c.on("drag",((t,i)=>{let n;n=0===c.scrollHeight?0:i/c.scrollHeight;const o=n*(r.scrollHeight-((s=r)===e.global.document.body?e.global.window.innerHeight:s.clientHeight));var s;p(r).scrollBy(0,Math.round(o))})),c.on("click",((t,e)=>{const i=e*r.scrollHeight;p(r).scrollBy(0,Math.round(i))})),o.appendChild(c.element)}_syncMinimapToEditingRootScrollPosition(){const t=this._editingRootElement,e=this._minimapView;e.setContentHeight(t.offsetHeight);const i=d(t),n=d(this._scrollableRootAncestor);let o;n.contains(i)||i.top>n.top?o=0:(o=(i.top-n.top)/(n.height-i.height),o=Math.max(0,Math.min(o,1))),e.setPositionTrackerHeight(n.getIntersection(i).height),e.setScrollProgress(o)}}})(),(window.CKEditor5=window.CKEditor5||{}).minimap=n})();
{
"name": "@ckeditor/ckeditor5-minimap",
"version": "33.0.0",
"version": "34.0.0",
"description": "Content minimap feature for CKEditor 5.",

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

"dependencies": {
"ckeditor5": "^33.0.0"
"ckeditor5": "^34.0.0"
},
"devDependencies": {
"@ckeditor/ckeditor5-alignment": "^33.0.0",
"@ckeditor/ckeditor5-basic-styles": "^33.0.0",
"@ckeditor/ckeditor5-cloud-services": "^33.0.0",
"@ckeditor/ckeditor5-code-block": "^33.0.0",
"@ckeditor/ckeditor5-core": "^33.0.0",
"@ckeditor/ckeditor5-dev-utils": "^28.0.1",
"@ckeditor/ckeditor5-easy-image": "^33.0.0",
"@ckeditor/ckeditor5-editor-decoupled": "^33.0.0",
"@ckeditor/ckeditor5-font": "^33.0.0",
"@ckeditor/ckeditor5-image": "^33.0.0",
"@ckeditor/ckeditor5-indent": "^33.0.0",
"@ckeditor/ckeditor5-page-break": "^33.0.0",
"@ckeditor/ckeditor5-table": "^33.0.0",
"@ckeditor/ckeditor5-theme-lark": "^33.0.0",
"@ckeditor/ckeditor5-alignment": "^34.0.0",
"@ckeditor/ckeditor5-basic-styles": "^34.0.0",
"@ckeditor/ckeditor5-cloud-services": "^34.0.0",
"@ckeditor/ckeditor5-code-block": "^34.0.0",
"@ckeditor/ckeditor5-core": "^34.0.0",
"@ckeditor/ckeditor5-dev-utils": "^30.0.0",
"@ckeditor/ckeditor5-easy-image": "^34.0.0",
"@ckeditor/ckeditor5-editor-decoupled": "^34.0.0",
"@ckeditor/ckeditor5-font": "^34.0.0",
"@ckeditor/ckeditor5-image": "^34.0.0",
"@ckeditor/ckeditor5-indent": "^34.0.0",
"@ckeditor/ckeditor5-page-break": "^34.0.0",
"@ckeditor/ckeditor5-table": "^34.0.0",
"@ckeditor/ckeditor5-theme-lark": "^34.0.0",
"webpack": "^5.58.1",

@@ -34,0 +34,0 @@ "webpack-cli": "^4.9.0"

@@ -6,3 +6,4 @@ CKEditor 5 Minimap Feature

[![Coverage Status](https://coveralls.io/repos/github/ckeditor/ckeditor5/badge.svg?branch=master)](https://coveralls.io/github/ckeditor/ckeditor5?branch=master)
[![Build Status](https://travis-ci.com/ckeditor/ckeditor5.svg?branch=master)](https://travis-ci.com/ckeditor/ckeditor5)
[![Build Status](https://travis-ci.com/ckeditor/ckeditor5.svg?branch=master)](https://app.travis-ci.com/github/ckeditor/ckeditor5)
![Dependency Status](https://img.shields.io/librariesio/release/npm/@ckeditor/ckeditor5-minimap)

@@ -9,0 +10,0 @@ This package implements the content minimap feature for CKEditor 5.

Sorry, the diff of this file is not supported yet

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