From 43890c9680f90409e538a5e00569bcf5b215a737 Mon Sep 17 00:00:00 2001 From: Jonas Date: Thu, 5 Nov 2026 09:48:21 +0100 Subject: [PATCH 1/2] fix(gapcursor): visibility in dark mode and padding Make sure the gap cursor is visible in dark mode and fix its padding so the content doesn't jump when gap cursor is displayed. Signed-off-by: Jonas Assisted-by: ClaudeCode:claude-opus-5-5 --- src/css/prosemirror.scss | 8 +++++++- src/css/style.scss | 24 ++++-------------------- 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/src/css/prosemirror.scss b/src/css/prosemirror.scss index 1fdad505fb2..9dc743e1ad2 100644 --- a/src/css/prosemirror.scss +++ b/src/css/prosemirror.scss @@ -86,10 +86,16 @@ div.ProseMirror { } } - > *:first-child { + // Widgets such as the gap cursor don't take space, so make sure the top margin + // goes into the first real node. + > *:nth-child(1 of :not(:where(.ProseMirror-widget))) { margin-top: 10px; } + > .ProseMirror-gapcursor:first-child::after { + top: 8px; + } + > h1, h2, h3, diff --git a/src/css/style.scss b/src/css/style.scss index b58844f09ea..cc6b87d54f6 100644 --- a/src/css/style.scss +++ b/src/css/style.scss @@ -46,26 +46,10 @@ li.ProseMirror-selectednode { } } -.ProseMirror-gapcursor { - display: none; - pointer-events: none; - position: absolute; - - &:after { - content: ''; - display: block; - position: absolute; - top: -2px; - width: 20px; - border-top: 1px solid var(--color-main-text); - animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite; - } -} - -@keyframes ProseMirror-cursor-blink { - to { - visibility: hidden; - } +// Tiptap injects its own gap cursor stylesheet (black cursor) after ours, +// so the theme colour needs a more specific selector to win. +.ProseMirror .ProseMirror-gapcursor:after { + border-top-color: var(--color-main-text); } .animation-rotate { From 8bd72d64f64b8fdb1f9dcbeac6a51cfc2e56b72f Mon Sep 17 00:00:00 2001 From: Jonas Date: Thu, 5 Nov 2026 10:29:25 +0100 Subject: [PATCH 2/2] fix(gapcursor): fix gap cursor between block nodes The gap cursor plugin accepts a position only if the parent's content match at that index has a textblock as its default type. A we set `block+ comments? footnotes?` as content for the Document node, the content match after first block lists footnotes first. Therefore we have to explicitely allow gapcursor for the Documents node. Also leave a gap before tables for the gap cursor so it's possible to navigate the cursor between two tables with the mouse. Signed-off-by: Jonas Assisted-by: ClaudeCode:claude-opus-5-5 --- src/extensions/RichText.ts | 4 ++++ src/nodes/Table/TableView.vue | 3 +++ src/tests/extensions/Gapcursor.spec.ts | 33 ++++++++++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 src/tests/extensions/Gapcursor.spec.ts diff --git a/src/extensions/RichText.ts b/src/extensions/RichText.ts index ab643e5dc61..58a64898dbb 100644 --- a/src/extensions/RichText.ts +++ b/src/extensions/RichText.ts @@ -91,6 +91,10 @@ export default Extension.create({ Markdown, Document.extend({ content: 'block+ comments? footnotes?', + // The trailing `comments`/`footnotes` make `footnotes` the default + // type after the first block, so without this override the gap + // cursor's textblock check rejects every position but the start. + allowGapCursor: true, }), Text, Paragraph, diff --git a/src/nodes/Table/TableView.vue b/src/nodes/Table/TableView.vue index fe826b9f475..12fbf339614 100644 --- a/src/nodes/Table/TableView.vue +++ b/src/nodes/Table/TableView.vue @@ -145,6 +145,9 @@ export default {