Daily updates from Odoo
Thursday, September 26, 2024
1 change
Code cleanup and technical improvements
This update simplifies how editor pop-ups and menus are managed, making them more consistent and easier to maintain. It also improves behavior when users interact with fields inside these pop-ups, reducing unexpected focus changes while editing content.
Original PR description
The purpose of this PR is to make it easier to use overlays in the editor. 1. Clarify the createOverlay API. ================================ Before, we mixed up the positioning hook options and the…
The purpose of this PR is to make it easier to use overlays in the editor. 1. Clarify the createOverlay API. ================================ Before, we mixed up the positioning hook options and the EditorOverlay props. After, put all the positioning options in the positionOptions props and move the sequence to the last param, which corresponds to the overlay system options. 2. Automatically manage the close at pointerdown. ================================================= Before, the logic for closing overlays outside the overlay was duplicated in each component use by createOverlay. After, the overlay editor is responsible for closing overlays when a pointerdown occurs outsite of the overlay. You can disable this functionality with the closeOnPointerdown=‘false’ props. 3. Managing setSelections when the selection is not in the editable =================================================================== For example, the selection is in the input of an overlay. From this commit, when you call setSelection, if the selection is not in the editable, you no longer force the selection to be moved into the editable, you just update the activeSelection. When you want to force the restoration of the selection in the editable, for example when you close an overlay, you call the focusEditable function. This change makes it possible to call functions that manipulate the selection from the outside without having to refocus in the editor. Description of the issue/feature this PR addresses: Current behavior before PR: Desired behavior after PR is merged: --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr