Skip to content

Commit 4eaae6d

Browse files
max-nextcloudbackportbot[bot]
authored andcommitted
fix(smart-picker): Add content on next line
Fixes #6871 Signed-off-by: Max <[email protected]>
1 parent cb10911 commit 4eaae6d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/plugins/currentLineMenu.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,12 @@ function menuForCurrentParagraph(editor) {
157157
const { selection } = editor.state
158158
const { textContent } = selection.$anchor.parent
159159
const eol = selection.$anchor.end()
160-
const contentToInsert = textContent.match(/(^| )$/) ? '/' : ' /'
161-
editor.chain()
162-
.focus()
163-
.setTextSelection(eol)
164-
.insertContent(contentToInsert)
165-
.run()
160+
const chain = editor.chain().focus().setTextSelection(eol)
161+
if (textContent.trim() === '') {
162+
chain.insertContent('/').run()
163+
} else {
164+
chain.splitBlock().insertContent('/').run()
165+
}
166166
})
167167
return menu.$el
168168
}

0 commit comments

Comments
 (0)