File tree 1 file changed +14
-2
lines changed
docs/.vitepress/components/demo-block/src
1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -33,8 +33,20 @@ function updateImportPaths(code: string): string {
33
33
magicString .replaceAll (' ../../lib/utils' , ' @/libs/utils' )
34
34
35
35
return magicString .toString ()
36
- }
37
- const { copy, copied } = useClipboard ({ source: decodeURIComponent (props .code ) })
36
+ };
37
+
38
+ const normalizeImportPath = computed (() => {
39
+ try {
40
+ const decodeHighlightedCode = decodeURIComponent (props .code )
41
+ const updatedCode = updateImportPaths (decodeHighlightedCode )
42
+ return updatedCode
43
+ }
44
+ catch (error ) {
45
+ console .error (' Error decoding code:' , error )
46
+ return props .code
47
+ }
48
+ })
49
+ const { copy, copied } = useClipboard ({ source: normalizeImportPath .value })
38
50
const [value, toggle] = useToggle ()
39
51
const refreshKey = ref (0 )
40
52
function handleRefreshComponent() {
You can’t perform that action at this time.
0 commit comments