mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-25 03:06:31 -05:00
fix(editor): fix positions of tag migration lint
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
18e1ab340c
commit
386cf469fd
2 changed files with 7 additions and 7 deletions
|
@ -45,8 +45,8 @@ describe('FrontmatterLinter', () => {
|
|||
testFrontmatterLinter(
|
||||
'---\ntags: a\n---',
|
||||
{
|
||||
from: 5,
|
||||
to: 12,
|
||||
from: 4,
|
||||
to: 11,
|
||||
severity: 'warning'
|
||||
},
|
||||
'tags:\n- a'
|
||||
|
@ -56,8 +56,8 @@ describe('FrontmatterLinter', () => {
|
|||
testFrontmatterLinter(
|
||||
'---\ntags: 1\n---',
|
||||
{
|
||||
from: 5,
|
||||
to: 12,
|
||||
from: 4,
|
||||
to: 11,
|
||||
severity: 'warning'
|
||||
},
|
||||
'tags:\n- 1'
|
||||
|
@ -67,8 +67,8 @@ describe('FrontmatterLinter', () => {
|
|||
testFrontmatterLinter(
|
||||
'---\ntags: 123, a\n---',
|
||||
{
|
||||
from: 5,
|
||||
to: 17,
|
||||
from: 4,
|
||||
to: 16,
|
||||
severity: 'warning'
|
||||
},
|
||||
'tags:\n- 123\n- a'
|
||||
|
|
|
@ -60,7 +60,7 @@ export class FrontmatterLinter implements Linter {
|
|||
const replacedText = 'tags:\n- ' + tags.join('\n- ')
|
||||
const tagsLineIndex = frontmatterLines.findIndex((value) => value.startsWith('tags: '))
|
||||
const linesBeforeTagsLine = frontmatterLines.slice(0, tagsLineIndex)
|
||||
const from = startOfYaml + linesBeforeTagsLine.join('\n').length + 1
|
||||
const from = startOfYaml + linesBeforeTagsLine.join('\n').length + linesBeforeTagsLine.length
|
||||
const to = from + frontmatterLines[tagsLineIndex].length
|
||||
return [
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue