From 1756cb4b173aae852629efa7d7ca3f2c3fe01a89 Mon Sep 17 00:00:00 2001 From: alitsov Date: Tue, 28 Nov 2023 02:07:34 +0300 Subject: [PATCH] bugfix: last field content is lost while converting from md window to fields --- src/ts/window_input.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/ts/window_input.ts b/src/ts/window_input.ts index a2cc3ff..56ab60d 100644 --- a/src/ts/window_input.ts +++ b/src/ts/window_input.ts @@ -41,11 +41,9 @@ class WindowEditor { get_html() { if (this[WINDOW_INPUT]?.[WINDOW_MODE] === 'note') { const fields: [title: string, content: string][] = [] - const md = this.editor.cm.state.doc.toString() - for (const match of md.matchAll(/(.*?)^[ \t]*[ \t]*$/gms)) { - if (fields.length) - fields[fields.length - 1][1] = this.converter.markdown_to_html(match[1].trim()) - fields.push([match[2], '']) + const md = this.editor.cm.state.doc.toString() + "" + for (const match of md.matchAll(/(.*?)(?=)/gms)) { + fields.push([match[1].trim(), match[2].trim()]) } return fields }