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

vertical align center support as a props option #258

Open
ibarapascal opened this issue Mar 1, 2022 · 3 comments
Open

vertical align center support as a props option #258

ibarapascal opened this issue Mar 1, 2022 · 3 comments

Comments

@ibarapascal
Copy link

as title

current

we can customize the element's style to enable them vertically aligned at the center, but the initial cursor position would keep at the top as long as the initial content is empty.

enhancement

we can do that via adding a CSS :empty class to set the line-height the same value as the contentEditable's element height to fix that, if we can include such adjustments within our components and expose a boolean option to do so, that would be great

related QA: https://stackoverflow.com/a/71304258/11872246

@hiukky
Copy link

hiukky commented Mar 4, 2022

@ibarapascal https://github.com/hiukky/cedit

I'm trying to do something like this but without beating around the bush with js to control caret, I think with pure css you can do something, or at least try! the closest I've come to such a behavior was added a   just to move the caret to the center but without losing the placeholder.

@ibarapascal
Copy link
Author

@ibarapascal https://github.com/hiukky/cedit

I'm trying to do something like this but without beating around the bush with js to control caret, I think with pure css you can do something, or at least try! the closest I've come to such a behavior was added a   just to move the caret to the center but without losing the placeholder.

I've created a demo that achieved it with other features, here is the share: https://codesandbox.io/s/demo-textarea-vertical-align-center-8v9n3b?file=/src/App.tsx

@hiukky
Copy link

hiukky commented Mar 7, 2022

I added a story with examples https://hiukky.github.io/cedit/?path=/story/cedit-editor--default

Can you tell me if this solves the problem mentioned? I saw your pen but I didn't understand the case well?!

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

No branches or pull requests

2 participants