@diplodoc/cut-extension
Advanced tools
Comparing version
@@ -1,2 +0,2 @@ | ||
"use strict";(()=>{var i="yfm_cut",I={CUT:".yfm .yfm-cut",TITLE:".yfm .yfm-cut-title",CONTENT:".yfm .yfm-cut-content"},n={OPEN:"open"};var o=g=>{let t=g.composedPath();return Array.isArray(t)&&t.length>0?t[0]:g.target},l=g=>{let t=o(g);return!t||!t.matches};var c=class{__doc;constructor(t){this.__doc=t,this.__doc.addEventListener("click",this._onDocClick)}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(n.OPEN),e.setAttribute("open","true"),setTimeout(()=>{e.classList.add("cut-highlight"),e.scrollIntoView()},70),setTimeout(()=>{e.classList.remove("cut-highlight")},1e3))}_onDocClick=t=>{if(l(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(n.OPEN)}};typeof window<"u"&&typeof document<"u"&&!window[i]&&(window[i]=new c(document));})(); | ||
"use strict";(()=>{var i="yfm_cut",I={CUT:".yfm .yfm-cut",TITLE:".yfm .yfm-cut-title",CONTENT:".yfm .yfm-cut-content"},o={OPEN:"open"};var n=g=>{let t=g.composedPath();return Array.isArray(t)&&t.length>0?t[0]:g.target},l=g=>{let t=n(g);return!t||!t.matches};var c=class{__doc;constructor(t){this.__doc=t,this.__doc.addEventListener("click",this._onDocClick)}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(o.OPEN),e.setAttribute("open","true"),setTimeout(()=>{e.classList.add("cut-highlight"),e.scrollIntoView()},70),setTimeout(()=>{e.classList.remove("cut-highlight")},1e3))}_onDocClick=t=>{if(l(t))return;let e=this._findTitleInPath(t);e&&this._toggleCut(e)};_findTitleInPath(t){let e=n(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(o.OPEN)}};typeof window<"u"&&typeof document<"u"&&!window[i]&&(window[i]=new c(document));})(); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@diplodoc/cut-extension", | ||
"version": "0.7.2", | ||
"version": "0.7.3", | ||
"description": "Cut extension for Diplodoc platform", | ||
@@ -5,0 +5,0 @@ "main": "build/plugin/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
42687
-0.13%