TASKMAN-18: Improve task edit for Flamingo

This pull request is inspired by https://github.com/xwiki-contrib/application-task/pull/5 from @maximaker.
See the comment https://github.com/xwiki-contrib/application-task/pull/12/files#r18827114