mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-25 11:16: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(
|
testFrontmatterLinter(
|
||||||
'---\ntags: a\n---',
|
'---\ntags: a\n---',
|
||||||
{
|
{
|
||||||
from: 5,
|
from: 4,
|
||||||
to: 12,
|
to: 11,
|
||||||
severity: 'warning'
|
severity: 'warning'
|
||||||
},
|
},
|
||||||
'tags:\n- a'
|
'tags:\n- a'
|
||||||
|
@ -56,8 +56,8 @@ describe('FrontmatterLinter', () => {
|
||||||
testFrontmatterLinter(
|
testFrontmatterLinter(
|
||||||
'---\ntags: 1\n---',
|
'---\ntags: 1\n---',
|
||||||
{
|
{
|
||||||
from: 5,
|
from: 4,
|
||||||
to: 12,
|
to: 11,
|
||||||
severity: 'warning'
|
severity: 'warning'
|
||||||
},
|
},
|
||||||
'tags:\n- 1'
|
'tags:\n- 1'
|
||||||
|
@ -67,8 +67,8 @@ describe('FrontmatterLinter', () => {
|
||||||
testFrontmatterLinter(
|
testFrontmatterLinter(
|
||||||
'---\ntags: 123, a\n---',
|
'---\ntags: 123, a\n---',
|
||||||
{
|
{
|
||||||
from: 5,
|
from: 4,
|
||||||
to: 17,
|
to: 16,
|
||||||
severity: 'warning'
|
severity: 'warning'
|
||||||
},
|
},
|
||||||
'tags:\n- 123\n- a'
|
'tags:\n- 123\n- a'
|
||||||
|
|
|
@ -60,7 +60,7 @@ export class FrontmatterLinter implements Linter {
|
||||||
const replacedText = 'tags:\n- ' + tags.join('\n- ')
|
const replacedText = 'tags:\n- ' + tags.join('\n- ')
|
||||||
const tagsLineIndex = frontmatterLines.findIndex((value) => value.startsWith('tags: '))
|
const tagsLineIndex = frontmatterLines.findIndex((value) => value.startsWith('tags: '))
|
||||||
const linesBeforeTagsLine = frontmatterLines.slice(0, tagsLineIndex)
|
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
|
const to = from + frontmatterLines[tagsLineIndex].length
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue