From cf5e5a9e2f349a3ca421107e0502028842ea526b Mon Sep 17 00:00:00 2001 From: Marijn Haverbeke Date: Fri, 10 Nov 2023 17:58:38 +0100 Subject: [PATCH] Fix previous patch --- src/draw-selection.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/draw-selection.ts b/src/draw-selection.ts index dc66d47..497bc31 100644 --- a/src/draw-selection.ts +++ b/src/draw-selection.ts @@ -1,4 +1,5 @@ import {EditorSelection, Extension, Facet, combineConfig, Prec, EditorState} from "@codemirror/state" +import {StyleSpec} from "style-mod" import {ViewUpdate, nativeSelectionHidden} from "./extension" import {EditorView} from "./editorview" import {layer, RectangleMarker} from "./layer" @@ -108,11 +109,14 @@ const selectionLayer = layer({ class: "cm-selectionLayer" }) -const themeSpec = { +const themeSpec: {[selector: string]: StyleSpec} = { ".cm-line": { "& ::selection": {backgroundColor: "transparent !important"}, "&::selection": {backgroundColor: "transparent !important"} } } -if (CanHidePrimary) (themeSpec as any)[".cm-content, .cm-line"].caretColor = "transparent !important" +if (CanHidePrimary) { + themeSpec[".cm-line"].caretColor = "transparent !important" + themeSpec[".cm-content"] = {caretColor: "transparent !important"} +} const hideNativeSelection = Prec.highest(EditorView.theme(themeSpec))