-
-
Notifications
You must be signed in to change notification settings - Fork 405
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: better drop cursor for crepe (#1378)
* feat: 🎸 better drop cursor for crepe * chore: fix * chore: fix * chore: optimize style
- Loading branch information
1 parent
1ee21e8
commit c2dff9c
Showing
20 changed files
with
282 additions
and
129 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { cursor, dropCursorConfig } from '@milkdown/plugin-cursor' | ||
|
||
import type { DefineFeature } from '../shared' | ||
|
||
interface CursorConfig { | ||
color: string | false | ||
width: number | ||
} | ||
export type CursorFeatureConfig = CursorConfig | ||
|
||
export const defineFeature: DefineFeature<CursorFeatureConfig> = (editor, config) => { | ||
editor | ||
.config((ctx) => { | ||
ctx.update(dropCursorConfig.key, value => ({ | ||
...value, | ||
class: 'crepe-drop-cursor', | ||
width: config?.width ?? 4, | ||
color: config?.color ?? false, | ||
})) | ||
}) | ||
.use(cursor) | ||
} |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
@import "@milkdown/prose/gapcursor/style/gapcurosr.css"; | ||
|
||
.milkdown { | ||
.crepe-drop-cursor { | ||
background-color: color-mix(in srgb, var(--crepe-color-outline), transparent 50%); | ||
opacity: 0.5; | ||
transition: all 0.2s; | ||
pointer-events: none | ||
} | ||
|
||
.ProseMirror-gapcursor:after { | ||
box-sizing: border-box; | ||
border-top: 1px solid var(--crepe-color-on-background); | ||
top: -40px; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.