@diplodoc/cut-extension
Advanced tools
Comparing version 0.3.1 to 0.3.2
@@ -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=e=>{let t=e.composedPath();return Array.isArray(t)&&t.length>0?t[0]:e.target},n=e=>{let t=o(e);return!t||!t.matches};var I=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),g=document.getElementById(t);g instanceof HTMLElement&&g.matches(i.CUT)&&(g.classList.toggle(C.OPEN),g.setAttribute("open","true"),setTimeout(()=>{g.classList.add("cut-highlight"),g.scrollIntoView()},70),setTimeout(()=>{g.classList.remove("cut-highlight")},1e3))}_onDocClick=t=>{if(n(t))return;let g=this._findTitleInPath(t);g&&this._toggleCut(g)};_findTitleInPath(t){let g=o(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(C.OPEN)}};typeof window<"u"&&typeof document<"u"&&!window[c]&&(window[c]=new I(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 C=e=>{let t=e.composedPath();return Array.isArray(t)&&t.length>0?t[0]:e.target},n=e=>{let t=C(e);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),g=document.getElementById(t);g instanceof HTMLElement&&g.matches(i.CUT)&&(g.classList.toggle(o.OPEN),g.setAttribute("open","true"),setTimeout(()=>{g.classList.add("cut-highlight"),g.scrollIntoView()},70),setTimeout(()=>{g.classList.remove("cut-highlight")},1e3))}_onDocClick=t=>{if(n(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(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.3.1", | ||
"version": "0.3.2", | ||
"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
38725