We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cb10911 commit 4eaae6dCopy full SHA for 4eaae6d
src/plugins/currentLineMenu.js
@@ -157,12 +157,12 @@ function menuForCurrentParagraph(editor) {
157
const { selection } = editor.state
158
const { textContent } = selection.$anchor.parent
159
const eol = selection.$anchor.end()
160
- const contentToInsert = textContent.match(/(^| )$/) ? '/' : ' /'
161
- editor.chain()
162
- .focus()
163
- .setTextSelection(eol)
164
- .insertContent(contentToInsert)
165
- .run()
+ const chain = editor.chain().focus().setTextSelection(eol)
+ if (textContent.trim() === '') {
+ chain.insertContent('/').run()
+ } else {
+ chain.splitBlock().insertContent('/').run()
+ }
166
})
167
return menu.$el
168
}
0 commit comments