The insert command ends with setting the selection to the "right" of the last inserted node. However, it did this without checking if that position was valid for the selection, so we could end up with the selection directly within the root of the editor. This corrects it if such is the case. X-original-commit: 722cf3bf11fcc9839677837018c1389d65b3f4fa Part-of: odoo/odoo#109208