mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-04-11 01:58:46 +00:00
Replace vars
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
7e1f774867
commit
e565a548ee
3 changed files with 7 additions and 18 deletions
|
@ -20,14 +20,11 @@ export const useAdjustedRelativeSplitValue = (
|
|||
relativeSplitValue: number
|
||||
): number =>
|
||||
useMemo(() => {
|
||||
let splitValue: number
|
||||
if (!showLeft && showRight) {
|
||||
splitValue = 0
|
||||
return 0
|
||||
} else if (showLeft && !showRight) {
|
||||
splitValue = 100
|
||||
return 100
|
||||
} else {
|
||||
splitValue = relativeSplitValue
|
||||
return Math.min(100, Math.max(0, relativeSplitValue))
|
||||
}
|
||||
|
||||
return Math.min(100, Math.max(0, splitValue))
|
||||
}, [relativeSplitValue, showLeft, showRight])
|
||||
|
|
|
@ -30,17 +30,9 @@ export class HighlightedCodeReplacer extends ComponentReplacer {
|
|||
const language = codeNode.attribs['data-highlight-language']
|
||||
const extraData = codeNode.attribs['data-extra']
|
||||
const extraInfos = /(=(\d+|\+)?)?(!?)/.exec(extraData)
|
||||
|
||||
let showLineNumbers = false
|
||||
let startLineNumberAttribute = ''
|
||||
let wrapLines = false
|
||||
|
||||
if (extraInfos) {
|
||||
showLineNumbers = extraInfos[1]?.startsWith('=') || false
|
||||
startLineNumberAttribute = extraInfos[2]
|
||||
wrapLines = extraInfos[3] === '!'
|
||||
}
|
||||
|
||||
const showLineNumbers = extraInfos ? extraInfos[1]?.startsWith('=') : false
|
||||
const startLineNumberAttribute = extraInfos?.[2] ?? ''
|
||||
const wrapLines = extraInfos?.[3] === '!'
|
||||
const startLineNumber =
|
||||
startLineNumberAttribute === '+' ? this.lastLineNumber : parseInt(startLineNumberAttribute) || 1
|
||||
|
||||
|
|
|
@ -7,5 +7,5 @@
|
|||
import type { Document } from 'domhandler'
|
||||
|
||||
export abstract class NodeProcessor {
|
||||
public abstract process(nodes: Document): Document
|
||||
public abstract process(document: Document): Document
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue