(lines, presetName, periodKey)
| 4600 | } |
| 4601 | |
| 4602 | function resolveTimelineTarget(lines, presetName, periodKey) { |
| 4603 | const section = resolveTimelineSection(lines, presetName); |
| 4604 | if (!section) return null; |
| 4605 | |
| 4606 | const { sectionStart, sectionEnd, sectionIndent } = section; |
| 4607 | let targetStart = -1; |
| 4608 | |
| 4609 | if (periodKey === 'default') { |
| 4610 | targetStart = findChildKey(lines, sectionStart, sectionEnd, sectionIndent, 'default'); |
| 4611 | } else { |
| 4612 | const periodsLine = findChildKey(lines, sectionStart, sectionEnd, sectionIndent, 'periods'); |
| 4613 | if (periodsLine < 0) return null; |
| 4614 | const periodsIndent = lines[periodsLine].search(/\S/); |
| 4615 | const periodsEnd = findBlockEnd(lines, periodsLine, periodsIndent, sectionEnd); |
| 4616 | targetStart = findChildKey(lines, periodsLine, periodsEnd, periodsIndent, periodKey); |
| 4617 | } |
| 4618 | |
| 4619 | if (targetStart < 0) return null; |
| 4620 | |
| 4621 | const targetIndent = lines[targetStart].search(/\S/); |
| 4622 | const targetEnd = findBlockEnd(lines, targetStart, targetIndent, sectionEnd); |
| 4623 | |
| 4624 | return { sectionStart, sectionEnd, sectionIndent, targetStart, targetEnd, targetIndent }; |
| 4625 | } |
| 4626 | |
| 4627 | function applyTimelineEditorChanges(editor, lines) { |
| 4628 | editor.value = lines.join('\n'); |
no test coverage detected