My users have asked if I can add a Rich Text type editor to my app. The field that they want this added to is a UITextView.
Obviously, they also will want to see the text displayed as they've entered it.
Any suggestions for how to implement this is greatly appreciated.
There are 2 approaches - a UiTexView can handle most Rich Text Editor stuff not including lists.
The 2nd way is a WebView and some html / JavaScript.
A WebView might be the best approach but be careful - some of the WebView based solutions out there were rejected from the AppStore since they use private methods of the WebView - that is not allowed by Apple.
Related
I am working on text editor app and using UITextView for this. Does anybody know how to make ability to do bullet/num/check lists in it? Any examples/tutorials?
Note: I need to do this as a part of text editor, so user can select some area, tap on according button and enable/disable lists formatting.
Based on my research for similar behavior (e.g. Bullet list and Numbered list in UITextView ), I would expect that there is no easy way to do it. I expect that you will have to use textView(_:shouldChangeTextIn:replacementText:) to hack currently added text to manually add bullets/numbers - e.g., if the user set that she currently wants to use unordered list, you will have to detect a new line added in shouldChangeTextIn and manually add there the bullet and indentation.
Another approach which you might consider (its applicability depends on your requirements) is to customize existing open source rich text editor. In my case I was able to get close enough to what I needed using RichEditorView, which uses HTML+CSS as an underlying technology (so to be able to do customizations, you need to know a bit about JavaScript, CSS and HTML).
How can I implement the tradition menu items to copy / cut / paste / selectAll
in Codenameone TextArea
I can do these things if I happen to remember the keystrokes, but I don't
see any hooks to do them programmatically.
Since on-device editing is native the cut/copy/paste work thru touch and the menu will implicitly appear. So normally you wouldn't want to do this programmatically in Codename One, e.g. right now we don't have any API to get the currently selected text either since that concept is pretty different between platforms.
There are Display.copyToClipboard & Display.getPasteDataFromClipboard but those aren't for the text field selection purpose. They are rather for the use case of moving data within/between apps.
My iOS app has a log-in page with username and password textfields. These text fields are in a web view. I am trying to automate the log-in process with UIAutomation. I know that working with content in a web view with UIAutomation is tricky. I am able to tap into the text fields using target.tap({x:100, y:200}); but I want to have UIAutomation enter text after the field has been tapped. How can I achieve this?
You can do something like:
Get the reference to the webview
var webView=window.scrollViews()[0].webViews()[0];
Tap the textView that you want to edit:
webView.textFields()[0].tap();
Use the keyboard
UIATarget.localTarget().frontMostApp().keyboard().typeString("text");
You can use: webView.logElementTree() to find out your webview.
Yes this is quite possible but instead of going through the position of the text field, I'd suggest going through the id/name of the text field. Another approach is to traverse the application window.
Try following this apple's documentation - http://developer.apple.com/library/ios/#documentation/DeveloperTools/Conceptual/InstrumentsUserGuide/UsingtheAutomationInstrument/UsingtheAutomationInstrument.html
This will give you a head start and many other ideas.
I have been trying in vain to try to find how to add listeners to text area.
What I am basically trying to do is create a rich text editor where I can let the user comment on a particular item.
For this purpose I am using a text area. If you have any other suggestion please let me know.
On another note, I have not seen that there is text did change or related functionality for the textarea. Is there a way we can build it ourself?
What you are looking for are the UITextViewDelegate's. Have a look at http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UITextViewDelegate_Protocol/Reference/UITextViewDelegate.html
EDIT
Per our chat the tutorial you are looking for to also ad a done button above your keyboard can be found at http://gabriel-tips.blogspot.com/2011/05/input-accessory-view-how-to-add-extra.html
I have a web-based table editor with many textarea's. The textarea's contain HTML content. I would like the users to be able to edit them in WYSIWYG style. Since my users love to use the keyboard, I would like it to have a simple way to add keyboard shortcuts, including shortcuts for adding div's with custom class names.
This: http://markitup.jaysalvat.com/home/ comes close to what I need, the only problem is that it's not WYSIWYG.
This: http://premiumsoftware.net/cleditor/ is also close, but does not have keyboard shortcuts.
An obvious answer is CKEditor. Besides all the built-in shortcuts (Press Alt-0) you can add more commands with the API.