-
-
Notifications
You must be signed in to change notification settings - Fork 464
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: added placeholder example #1252
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@ezhil56x is attempting to deploy a commit to the TypeCell Team on Vercel. A member of the Team first needs to authorize it. |
This only works for en locales, if your locale is set to french it won't work, how would you handle that depending on the user locale then? |
@Blapi Updated, now the user locale can be set |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, some requests commented, then we should be good
const editor = useCreateBlockNote({ | ||
dictionary: { | ||
...locales[userLocale], | ||
placeholders: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides the default, please also show how you can change the "heading" placeholder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a comment to explain code
// We override the `placeholders` in our dictionary
|
||
export default function App() { | ||
// Set the user locale. | ||
const userLocale = "en"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's change to
// We use the English, default dictionary
const locale = locales["en";]
...locales[userLocale], | ||
placeholders: { | ||
...locales[userLocale].placeholders, | ||
default: placeholder ?? locales[userLocale].placeholders.default, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just pass in "This is a custom placeholder" directly, and remove the placeholder
variable
@@ -0,0 +1,3 @@ | |||
# Placeholder | |||
|
|||
In this example, we pass in a custom placeholder to change the placeholder text of the editor. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this example, we customize the dictionary to pass in custom placeholder texts. This way, we change the text of an empty block (and empty heading block) in the editor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, follow the default template and add a link to relevant docs, same as on https://www.blocknotejs.org/examples/basic/localization
playground/src/examples.gen.tsx
Outdated
"Basic" | ||
] | ||
}, | ||
"title": "Placeholder", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Custom placeholder"
@@ -0,0 +1,3 @@ | |||
# Placeholder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Change placeholder text
ef431a8
to
776cf32
Compare
2024-11-18.10-06-45.mp4@YousefED Updated my PR |
Fixes #1242
/claim #1242
Added an example for placeholder