Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] ContentEditableHelper: do not throw on missing node
Currently,the method `findSizeBeforeElement` will throw if called when the selection is not targetting a node inside the ContentEditableHelper instance. Unfortunately, this can happen since commit d466315. If a menu is opened and we decide to click on the composer, the click event if first caught by the menu global listener which will close the menu and invoke a callback that focuses the grid; this focus will alter the selection of `document`. The event is then handled by the composer component but at that point, the selection is not targetting it anymore. With this revision, we change the behavior of `findSizeBeforeElement` to return a default value of 0 in those situations as we simply don't know how to determine the selection outside of the scope of the ContentEditableHelper. There is a functional drawback to this solution: When clicking on a specific character of the composer when a menu is opened, the selection will be set to `{ start: 0, end: 0 }`. closes #2494 X-original-commit: 371666f Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
- Loading branch information