-
-
Notifications
You must be signed in to change notification settings - Fork 92
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
Node specific placeholders and showOnlyCurrent property #515
Conversation
Hi @awcodes, I was wondering if you might have some time soon to review this PR? This feature would really help with a current project, and I’d prefer to avoid using a forked version if possible. If there’s anything you’d like me to adjust or improve, I’d be more than happy to make those changes. Thanks! |
Hope to get to this review soon. Sorry. Really busy with work at the moment. |
Are you disabling the floating menu? Seems like there would be a conflict with this and also I think that there would need to be changes to the placeholder css to make this work. |
Hi @awcodes, thanks for your feedback!
I've added the missing placeholder CSS to the fork. It's now updated to use the existing placeholder styling. It now works as expected, see the example: 👁️ View example TiptapEditor::make('content')
->customDocument('heading block+')
->nodePlaceholders([
'paragraph' => 'Start writing...',
'heading' => 'A wonderful title',
])
You are right: I disabled floating menu's in my personal project. I now notice the issue as well: if you enter a block that does not have any floating menu items, then it is still shown. This is not caused by this PR, since I can reproduce it on the main branch: Reproduction
I notice the floating menu already contains a |
This looks good. If you can merge in the updates I've done and resolve the conflicts I'll get it merged in. Thanks. |
# Conflicts: # resources/dist/filament-tiptap-editor.js
Thanks @awcodes! I just updated the branch. |
In this PR, I've added two functionalities from the TipTap Placeholder extension.
Node specific placeholders
You can now set placeholders for specific node types. For example: I had a case where I wanted to set a different placeholder to a heading and a paragraph. You can now do that like this:
The code implementation is based on the official example, see the code example here.
Show only current placeholder
I have added the showOnlyCurrent property to TiptapEditor. You can use it like this:
In the example above, all nodes will immediately be displayed, instead of only the selected node.