mirror of
https://github.com/heyman/heynote.git
synced 2025-02-25 14:42:10 +01: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 {
|
||||
constructor() {
|
||||
|
Loading…
Reference in New Issue
Block a user