yydcdut / RxMarkdown

:fax:Markdown for Android, supports TextView && EditText (Live Preview), supports code high light.
749 stars 92 forks source link

checkboxes can't be (un)checked easily #40

Closed jpggithub closed 6 years ago

jpggithub commented 7 years ago

I use RxMarkdown in nextcloud-notes (https://github.com/stefan-niedermann/nextcloud-notes/) With the syntax '- [ ] item 1' '- [x] item 2' I have two nice checkboxes in 'view mode' but I can't check or uncheck the checkboxes. See the bugs https://github.com/stefan-niedermann/nextcloud-notes/issues/287 and https://github.com/stefan-niedermann/nextcloud-notes/issues/157

Please can you enhance this point?

stefan-niedermann commented 7 years ago

Maybe kind of a callback in TextView that passes line and charachter or the complete text as string (with x instead of the space character)?

yydcdut commented 6 years ago

Hi, you mean, you want to click the checkbox?

stefan-niedermann commented 6 years ago

yeah, right :)

stefan-niedermann commented 6 years ago

By the way @yydcdut - great you eventually found some time again to enhance your great lib! thousands of end users will be thankful :)

stefan-niedermann commented 6 years ago

@yydcdut Great you implemented a callback :)

Just one question: While the checkbox can be checked and unchecked in the user interface now easily, the callback returns always the initial value.

.setOnTodoClickCallback(new OnTodoClickCallback() {//todo or done click callback
    @Override
    public CharSequence onTodoClicked(View view, String line) {
        Log.v("Note", noteContent.getText()); // <-- This always returns - [x] Test
        return noteContent.getText();
    }

Also the String line always returns the initial value.

It would be great, if one could have the complete Text (including the changed checkbox-status) within the callback. Would that be possible?

yydcdut commented 6 years ago

Hi stefan, First of all, the complete Text means all the content text? Mentioned in README, TextFactory will destroy the integrity of the content text, so the text in TextView is not the same as the original content text user set. So here, what i thought when coding, the parameter line just wanna tell you to change the original content text, not the text in TextView. Possibly, I can hold the original text content, and return the complete text (including the changed checkbox-status) . SO, I just want to think more about it.

stefan-niedermann commented 6 years ago

Ah, i understand the problem.

Just one more thought: Wasn't it better to give the lineNumber instead of the line text? Maybe there are multiple lines with the same content, so it would ne safer to go by line number?

Let me hear what you think about the topic and what will be your solution :-)

yydcdut commented 6 years ago

Hi, can you create another issue for this?

stefan-niedermann commented 6 years ago

48