Skip to content

Commit

Permalink
Fix previous patch
Browse files Browse the repository at this point in the history
  • Loading branch information
marijnh committed Nov 10, 2023
1 parent df237c8 commit cf5e5a9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/draw-selection.ts
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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))

0 comments on commit cf5e5a9

Please sign in to comment.