File tree Expand file tree Collapse file tree 4 files changed +16
-7
lines changed
pages/workbench/components/enablement-area/EnablementArea/utils Expand file tree Collapse file tree 4 files changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,14 @@ export const MOCK_GUIDES_ITEMS: IEnablementAreaItem[] = [
30
30
args : {
31
31
path : 'quick-guides/working-with-hash.html' ,
32
32
} ,
33
+ } ,
34
+ {
35
+ type : EnablementAreaComponent . InternalLink ,
36
+ id : 'working-with-hash-2' ,
37
+ label : 'Working with HASH' ,
38
+ args : {
39
+ path : '\\quick-guides\\working-with-hash.html' ,
40
+ } ,
33
41
}
34
42
]
35
43
} ,
Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ export const getMarkdownPathByManifest = (
97
97
if ( ! manifestPath || ! manifest ) return pathPrefix
98
98
const path = removeManifestPrefix ( manifestPath )
99
99
const pathToMarkDown = path . replaceAll ( '/' , '.children.' )
100
- const markDownPath = get ( manifest , pathToMarkDown ) ?. args ?. path
100
+ const markDownPath = get ( manifest , pathToMarkDown ) ?. args ?. path ?. replaceAll ( '\\' , '/' )
101
101
102
102
if ( ! markDownPath ) return ''
103
103
@@ -116,7 +116,7 @@ export const getMarkdownPathByManifest = (
116
116
return undefined
117
117
} )
118
118
119
- return pathPrefix + folderPath + ( markDownPath . match ( / ^ ( \/ | \\ ) / ) ? markDownPath : '/' . concat ( markDownPath ) )
119
+ return pathPrefix + folderPath + ( markDownPath . match ( / ^ ( \/ ) / ) ? markDownPath : '/' . concat ( markDownPath ) )
120
120
}
121
121
122
122
export const removeManifestPrefix = ( path ?: string ) : string => path
Original file line number Diff line number Diff line change @@ -147,9 +147,13 @@ const getMarkdownPathByManifestTests = [
147
147
input : [ MOCK_GUIDES_ITEMS , '/quick-guides/0/1' ] ,
148
148
expected : `/123123-123123${ MOCK_GUIDES_ITEMS [ 0 ] ?. children ?. [ 1 ] ?. args ?. path } `
149
149
} ,
150
+ {
151
+ input : [ MOCK_GUIDES_ITEMS , '/quick-guides/0/3' ] ,
152
+ expected : '/quick-guides/working-with-hash.html'
153
+ } ,
150
154
]
151
155
152
- describe ( 'getWBSourcePath ' , ( ) => {
156
+ describe ( 'getMarkdownPathByManifest ' , ( ) => {
153
157
test . each ( getMarkdownPathByManifestTests ) (
154
158
'%j' ,
155
159
( { input, expected } ) => {
Original file line number Diff line number Diff line change @@ -20,10 +20,7 @@ export const getRootStaticPath = (mdPath: string) => {
20
20
}
21
21
22
22
const processAbsolutePath = ( nodeUrl : string , mdPath : string ) => {
23
- // todo: quick fix. find the root cause why path has both '/' and '\'
24
- const normalizedMdPath = mdPath . replaceAll ( '\\' , '/' )
25
- const tutorialRootPath = getRootStaticPath ( normalizedMdPath )
26
-
23
+ const tutorialRootPath = getRootStaticPath ( mdPath )
27
24
return new URL ( tutorialRootPath + nodeUrl , getOriginUrl ( ) ) . toString ( )
28
25
}
29
26
You can’t perform that action at this time.
0 commit comments