mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
[visual] Only use the first document environment when calculating the preamble (#14343)
GitOrigin-RevId: fc7cb26f2e71bd1142f0269b7b95cacad3cf10a5
This commit is contained in:
parent
06aa92d0fd
commit
c90f4bee62
1 changed files with 8 additions and 2 deletions
|
@ -188,13 +188,19 @@ export const atomicDecorations = (options: Options) => {
|
|||
currentOrdinal = ordinalStack.pop() ?? 0
|
||||
}
|
||||
|
||||
let seenDocumentEnvironment = false
|
||||
|
||||
tree.iterate({
|
||||
enter(nodeRef) {
|
||||
if (nodeRef.node.type.is('Maketitle')) {
|
||||
preamble.to = nodeRef.node.from
|
||||
} else if (nodeRef.node.type.is('DocumentEnvironment')) {
|
||||
preamble.to =
|
||||
nodeRef.node.getChild('Content')?.from ?? nodeRef.node.from
|
||||
// only count the first instance of DocumentEnvironment
|
||||
if (!seenDocumentEnvironment) {
|
||||
preamble.to =
|
||||
nodeRef.node.getChild('Content')?.from ?? nodeRef.node.from
|
||||
seenDocumentEnvironment = true
|
||||
}
|
||||
} else if (nodeRef.node.type.is('Title')) {
|
||||
const node = nodeRef.node.getChild('TextArgument')
|
||||
if (node) {
|
||||
|
|
Loading…
Reference in a new issue