Fixes miscoloring meta
This commit is contained in:
parent
688985c133
commit
38a95d2382
@ -12,14 +12,30 @@ export function listBulletPlugin() {
|
||||
const widgets: any[] = [];
|
||||
syntaxTree(state).iterate({
|
||||
enter: ({ type, from, to }) => {
|
||||
if (isCursorInRange(state, [from, to])) return;
|
||||
if (type.name === "ListMark") {
|
||||
const listMark = state.sliceDoc(from, to);
|
||||
if (bulletListMarkerRE.test(listMark)) {
|
||||
const dec = Decoration.replace({
|
||||
widget: new ListBulletWidget(listMark),
|
||||
});
|
||||
widgets.push(dec.range(from, to));
|
||||
if (isCursorInRange(state, [from, to])) {
|
||||
// Cursor is in the list mark
|
||||
widgets.push(
|
||||
Decoration.mark({
|
||||
class: "sb-li-cursor",
|
||||
}).range(from, to),
|
||||
);
|
||||
} else {
|
||||
// Cursor is outside the list mark, render as a (silver) bullet
|
||||
const listMark = state.sliceDoc(from, to);
|
||||
if (bulletListMarkerRE.test(listMark)) {
|
||||
const dec = Decoration.replace({
|
||||
widget: new ListBulletWidget(listMark),
|
||||
});
|
||||
widgets.push(dec.range(from, to));
|
||||
} else {
|
||||
// Ordered list, no special rendering
|
||||
widgets.push(
|
||||
Decoration.mark({
|
||||
class: "sb-li-cursor",
|
||||
}).range(from, to),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -206,16 +206,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
/* Color list item this way */
|
||||
.sb-line-li .sb-meta {
|
||||
/* Color list items when the cursor is on it */
|
||||
.sb-li-cursor .sb-meta {
|
||||
color: var(--editor-line-meta-color);
|
||||
}
|
||||
|
||||
/* Then undo other meta */
|
||||
.sb-line-li .sb-meta~.sb-meta {
|
||||
color: var(--editor-meta-color);
|
||||
}
|
||||
|
||||
.sb-table-widget {
|
||||
thead tr {
|
||||
background-color: var(--editor-table-head-background-color);
|
||||
|
Loading…
Reference in New Issue
Block a user