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

Clearing inline content makes editor momentarily collapse #54

Open
madeleineostoja opened this issue May 21, 2017 · 6 comments
Open

Clearing inline content makes editor momentarily collapse #54

madeleineostoja opened this issue May 21, 2017 · 6 comments

Comments

@madeleineostoja
Copy link

Since ProseMirror denounces state updates, the placeholder for simpla-text doesn't show up until a little while after content is cleared. This is fine for block elements, but for inline simpla-texts the element's height collapses to 0, causing a jarring page reflow.

Related (but more minor) issue: entering content in an empty element 'pushes' the placeholder along for a bit before it's cleared.

Both issues would be solved if we could prevent the placeholder state updates from denouncing.

@bedeoverend
Copy link
Contributor

bedeoverend commented May 22, 2017

denounce, verb
- publicly declare to be wrong or evil.

Erm...do you by chance mean debouncing? 😉

There is view.inDOMChange but it's undocumented so I'd be hesitant to use it.

The other, probably more viable one, is to find a way for the placeholder to predict the next state change based on incoming events, that way it will update with the DOM, rather than asynchronously due to a change in state.

I'll dig into this some more

@madeleineostoja
Copy link
Author

It's not private though? Unless ProseMirror doesn't use the underscore convention

@bedeoverend
Copy link
Contributor

Don't know whether they do or not, which means I'd err on the side of undocumented -> can break in a patch. Easiest way to solve this is probably just bring it up in their discussion forums / raise an issue on GitHub.

@madeleineostoja
Copy link
Author

Yep, I'd say so. File an issue on whether inDom thing is public interface or not

@bedeoverend
Copy link
Contributor

Actually, that's not gonna work 🤔 The placeholder plugin listens to changes after the state has changed on the view - at that point checking a few things including if the state is empty before saying it should update the state with a placeholder decoration.

I'd say the way to do it is to try add the decoration before the updated state has been applied to the view. Not sure how to do that though.

@madeleineostoja
Copy link
Author

Hmm okay. It does feel pretty buggy, but only breaking with inline text elements that rely on their content for height. And even then, only breaking minorly in edit mode. So I wouldn't dive too deep on it now, but worth tinkering with a fix for.

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