@diplodoc/cut-extension
Advanced tools
Comparing version 0.2.6-beta4 to 0.3.0
@@ -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},A=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(A(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 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));})(); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@diplodoc/cut-extension", | ||
"version": "0.2.6-beta4", | ||
"version": "0.3.0", | ||
"description": "Cut extension for Diplodoc platform", | ||
@@ -48,3 +48,3 @@ "main": "build/plugin/index.js", | ||
"devDependencies": { | ||
"@diplodoc/lint": "^1.1.3", | ||
"@diplodoc/lint": "^1.2.0", | ||
"@diplodoc/tsconfig": "^1.0.2", | ||
@@ -51,0 +51,0 @@ "@types/markdown-it": "^13.0.9", |
Sorry, the diff of this file is not supported yet
38759