backport richtext behavior from Plone5 branch