zandy
zandy copied to clipboard
Rich text editing for notes
As of 7aa16800e4579c32af3b9ea7e8e55071725016e8, rich text notes are displayed properly. We need a way to edit them as rich text; the status quo is that they are edited as raw HTML. Current thinking is to do this with SpannableString
, either by writing our own implementation or by importing someone else's, like droid-writer
.
When things calm down, try http://code.google.com/p/droid-writer/
Could WebView be used meanwhile with that TinyMCE meanwhile? Or is it gonna be too heavy?
I'll look into it-- it may well be OK.
(only) Rendering for standalone notes works okay with WebView. However I'm new to android so I ended up adding WebView to list_data.xml to the same row as regular TextView. I make it invisible unless "label" is "note". Perhaps it is a bit ugly to have an extra widget and not showing it thus wasting resources. Otherwise I don't know how could I reuse view without inflating it every time. I want to fiddle around with attached notes first before I push changes.
Sounds exciting! If you get the basic functionality working with WebView, we can work out the resource implications later. It should be possible to use a separate layout only when needed, but that should be a simple change and we can leave it for now.
Turned out that jwysiwyg doesn't want to work inside of the WebView :( I didn't try anything else. Here is yet another approach to reuse wordpress editor.
Update Turned out that TinyMCE does work as well as Yahoo's yui. However it is a pain to use from android browser. Perhaps html display with WebView and editing as a plain text may be enough.
Do you have a version using TinyMCE built or tagged? Maybe we can get it working by tweaking TinyMCE some.
The HEAD of my repo has TinyMCE working. But it is a PITA to actually use it.
I think it worth adding a setting if user wants just to see notes and edit as html, or use TinyMCE for everything. The problem is with navigation. I can't move cursor in emulator. It jumps from field to field instead of moving between characters. I still have to try it on a real hardware.
I've made a stripped copy. Perhaps git submodule with pre-build step to copy jscripts folder would be better. I don't know if git and release versions of TinyMCE are different. Probably they do squeeze space out of javascripts.
I worked on this some yesterday in the richtext branch (https://github.com/ajlyon/zandy/tree/richtext) -- good work getting something going. Now that I've seen what TinyMCE is like on my phone (Android 2.2, LG Optimus), I see why you shied away from using it. My current approach is using the WebView to display only, as you proposed, but I can't get the WebView to update when I send it new content, and I'm still struggling to get the back button to work. So there's still work to be done!
I'll be quiet on this front for several more days, since I have obligations at university for about one week more. Then I'll see what I can do on this and other major Zandy features.
An option to not use WebView, which might be better for performance: http://developer.android.com/reference/android/text/Html.html
So what would be the view (class) that shows converted html?
We can pass a SpannableString
to the standard TextView
.
I moved this to Html
in c3796da4b7aa6e3939bee46d9288ab2c45a4ce2c and 7aa16800e4579c32af3b9ea7e8e55071725016e8; the revised version is pretty clean and quite serviceable for now. Since we don't need full-fledged rich text, we might be able to roll our own solution using SpannableString
. I'll also run titles through Html
before display, since there are styled titles out there.