@@ -20,15 +20,16 @@ const props = defineProps({
2020
2121const emits = defineEmits ([' spanAll' ])
2222
23- const headingElem = ref (null )
23+ const headingElem = ref < HTMLElement | null > (null ) // get heading DOM
2424
2525/**
2626 *
2727 * heading style mapping
2828 *
2929 */
3030const headingArr = [' h1' , ' h2' , ' h3' , ' h4' , ' h5' , ' h6' ]
31- const headingColorMap = {
31+ // 🚨 maybe should fix this "any" type
32+ const headingColorMap: any = {
3233 h1: ' text-gray-800' ,
3334 h2: ' text-purple-500' ,
3435 h3: ' text-red-500' ,
@@ -37,7 +38,8 @@ const headingColorMap = {
3738 h6: ' text-gray-500'
3839}
3940
40- const headingBtnMap = {
41+ // 🚨 maybe should fix this "any" type
42+ const headingBtnMap: any = {
4143 h1: {
4244 expand: ' text-white bg-gray-500 hover:bg-gray-400 active:bg-gray-500 border-gray-500' ,
4345 collapse: ' text-gray-400 hover:text-gray-500 active:text-white active:bg-gray-500 border-gray-500'
@@ -64,7 +66,8 @@ const headingBtnMap = {
6466 }
6567}
6668
67- const borderColorMap = {
69+ // 🚨 maybe should fix this "any" type
70+ const borderColorMap: any = {
6871 h1: ' border-gray-100' ,
6972 h2: ' border-purple-100' ,
7073 h3: ' border-red-100' ,
@@ -96,10 +99,11 @@ const toggleExpandStateHandler = () => {
9699 */
97100const highlightTitle = ref (false )
98101
99- const activeHeadingId = inject < Ref < string >> (' activeHeadingId' )
100- const setActiveHeadingId = inject <( string ) => void >( ' setActiveHeadingId ' )
102+ const activeHeadingId = inject (' activeHeadingId' ) as Ref < string >
103+ const setActiveHeadingId = inject ( ' setActiveHeadingId ' ) as ( arg0 : string ) => void
101104
102- const highlightColorMap = {
105+ // 🚨 maybe should fix this "any" type
106+ const highlightColorMap: any = {
103107 h1: ' bg-gray-100' ,
104108 h2: ' bg-purple-100' ,
105109 h3: ' bg-red-100' ,
@@ -139,7 +143,7 @@ const setLayoutHandler = (value: 'waterfall' | 'compact' | 'card') => {
139143
140144 if (headingElem .value ) {
141145 nextTick (() => {
142- headingElem .value .scrollIntoView (true )
146+ headingElem .value ? .scrollIntoView (true )
143147 highlightTitle .value = true
144148 const timer = setTimeout (() => {
145149 highlightTitle .value = false
@@ -160,7 +164,7 @@ const toggleLayoutForContent = () => {
160164// compact layout
161165const childrenSpanAllNum = ref (0 )
162166
163- const childrenSpanAllHandler = (state ) => {
167+ const childrenSpanAllHandler = (state : Boolean ) => {
164168 if (state ) {
165169 childrenSpanAllNum .value += 1
166170 } else {
@@ -178,7 +182,7 @@ watch(childrenSpanAllNum, (newNum, oldNum) => {
178182
179183// divide columns
180184const childrenDivideColumns = ref (1 )
181- const divideColumns = inject < Ref < number >> (' divideColumns' )
185+ const divideColumns = inject (' divideColumns' ) as Ref < number >
182186
183187watch (divideColumns , () => {
184188 if (syncChangeColumns .value ) {
@@ -207,7 +211,7 @@ onMounted(() => {
207211 }
208212})
209213
210- const changeChildrenDivideColumns = (event ) => {
214+ const changeChildrenDivideColumns = (event : MouseEvent ) => {
211215 if (event .shiftKey ) {
212216 childrenDivideColumns .value += 1
213217 } else if (event .ctrlKey || event .metaKey ) {
0 commit comments