Reduce vertical jump for other blocks

This commit is contained in:
Zef Hemel
2022-12-19 12:35:58 +01:00
parent d032672076
commit bb04f30470
6 changed files with 79 additions and 51 deletions
+12
View File
@@ -1,6 +1,7 @@
import { Decoration, EditorState, syntaxTree } from "../deps.ts";
import {
decoratorStateField,
HtmlWidget,
invisibleDecoration,
isCursorInRange,
} from "./util.ts";
@@ -38,6 +39,17 @@ function hideNodes(state: EditorState) {
class: "sb-line-frontmatter-outside",
}).range(node.from),
);
if (parent.from === node.from) {
// Only put this on the first line of the frontmatter
widgets.push(
Decoration.widget({
widget: new HtmlWidget(
`frontmatter`,
"sb-frontmatter-marker",
),
}).range(node.from),
);
}
}
}