Feature Request: How about adding a placeholder
attribute to the suggestion plugin?
#5811
guanriyue
started this conversation in
Feature Requests
Replies: 1 comment
-
Agree this is super useful and important for making the search discoverable! I implemented this using placeholder styling as well. My workaround was to set a data-show-suggestion-placeholder attribute with the correct value on the closest .tiptap element in onBeforeStart and onBeforeUpdate. Obviously this solution only works well if you only have one suggestion at a time. Hope this helps someone.
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Description
Before using the placeholder.
2024-11-07.16.13.37.mov
After that, it looks like this.
2024-11-07.16.17.09.mov
After activating the suggestion menu, a placeholder text appears to provide a hint for the user.
This is just a simple implementation of mine, using a pseudo-element. However, it has a drawback: when the placeholder text is long and the input position is towards the end of the current line, the placeholder wraps to the next line, which misaligns the popup's position from what’s expected.
Simply modify this part of the code as follows.
tiptap/packages/suggestion/src/suggestion.ts
Lines 373 to 387 in 8837156
And add a bit of styling too.
Perhaps we could implement it in a better way.
Use Case
For a more user-friendly interaction.
Type
New feature
Beta Was this translation helpful? Give feedback.
All reactions