Skip to content

Commit 16cfa6d

Browse files
committed
Fix pressing the enter key removes heading content
`div` is not an allowed child element of a `hX` tag, this leads to invalid behavior on firefox so we need to use the `span` tag as the NodeView content container. Also using `tabindex=-1` on the NodeView will trigger weird behavior when clicking inside the heading and pressing the enter key. It will split the node but also copy the heading anchor link of the NodeView. Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
1 parent 0e4d145 commit 16cfa6d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/nodes/Heading/HeadingView.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,14 @@
2121
<template>
2222
<NodeViewWrapper :id="node.attrs.id"
2323
ref="container"
24-
:as="domElement"
25-
tabindex="-1">
24+
:as="domElement">
2625
<a aria-hidden="true"
2726
class="heading-anchor"
2827
:href="href"
2928
:title="t('text', 'Link to this section')"
3029
:contenteditable="false"
3130
@click.stop="click">{{ linkSymbol }}</a>
32-
<NodeViewContent />
31+
<NodeViewContent as="span" />
3332
</NodeViewWrapper>
3433
</template>
3534

0 commit comments

Comments
 (0)