@@ -10,7 +10,6 @@ const {
1010 copyMarkdownLink,
1111 chatGPTUrl,
1212 claudeUrl,
13- viewAsMarkdown,
1413 copyOptionsConfig,
1514 showCopyMarkdown,
1615} = useSourceCode ()
@@ -50,7 +49,13 @@ const dropdownOptions = computed(() => {
5049 options .push ({
5150 icon: ' i-tabler:eye' ,
5251 label: ' View as markdown' ,
53- onClick: viewAsMarkdown ,
52+ onClick : () => {
53+ if (typeof window !== ' undefined' ) {
54+ const currentPath = window .location .pathname
55+ const markdownPath = currentPath .replace (/ \. html$ / , ' .md' ).replace (/ \/ $ / , ' /index.md' )
56+ window .open (markdownPath , ' _blank' , ' noopener,noreferrer' )
57+ }
58+ },
5459 })
5560 }
5661
@@ -68,7 +73,7 @@ const dropdownOptions = computed(() => {
6873
6974 if (copyOptionsConfig .value .claude ) {
7075 options .push ({
71- icon: ' i-tabler:sparkles ' ,
76+ icon: ' i-tabler:brand-openai ' ,
7277 label: ' Open in Claude' ,
7378 onClick : () => {
7479 if (typeof window !== ' undefined' ) {
@@ -97,58 +102,78 @@ function toggleExpanded() {
97102 v-for =" (action, index) in allActions"
98103 :key =" index"
99104 flex =" ~ items-center justify-between"
100- p-4
101- cursor-pointer
102- hover:bg-neutral-100
103- rounded-6
104- transition-colors
105- @click =" action.onClick"
105+ relative
106106 >
107- <div flex =" ~ items-center gap-8" f-text-xs text-neutral-800 >
108- <div :class =" action.icon" />
109- <span >{{ action.label }}</span >
110- </div >
111-
112- <button
113- v-if =" index === 0 && hasDropdown"
114- type =" button"
107+ <div
108+ flex =" ~ items-center gap-8"
109+ flex-1
115110 p-4
116- hover:bg-neutral-200
117- rounded-4
111+ cursor-pointer
112+ hover:bg-neutral-100
113+ rounded-6
118114 transition-colors
119- @click.stop =" toggleExpanded"
115+ f-text-xs
116+ text-neutral-800
117+ @click =" action.onClick"
120118 >
121- <div :class =" isExpanded ? 'i-tabler:chevron-up' : 'i-tabler:chevron-down' " />
122- </ button >
123- </div >
119+ <div :class =" action.icon " />
120+ < span >{{ action.label }}</ span >
121+ </div >
124122
125- <Transition
126- enter-active-class =" transition-all duration-200"
127- enter-from-class =" opacity-0 -translate-y-8"
128- enter-to-class =" opacity-100 translate-y-0"
129- leave-active-class =" transition-all duration-200"
130- leave-from-class =" opacity-100 translate-y-0"
131- leave-to-class =" opacity-0 -translate-y-8"
132- >
133- <div v-if =" isExpanded && hasDropdown" flex =" ~ col gap-4" pl-16 >
134- <div
135- v-for =" (option, idx) in dropdownOptions"
136- :key =" idx"
137- flex =" ~ items-center gap-8"
138- p-4
139- cursor-pointer
123+ <div v-if =" index === 0 && hasDropdown" relative >
124+ <button
125+ type =" button"
126+ p-6
140127 hover:bg-neutral-100
141128 rounded-6
142129 transition-colors
143- f-text-xs
144- text-neutral-700
145- @click =" option.onClick"
130+ @click.stop =" toggleExpanded"
146131 >
147- <div :class =" option.icon" />
148- <span >{{ option.label }}</span >
149- </div >
132+ <div i-tabler:dots />
133+ </button >
134+
135+ <Transition
136+ enter-active-class =" transition-all duration-200"
137+ enter-from-class =" opacity-0 scale-95"
138+ enter-to-class =" opacity-100 scale-100"
139+ leave-active-class =" transition-all duration-150"
140+ leave-from-class =" opacity-100 scale-100"
141+ leave-to-class =" opacity-0 scale-95"
142+ >
143+ <div
144+ v-if =" isExpanded"
145+ absolute
146+ right-0
147+ top =" [calc(100%+4px)]"
148+ min-w-200
149+ bg-white
150+ rounded-8
151+ shadow-lg
152+ border =" 1 neutral-200"
153+ z-50
154+ py-4
155+ @click =" isExpanded = false"
156+ >
157+ <div
158+ v-for =" (option, idx) in dropdownOptions"
159+ :key =" idx"
160+ flex =" ~ items-center gap-8"
161+ px-12
162+ py-8
163+ cursor-pointer
164+ hover:bg-neutral-100
165+ transition-colors
166+ f-text-xs
167+ text-neutral-700
168+ @click =" option.onClick"
169+ >
170+ <div :class =" option.icon" />
171+ <span >{{ option.label }}</span >
172+ </div >
173+ </div >
174+ </Transition >
150175 </div >
151- </Transition >
176+ </div >
152177 </div >
153178 </div >
154179</template >
0 commit comments