-
-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #168 from riccardoperra/167-broken-editor-autocomp…
…lete-style fix: broken editor autocomplete style #167
- Loading branch information
Showing
10 changed files
with
100 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@codeimage/theme': patch | ||
--- | ||
|
||
fix: add editor auto-complete theme style |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import {EditorView} from '@codemirror/view'; | ||
|
||
interface StyledAutoCompleteOptions { | ||
background: string; | ||
border?: string; | ||
selectedBackground: string; | ||
selectedColor?: string; | ||
} | ||
|
||
export function styledAutocomplete(options: StyledAutoCompleteOptions) { | ||
return EditorView.theme({ | ||
'.cm-tooltip': { | ||
border: options.border ? `1px solid ${options.border}` : 'none', | ||
backgroundColor: options.background, | ||
borderRadius: '6px', | ||
}, | ||
|
||
'.cm-tooltip .cm-tooltip-arrow:before': { | ||
borderTopColor: 'transparent', | ||
borderBottomColor: 'transparent', | ||
}, | ||
'.cm-tooltip .cm-tooltip-arrow:after': { | ||
borderTopColor: options.background, | ||
borderBottomColor: options.background, | ||
}, | ||
|
||
'.cm-tooltip-autocomplete': { | ||
'& > ul > li': { | ||
padding: '6px !important', | ||
}, | ||
'& > ul > li[aria-selected]': { | ||
backgroundColor: options.selectedBackground, | ||
color: options.selectedColor ?? 'inherit', | ||
}, | ||
}, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters