Update GetAnchorUrl in SPService.ts
Solve issue: https://github.com/pnp/sp-dev-fx-webparts/issues/3686 fix GetAnchorUrl so it creates correct anchorlink that has a + symbol in the heading.
This commit is contained in:
parent
089162f740
commit
6c7ce5883a
|
@ -15,10 +15,11 @@ export class SPService {
|
|||
private static GetAnchorUrl(headingValue: string): string {
|
||||
let anchorUrl = `#${headingValue
|
||||
.toLowerCase()
|
||||
.replace(/[{}|\[\]\<\>#@"'^%`?;:\/=~\\\s\s+]/g, " ")
|
||||
.replace(/[{}|\[\]\<\>#@"'^%`?;:\/=~\\\s\s]/g, " ")
|
||||
.replace(/^(-|\s)*|(-|\s)*$/g, "")
|
||||
.replace(/\'|\?|\\|\/| |\&/g, "-")
|
||||
.replace(/-+/g, "-")
|
||||
.replace(/[+]/g, "%2B") // https://github.com/pnp/sp-dev-fx-webparts/issues/3686
|
||||
.substring(0, 128)}`;
|
||||
|
||||
let counter = 1;
|
||||
|
@ -110,4 +111,4 @@ export class SPService {
|
|||
|
||||
return anchorLinks;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue