@diplodoc/cut-extension
Advanced tools
Comparing version 0.6.0 to 0.6.1
@@ -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"},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));})(); | ||
"use strict";(()=>{var c="yfm_cut",i={CUT:".yfm .yfm-cut",TITLE:".yfm .yfm-cut-title",CONTENT:".yfm .yfm-cut-content"},n={OPEN:"open"};var C=g=>{let t=g.composedPath();return Array.isArray(t)&&t.length>0?t[0]:g.target},o=g=>{let t=C(g);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),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(o(t))return;let e=this._findTitleInPath(t);e&&this._toggleCut(e)};_findTitleInPath(t){let e=C(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[c]&&(window[c]=new I(document));})(); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@diplodoc/cut-extension", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"description": "Cut extension for Diplodoc platform", | ||
@@ -65,4 +65,4 @@ "main": "build/plugin/index.js", | ||
"peerDependencies": { | ||
"react": "^16.8.0 || ^17.0.0 || ^18.0.0" | ||
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
43347