From a54b2359a1606ead8f708636e945a686f57cfd1d Mon Sep 17 00:00:00 2001 From: Grzegorz Godlewski Date: Fri, 16 Feb 2024 14:04:26 +0100 Subject: [PATCH] Remove breaks around images --- src/odt/postprocess/addEmptyLines.ts | 6 +++--- src/odt/postprocess/addIndentsAndBullets.ts | 3 ++- test/odt_md/issue-435-436.md | 6 ++---- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/odt/postprocess/addEmptyLines.ts b/src/odt/postprocess/addEmptyLines.ts index b6c1f526..7e3a55c3 100644 --- a/src/odt/postprocess/addEmptyLines.ts +++ b/src/odt/postprocess/addEmptyLines.ts @@ -5,7 +5,7 @@ export function addEmptyLines(markdownChunks: MarkdownChunks) { for (let position = 0; position < markdownChunks.length; position++) { const chunk = markdownChunks.chunks[position]; - if (position + 1 < markdownChunks.chunks.length && chunk.isTag && ['/H1', '/H2', '/H3', '/H4', 'IMG/', 'SVG/', '/UL'].indexOf(chunk.tag) > -1) { + if (position + 1 < markdownChunks.chunks.length && chunk.isTag && ['/H1', '/H2', '/H3', '/H4', 'SVG/', '/UL'].indexOf(chunk.tag) > -1) { const nextTag = markdownChunks.chunks[position + 1]; if (!(nextTag.isTag && nextTag.tag === 'BR/') && !(nextTag.isTag && nextTag.tag === '/TD')) { @@ -19,10 +19,10 @@ export function addEmptyLines(markdownChunks: MarkdownChunks) { } } - if (position > 1 && chunk.isTag && ['H1', 'H2', 'H3', 'H4', 'IMG/', 'SVG/', 'UL'].indexOf(chunk.tag) > -1) { + if (position > 1 && chunk.isTag && ['H1', 'H2', 'H3', 'H4', 'SVG/', 'UL'].indexOf(chunk.tag) > -1) { const prevTag = markdownChunks.chunks[position - 1]; if (!(prevTag.isTag && prevTag.tag === 'BR/') && !(prevTag.isTag && prevTag.tag === 'TD')) { - markdownChunks.chunks.splice(position - 1, 0, { + markdownChunks.chunks.splice(position, 0, { isTag: false, mode: 'md', text: '\n', diff --git a/src/odt/postprocess/addIndentsAndBullets.ts b/src/odt/postprocess/addIndentsAndBullets.ts index 16964670..ec375163 100644 --- a/src/odt/postprocess/addIndentsAndBullets.ts +++ b/src/odt/postprocess/addIndentsAndBullets.ts @@ -40,7 +40,8 @@ export function addIndentsAndBullets(markdownChunks: MarkdownChunks) { markdownChunks.chunks.splice(position2, 0, { mode: 'md', isTag: false, - text: prevEmptyLine === 1 ? firstStr : otherStr + text: prevEmptyLine === 1 ? firstStr : otherStr, + comment: 'Indent or bullet' }); prevEmptyLine = 0; position2++; diff --git a/test/odt_md/issue-435-436.md b/test/odt_md/issue-435-436.md index 8e4b356f..026c682b 100644 --- a/test/odt_md/issue-435-436.md +++ b/test/odt_md/issue-435-436.md @@ -6,10 +6,8 @@ Similar to adding a new question, users must have the proper permission to modif 3. Click the ?Show Questions button 4. Locate the question to update and click on the row. - ![](10000001000001AE0000013A3DD8D81D5AC3DDAE.png) +![](10000001000001AE0000013A3DD8D81D5AC3DDAE.png) 5. From here, you may update the Description, the process order, the question code, or the response. 1. You may not change this from one "type" of response (like Text) to another type (like Yes/No). For this type of change, create a new question. - 2. Be sure to click the Submit button at the bottom to save your changes. - - ![](10000001000003C90000010BE8F0122D00285531.png) + 2. Be sure to click the Submit button at the bottom to save your changes.![](10000001000003C90000010BE8F0122D00285531.png)