Skip to content

Commit 0985395

Browse files
authored
fix(view): updated cut open logic to use attributes instead of classes due to extension update (#628)
1 parent 05fa997 commit 0985395

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/view/hooks/useYfmShowElemWithId/useYfmShowElemWithId.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
import {type RefObject, useEffect} from 'react';
22

33
const YfmCutCN = {
4-
Open: 'open',
54
Cut: 'yfm-cut',
65
} as const;
76

7+
const YfmCutAttrs = {
8+
Open: 'open',
9+
} as const;
10+
811
const YfmTabsCN = {
912
Active: 'active',
1013
Tabs: 'yfm-tabs',
@@ -34,9 +37,9 @@ export function useYfmShowElemWithId(ref: RefObject<HTMLElement>, id: string) {
3437
}, [id]);
3538
}
3639

37-
function openYfmCut({classList}: Element): boolean {
38-
if (classList.contains(YfmCutCN.Cut) && !classList.contains(YfmCutCN.Open)) {
39-
classList.add(YfmCutCN.Open);
40+
function openYfmCut(cutElement: Element): boolean {
41+
if (cutElement.classList.contains(YfmCutCN.Cut) && !cutElement.hasAttribute(YfmCutAttrs.Open)) {
42+
cutElement.setAttribute(YfmCutAttrs.Open, '');
4043
return true;
4144
}
4245
return false;

0 commit comments

Comments
 (0)