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

Paragraph-level styles #6

Closed
TomasMikula opened this issue Dec 24, 2013 · 5 comments
Closed

Paragraph-level styles #6

TomasMikula opened this issue Dec 24, 2013 · 5 comments

Comments

@TomasMikula
Copy link
Member

To support rich-text editors, it should be possible to assign paragraph-level styles, such as alignment, heading, ...

@TomasMikula
Copy link
Member Author

Currently, StyledTextArea is parameterized by a type parameter S, which represents the type of style information that can be applied to text. In concrete subclass, S can be a list of style classes (as in StyleClassedTextArea), a CSS string (as in InlineCSSTextArea), or any user defined type (such as StyleInfo in the RichText demo application).

The StyledTextArea constructor takes the initial (default) style and a function that is capable of applying that opaque style object to a Text node.

To add support for paragraph-level styles, we need to add a second type parameter PS to StyledTextArea that will represent the type of style that can be applied to whole paragraphs. The constructor will then accept two additional arguments: the default paragraph style (of type PS) and a function capable of applying an object of type PS to a TextFlow (TextFlow is the visual rendering of a paragraph.)

The addition of the second type parameter will propagate down to StyledDocument and Paragraph as well.

The change is not going to be backwards compatible. However, the users of some concrete subclasses such as StyleClassedTextArea may not be impacted too much.

MewesK added a commit to MewesK/RichTextFX that referenced this issue Aug 20, 2015
Implemented the proposed paragraph style feature (FXMisc#6)
@TomasMikula
Copy link
Member Author

So this is now mostly implemented. Among the remaining things to do is to support copying to the clipboard including paragraph style.

@JordanMartinez
Copy link
Contributor

I was testing out the demo, and it seems another thing to support is the UndoManager. As of now, it doesn't undo/redo the paragraph's style.

After the program started, I typed some text, and then changed the line's background color. After undoing my action, the text was deleted but the line's background color remained the same. When I redo my action, the text reappears but the line's background color returns to the initial white color.

The same basic thing happened with the paragraph's alignment values. When I change the alignment to Center and then click Undo, the text is deleted but the alignment remains at Center. When I redo, the text reappears but the text is aligned to the left despite the Alignment Center button still appearing to be pressed.

@TomasMikula
Copy link
Member Author

Copy&Paste is now fixed in master.

@TomasMikula
Copy link
Member Author

Undo/Redo now seems to work, too.

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

No branches or pull requests

2 participants