[FIX] web_editor: do not scroll up when inserting a link

Before this commit:

When we write a long pad and go to bottom a insert a link when the modal opens
the editable area scrolls to the top.

After this commit:

Now from the bottom of the pad when we insert a link the editable area does not
scrolls to the top.

task - 3138700

closes odoo/odoo#119279

X-original-commit: 2c50808d9cebc7ba0913a098bf79a15ef36da47f
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This commit is contained in:
Deependra Solanki
2023-04-21 16:47:31 +02:00
parent f19de6f5cd
commit bb914f863d
2 changed files with 3 additions and 4 deletions
@@ -451,10 +451,8 @@ export class OdooEditor extends EventTarget {
this.historyRevertUntil(this._powerboxBeforeStepIndex);
this.historyStep(true);
this._historyStepsStates.set(peek(this._historySteps).id, 'consumed');
setTimeout(() => {
ensureFocus(this.editable);
getDeepRange(this.editable, { select: true });
});
ensureFocus(this.editable);
getDeepRange(this.editable, { select: true });
}
},
afterCommand: () => {
@@ -756,6 +756,7 @@ describe('Utils', () => {
triggerEvent(element, 'keyup', { key: '2' });
await nextTickFrame();
triggerEvent(editor.editable, 'keydown', { key: 'Enter' });
await nextTickFrame();
const activeElement = document.activeElement;
setCursorStart(activeElement.lastElementChild);
await nextTickFrame();