mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-18 17:25:16 -04:00
Replace substr with slice
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
e6ccc0e65e
commit
750a4233d3
4 changed files with 6 additions and 6 deletions
|
@ -32,7 +32,7 @@ export const buildReactDomFromTocAst = (
|
||||||
const content = (
|
const content = (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<ShowIf condition={toc.l > 0}>
|
<ShowIf condition={toc.l > 0}>
|
||||||
<JumpAnchor href={headlineUrl} title={rawName} jumpTargetId={slug.substr(1)}>
|
<JumpAnchor href={headlineUrl} title={rawName} jumpTargetId={slug.slice(1)}>
|
||||||
{rawName}
|
{rawName}
|
||||||
</JumpAnchor>
|
</JumpAnchor>
|
||||||
</ShowIf>
|
</ShowIf>
|
||||||
|
|
|
@ -54,7 +54,7 @@ const languages = {
|
||||||
*/
|
*/
|
||||||
const findLanguageCode = (wantedLanguage: string): string =>
|
const findLanguageCode = (wantedLanguage: string): string =>
|
||||||
Object.keys(languages).find((supportedLanguage) => wantedLanguage === supportedLanguage) ??
|
Object.keys(languages).find((supportedLanguage) => wantedLanguage === supportedLanguage) ??
|
||||||
Object.keys(languages).find((supportedLanguage) => wantedLanguage.substr(0, 2) === supportedLanguage) ??
|
Object.keys(languages).find((supportedLanguage) => wantedLanguage.slice(0, 2) === supportedLanguage) ??
|
||||||
''
|
''
|
||||||
|
|
||||||
export const LanguagePicker: React.FC = () => {
|
export const LanguagePicker: React.FC = () => {
|
||||||
|
|
|
@ -46,8 +46,8 @@ export const parseBlockquoteExtraTag = (
|
||||||
labelEndIndex,
|
labelEndIndex,
|
||||||
valueStartIndex,
|
valueStartIndex,
|
||||||
valueEndIndex,
|
valueEndIndex,
|
||||||
label: line.substr(labelStartIndex, labelEndIndex - labelStartIndex),
|
label: line.slice(labelStartIndex, labelEndIndex),
|
||||||
value: line.substr(valueStartIndex, valueEndIndex - valueStartIndex)
|
value: line.slice(valueStartIndex, valueEndIndex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,10 +26,10 @@ export class AnchorNodePreprocessor extends TravelerNodeProcessor {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const isJumpMark = url.substr(0, 1) === '#'
|
const isJumpMark = url.slice(0, 1) === '#'
|
||||||
|
|
||||||
if (isJumpMark) {
|
if (isJumpMark) {
|
||||||
node.attribs['data-jump-target-id'] = url.substr(1)
|
node.attribs['data-jump-target-id'] = url.slice(1)
|
||||||
} else {
|
} else {
|
||||||
node.attribs.rel = 'noreferer noopener'
|
node.attribs.rel = 'noreferer noopener'
|
||||||
node.attribs.target = '_blank'
|
node.attribs.target = '_blank'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue