quill icon indicating copy to clipboard operation
quill copied to clipboard

Page scrolls when setting editor direction

Open MustafaMohamed2018 opened this issue 1 year ago • 1 comments

When setting editor direction to rtl the page scrolls to the editor element immediately editor.format('align', 'right'); editor.format('direction', 'rtl');

MustafaMohamed2018 avatar Aug 28 '24 10:08 MustafaMohamed2018

Hi @MustafaMohamed2018 You can prevent unintended scroll by quill when clicking alignment toolbar like this

let lastScroll = window.pageYOffset;

window.onscroll = () => {
    lastScroll = scrollDetection(lastScroll);
}

const toolbar = document.querySelector('.ql-toolbar');

toolbar?.addEventListener('click', (e) => {
    window.scrollTo(0, lastScroll);
});

ghabriel25 avatar Dec 10 '25 07:12 ghabriel25