mirror of
https://github.com/heyman/heynote.git
synced 2025-06-25 12:01:46 +02:00
Add getActiveNoteBlock function
This commit is contained in:
parent
f53a579614
commit
95328ba739
@ -54,6 +54,12 @@ export const blockState = StateField.define({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
export function getActiveNoteBlock(state) {
|
||||||
|
// find which block the cursor is in
|
||||||
|
const range = state.selection.asSingle().ranges[0]
|
||||||
|
return state.facet(blockState).find(block => block.content.from <= range.from && block.content.to >= range.from)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class NoteBlockStart extends WidgetType {
|
class NoteBlockStart extends WidgetType {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user