Skip to content

Commit

Permalink
fix: open suggestion menu on add block click
Browse files Browse the repository at this point in the history
  • Loading branch information
m-risto committed Dec 4, 2024
1 parent 63a38af commit d3f5acc
Showing 1 changed file with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,18 @@ export class BnaAddBlockButtonComponent {
constructor(public ngxBlockNoteService: NgxBlocknoteService) {}

addNewBlock() {
const currentBlock = this.ngxBlockNoteService.editor().getTextCursorPosition().block;
this.ngxBlockNoteService.editor().insertBlocks([{
type: "paragraph",
}], currentBlock, "after");
const editor = this.ngxBlockNoteService.editor();
const currentBlock = editor.getTextCursorPosition().block;
const insertedBlock = editor.insertBlocks(
[
{
type: 'paragraph',
},
],
currentBlock,
'after',
)[0];
editor.setTextCursorPosition(insertedBlock);
editor.openSuggestionMenu('/');
}
}

0 comments on commit d3f5acc

Please sign in to comment.