From 9a599ef1e5746d62854dea5fffd666948d87845d Mon Sep 17 00:00:00 2001 From: dragonish Date: Fri, 14 Mar 2025 13:23:53 +0800 Subject: [PATCH] fix(editing): fix last line in editing view not rendered --- components/view.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/view.ts b/components/view.ts index 18aa2b0..c5dbd01 100644 --- a/components/view.ts +++ b/components/view.ts @@ -117,12 +117,12 @@ export class HeadingViewPlugin implements PluginValue { if (ordered && orderedIgnoreSingle) { const queier = new Querier(orderedAllowZeroLevel); const heading = new Heading(); - for (let lineIndex = 1; lineIndex < doc.lines; lineIndex++) { + for (let lineIndex = 1; lineIndex <= doc.lines; lineIndex++) { const line = doc.line(lineIndex); const lineText = line.text; const nextLineIndex = lineIndex + 1; const nextLineText = - nextLineIndex < doc.lines ? doc.line(nextLineIndex).text : ""; + nextLineIndex <= doc.lines ? doc.line(nextLineIndex).text : ""; const level = heading.handler(lineIndex, lineText, nextLineText); if (level === -1) { continue; @@ -147,12 +147,12 @@ export class HeadingViewPlugin implements PluginValue { }); const heading = new Heading(); - for (let lineIndex = 1; lineIndex < doc.lines; lineIndex++) { + for (let lineIndex = 1; lineIndex <= doc.lines; lineIndex++) { const line = doc.line(lineIndex); const lineText = line.text; const nextLineIndex = lineIndex + 1; const nextLineText = - nextLineIndex < doc.lines ? doc.line(nextLineIndex).text : ""; + nextLineIndex <= doc.lines ? doc.line(nextLineIndex).text : ""; const level = heading.handler(lineIndex, lineText, nextLineText); if (level === -1) { continue;