From d563d57f2721eb21d662b72eaeb9a0c031bf5c73 Mon Sep 17 00:00:00 2001 From: Gleb Voitenko Date: Tue, 3 Sep 2024 12:53:25 +0300 Subject: [PATCH] fix: remove focus from plugin --- src/runtime/controller.ts | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/src/runtime/controller.ts b/src/runtime/controller.ts index 43ebe8c..1e51d9b 100644 --- a/src/runtime/controller.ts +++ b/src/runtime/controller.ts @@ -7,38 +7,12 @@ export class YfmCutController { constructor(doc: Document) { this.__doc = doc; this.__doc.addEventListener('click', this._onDocClick); - this.__doc.addEventListener('DOMContentLoaded', this._focusActiveCut); } destroy() { this.__doc.removeEventListener('click', this._onDocClick); } - _focusActiveCut() { - const cutId = window.location.hash.slice(1); - const cutNode = document.getElementById(cutId) as HTMLDetailsElement | null; - - if (!(cutNode instanceof HTMLElement)) { - return; - } - - if (!cutNode.matches(Selector.CUT)) { - return; - } - - cutNode.classList.toggle(ClassName.OPEN); - cutNode.setAttribute('open', 'true'); - - setTimeout(() => { - cutNode.classList.add('cut-highlight'); - cutNode.scrollIntoView(); - }, 70); - - setTimeout(() => { - cutNode.classList.remove('cut-highlight'); - }, 1_000); - } - private _onDocClick = (event: MouseEvent) => { if (isCustom(event)) { return;