fix: prevent adding hard breaks in isolated nodes
This commit is contained in:
@@ -57,10 +57,16 @@ export const HardBreak = Node.create<HardBreakOptions>({
|
|||||||
return commands.first([
|
return commands.first([
|
||||||
() => commands.exitCode(),
|
() => commands.exitCode(),
|
||||||
() => commands.command(() => {
|
() => commands.command(() => {
|
||||||
|
const { selection, storedMarks } = state
|
||||||
|
|
||||||
|
if (selection.$from.parent.type.spec.isolating) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
const { keepMarks } = this.options
|
const { keepMarks } = this.options
|
||||||
const { splittableMarks } = editor.extensionManager
|
const { splittableMarks } = editor.extensionManager
|
||||||
const marks = state.storedMarks
|
const marks = storedMarks
|
||||||
|| (state.selection.$to.parentOffset && state.selection.$from.marks())
|
|| (selection.$to.parentOffset && selection.$from.marks())
|
||||||
|
|
||||||
return chain()
|
return chain()
|
||||||
.insertContent({ type: this.name })
|
.insertContent({ type: this.name })
|
||||||
|
|||||||
Reference in New Issue
Block a user