mirror of
https://github.com/docmost/docmost.git
synced 2026-05-07 06:23:06 +08:00
fix: allow deleting last character in headings (#1954)
The copy-link decoration widget (contentEditable="false") injected inside headings prevented browsers from deleting the last remaining character via Backspace or Delete keys. Only show the widget when the heading has more than one character of content.
This commit is contained in:
@@ -20,7 +20,7 @@ export const Heading = TiptapHeading.extend<TiptapHeadingOptions>({
|
||||
const { doc } = state;
|
||||
|
||||
doc.descendants((node, pos) => {
|
||||
if (node.type.name === "heading" && node.content.size > 0) {
|
||||
if (node.type.name === "heading" && node.content.size > 1) {
|
||||
const deco = Decoration.widget(
|
||||
pos + node.nodeSize - 1,
|
||||
() => {
|
||||
|
||||
Reference in New Issue
Block a user