zandy icon indicating copy to clipboard operation
zandy copied to clipboard

Rich text editing for notes

Open avram opened this issue 13 years ago • 13 comments

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.

avram avatar Oct 19 '11 08:10 avram

When things calm down, try http://code.google.com/p/droid-writer/

avram avatar Oct 22 '11 04:10 avram

Could WebView be used meanwhile with that TinyMCE meanwhile? Or is it gonna be too heavy?

mlt avatar Nov 30 '11 17:11 mlt

I'll look into it-- it may well be OK.

avram avatar Nov 30 '11 19:11 avram

(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.

mlt avatar Dec 01 '11 21:12 mlt

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.

avram avatar Dec 02 '11 00:12 avram

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.

mlt avatar Dec 02 '11 10:12 mlt

Do you have a version using TinyMCE built or tagged? Maybe we can get it working by tweaking TinyMCE some.

avram avatar Dec 02 '11 19:12 avram

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.

mlt avatar Dec 02 '11 19:12 mlt

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.

avram avatar Dec 05 '11 01:12 avram

An option to not use WebView, which might be better for performance: http://developer.android.com/reference/android/text/Html.html

avram avatar Dec 11 '11 08:12 avram

So what would be the view (class) that shows converted html?

mlt avatar Dec 14 '11 20:12 mlt

We can pass a SpannableString to the standard TextView.

avram avatar Dec 14 '11 20:12 avram

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.

avram avatar Dec 20 '11 03:12 avram