aryaxt / iOS-Rich-Text-Editor

A Rich Text Editor for iOS
Other
893 stars 159 forks source link

Bullets #19

Open johnrickman opened 11 years ago

johnrickman commented 11 years ago

Hi there:

I see that you started to implement a bullet function. Whats the status on that?

Thanks.

aryaxt commented 11 years ago

Hi John, I implemented it once, I was not happy with the implementation so I never checked it in. The problem is there is no list feature in paragraphStyle, so basically no decent solution and no way to implement it without adding a bunch of mess to the code. Will give it another shot after I'm done with first line indentation feature.

Thanks

johnrickman commented 11 years ago

Hi; Yea, I was looking around on how to implement a list feature and found that the OS X has a NSTextList class. So maybe something similar can be implemented for iOS. Let me know if I can be of any help.

brennanMKE commented 10 years ago

Here's an approach which might help. See the 2nd answer.

http://stackoverflow.com/questions/6644501/objective-c-nsattributedstring-inserting-a-bullet-point

Below is the 2nd answer, currently, from Rob Napier.

You don't implement a bulleted list with a paragraph style in iOS. Set your tab stops as you'd like, and then insert a tab, bullet, tab at the beginning of the paragraph.

CTParagraphStyle is quite inflexible, so you can't just add new styles of your choosing to it. You can, however, add any attribute you like (MYBulletStyle) to arbitrary runs within the NSAttributedString. This can be useful for passing the bullet-list information around with the NSAttributedString and then rebuilding the string to include the bullets when you're ready to display it. But Core Text won't render the bullets for you automatically.

aryaxt commented 10 years ago

Thanks brennanMKE. That's my own question in that thread :), and I don't like the provided answer. I ended up implementing bullets in a cleaner way, code is in the List_implementation branch.

You do need to use paragraphs in order to make sure that the following lines have the same indentation plus the width of the bullet.

Actually NSAttributedString uses paragraphs for bullet lists, just try to convert some html to NSAttributedStirng using their convertor, and see the result.

brennanMKE commented 10 years ago

How long before the List_implementation is merged to master?

aryaxt commented 10 years ago

I'm really busy with work, Not sure when I'll get the chance to test all these changes. Hopefully I'll get to it in a couple of weeks/

brennanMKE commented 10 years ago

I will see if I can give it a try. I am also interested in working with DTCoreText for get and set HTML in this editor. If I can pull something together I can post a sample project which uses both libraries together to illustrate how to do it.

Brennan

On Tue, Feb 4, 2014 at 12:17 PM, Aryan Ghassemi notifications@github.comwrote:

I'm really busy with work, Not sure when I'll get the chance to test all these changes.

Reply to this email directly or view it on GitHubhttps://github.com/aryaxt/iOS-Rich-Text-Editor/issues/19#issuecomment-34089559 .

Brennan Stehling SmallSharpTools Connect with me: http://www.linkedin.com/in/smallsharptools Follow me: http://twitter.com/smallsharptools

aryaxt commented 10 years ago

That would be nice. The list implementation I believe is done already, it just needs more testing. The branch name is a little misleading, I have other features such as image attachment in this branch.

There are some iOS7 related bugs that I need to fix. I am also trying to get rid of the iPhone popover, and only allow modals for iPhone. The popover is buggy.

Thanks

rajinderpaul commented 9 years ago

Hi

Is the bullet point implementation done for RichTextEditor?