Toggle inline styles to current block(s), even when it is not fully selected
See original GitHub issueFirst of all, thank you very much for making public this fantastic editor.
I’m trying to do something simple, at least I think so 😃 I want to toggle inline styles for the entire current block(s), as if fully selected, even when it is not. Even with the clear understanding that I have to play with SelectionState
, I can’t understand how to do it.
This is what I have so far (the basic functionality), taken from the RichEditor example:
_toggleInlineStyle(inlineStyle) {
this.onChange(
RichUtils.toggleInlineStyle(
this.state.editorState,
inlineStyle
)
);
}
Thanks again for this awesome project!
Issue Analytics
- State:
- Created 7 years ago
- Comments:7
Top Results From Across the Web
Is it possible to remove inline styles with jQuery?
At first I tried to remove inline style in css, but it does not work and new style like display: none will be...
Read more >display - CSS: Cascading Style Sheets - MDN Web Docs
The display CSS property sets whether an element is treated as a block or inline element and the layout used for its children, ......
Read more >The CSS Display Property – Display None, Display Table ...
An element with a display property set to inline will not start on a new line and it will take up the remaining/available...
Read more >Style Sheets in HTML documents - W3C
The syntax of the value of the style attribute is determined by the default style sheet language. For example, for [[CSS2]] inline style,...
Read more >A Complete Guide to CSS Cascade Layers
As web authors, we often think of !important as a way of increasing specificity, to override inline styles or highly specific selectors. That ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
First you have to change your selection into entire block. To do that you can set anchorOffset to 0, and focusOffset to content length, then apply using forceSelection which will return new editorstate. You can then use the new editor state to perform the operation you want, like this
Yeah, it’s solved now! Thanks again!