-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Placeholder.swift
21 lines (20 loc) · 995 Bytes
/
Placeholder.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
open class Placeholder : SyntaxTreeComponent {
public init() {}
public var parentNode: BranchingNode? = nil
public var nodes = ReferenceArray<TreeNode>()
open func getLatex(_ k: KeyboardMemory, _ latexConfiguration: LatexConfiguration) -> String {
if self === k.inclusiveSelectionLeftBorder {
return concatLatex([latexConfiguration.selectionHightlightStart] + nodes.asValueTypeArray.map( { $0.getLatex(k, latexConfiguration) }))
}
else if self === k.current {
if nodes.isEmpty {
return latexConfiguration.activePlaceholderLatex
} else {
return concatLatex([latexConfiguration.activePlaceholderLatex] + nodes.asValueTypeArray.map( { $0.getLatex(k, latexConfiguration) }))
}
} else if nodes.isEmpty {
return latexConfiguration.passivePlaceholderLatex
}
return concatLatex(nodes.asValueTypeArray.map({ $0.getLatex(k, latexConfiguration) }))
}
}