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 { 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 {