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

ListItem.attributedText: is this the desired behavior? #32

Open
NightFlyer opened this issue May 3, 2019 · 3 comments
Open

ListItem.attributedText: is this the desired behavior? #32

NightFlyer opened this issue May 3, 2019 · 3 comments

Comments

@NightFlyer
Copy link
Collaborator

If there are nested lists, then the attributedText() for the ListItem includes all the sub-lists as well.

For example, with this document:

- list 1
  a paragraph inside list one, followed by:
  - embedded list
  - another embedded item
    1. ordered list inside
    1. another ordered item
  - third embedded item
- second item in top list

The first ListItem has a attributedText value of list 1 a paragraph inside list one, followed by:• embedded list• another embedded item1. ordered list inside2. another ordered item• third embedded item because it includes all blocks under the list item.

I'm not sure if that is what you really want, but I wonder how useful that is.

I'm not sure what you really had in mind for the use of attributedText(), so maybe this fits with what you had in mind.

For my usage, however, it would be more useful to have some version of attributedText() that didn't descend into sublists.

So, this issue is mostly a placeholder for you to either state that this is your desired behavior, or to open the issue of what other behavior might be desired.

@KristopherGBaker
Copy link
Owner

I think this is related to #18. I see the default behavior of attributedText() to fully render the lists and sublists recursively with appropriate new lines and indentation (which it does not currently do correctly), with some type of options or rendering/behavior protocol parameter that can be passed to it if different behavior is desired (such as in lists/sublists in your case). Please let me know if you have any ideas on how best to achieve this, and I will think about it as well.

@NightFlyer
Copy link
Collaborator Author

It's good to know that you see attributedText() as rendering the entire Block element, including anything included in it. I'll have to think about what would be the best solution for people who only want partial rendering (for example, if you are displaying a document "collapsed" and expand each element as the user chooses). It might be to have different version of attributedText() with parameters, or it might just be that the desired rendering would just be too different for each case, and so the best thing to do would be to have some examples of how people could extend things to make it work out.

@KristopherGBaker
Copy link
Owner

Yeah, my personal use of the framework didn't call attributedText() on block elements, but if a user wanted to call attributedText() on a block element, then that's how I see it working; rendering the entire block element including anything in it.

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

No branches or pull requests

2 participants