#Use Case
typing into RichTextArea with a default model (or any other model that supports discrete styles), in the presence of a tool bar or similar UI that allows to specify the styles to take effect on the next key press. Example:
- open MS Word or another rich text editor such as TextEdit
- type something
- place cursor at the middle of the typed text and hit command-B or ctrl-B on Win/Linux
- notice how the formatting toolbar highlights [b] button indicating that the style for next character to be inserted has changed to bold
- type something and confirm that inserted text is bold
the new style is captured only in the toolbar UI, so clicking on some other part of the text reverts the bold button to the unselected state.
#Problem
typing a character uses the model's logic to deal with the styles, via StyledTextModel::replace(StyleResolver resolver, TextPos start, TextPos end, String text) method, see RichTextAreaBehavior::handleTypedChar(). This worked well initially, however it makes it impossible (without extending RichTextAreaBehavior which is not a public class) to implement the behavior described earlier.
#Possible Solution
- add 'insertStyles<StyleAttributeMap>' (name?) property to the RichTextArea, which will override the model styles in RichTextAreaBehavior::handleTypedChar() if the value is not null
- possibly remove public final StyledTextModel::replace(StyleResolver resolver, TextPos start, TextPos end, String text) method in favor of existing and more general replace(StyleResolver resolver, TextPos start, TextPos end, StyledInput input)
typing into RichTextArea with a default model (or any other model that supports discrete styles), in the presence of a tool bar or similar UI that allows to specify the styles to take effect on the next key press. Example:
- open MS Word or another rich text editor such as TextEdit
- type something
- place cursor at the middle of the typed text and hit command-B or ctrl-B on Win/Linux
- notice how the formatting toolbar highlights [b] button indicating that the style for next character to be inserted has changed to bold
- type something and confirm that inserted text is bold
the new style is captured only in the toolbar UI, so clicking on some other part of the text reverts the bold button to the unselected state.
#Problem
typing a character uses the model's logic to deal with the styles, via StyledTextModel::replace(StyleResolver resolver, TextPos start, TextPos end, String text) method, see RichTextAreaBehavior::handleTypedChar(). This worked well initially, however it makes it impossible (without extending RichTextAreaBehavior which is not a public class) to implement the behavior described earlier.
#Possible Solution
- add 'insertStyles<StyleAttributeMap>' (name?) property to the RichTextArea, which will override the model styles in RichTextAreaBehavior::handleTypedChar() if the value is not null
- possibly remove public final StyledTextModel::replace(StyleResolver resolver, TextPos start, TextPos end, String text) method in favor of existing and more general replace(StyleResolver resolver, TextPos start, TextPos end, StyledInput input)
- relates to
-
JDK-8351982 ☂ RichTextArea (Incubator) Feedback and Bugs in jfx24
-
- Open
-
-
JDK-8373936 RichEditorDemoApp enhancements
-
- In Progress
-