Replace spaces with underscores when setting the hash value and inserting the ID into the DOM. Escape the deep link path when querying for the DOM element on hash change.
This commit is contained in:
@@ -8,6 +8,7 @@ import some from "lodash/some"
|
||||
import eq from "lodash/eq"
|
||||
import { memoizedSampleFromSchema, memoizedCreateXMLExample } from "core/plugins/samples/fn"
|
||||
import win from "./window"
|
||||
import cssEscape from "css.escape"
|
||||
|
||||
const DEFAULT_REPONSE_KEY = "default"
|
||||
|
||||
@@ -651,4 +652,5 @@ export const shallowEqualKeys = (a,b, keys) => {
|
||||
})
|
||||
}
|
||||
|
||||
export const replaceSpacesWithUnderscores = (str) => str.replace(/\s/, "_")
|
||||
export const createDeepLinkPath = (str) => str.replace(/\s/g, "_")
|
||||
export const escapeDeepLinkPath = (str) => cssEscape( createDeepLinkPath(str) )
|
||||
Reference in New Issue
Block a user