dankito / RichTextEditor

Rich text WYSIWYG editor for Android and JavaFX
Apache License 2.0
92 stars 36 forks source link

State of checkbox isn't saved #24

Closed tised closed 4 years ago

tised commented 5 years ago

I added 3 checkboxes, saved. Then entered again and checked 2 of them, saved it, but state "checked" isn't saved.

Also, I wonder - is there are a possibility to add new checkbox on enter press ? Just like lists of (1,2,3) or bullets Can you add such possibility ? Thanks!

dankito commented 5 years ago

You're absolutely right, the 'checked' attribute doesn't get set on element when clicking on a checkbox! Therefore checkbox's state doesn't get saved.

Commit 585f62c0 should fix this issue. If you think it's OK then I release 2.0.11.

Concerning your second question: This would be very hard to implement. \

  • (ordered and unordered lists) is a block element. So on pressing enter you can check if previous sibling is a \
  • and if so add another one.

    Whilst \ is an inline element. So on pressing enter one would have to check previous sibling if it starts with such an input element, but what if it as a space before input element, or if input element is in the midst of previous paragraph, ...

    Also one would need to implement detecting pressing enter on an empty check box to remove check box from paragraph (like \

  • gets removed if pressed enter on an empty item).

    This would cause me a lot of effort, so I will not implement this. But if you like to do this, feel free to open a pull request.

  • tised commented 5 years ago

    But what if you'll do it in this way: Make checkbox button like you did with color for example, so it will have states now (selected/unselected) If checkbox selected - whenever you detect enter - add a new line with checkbox and that's all If user unselect checkbox, enter button on keyboard should work as it is I think it will be useful for many developers for creating like tasks lists

    P.S. fix with checkbox checked/unchecked looks good

    tised commented 5 years ago

    Hey, just pinging you :) You can release version with checkbox commit to 2.0.11

    And also what about my suggestion ? I think it the most sophisticated and easy solution for that

    dankito commented 5 years ago

    Sorry, it's summer time and my customer has also been yelling. I will be better available again from mid September on.

    Just released 2.0.11.

    To your suggestion: Why would you like to insert a new checkbox on enter only if previous checkbox is selected?

    But as I said, feel free to implement this and give me a pull request. I just will hardly find the time to implement this on my own.

    MarcosPedraza commented 4 years ago

    any solution for checkbox status?