Can't edit after removing container
ri8ika opened this issue · 4 comments
ri8ika commented
I am not using CommonBlock as per plugin example. I have a button which calls the following function to remove the container. But after this the content is not editable. It only becomes accessible after window is reloaded.
this.props.container.remove()
I think I need to update the editorState. But not sure how to update it?
SvyatoslavPozhydaev commented
+1
SvyatoslavPozhydaev commented
@ri8ika this problem occurs if you use a focusable element to invoke container methods
SvyatoslavPozhydaev commented
@ri8ika you can add stopPropagation on root element block
import React, { PureComponent } from 'react';
class Block extends PureComponent {
render() {
return (
<div
className="root-ement-block"
onFocus={(e) => e.stopPropagation()}
onBlur={(e) => e.stopPropagation()}
>
<button onClick={() => this.props.container.remove()}>remove</botton>
....
</div>
)
}
}
stale commented
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.