RichTextFX
RichTextFX copied to clipboard
Support for numbered and unnumbered Lists
It should be possible to define numbered and unnumbered, nested lists. Each paragraph in the list would serve as a list item, the paragraph would be indented according to its level inside the nested list, and optionally prepended either with a level specific bullet (ideally defineable by CSS) or a numeric value, either as single numbers or as combined numbers (like 1., 1.1, 1.2, 1.2,1 etc).
This requires enhancements in the data model (optionally allowing to add each paragraph to a List) and in the rendering layer (indenting ParagraphText and adding the bullet node). It also requires some adjustments in the behaviour of the component: When pressing enter inside a paragraph which is part of a List, the new Paragraph will become a list item of the same List.
How should this be implemented?
Would we be generifying the Paragraph similarly to how we generified the Segment? In which case, rather than a list of Paragraph
s, we would have a list of generic lines. A line could be a List
that could contain another List
(for nested lists) or a Paragraph
(for the actual item itself). For example
public class StyledTextArea<Line, LS, Seg, S> {
// rather than "getParagraphs()" this would now be
public List<Line> getLines();
}
// thus generifying the Paragraph to be
StyledTextArea<
// paragraph is now lines
Either<NestedList, Paragraph<String>>, String,
// your custom object support
Either<StyledText<String>, Image>, String>
> area = //;
Would we be generifying the Paragraph similarly to how we generified the Segment?
Ah no, I am still busy with unscrambling the knots in my head, caused by all those generic types from the Segment
implementation :joy:
My current thinking is that a Paragraph must not be as generic as a Segment - and a Paragraph's list structure is more tied to the Paragraph's style than to its type. The current approach is to add an Optional<ListItem>
to a Paragraph
, which can be passed around when creating new derived Paragraphs (when splitting, joining etc.). The ListItem
can then further reference to some List object which further defines the structure of the List (this is especially required for hierarchically numbered Lists). But, let's discuss any other reasonable approach ...
My playground for this enhancement is https://github.com/afester/RichTextFX/tree/paragraphBullets. It already implements indentation of single paragraphs and rendering for level dependent bullets:
Its still a draft only, with many hard coded pieces, just to get an idea where to implement the various bits&pieces.
Does a simple example exist yet for doing this?
Unfortunately, no. afester's playground is probably the best place to start.
I also urgently need this feature. afester's example must have been deleted.
afester's example must have been deleted
Seems to be still there in the paragraphBullets
branch in his repo:
https://github.com/afester/RichTextFX/tree/paragraphBullets
I do not see it …. any class inside this branch I should look at?
On 20 Oct 2017, at 16:40, JFormDesigner [email protected] wrote:
afester's example must have been deleted
Seems to be still there in the paragraphBullets branch in his repo: https://github.com/afester/RichTextFX/tree/paragraphBullets https://github.com/afester/RichTextFX/tree/paragraphBullets — You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/FXMisc/RichTextFX/issues/384#issuecomment-338226013, or mute the thread https://github.com/notifications/unsubscribe-auth/AJF7XVeI01ZL9eVX8QPXZxazaGUf_4iLks5suLDNgaJpZM4KaNyb.
Sorry, don't know... never used it
I'd check out a local branch of the build, and see where ListItem
is used throughout it. That's the only class that doesn't appear normally in the code, so he must have added it. That will probably lead you to other classes where he's made some changes.
Note: The RichTextDemo meanwhile supports bullets (see #850). Probably this is sufficient for this enhancement request - I would like to check if this can be extended to numbered lists though.