@diplodoc/cut-extension
Advanced tools
Comparing version 0.2.3 to 0.2.4
{ | ||
"name": "@diplodoc/cut-extension", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"description": "Cut extension for Diplodoc platform", | ||
@@ -5,0 +5,0 @@ "main": "plugin/index.js", |
@@ -5,3 +5,2 @@ export declare class YfmCutController { | ||
destroy(): void; | ||
_focusActiveCut(): void; | ||
private _onDocClick; | ||
@@ -8,0 +7,0 @@ private _findTitleInPath; |
@@ -1,2 +0,2 @@ | ||
"use strict";(()=>{var c="yfm_cut",i={CUT:".yfm .yfm-cut",TITLE:".yfm .yfm-cut-title",CONTENT:".yfm .yfm-cut-content"},C={OPEN:"open"};var o=g=>{let t=g.composedPath();return Array.isArray(t)&&t.length>0?t[0]:g.target},n=g=>{let t=o(g);return!t||!t.matches};var I=class{__doc;constructor(t){this.__doc=t,this.__doc.addEventListener("click",this._onDocClick),this.__doc.addEventListener("DOMContentLoaded",this._focusActiveCut)}destroy(){this.__doc.removeEventListener("click",this._onDocClick)}_focusActiveCut(){let t=window.location.hash.slice(1),e=document.getElementById(t);e instanceof HTMLElement&&e.matches(i.CUT)&&(e.classList.toggle(C.OPEN),e.setAttribute("open","true"),setTimeout(()=>{e.classList.add("cut-highlight"),e.scrollIntoView()},70),setTimeout(()=>{e.classList.remove("cut-highlight")},1e3))}_onDocClick=t=>{if(n(t))return;let e=this._findTitleInPath(t);e&&this._toggleCut(e)};_findTitleInPath(t){let e=o(t);return this._matchTitle(e)?e:t.composedPath?.()?.find(this._matchTitle)}_matchTitle=t=>t instanceof HTMLElement?t?.matches?.(i.TITLE):!1;_toggleCut(t){t.parentElement?.classList.toggle(C.OPEN)}};typeof window<"u"&&typeof document<"u"&&!window[c]&&(window[c]=new I(document));})(); | ||
"use strict";(()=>{var C="yfm_cut",i={CUT:".yfm .yfm-cut",TITLE:".yfm .yfm-cut-title",CONTENT:".yfm .yfm-cut-content"},A={OPEN:"open"};var c=I=>{let t=I.composedPath();return Array.isArray(t)&&t.length>0?t[0]:I.target},o=I=>{let t=c(I);return!t||!t.matches};var e=class{__doc;constructor(t){this.__doc=t,this.__doc.addEventListener("click",this._onDocClick)}destroy(){this.__doc.removeEventListener("click",this._onDocClick)}_onDocClick=t=>{if(o(t))return;let g=this._findTitleInPath(t);g&&this._toggleCut(g)};_findTitleInPath(t){let g=c(t);return this._matchTitle(g)?g:t.composedPath?.()?.find(this._matchTitle)}_matchTitle=t=>t instanceof HTMLElement?t?.matches?.(i.TITLE):!1;_toggleCut(t){t.parentElement?.classList.toggle(A.OPEN)}};typeof window<"u"&&typeof document<"u"&&!window[C]&&(window[C]=new e(document));})(); | ||
//# sourceMappingURL=index.js.map |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
1
36184
310