Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: option to disable trailing block #679

Conversation

Kashifwahaj
Copy link
Contributor

@Kashifwahaj Kashifwahaj commented Apr 2, 2024

//Creates a new editor instance.
  const editor = useCreateBlockNote({
    trailingBlock: true,
  });

  // Renders the editor instance using a React component.
  return <BlockNoteView editor={editor} />;

So user need to pass trailingBlock boolean option to enable trailing Node.

/claim #631

Copy link

vercel bot commented Apr 2, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
blocknote ✅ Ready (Inspect) Visit Preview Apr 9, 2024 1:54am

Copy link

vercel bot commented Apr 2, 2024

@Kashifwahaj is attempting to deploy a commit to the TypeCell Team on Vercel.

A member of the Team first needs to authorize it.

@algora-pbc algora-pbc bot mentioned this pull request Apr 2, 2024
1 task
Copy link

algora-pbc bot commented Apr 2, 2024

💵 To receive payouts, sign up on Algora, link your Github account and connect with Stripe/Alipay.

Copy link
Collaborator

@YousefED YousefED left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks!

  • can you make the default true? (inline with current behaviour)
  • can you also update the documentation where the other editor options are explained?

@@ -180,6 +182,8 @@ export class BlockNoteEditor<

public readonly uploadFile: ((file: File) => Promise<string>) | undefined;

public trailingBlock?: boolean = false;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove this member, and just pass the option to getBlockNoteExtensions on line 249, similar to the other options?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's better and resulted in less code. Thanks! 👍

@@ -66,6 +66,8 @@ export class BlockNoteSchema<
* A list of custom Styles that should be available in the editor.
*/
styleSpecs?: SSpecs;

trailingNode?: boolean;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this added here?

Copy link
Contributor Author

@Kashifwahaj Kashifwahaj Apr 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was necessary for the 'typescript' warning, but with getBlockNoteExtensions, it's no longer needed, so I removed it in the new commits.

@Kashifwahaj
Copy link
Contributor Author

Got it, I will make the default value true and update the documentation also , -I am on it.

@Kashifwahaj
Copy link
Contributor Author

Kashifwahaj commented Apr 9, 2024

@YousefED

  • Now, the default behavior is true. Therefore, if a user explicitly passes trailingBlock: false, it will disable the automatic creation of a trailing new block.
  • Updated documentation in /docs/editor-basics/setup#usecreateblocknote-hook to include the explanation of the new option.

Screenshot 2024-04-09 at 7 28 23 AM

Please let me know if any change is needed.

Thanks

@Kashifwahaj
Copy link
Contributor Author

@YousefED Hi, Please Let me know if any improvement or changes required for this PR.

@YousefED YousefED changed the title feat-#631 Extended block options for trailing block, by default I made it false feat: option to disable trailing block May 1, 2024
@YousefED YousefED merged commit 6a9e6b1 into TypeCellOS:main May 1, 2024
4 of 5 checks passed
@YousefED
Copy link
Collaborator

YousefED commented May 1, 2024

Looks good, awesome!

@hampak
Copy link

hampak commented May 3, 2024

Hello, @YousefED

Is #679 going to be released in version 0.12.5?

Thank you for your hard work :)

@hampak
Copy link

hampak commented May 8, 2024

Thank you for this in the latest release :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants