-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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(react-slate): Ability to add multiple placeholders. #4187
Conversation
- Now previews can be any of ReactNode or ReactNodeArray - Leaf component is fully refactored, no effects used anymore, just straight render. - Preview styling moved to `DefaultLeaf` component so users now able to change it on their need via `Editable.renderLeaf`. - `Editable` component has proper typing now. BREAKING CHANGE: anyone using `Editable.renderLeaf` and not calling `DefaultLeaf` on placeholder leaves wont have placeholder displayed. Sadly this is the only way to allow placeholder customisation.
Each of them will create own empty space and will be hidden separately when it's empty place filled. Also, instead of adding new line having placeholder ahead editor will simply switch to next empty space.
🦋 Changeset detectedLatest commit: af331fb The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@ianstormtaylor current placeholder will disappead at the moment first character entered. Thus no, it cant be achieved with renderer. |
@xobotyi I believe your case could instead be solved by handling the placeholder logic at the block level? One for the heading and one for the paragraph like with the Forced Layout example? |
@ianstormtaylor and no again, at block level i wont be able to gain access to keypress handlers to move between placholders by pressing enter. |
@xobotyi I'm not sure I understand what you mean by splitting the block. But since placeholders internally are implemented with decorations, I believe you could implement a similar behavior in userland with special decoration logic for your two nodes. |
@ianstormtaylor when enter pressed - handler calls |
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.
@xobotyi unfortunately this one has fallen a bit behind main.
If you're still interested in landing this, please update against the latest and then I'll review. Apologies that this PR was ignored after your last comment.
Closing this one out due to inactivity and it being stale. Feel free to reopen or create a new PR if I missed something here. Thanks! |
Description
As for my case i had a need to add multiple placeholders for a single editable, that are hidden separately as content fills.
Example
Above example has such
placeholder
property:Checks
yarn test
.yarn lint
. (Fix errors withyarn fix
.)yarn start
.)yarn changeset add
.)