objective c - How to implement an NSTextView that performs on-the-fly markup to RTF conversions -


I am trying to create a NSTextView that can take the "marked" input, which is automatically beautiful RTF-style Text while user type

The idea is that the user should enter text in the "plain text" format, but to "beautify" it on the spot, like

  H1 is a quick list : * First item * second item  

will be used in the first line with a headlined font, followed by a bulleted list.

I find so much of the possible ways of doing this, but the text system is incredibly complex (with reason) and if I already have some appropriate built-in "own cooking" Do not want to start BTW I will be happy with Snow Leopard only APIs.

The first thing I thought was " data detectors ", but I could not find a public API to do this.

After reaching the end of the road with it, I changed the new " Text Input Source API ". These are all kinds of things, but the "Data-Driven Input Method" section of WWDC 2006 presentation "Low Charge" is interesting in my reference, beyond that single presentation slide, nothing is available anywhere, so it does not exist anywhere There is a bit of a dead end.

Finally, I have also seen the NSSpellChecker class to offer the facility of completing and automatic correction .. but I'm not sure that it is for my needs Can be reproduced again.

For the moment, let me manually make changes to NSTextStorage manually and when the user stops typing .. But I'm sure there are hard heads around this forum.

Any suggestions or signals in the right direction will be appreciated.

Data detectors and spell checkers are also appropriate for this task. Assuming that you are looking for a way to pass the input for a parsed / input, which you already have, it is not very difficult to interface with the text system, while handling editing in NSTextStorage, on the right path Are there.

With those lines, there is no need to re-parse the whole thing when the user closes. The text system sends you a revised range and gives you an opportunity to work on those changes (and reject them out of hand). Since all changes through the funnel (typing, pasting, droping ...), this is the point where you want to intervene.

Because you are working with titles and bulleted lists, let me close the paragraph of the modified range.

Good luck!

This gives you a good, rounded unit of work that is easily searchable and fits completely.

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -