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

Support for numbered and unnumbered Lists #384

Open
afester opened this issue Oct 18, 2016 · 10 comments
Open

Support for numbered and unnumbered Lists #384

afester opened this issue Oct 18, 2016 · 10 comments

Comments

@afester
Copy link
Collaborator

afester commented Oct 18, 2016

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.

@JordanMartinez
Copy link
Contributor

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 Paragraphs, 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 = //;

@afester
Copy link
Collaborator Author

afester commented Oct 24, 2016

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 😂

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:

image

Its still a draft only, with many hard coded pieces, just to get an idea where to implement the various bits&pieces.

@stevedefazio
Copy link

Does a simple example exist yet for doing this?

@JordanMartinez
Copy link
Contributor

Unfortunately, no. afester's playground is probably the best place to start.

@dlemmermann
Copy link

I also urgently need this feature. afester's example must have been deleted.

@JFormDesigner
Copy link
Contributor

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

@dlemmermann
Copy link

dlemmermann commented Oct 20, 2017 via email

@JFormDesigner
Copy link
Contributor

Sorry, don't know... never used it

@JordanMartinez
Copy link
Contributor

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.

@afester
Copy link
Collaborator Author

afester commented Sep 18, 2021

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.

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

5 participants